Skip to content

Commit

Permalink
SUNRPC: pipefs dentry lookup helper introduced
Browse files Browse the repository at this point in the history
In all places, where pipefs dentries are created, only directory inode is
actually required to create new dentry. And all this directories has root
pipefs dentry as their parent. So we actually don't need this pipefs mount
point at all if some pipefs lookup method will be provided.
IOW, all we really need is just superblock and simple lookup method to find
root's child dentry with appropriate name. And this patch introduces this
method.
Note, that no locking implemented in rpc_d_lookup_sb(). So it can be used only
in case of assurance, that pipefs superblock still exist. IOW, we can use this
method only in pipefs mount-umount notification subscribers callbacks.

Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
  • Loading branch information
Stanislav Kinsbursky authored and Trond Myklebust committed Jan 31, 2012
1 parent 2d00131 commit 432eb1a
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
3 changes: 3 additions & 0 deletions include/linux/sunrpc/rpc_pipe_fs.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ enum {
RPC_PIPEFS_UMOUNT,
};

extern struct dentry *rpc_d_lookup_sb(const struct super_block *sb,
const unsigned char *dir_name);

extern ssize_t rpc_pipe_generic_upcall(struct file *, struct rpc_pipe_msg *,
char __user *, size_t);
extern int rpc_queue_upcall(struct inode *, struct rpc_pipe_msg *);
Expand Down
16 changes: 16 additions & 0 deletions net/sunrpc/rpc_pipe.c
Original file line number Diff line number Diff line change
Expand Up @@ -1007,6 +1007,22 @@ static const struct rpc_filelist files[] = {
},
};

/*
* This call can be used only in RPC pipefs mount notification hooks.
*/
struct dentry *rpc_d_lookup_sb(const struct super_block *sb,
const unsigned char *dir_name)
{
struct qstr dir = {
.name = dir_name,
.len = strlen(dir_name),
.hash = full_name_hash(dir_name, strlen(dir_name)),
};

return d_lookup(sb->s_root, &dir);
}
EXPORT_SYMBOL_GPL(rpc_d_lookup_sb);

static int
rpc_fill_super(struct super_block *sb, void *data, int silent)
{
Expand Down

0 comments on commit 432eb1a

Please sign in to comment.