Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 294363
b: refs/heads/master
c: c21a588
h: refs/heads/master
i:
  294361: 3f7b396
  294359: 6bf579a
v: v3
  • Loading branch information
Stanislav Kinsbursky authored and Trond Myklebust committed Jan 31, 2012
1 parent 734455f commit a93ce17
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 90c4e82999c517e0cd00d0782c68d186cb18b784
refs/heads/master: c21a588f35b1c50304e505fad542b3aab0814266
3 changes: 3 additions & 0 deletions trunk/include/linux/sunrpc/rpc_pipe_fs.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ enum {

extern struct dentry *rpc_d_lookup_sb(const struct super_block *sb,
const unsigned char *dir_name);
extern void rpc_pipefs_init_net(struct net *net);
extern struct super_block *rpc_get_sb_net(const struct net *net);
extern void rpc_put_sb_net(const struct net *net);

extern ssize_t rpc_pipe_generic_upcall(struct file *, struct rpc_pipe_msg *,
char __user *, size_t);
Expand Down
1 change: 1 addition & 0 deletions trunk/net/sunrpc/netns.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ struct sunrpc_net {
struct cache_detail *ip_map_cache;

struct super_block *pipefs_sb;
struct mutex pipefs_sb_lock;
};

extern int sunrpc_net_id;
Expand Down
36 changes: 36 additions & 0 deletions trunk/net/sunrpc/rpc_pipe.c
Original file line number Diff line number Diff line change
Expand Up @@ -1023,6 +1023,40 @@ struct dentry *rpc_d_lookup_sb(const struct super_block *sb,
}
EXPORT_SYMBOL_GPL(rpc_d_lookup_sb);

void rpc_pipefs_init_net(struct net *net)
{
struct sunrpc_net *sn = net_generic(net, sunrpc_net_id);

mutex_init(&sn->pipefs_sb_lock);
}

/*
* This call will be used for per network namespace operations calls.
* Note: Function will be returned with pipefs_sb_lock taken if superblock was
* found. This lock have to be released by rpc_put_sb_net() when all operations
* will be completed.
*/
struct super_block *rpc_get_sb_net(const struct net *net)
{
struct sunrpc_net *sn = net_generic(net, sunrpc_net_id);

mutex_lock(&sn->pipefs_sb_lock);
if (sn->pipefs_sb)
return sn->pipefs_sb;
mutex_unlock(&sn->pipefs_sb_lock);
return NULL;
}
EXPORT_SYMBOL_GPL(rpc_get_sb_net);

void rpc_put_sb_net(const struct net *net)
{
struct sunrpc_net *sn = net_generic(net, sunrpc_net_id);

BUG_ON(sn->pipefs_sb == NULL);
mutex_unlock(&sn->pipefs_sb_lock);
}
EXPORT_SYMBOL_GPL(rpc_put_sb_net);

static int
rpc_fill_super(struct super_block *sb, void *data, int silent)
{
Expand Down Expand Up @@ -1077,7 +1111,9 @@ void rpc_kill_sb(struct super_block *sb)
struct net *net = sb->s_fs_info;
struct sunrpc_net *sn = net_generic(net, sunrpc_net_id);

mutex_lock(&sn->pipefs_sb_lock);
sn->pipefs_sb = NULL;
mutex_unlock(&sn->pipefs_sb_lock);
put_net(net);
blocking_notifier_call_chain(&rpc_pipefs_notifier_list,
RPC_PIPEFS_UMOUNT,
Expand Down
1 change: 1 addition & 0 deletions trunk/net/sunrpc/sunrpc_syms.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ static __net_init int sunrpc_init_net(struct net *net)
if (err)
goto err_ipmap;

rpc_pipefs_init_net(net);
return 0;

err_ipmap:
Expand Down

0 comments on commit a93ce17

Please sign in to comment.