Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 294388
b: refs/heads/master
c: 4929d1d
h: refs/heads/master
v: v3
  • Loading branch information
Stanislav Kinsbursky authored and Trond Myklebust committed Jan 31, 2012
1 parent 1f75053 commit 06cc534
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 9 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 7bb782c6ac75898604eb547ed37b05c49b1edf21
refs/heads/master: 4929d1d33fdbe8385cdd49ccd23563e9ff247ff8
61 changes: 53 additions & 8 deletions trunk/fs/nfs/idmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,56 @@ static const struct rpc_pipe_ops idmap_upcall_ops = {
.destroy_msg = idmap_pipe_destroy_msg,
};

static void __nfs_idmap_unregister(struct rpc_pipe *pipe)
{
if (pipe->dentry)
rpc_unlink(pipe->dentry);
}

static int __nfs_idmap_register(struct dentry *dir,
struct idmap *idmap,
struct rpc_pipe *pipe)
{
struct dentry *dentry;

dentry = rpc_mkpipe_dentry(dir, "idmap", idmap, pipe);
if (IS_ERR(dentry))
return PTR_ERR(dentry);
pipe->dentry = dentry;
return 0;
}

static void nfs_idmap_unregister(struct nfs_client *clp,
struct rpc_pipe *pipe)
{
struct net *net = clp->net;
struct super_block *pipefs_sb;

pipefs_sb = rpc_get_sb_net(net);
if (pipefs_sb) {
__nfs_idmap_unregister(pipe);
rpc_put_sb_net(net);
}
}

static int nfs_idmap_register(struct nfs_client *clp,
struct idmap *idmap,
struct rpc_pipe *pipe)
{
struct net *net = clp->net;
struct super_block *pipefs_sb;
int err = 0;

pipefs_sb = rpc_get_sb_net(net);
if (pipefs_sb) {
if (clp->cl_rpcclient->cl_dentry)
err = __nfs_idmap_register(clp->cl_rpcclient->cl_dentry,
idmap, pipe);
rpc_put_sb_net(net);
}
return err;
}

int
nfs_idmap_new(struct nfs_client *clp)
{
Expand All @@ -450,12 +500,8 @@ nfs_idmap_new(struct nfs_client *clp)
kfree(idmap);
return error;
}

if (clp->cl_rpcclient->cl_dentry)
pipe->dentry = rpc_mkpipe_dentry(clp->cl_rpcclient->cl_dentry,
"idmap", idmap, pipe);
if (IS_ERR(pipe->dentry)) {
error = PTR_ERR(pipe->dentry);
error = nfs_idmap_register(clp, idmap, pipe);
if (error) {
rpc_destroy_pipe_data(pipe);
kfree(idmap);
return error;
Expand All @@ -478,8 +524,7 @@ nfs_idmap_delete(struct nfs_client *clp)

if (!idmap)
return;
if (idmap->idmap_pipe->dentry)
rpc_unlink(idmap->idmap_pipe->dentry);
nfs_idmap_unregister(clp, idmap->idmap_pipe);
rpc_destroy_pipe_data(idmap->idmap_pipe);
clp->cl_idmap = NULL;
kfree(idmap);
Expand Down

0 comments on commit 06cc534

Please sign in to comment.