Skip to content

Commit

Permalink
Revert "[PATCH] RPC,NFS: new rpc_pipefs patch"
Browse files Browse the repository at this point in the history
This reverts 17f4e6febca160a9f9dd4bdece9784577a2f4524 commit.
  • Loading branch information
Trond Myklebust authored and Trond Myklebust committed Sep 23, 2005
1 parent 3063d8a commit f134585
Show file tree
Hide file tree
Showing 6 changed files with 209 additions and 142 deletions.
10 changes: 7 additions & 3 deletions fs/nfs/idmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ struct idmap_hashtable {
};

struct idmap {
char idmap_path[48];
struct dentry *idmap_dentry;
wait_queue_head_t idmap_wq;
struct idmap_msg idmap_im;
Expand Down Expand Up @@ -101,8 +102,11 @@ nfs_idmap_new(struct nfs4_client *clp)

memset(idmap, 0, sizeof(*idmap));

idmap->idmap_dentry = rpc_mkpipe(clp->cl_rpcclient->cl_dentry,
"idmap", idmap, &idmap_upcall_ops, 0);
snprintf(idmap->idmap_path, sizeof(idmap->idmap_path),
"%s/idmap", clp->cl_rpcclient->cl_pathname);

idmap->idmap_dentry = rpc_mkpipe(idmap->idmap_path,
idmap, &idmap_upcall_ops, 0);
if (IS_ERR(idmap->idmap_dentry)) {
kfree(idmap);
return;
Expand All @@ -124,7 +128,7 @@ nfs_idmap_delete(struct nfs4_client *clp)

if (!idmap)
return;
rpc_unlink(idmap->idmap_dentry);
rpc_unlink(idmap->idmap_path);
clp->cl_idmap = NULL;
kfree(idmap);
}
Expand Down
2 changes: 1 addition & 1 deletion include/linux/sunrpc/clnt.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ struct rpc_clnt {

int cl_nodelen; /* nodename length */
char cl_nodename[UNX_MAXNODENAME];
struct dentry * __cl_parent_dentry;
char cl_pathname[30];/* Path in rpc_pipe_fs */
struct dentry * cl_dentry; /* inode */
struct rpc_clnt * cl_parent; /* Points to parent of clones */
struct rpc_rtt cl_rtt_default;
Expand Down
9 changes: 4 additions & 5 deletions include/linux/sunrpc/rpc_pipe_fs.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,10 @@ RPC_I(struct inode *inode)

extern int rpc_queue_upcall(struct inode *, struct rpc_pipe_msg *);

extern struct dentry *rpc_mkdir(struct dentry *, char *, struct rpc_clnt *);
extern void rpc_rmdir(struct dentry *);
extern struct dentry *rpc_mkpipe(struct dentry *, char *, void *,
struct rpc_pipe_ops *, int flags);
extern void rpc_unlink(struct dentry *);
extern struct dentry *rpc_mkdir(char *, struct rpc_clnt *);
extern int rpc_rmdir(char *);
extern struct dentry *rpc_mkpipe(char *, void *, struct rpc_pipe_ops *, int flags);
extern int rpc_unlink(char *);

#endif
#endif
9 changes: 6 additions & 3 deletions net/sunrpc/auth_gss/auth_gss.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ struct gss_auth {
struct list_head upcalls;
struct rpc_clnt *client;
struct dentry *dentry;
char path[48];
spinlock_t lock;
};

Expand Down Expand Up @@ -689,8 +690,10 @@ gss_create(struct rpc_clnt *clnt, rpc_authflavor_t flavor)
if (err)
goto err_put_mech;

gss_auth->dentry = rpc_mkpipe(clnt->cl_dentry, gss_auth->mech->gm_name,
clnt, &gss_upcall_ops, RPC_PIPE_WAIT_FOR_OPEN);
snprintf(gss_auth->path, sizeof(gss_auth->path), "%s/%s",
clnt->cl_pathname,
gss_auth->mech->gm_name);
gss_auth->dentry = rpc_mkpipe(gss_auth->path, clnt, &gss_upcall_ops, RPC_PIPE_WAIT_FOR_OPEN);
if (IS_ERR(gss_auth->dentry)) {
err = PTR_ERR(gss_auth->dentry);
goto err_put_mech;
Expand All @@ -715,7 +718,7 @@ gss_destroy(struct rpc_auth *auth)
auth, auth->au_flavor);

gss_auth = container_of(auth, struct gss_auth, rpc_auth);
rpc_unlink(gss_auth->dentry);
rpc_unlink(gss_auth->path);
gss_mech_put(gss_auth->mech);

rpcauth_free_credcache(auth);
Expand Down
53 changes: 17 additions & 36 deletions net/sunrpc/clnt.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,42 +67,26 @@ static u32 * call_verify(struct rpc_task *task);
static int
rpc_setup_pipedir(struct rpc_clnt *clnt, char *dir_name)
{
static unsigned int clntid;
char name[128];
static uint32_t clntid;
int error;

if (dir_name == NULL)
return 0;

retry_parent:
clnt->__cl_parent_dentry = rpc_mkdir(NULL, dir_name, NULL);
if (IS_ERR(clnt->__cl_parent_dentry)) {
error = PTR_ERR(clnt->__cl_parent_dentry);
if (error == -EEXIST)
goto retry_parent; /* XXX(hch): WTF? */

printk(KERN_INFO "RPC: Couldn't create pipefs entry %s, error %d\n",
dir_name, error);
return error;
}


retry_child:
snprintf(name, sizeof(name), "clnt%x", clntid++);
name[sizeof(name) - 1] = '\0';

clnt->cl_dentry = rpc_mkdir(clnt->__cl_parent_dentry, name, clnt);
if (IS_ERR(clnt->cl_dentry)) {
for (;;) {
snprintf(clnt->cl_pathname, sizeof(clnt->cl_pathname),
"%s/clnt%x", dir_name,
(unsigned int)clntid++);
clnt->cl_pathname[sizeof(clnt->cl_pathname) - 1] = '\0';
clnt->cl_dentry = rpc_mkdir(clnt->cl_pathname, clnt);
if (!IS_ERR(clnt->cl_dentry))
return 0;
error = PTR_ERR(clnt->cl_dentry);
if (error == -EEXIST)
goto retry_child;
printk(KERN_INFO "RPC: Couldn't create pipefs entry %s, error %d\n",
name, error);
rpc_rmdir(clnt->__cl_parent_dentry);
return error;
if (error != -EEXIST) {
printk(KERN_INFO "RPC: Couldn't create pipefs entry %s, error %d\n",
clnt->cl_pathname, error);
return error;
}
}

return 0;
}

/*
Expand Down Expand Up @@ -190,8 +174,7 @@ rpc_new_client(struct rpc_xprt *xprt, char *servname,
return clnt;

out_no_auth:
rpc_rmdir(clnt->cl_dentry);
rpc_rmdir(clnt->__cl_parent_dentry);
rpc_rmdir(clnt->cl_pathname);
out_no_path:
if (clnt->cl_server != clnt->cl_inline_name)
kfree(clnt->cl_server);
Expand Down Expand Up @@ -319,10 +302,8 @@ rpc_destroy_client(struct rpc_clnt *clnt)
rpc_destroy_client(clnt->cl_parent);
goto out_free;
}
if (clnt->cl_dentry)
rpc_rmdir(clnt->cl_dentry);
if (clnt->__cl_parent_dentry)
rpc_rmdir(clnt->__cl_parent_dentry);
if (clnt->cl_pathname[0])
rpc_rmdir(clnt->cl_pathname);
if (clnt->cl_xprt) {
xprt_destroy(clnt->cl_xprt);
clnt->cl_xprt = NULL;
Expand Down
Loading

0 comments on commit f134585

Please sign in to comment.