Home » Mailing lists » Devel » [PATCH v3, RESEND 00/16] make rpc_pipefs be mountable multiple time
[PATCH v3, RESEND 12/16] sunrpc: introduce get_rpc_pipefs() [message #42053 is a reply to message #42046] |
Tue, 08 February 2011 18:42   |
Kirill A. Shutemov
Messages: 37 Registered: January 2011
|
Member |
|
|
Get rpc_pipefs mount point by path. If path is NULL, we use first
rpc_pipefs from mount table visible from current root directory.
Signed-off-by: Kirill A. Shutemov <kas@openvz.org>
Reviewed-by: Rob Landley <rlandley@parallels.com>
---
include/linux/sunrpc/rpc_pipe_fs.h | 1 +
net/sunrpc/rpc_pipe.c | 51 ++++++++++++++++++++++++++++++++++++
2 files changed, 52 insertions(+), 0 deletions(-)
diff --git a/include/linux/sunrpc/rpc_pipe_fs.h b/include/linux/sunrpc/rpc_pipe_fs.h
index f5216f1..4a8830a 100644
--- a/include/linux/sunrpc/rpc_pipe_fs.h
+++ b/include/linux/sunrpc/rpc_pipe_fs.h
@@ -46,6 +46,7 @@ RPC_I(struct inode *inode)
extern struct vfsmount *init_rpc_pipefs;
+extern struct vfsmount *get_rpc_pipefs(const char *path);
extern int rpc_pipefs_add_destroy_cb(struct super_block *sb,
void (*destroy_cb)(void *data), void *data);
diff --git a/net/sunrpc/rpc_pipe.c b/net/sunrpc/rpc_pipe.c
index 58312fa..1261f27 100644
--- a/net/sunrpc/rpc_pipe.c
+++ b/net/sunrpc/rpc_pipe.c
@@ -16,6 +16,9 @@
#include <linux/namei.h>
#include <linux/fsnotify.h>
#include <linux/kernel.h>
+#include <linux/nsproxy.h>
+#include <linux/mnt_namespace.h>
+#include <linux/fs_struct.h>
#include <asm/ioctls.h>
#include <linux/fs.h>
@@ -939,6 +942,54 @@ static const struct super_operations s_ops = {
#define RPCAUTH_GSSMAGIC 0x67596969
+static int check_rpc_pipefs(struct vfsmount *mnt, void *arg)
+{
+ struct vfsmount **rpcmount = arg;
+ struct path path = {
+ .mnt = mnt,
+ .dentry = mnt->mnt_root,
+ };
+
+ if (!mnt->mnt_sb)
+ return 0;
+ if (mnt->mnt_sb->s_magic != RPCAUTH_GSSMAGIC)
+ return 0;
+
+ if (!path_is_under(&path, ¤t->fs->root))
+ return 0;
+
+ *rpcmount = mntget(mnt);
+ return 1;
+}
+
+struct vfsmount *get_rpc_pipefs(const char *p)
+{
+ int error;
+ struct vfsmount *rpcmount = ERR_PTR(-EINVAL);
+ struct path path;
+
+ if (!p) {
+ iterate_mounts(check_rpc_pipefs, &rpcmount,
+ current->nsproxy->mnt_ns->root);
+
+ if (IS_ERR(rpcmount) && (current->nsproxy->mnt_ns ==
+ init_task.nsproxy->mnt_ns))
+ return mntget(init_rpc_pipefs);
+
+ return rpcmount;
+ }
+
+ error = kern_path(p, LOOKUP_FOLLOW | LOOKUP_DIRECTORY, &path);
+ if (error)
+ return ERR_PTR(error);
+
+ check_rpc_pipefs(path.mnt, &rpcmount);
+ path_put(&path);
+
+ return rpcmount;
+}
+EXPORT_SYMBOL_GPL(get_rpc_pipefs);
+
struct destroy_cb {
struct list_head list;
void (*callback)(void *data);
--
1.7.4
_______________________________________________
Containers mailing list
Containers@lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/containe rs
|
|
|
 |
|
[PATCH v3, RESEND 00/16] make rpc_pipefs be mountable multiple time
|
 |
|
[PATCH v3, RESEND 03/16] sunrpc: push init_rpc_pipefs up to rpc_create() callers
|
 |
|
[PATCH v3, RESEND 02/16] sunrpc: introduce init_rpc_pipefs
|
 |
|
[PATCH v3, RESEND 05/16] sunrpc: get rpc_pipefs mount point for svc_serv from callers
|
 |
|
[PATCH v3, RESEND 06/16] lockd: get rpc_pipefs mount point from callers
|
 |
|
[PATCH v3, RESEND 08/16] sunrpc: tag pipefs field of cache_detail with rpc_pipefs mount point
|
 |
|
[PATCH v3, RESEND 07/16] sunrpc: get rpc_pipefs mount point for rpcb_create[_local] from callers
|
 |
|
[PATCH v3, RESEND 12/16] sunrpc: introduce get_rpc_pipefs()
|
 |
|
[PATCH v3, RESEND 16/16] Rework get_rpc_pipefs() and introduce put_rpc_pipefs()
|
 |
|
[PATCH v3, RESEND 10/16] nfs: per-rpc_pipefs dns cache
|
 |
|
[PATCH v3, RESEND 14/16] sunrpc: make rpc_pipefs be mountable multiple times
|
 |
|
[PATCH v3, RESEND 11/16] Export iterate_mounts symbol to be able to use from sunrpc module.
|
 |
|
[PATCH v3, RESEND 15/16] sunrpc: remove global init_rpc_pipefs
|
 |
|
[PATCH v3, RESEND 13/16] nfs: introduce mount option 'rpcmount'
|
 |
|
[PATCH v3, RESEND 09/16] sunrpc: introduce rpc_pipefs_add_destroy_cb()
|
Goto Forum:
Current Time: Mon Oct 06 20:26:27 GMT 2025
Total time taken to generate the page: 0.16902 seconds
|