Skip to contentSkip to conversation

NFS: Permit filesystem to override root dentry on mount

PATCH New David Howells 1 participant 5 messages Feb 22, 2006

Subsystems (40)
lore
Share & tools
lore

David Howells

author maintainer
#0 lore raw

PATCH 1/5 NFS: Permit filesystem to override root dentry on mount

The attached patch extends the get_sb() filesystem operation to take an extra argument that permits the default root dentry choice (sb->s_root) to be overridden by the filesystem that owns the superblock.

If the dentry pointer pointed to by that argument is left unchanged, then do_kern_mount() will use sb->s_root as the root of the mount. If the filesystem sets the pointer to a dentry of its choice, then that will be used as the root for that particular mount.

This patch permits a superblock to be implicitly shared amongst several mount points, such as can be done with NFS to avoid potential inode aliasing (see patch 5/5).

---
warthog>diffstat -p1 getsb-2616rc4.diff

 Documentation/filesystems/porting |    2 +-
 fs/super.c                        |   10 +++++++---
 include/linux/fs.h                |    2 +-
 3 files changed, 9 insertions(+), 5 deletions(-)
Documentation/filesystems/porting +1 -1
diff -uNrp linux-2.6.16-rc4/Documentation/filesystems/porting linux-2.6.16-rc4-getsb/Documentation/filesystems/porting
@@ -51,7 +51,7 @@ success and negative number in case of e
 informative error value to report).  Call it foo_fill_super().  Now declare
 
 struct super_block foo_get_sb(struct file_system_type *fs_type,
-	int flags, const char *dev_name, void *data)
+	int flags, const char *dev_name, void *data, struct dentry **_root)
 {
 	return get_sb_bdev(fs_type, flags, dev_name, data, ext2_fill_super);
 }
include/linux/fs.h +1 -1
diff -uNrp linux-2.6.16-rc4/include/linux/fs.h linux-2.6.16-rc4-getsb/include/linux/fs.h
@@ -1240,7 +1240,7 @@ struct file_system_type {
 	const char *name;
 	int fs_flags;
 	struct super_block *(*get_sb) (struct file_system_type *, int,
-				       const char *, void *);
+				       const char *, void *, struct dentry **);
 	void (*kill_sb) (struct super_block *);
 	struct module *owner;
 	struct file_system_type * next;
fs/super.c +7 -3
diff -uNrp linux-2.6.16-rc4/fs/super.c linux-2.6.16-rc4-getsb/fs/super.c
@@ -792,6 +792,7 @@ do_kern_mount(const char *fstype, int fl
 	struct file_system_type *type = get_fs_type(fstype);
 	struct super_block *sb = ERR_PTR(-ENOMEM);
 	struct vfsmount *mnt;
+	struct dentry *root;
 	int error;
 	char *secdata = NULL;
 
@@ -816,15 +817,18 @@ do_kern_mount(const char *fstype, int fl
 		}
 	}
 
-	sb = type->get_sb(type, flags, name, data);
+	root = NULL;
+	sb = type->get_sb(type, flags, name, data, &root);
 	if (IS_ERR(sb))
 		goto out_free_secdata;
+	if (!root)
+		root = dget(sb->s_root);
  	error = security_sb_kern_mount(sb, secdata);
  	if (error)
  		goto out_sb;
 	mnt->mnt_sb = sb;
-	mnt->mnt_root = dget(sb->s_root);
-	mnt->mnt_mountpoint = sb->s_root;
+	mnt->mnt_root = root;
+	mnt->mnt_mountpoint = root;
 	mnt->mnt_parent = mnt;
 	up_write(&sb->s_umount);
 	free_secdata(secdata);
author maintainer
#1 lore raw

PATCH 2/5 NFS: Apply mount root dentry override to filesystems

The attached patch changes all the filesystems in the kernel to deal with the extra argument to get_sb(). In every case the extra argument is simply ignored, thus causing the dentry returned in sb->s_root to be used as the root of the mountpoint.

---
warthog>diffstat -p1 getsb-change-fses-2616rc4.diff

 arch/ia64/kernel/perfmon.c                |    3 ++-
 arch/powerpc/platforms/cell/spufs/inode.c |    2 +-
 drivers/infiniband/core/uverbs_main.c     |    3 ++-
 drivers/isdn/capi/capifs.c                |    2 +-
 drivers/misc/ibmasm/ibmasmfs.c            |    3 ++-
 drivers/oprofile/oprofilefs.c             |    2 +-
 drivers/usb/core/inode.c                  |    2 +-
 drivers/usb/gadget/inode.c                |    2 +-
 fs/9p/vfs_super.c                         |    3 ++-
 fs/adfs/super.c                           |    2 +-
 fs/affs/super.c                           |    2 +-
 fs/afs/super.c                            |    5 +++--
 fs/autofs/init.c                          |    2 +-
 fs/autofs4/init.c                         |    2 +-
 fs/befs/linuxvfs.c                        |    2 +-
 fs/bfs/inode.c                            |    2 +-
 fs/binfmt_misc.c                          |    2 +-
 fs/block_dev.c                            |    2 +-
 fs/cifs/cifsfs.c                          |    2 +-
 fs/coda/inode.c                           |    2 +-
 fs/configfs/mount.c                       |    2 +-
 fs/cramfs/inode.c                         |    2 +-
 fs/debugfs/inode.c                        |    2 +-
 fs/devfs/base.c                           |    2 +-
 fs/devpts/inode.c                         |    2 +-
 fs/efs/super.c                            |    2 +-
 fs/eventpoll.c                            |    4 ++--
 fs/ext2/super.c                           |    2 +-
 fs/ext3/super.c                           |    2 +-
 fs/freevxfs/vxfs_super.c                  |    2 +-
 fs/fuse/inode.c                           |    2 +-
 fs/hfs/super.c                            |    3 ++-
 fs/hfsplus/super.c                        |    3 ++-
 fs/hpfs/super.c                           |    2 +-
 fs/hugetlbfs/inode.c                      |    2 +-
 fs/inotify.c                              |    2 +-
 fs/isofs/inode.c                          |    2 +-
 fs/jffs/inode-v23.c                       |    2 +-
 fs/jffs2/super.c                          |    2 +-
 fs/jfs/super.c                            |    2 +-
 fs/minix/inode.c                          |    2 +-
 fs/msdos/namei.c                          |    2 +-
 fs/ncpfs/inode.c                          |    2 +-
 fs/nfs/inode.c                            |    4 ++--
 fs/nfsd/nfsctl.c                          |    2 +-
 fs/ntfs/super.c                           |    2 +-
 fs/ocfs2/dlm/dlmfs.c                      |    2 +-
 fs/ocfs2/super.c                          |    3 ++-
 fs/openpromfs/inode.c                     |    2 +-
 fs/pipe.c                                 |    2 +-
 fs/proc/root.c                            |    2 +-
 fs/qnx4/inode.c                           |    2 +-
 fs/ramfs/inode.c                          |    4 ++--
 fs/relayfs/inode.c                        |    2 +-
 fs/romfs/inode.c                          |    2 +-
 fs/smbfs/inode.c                          |    2 +-
 fs/sysfs/mount.c                          |    2 +-
 fs/sysv/super.c                           |    4 ++--
 fs/udf/super.c                            |    2 +-
 fs/ufs/super.c                            |    2 +-
 fs/vfat/namei.c                           |    2 +-
 fs/xfs/linux-2.6/xfs_super.c              |    3 ++-
 include/linux/ramfs.h                     |    2 +-
 ipc/mqueue.c                              |    2 +-
 kernel/cpuset.c                           |    2 +-
 kernel/futex.c                            |    2 +-
 mm/shmem.c                                |    2 +-
 net/socket.c                              |    2 +-
 net/sunrpc/rpc_pipe.c                     |    2 +-
 security/selinux/selinuxfs.c              |    3 ++-
 70 files changed, 85 insertions(+), 75 deletions(-)
arch/ia64/kernel/perfmon.c +2 -1
diff -uNrp linux-2.6.16-rc4/arch/ia64/kernel/perfmon.c linux-2.6.16-rc4-getsb/arch/ia64/kernel/perfmon.c
@@ -596,7 +596,8 @@ pfm_get_unmapped_area(struct file *file,
 
 
 static struct super_block *
-pfmfs_get_sb(struct file_system_type *fs_type, int flags, const char *dev_name, void *data)
+pfmfs_get_sb(struct file_system_type *fs_type, int flags, const char *dev_name, void *data,
+	     struct dentry **_root)
 {
 	return get_sb_pseudo(fs_type, "pfm:", NULL, PFMFS_MAGIC);
 }
arch/powerpc/platforms/cell/spufs/inode.c +1 -1
diff -uNrp linux-2.6.16-rc4/arch/powerpc/platforms/cell/spufs/inode.c linux-2.6.16-rc4-getsb/arch/powerpc/platforms/cell/spufs/inode.c
@@ -430,7 +430,7 @@ spufs_fill_super(struct super_block *sb,
 
 static struct super_block *
 spufs_get_sb(struct file_system_type *fstype, int flags,
-		const char *name, void *data)
+		const char *name, void *data, struct dentry **_root)
 {
 	return get_sb_single(fstype, flags, data, spufs_fill_super);
 }
drivers/infiniband/core/uverbs_main.c +2 -1
diff -uNrp linux-2.6.16-rc4/drivers/infiniband/core/uverbs_main.c linux-2.6.16-rc4-getsb/drivers/infiniband/core/uverbs_main.c
@@ -819,7 +819,8 @@ static void ib_uverbs_remove_one(struct 
 }
 
 static struct super_block *uverbs_event_get_sb(struct file_system_type *fs_type, int flags,
-					       const char *dev_name, void *data)
+					       const char *dev_name, void *data,
+					       struct dentry **_root)
 {
 	return get_sb_pseudo(fs_type, "infinibandevent:", NULL,
 			     INFINIBANDEVENTFS_MAGIC);
drivers/isdn/capi/capifs.c +1 -1
diff -uNrp linux-2.6.16-rc4/drivers/isdn/capi/capifs.c linux-2.6.16-rc4-getsb/drivers/isdn/capi/capifs.c
@@ -122,7 +122,7 @@ fail:
 }
 
 static struct super_block *capifs_get_sb(struct file_system_type *fs_type,
-	int flags, const char *dev_name, void *data)
+	int flags, const char *dev_name, void *data, struct dentry **_root)
 {
 	return get_sb_single(fs_type, flags, data, capifs_fill_super);
 }
drivers/misc/ibmasm/ibmasmfs.c +2 -1
diff -uNrp linux-2.6.16-rc4/drivers/misc/ibmasm/ibmasmfs.c linux-2.6.16-rc4-getsb/drivers/misc/ibmasm/ibmasmfs.c
@@ -91,7 +91,8 @@ static int ibmasmfs_fill_super (struct s
 
 
 static struct super_block *ibmasmfs_get_super(struct file_system_type *fst,
-			int flags, const char *name, void *data)
+			int flags, const char *name, void *data,
+			struct dentry **_root)
 {
 	return get_sb_single(fst, flags, data, ibmasmfs_fill_super);
 }
drivers/oprofile/oprofilefs.c +1 -1
diff -uNrp linux-2.6.16-rc4/drivers/oprofile/oprofilefs.c linux-2.6.16-rc4-getsb/drivers/oprofile/oprofilefs.c
@@ -273,7 +273,7 @@ static int oprofilefs_fill_super(struct 
 
 
 static struct super_block *oprofilefs_get_sb(struct file_system_type *fs_type,
-	int flags, const char *dev_name, void *data)
+	int flags, const char *dev_name, void *data, struct dentry **_root)
 {
 	return get_sb_single(fs_type, flags, data, oprofilefs_fill_super);
 }
drivers/usb/core/inode.c +1 -1
diff -uNrp linux-2.6.16-rc4/drivers/usb/core/inode.c linux-2.6.16-rc4-getsb/drivers/usb/core/inode.c
@@ -544,7 +544,7 @@ static void fs_remove_file (struct dentr
 /* --------------------------------------------------------------------- */
 
 static struct super_block *usb_get_sb(struct file_system_type *fs_type,
-	int flags, const char *dev_name, void *data)
+	int flags, const char *dev_name, void *data, struct dentry **_root)
 {
 	return get_sb_single(fs_type, flags, data, usbfs_fill_super);
 }
drivers/usb/gadget/inode.c +1 -1
diff -uNrp linux-2.6.16-rc4/drivers/usb/gadget/inode.c linux-2.6.16-rc4-getsb/drivers/usb/gadget/inode.c
@@ -2067,7 +2067,7 @@ gadgetfs_fill_super (struct super_block 
 /* "mount -t gadgetfs path /dev/gadget" ends up here */
 static struct super_block *
 gadgetfs_get_sb (struct file_system_type *t, int flags,
-		const char *path, void *opts)
+		const char *path, void *opts, struct dentry **_root)
 {
 	return get_sb_single (t, flags, opts, gadgetfs_fill_super);
 }
fs/9p/vfs_super.c +2 -1
diff -uNrp linux-2.6.16-rc4/fs/9p/vfs_super.c linux-2.6.16-rc4-getsb/fs/9p/vfs_super.c
@@ -105,7 +105,8 @@ v9fs_fill_super(struct super_block *sb, 
 
 static struct super_block *v9fs_get_sb(struct file_system_type
 				       *fs_type, int flags,
-				       const char *dev_name, void *data)
+				       const char *dev_name, void *data,
+				       struct dentry **_root)
 {
 	struct super_block *sb = NULL;
 	struct v9fs_fcall *fcall = NULL;
fs/adfs/super.c +1 -1
diff -uNrp linux-2.6.16-rc4/fs/adfs/super.c linux-2.6.16-rc4-getsb/fs/adfs/super.c
@@ -470,7 +470,7 @@ error:
 }
 
 static struct super_block *adfs_get_sb(struct file_system_type *fs_type,
-	int flags, const char *dev_name, void *data)
+	int flags, const char *dev_name, void *data, struct dentry **_root)
 {
 	return get_sb_bdev(fs_type, flags, dev_name, data, adfs_fill_super);
 }
fs/affs/super.c +1 -1
diff -uNrp linux-2.6.16-rc4/fs/affs/super.c linux-2.6.16-rc4-getsb/fs/affs/super.c
@@ -524,7 +524,7 @@ affs_statfs(struct super_block *sb, stru
 }
 
 static struct super_block *affs_get_sb(struct file_system_type *fs_type,
-	int flags, const char *dev_name, void *data)
+	int flags, const char *dev_name, void *data, struct dentry **_root)
 {
 	return get_sb_bdev(fs_type, flags, dev_name, data, affs_fill_super);
 }
fs/afs/super.c +3 -2
diff -uNrp linux-2.6.16-rc4/fs/afs/super.c linux-2.6.16-rc4-getsb/fs/afs/super.c
@@ -40,7 +40,7 @@ static void afs_i_init_once(void *foo, k
 
 static struct super_block *afs_get_sb(struct file_system_type *fs_type,
 				      int flags, const char *dev_name,
-				      void *data);
+				      void *data, struct dentry **_root);
 
 static struct inode *afs_alloc_inode(struct super_block *sb);
 
@@ -297,7 +297,8 @@ static int afs_fill_super(struct super_b
 static struct super_block *afs_get_sb(struct file_system_type *fs_type,
 				      int flags,
 				      const char *dev_name,
-				      void *options)
+				      void *options,
+				      struct dentry **_root)
 {
 	struct afs_mount_params params;
 	struct super_block *sb;
fs/autofs/init.c +1 -1
diff -uNrp linux-2.6.16-rc4/fs/autofs/init.c linux-2.6.16-rc4-getsb/fs/autofs/init.c
@@ -15,7 +15,7 @@
 #include "autofs_i.h"
 
 static struct super_block *autofs_get_sb(struct file_system_type *fs_type,
-	int flags, const char *dev_name, void *data)
+	int flags, const char *dev_name, void *data, struct dentry **_root)
 {
 	return get_sb_nodev(fs_type, flags, data, autofs_fill_super);
 }
fs/autofs4/init.c +1 -1
diff -uNrp linux-2.6.16-rc4/fs/autofs4/init.c linux-2.6.16-rc4-getsb/fs/autofs4/init.c
@@ -15,7 +15,7 @@
 #include "autofs_i.h"
 
 static struct super_block *autofs_get_sb(struct file_system_type *fs_type,
-	int flags, const char *dev_name, void *data)
+	int flags, const char *dev_name, void *data, struct dentry **_root)
 {
 	return get_sb_nodev(fs_type, flags, data, autofs4_fill_super);
 }
fs/befs/linuxvfs.c +1 -1
diff -uNrp linux-2.6.16-rc4/fs/befs/linuxvfs.c linux-2.6.16-rc4-getsb/fs/befs/linuxvfs.c
@@ -900,7 +900,7 @@ befs_statfs(struct super_block *sb, stru
 
 static struct super_block *
 befs_get_sb(struct file_system_type *fs_type, int flags, const char *dev_name,
-	    void *data)
+	    void *data, struct dentry **_root)
 {
 	return get_sb_bdev(fs_type, flags, dev_name, data, befs_fill_super);
 }
fs/bfs/inode.c +1 -1
diff -uNrp linux-2.6.16-rc4/fs/bfs/inode.c linux-2.6.16-rc4-getsb/fs/bfs/inode.c
@@ -410,7 +410,7 @@ out:
 }
 
 static struct super_block *bfs_get_sb(struct file_system_type *fs_type,
-	int flags, const char *dev_name, void *data)
+	int flags, const char *dev_name, void *data, struct dentry **_root)
 {
 	return get_sb_bdev(fs_type, flags, dev_name, data, bfs_fill_super);
 }
fs/binfmt_misc.c +1 -1
diff -uNrp linux-2.6.16-rc4/fs/binfmt_misc.c linux-2.6.16-rc4-getsb/fs/binfmt_misc.c
@@ -741,7 +741,7 @@ static int bm_fill_super(struct super_bl
 }
 
 static struct super_block *bm_get_sb(struct file_system_type *fs_type,
-	int flags, const char *dev_name, void *data)
+	int flags, const char *dev_name, void *data, struct dentry **_root)
 {
 	return get_sb_single(fs_type, flags, data, bm_fill_super);
 }
fs/block_dev.c +1 -1
diff -uNrp linux-2.6.16-rc4/fs/block_dev.c linux-2.6.16-rc4-getsb/fs/block_dev.c
@@ -301,7 +301,7 @@ static struct super_operations bdev_sops
 };
 
 static struct super_block *bd_get_sb(struct file_system_type *fs_type,
-	int flags, const char *dev_name, void *data)
+	int flags, const char *dev_name, void *data, struct dentry **_root)
 {
 	return get_sb_pseudo(fs_type, "bdev:", &bdev_sops, 0x62646576);
 }
fs/cifs/cifsfs.c +1 -1
diff -uNrp linux-2.6.16-rc4/fs/cifs/cifsfs.c linux-2.6.16-rc4-getsb/fs/cifs/cifsfs.c
@@ -467,7 +467,7 @@ struct super_operations cifs_super_ops =
 
 static struct super_block *
 cifs_get_sb(struct file_system_type *fs_type,
-	    int flags, const char *dev_name, void *data)
+	    int flags, const char *dev_name, void *data, struct dentry **_root)
 {
 	int rc;
 	struct super_block *sb = sget(fs_type, NULL, set_anon_super, NULL);
fs/coda/inode.c +1 -1
diff -uNrp linux-2.6.16-rc4/fs/coda/inode.c linux-2.6.16-rc4-getsb/fs/coda/inode.c
@@ -306,7 +306,7 @@ static int coda_statfs(struct super_bloc
 /* init_coda: used by filesystems.c to register coda */
 
 static struct super_block *coda_get_sb(struct file_system_type *fs_type,
-	int flags, const char *dev_name, void *data)
+	int flags, const char *dev_name, void *data, struct dentry **_root)
 {
 	return get_sb_nodev(fs_type, flags, data, coda_fill_super);
 }
fs/configfs/mount.c +1 -1
diff -uNrp linux-2.6.16-rc4/fs/configfs/mount.c linux-2.6.16-rc4-getsb/fs/configfs/mount.c
@@ -104,7 +104,7 @@ static int configfs_fill_super(struct su
 }
 
 static struct super_block *configfs_get_sb(struct file_system_type *fs_type,
-	int flags, const char *dev_name, void *data)
+	int flags, const char *dev_name, void *data, struct dentry **_root)
 {
 	return get_sb_single(fs_type, flags, data, configfs_fill_super);
 }
fs/cramfs/inode.c +1 -1
diff -uNrp linux-2.6.16-rc4/fs/cramfs/inode.c linux-2.6.16-rc4-getsb/fs/cramfs/inode.c
@@ -530,7 +530,7 @@ static struct super_operations cramfs_op
 };
 
 static struct super_block *cramfs_get_sb(struct file_system_type *fs_type,
-	int flags, const char *dev_name, void *data)
+	int flags, const char *dev_name, void *data, struct dentry **_root)
 {
 	return get_sb_bdev(fs_type, flags, dev_name, data, cramfs_fill_super);
 }
fs/debugfs/inode.c +1 -1
diff -uNrp linux-2.6.16-rc4/fs/debugfs/inode.c linux-2.6.16-rc4-getsb/fs/debugfs/inode.c
@@ -112,7 +112,7 @@ static int debug_fill_super(struct super
 
 static struct super_block *debug_get_sb(struct file_system_type *fs_type,
 				        int flags, const char *dev_name,
-					void *data)
+					void *data, struct dentry **_root)
 {
 	return get_sb_single(fs_type, flags, data, debug_fill_super);
 }
fs/devfs/base.c +1 -1
diff -uNrp linux-2.6.16-rc4/fs/devfs/base.c linux-2.6.16-rc4-getsb/fs/devfs/base.c
@@ -2551,7 +2551,7 @@ static int devfs_fill_super(struct super
 
 static struct super_block *devfs_get_sb(struct file_system_type *fs_type,
 					int flags, const char *dev_name,
-					void *data)
+					void *data, struct dentry **_root)
 {
 	return get_sb_single(fs_type, flags, data, devfs_fill_super);
 }
fs/devpts/inode.c +1 -1
diff -uNrp linux-2.6.16-rc4/fs/devpts/inode.c linux-2.6.16-rc4-getsb/fs/devpts/inode.c
@@ -109,7 +109,7 @@ fail:
 }
 
 static struct super_block *devpts_get_sb(struct file_system_type *fs_type,
-	int flags, const char *dev_name, void *data)
+	int flags, const char *dev_name, void *data, struct dentry **_root)
 {
 	return get_sb_single(fs_type, flags, data, devpts_fill_super);
 }
fs/efs/super.c +1 -1
diff -uNrp linux-2.6.16-rc4/fs/efs/super.c linux-2.6.16-rc4-getsb/fs/efs/super.c
@@ -19,7 +19,7 @@ static int efs_statfs(struct super_block
 static int efs_fill_super(struct super_block *s, void *d, int silent);
 
 static struct super_block *efs_get_sb(struct file_system_type *fs_type,
-	int flags, const char *dev_name, void *data)
+	int flags, const char *dev_name, void *data, struct dentry **_root)
 {
 	return get_sb_bdev(fs_type, flags, dev_name, data, efs_fill_super);
 }
fs/eventpoll.c +2 -2
diff -uNrp linux-2.6.16-rc4/fs/eventpoll.c linux-2.6.16-rc4-getsb/fs/eventpoll.c
@@ -269,7 +269,7 @@ static int eventpollfs_delete_dentry(str
 static struct inode *ep_eventpoll_inode(void);
 static struct super_block *eventpollfs_get_sb(struct file_system_type *fs_type,
 					      int flags, const char *dev_name,
-					      void *data);
+					      void *data, struct dentry **_root);
 
 /*
  * This semaphore is used to serialize ep_free() and eventpoll_release_file().
@@ -1605,7 +1605,7 @@ eexit_1:
 
 static struct super_block *
 eventpollfs_get_sb(struct file_system_type *fs_type, int flags,
-		   const char *dev_name, void *data)
+		   const char *dev_name, void *data, struct dentry **_root)
 {
 	return get_sb_pseudo(fs_type, "eventpoll:", NULL, EVENTPOLLFS_MAGIC);
 }
fs/ext2/super.c +1 -1
diff -uNrp linux-2.6.16-rc4/fs/ext2/super.c linux-2.6.16-rc4-getsb/fs/ext2/super.c
@@ -1090,7 +1090,7 @@ static int ext2_statfs (struct super_blo
 }
 
 static struct super_block *ext2_get_sb(struct file_system_type *fs_type,
-	int flags, const char *dev_name, void *data)
+	int flags, const char *dev_name, void *data, struct dentry **_root)
 {
 	return get_sb_bdev(fs_type, flags, dev_name, data, ext2_fill_super);
 }
fs/ext3/super.c +1 -1
diff -uNrp linux-2.6.16-rc4/fs/ext3/super.c linux-2.6.16-rc4-getsb/fs/ext3/super.c
@@ -2651,7 +2651,7 @@ out:
 #endif
 
 static struct super_block *ext3_get_sb(struct file_system_type *fs_type,
-	int flags, const char *dev_name, void *data)
+	int flags, const char *dev_name, void *data, struct dentry **_root)
 {
 	return get_sb_bdev(fs_type, flags, dev_name, data, ext3_fill_super);
 }
fs/freevxfs/vxfs_super.c +1 -1
diff -uNrp linux-2.6.16-rc4/fs/freevxfs/vxfs_super.c linux-2.6.16-rc4-getsb/fs/freevxfs/vxfs_super.c
@@ -242,7 +242,7 @@ out:
  * The usual module blurb.
  */
 static struct super_block *vxfs_get_sb(struct file_system_type *fs_type,
-	int flags, const char *dev_name, void *data)
+	int flags, const char *dev_name, void *data, struct dentry **_root)
 {
 	return get_sb_bdev(fs_type, flags, dev_name, data, vxfs_fill_super);
 }
fs/fuse/inode.c +1 -1
diff -uNrp linux-2.6.16-rc4/fs/fuse/inode.c linux-2.6.16-rc4-getsb/fs/fuse/inode.c
@@ -606,7 +606,7 @@ static int fuse_fill_super(struct super_
 
 static struct super_block *fuse_get_sb(struct file_system_type *fs_type,
 				       int flags, const char *dev_name,
-				       void *raw_data)
+				       void *raw_data, struct dentry **_root)
 {
 	return get_sb_nodev(fs_type, flags, raw_data, fuse_fill_super);
 }
fs/hfs/super.c +2 -1
diff -uNrp linux-2.6.16-rc4/fs/hfs/super.c linux-2.6.16-rc4-getsb/fs/hfs/super.c
@@ -414,7 +414,8 @@ bail:
 }
 
 static struct super_block *hfs_get_sb(struct file_system_type *fs_type,
-				      int flags, const char *dev_name, void *data)
+				      int flags, const char *dev_name, void *data,
+				      struct dentry **_root)
 {
 	return get_sb_bdev(fs_type, flags, dev_name, data, hfs_fill_super);
 }
fs/hfsplus/super.c +2 -1
diff -uNrp linux-2.6.16-rc4/fs/hfsplus/super.c linux-2.6.16-rc4-getsb/fs/hfsplus/super.c
@@ -451,7 +451,8 @@ static void hfsplus_destroy_inode(struct
 #define HFSPLUS_INODE_SIZE	sizeof(struct hfsplus_inode_info)
 
 static struct super_block *hfsplus_get_sb(struct file_system_type *fs_type,
-					  int flags, const char *dev_name, void *data)
+					  int flags, const char *dev_name, void *data,
+					  struct dentry **_root)
 {
 	return get_sb_bdev(fs_type, flags, dev_name, data, hfsplus_fill_super);
 }
fs/hpfs/super.c +1 -1
diff -uNrp linux-2.6.16-rc4/fs/hpfs/super.c linux-2.6.16-rc4-getsb/fs/hpfs/super.c
@@ -662,7 +662,7 @@ bail0:
 }
 
 static struct super_block *hpfs_get_sb(struct file_system_type *fs_type,
-	int flags, const char *dev_name, void *data)
+	int flags, const char *dev_name, void *data, struct dentry **_root)
 {
 	return get_sb_bdev(fs_type, flags, dev_name, data, hpfs_fill_super);
 }
fs/hugetlbfs/inode.c +1 -1
diff -uNrp linux-2.6.16-rc4/fs/hugetlbfs/inode.c linux-2.6.16-rc4-getsb/fs/hugetlbfs/inode.c
@@ -758,7 +758,7 @@ void hugetlb_put_quota(struct address_sp
 }
 
 static struct super_block *hugetlbfs_get_sb(struct file_system_type *fs_type,
-	int flags, const char *dev_name, void *data)
+	int flags, const char *dev_name, void *data, struct dentry **_root)
 {
 	return get_sb_nodev(fs_type, flags, data, hugetlbfs_fill_super);
 }
fs/inotify.c +1 -1
diff -uNrp linux-2.6.16-rc4/fs/inotify.c linux-2.6.16-rc4-getsb/fs/inotify.c
@@ -1032,7 +1032,7 @@ out:
 
 static struct super_block *
 inotify_get_sb(struct file_system_type *fs_type, int flags,
-	       const char *dev_name, void *data)
+	       const char *dev_name, void *data, struct dentry **_root)
 {
     return get_sb_pseudo(fs_type, "inotify", NULL, 0xBAD1DEA);
 }
fs/isofs/inode.c +1 -1
diff -uNrp linux-2.6.16-rc4/fs/isofs/inode.c linux-2.6.16-rc4-getsb/fs/isofs/inode.c
@@ -1399,7 +1399,7 @@ struct inode *isofs_iget(struct super_bl
 }
 
 static struct super_block *isofs_get_sb(struct file_system_type *fs_type,
-	int flags, const char *dev_name, void *data)
+	int flags, const char *dev_name, void *data, struct dentry **_root)
 {
 	return get_sb_bdev(fs_type, flags, dev_name, data, isofs_fill_super);
 }
fs/jffs/inode-v23.c +1 -1
diff -uNrp linux-2.6.16-rc4/fs/jffs/inode-v23.c linux-2.6.16-rc4-getsb/fs/jffs/inode-v23.c
@@ -1786,7 +1786,7 @@ static struct super_operations jffs_ops 
 };
 
 static struct super_block *jffs_get_sb(struct file_system_type *fs_type,
-	int flags, const char *dev_name, void *data)
+	int flags, const char *dev_name, void *data, struct dentry **_root)
 {
 	return get_sb_bdev(fs_type, flags, dev_name, data, jffs_fill_super);
 }
fs/jffs2/super.c +1 -1
diff -uNrp linux-2.6.16-rc4/fs/jffs2/super.c linux-2.6.16-rc4-getsb/fs/jffs2/super.c
@@ -188,7 +188,7 @@ static struct super_block *jffs2_get_sb_
 
 static struct super_block *jffs2_get_sb(struct file_system_type *fs_type,
 					int flags, const char *dev_name,
-					void *data)
+					void *data, struct dentry **_root)
 {
 	int err;
 	struct nameidata nd;
fs/jfs/super.c +1 -1
diff -uNrp linux-2.6.16-rc4/fs/jfs/super.c linux-2.6.16-rc4-getsb/fs/jfs/super.c
@@ -542,7 +542,7 @@ static void jfs_unlockfs(struct super_bl
 }
 
 static struct super_block *jfs_get_sb(struct file_system_type *fs_type, 
-	int flags, const char *dev_name, void *data)
+	int flags, const char *dev_name, void *data, struct dentry **_root)
 {
 	return get_sb_bdev(fs_type, flags, dev_name, data, jfs_fill_super);
 }
fs/minix/inode.c +1 -1
diff -uNrp linux-2.6.16-rc4/fs/minix/inode.c linux-2.6.16-rc4-getsb/fs/minix/inode.c
@@ -559,7 +559,7 @@ void minix_truncate(struct inode * inode
 }
 
 static struct super_block *minix_get_sb(struct file_system_type *fs_type,
-	int flags, const char *dev_name, void *data)
+	int flags, const char *dev_name, void *data, struct dentry **_root)
 {
 	return get_sb_bdev(fs_type, flags, dev_name, data, minix_fill_super);
 }
fs/msdos/namei.c +1 -1
diff -uNrp linux-2.6.16-rc4/fs/msdos/namei.c linux-2.6.16-rc4-getsb/fs/msdos/namei.c
@@ -676,7 +676,7 @@ static int msdos_fill_super(struct super
 
 static struct super_block *msdos_get_sb(struct file_system_type *fs_type,
 					int flags, const char *dev_name,
-					void *data)
+					void *data, struct dentry **_root)
 {
 	return get_sb_bdev(fs_type, flags, dev_name, data, msdos_fill_super);
 }
fs/ncpfs/inode.c +1 -1
diff -uNrp linux-2.6.16-rc4/fs/ncpfs/inode.c linux-2.6.16-rc4-getsb/fs/ncpfs/inode.c
@@ -957,7 +957,7 @@ out:
 }
 
 static struct super_block *ncp_get_sb(struct file_system_type *fs_type,
-	int flags, const char *dev_name, void *data)
+	int flags, const char *dev_name, void *data, struct dentry **_root)
 {
 	return get_sb_nodev(fs_type, flags, data, ncp_fill_super);
 }
fs/nfs/inode.c +2 -2
diff -uNrp linux-2.6.16-rc4/fs/nfs/inode.c linux-2.6.16-rc4-getsb/fs/nfs/inode.c
@@ -1586,7 +1586,7 @@ static int nfs_compare_super(struct supe
 }
 
 static struct super_block *nfs_get_sb(struct file_system_type *fs_type,
-	int flags, const char *dev_name, void *raw_data)
+	int flags, const char *dev_name, void *raw_data, struct dentry **_root)
 {
 	int error;
 	struct nfs_server *server = NULL;
@@ -1924,7 +1924,7 @@ nfs_copy_user_string(char *dst, struct n
 }
 
 static struct super_block *nfs4_get_sb(struct file_system_type *fs_type,
-	int flags, const char *dev_name, void *raw_data)
+	int flags, const char *dev_name, void *raw_data, struct dentry **_root)
 {
 	int error;
 	struct nfs_server *server;
fs/nfsd/nfsctl.c +1 -1
diff -uNrp linux-2.6.16-rc4/fs/nfsd/nfsctl.c linux-2.6.16-rc4-getsb/fs/nfsd/nfsctl.c
@@ -495,7 +495,7 @@ static int nfsd_fill_super(struct super_
 }
 
 static struct super_block *nfsd_get_sb(struct file_system_type *fs_type,
-	int flags, const char *dev_name, void *data)
+	int flags, const char *dev_name, void *data, struct dentry **_root)
 {
 	return get_sb_single(fs_type, flags, data, nfsd_fill_super);
 }
fs/ntfs/super.c +1 -1
diff -uNrp linux-2.6.16-rc4/fs/ntfs/super.c linux-2.6.16-rc4-getsb/fs/ntfs/super.c
@@ -3015,7 +3015,7 @@ kmem_cache_t *ntfs_index_ctx_cache;
 DECLARE_MUTEX(ntfs_lock);
 
 static struct super_block *ntfs_get_sb(struct file_system_type *fs_type,
-	int flags, const char *dev_name, void *data)
+	int flags, const char *dev_name, void *data, struct dentry **_root)
 {
 	return get_sb_bdev(fs_type, flags, dev_name, data, ntfs_fill_super);
 }
fs/ocfs2/dlm/dlmfs.c +1 -1
diff -uNrp linux-2.6.16-rc4/fs/ocfs2/dlm/dlmfs.c linux-2.6.16-rc4-getsb/fs/ocfs2/dlm/dlmfs.c
@@ -575,7 +575,7 @@ static struct inode_operations dlmfs_fil
 };
 
 static struct super_block *dlmfs_get_sb(struct file_system_type *fs_type,
-	int flags, const char *dev_name, void *data)
+	int flags, const char *dev_name, void *data, struct dentry **_root)
 {
 	return get_sb_nodev(fs_type, flags, data, dlmfs_fill_super);
 }
fs/ocfs2/super.c +2 -1
diff -uNrp linux-2.6.16-rc4/fs/ocfs2/super.c linux-2.6.16-rc4-getsb/fs/ocfs2/super.c
@@ -675,7 +675,8 @@ read_super_error:
 static struct super_block *ocfs2_get_sb(struct file_system_type *fs_type,
 					int flags,
 					const char *dev_name,
-					void *data)
+					void *data,
+					struct dentry **_root)
 {
 	return get_sb_bdev(fs_type, flags, dev_name, data, ocfs2_fill_super);
 }
fs/openpromfs/inode.c +1 -1
diff -uNrp linux-2.6.16-rc4/fs/openpromfs/inode.c linux-2.6.16-rc4-getsb/fs/openpromfs/inode.c
@@ -1055,7 +1055,7 @@ out_no_root:
 }
 
 static struct super_block *openprom_get_sb(struct file_system_type *fs_type,
-	int flags, const char *dev_name, void *data)
+	int flags, const char *dev_name, void *data, struct dentry **_root)
 {
 	return get_sb_single(fs_type, flags, data, openprom_fill_super);
 }
fs/pipe.c +1 -1
diff -uNrp linux-2.6.16-rc4/fs/pipe.c linux-2.6.16-rc4-getsb/fs/pipe.c
@@ -806,7 +806,7 @@ no_files:
  */
 
 static struct super_block *pipefs_get_sb(struct file_system_type *fs_type,
-	int flags, const char *dev_name, void *data)
+	int flags, const char *dev_name, void *data, struct dentry **_root)
 {
 	return get_sb_pseudo(fs_type, "pipe:", NULL, PIPEFS_MAGIC);
 }
fs/proc/root.c +1 -1
diff -uNrp linux-2.6.16-rc4/fs/proc/root.c linux-2.6.16-rc4-getsb/fs/proc/root.c
@@ -27,7 +27,7 @@ struct proc_dir_entry *proc_sys_root;
 #endif
 
 static struct super_block *proc_get_sb(struct file_system_type *fs_type,
-	int flags, const char *dev_name, void *data)
+	int flags, const char *dev_name, void *data, struct dentry **_root)
 {
 	return get_sb_single(fs_type, flags, data, proc_fill_super);
 }
fs/qnx4/inode.c +1 -1
diff -uNrp linux-2.6.16-rc4/fs/qnx4/inode.c linux-2.6.16-rc4-getsb/fs/qnx4/inode.c
@@ -561,7 +561,7 @@ static void destroy_inodecache(void)
 }
 
 static struct super_block *qnx4_get_sb(struct file_system_type *fs_type,
-	int flags, const char *dev_name, void *data)
+	int flags, const char *dev_name, void *data, struct dentry **_root)
 {
 	return get_sb_bdev(fs_type, flags, dev_name, data, qnx4_fill_super);
 }
fs/ramfs/inode.c +2 -2
diff -uNrp linux-2.6.16-rc4/fs/ramfs/inode.c linux-2.6.16-rc4-getsb/fs/ramfs/inode.c
@@ -183,13 +183,13 @@ static int ramfs_fill_super(struct super
 }
 
 struct super_block *ramfs_get_sb(struct file_system_type *fs_type,
-	int flags, const char *dev_name, void *data)
+	int flags, const char *dev_name, void *data, struct dentry **_root)
 {
 	return get_sb_nodev(fs_type, flags, data, ramfs_fill_super);
 }
 
 static struct super_block *rootfs_get_sb(struct file_system_type *fs_type,
-	int flags, const char *dev_name, void *data)
+	int flags, const char *dev_name, void *data, struct dentry **_root)
 {
 	return get_sb_nodev(fs_type, flags|MS_NOUSER, data, ramfs_fill_super);
 }
fs/relayfs/inode.c +1 -1
diff -uNrp linux-2.6.16-rc4/fs/relayfs/inode.c linux-2.6.16-rc4-getsb/fs/relayfs/inode.c
@@ -539,7 +539,7 @@ static int relayfs_fill_super(struct sup
 
 static struct super_block * relayfs_get_sb(struct file_system_type *fs_type,
 					   int flags, const char *dev_name,
-					   void *data)
+					   void *data, struct dentry **_root)
 {
 	return get_sb_single(fs_type, flags, data, relayfs_fill_super);
 }
fs/romfs/inode.c +1 -1
diff -uNrp linux-2.6.16-rc4/fs/romfs/inode.c linux-2.6.16-rc4-getsb/fs/romfs/inode.c
@@ -607,7 +607,7 @@ static struct super_operations romfs_ops
 };
 
 static struct super_block *romfs_get_sb(struct file_system_type *fs_type,
-	int flags, const char *dev_name, void *data)
+	int flags, const char *dev_name, void *data, struct dentry **_root)
 {
 	return get_sb_bdev(fs_type, flags, dev_name, data, romfs_fill_super);
 }
fs/smbfs/inode.c +1 -1
diff -uNrp linux-2.6.16-rc4/fs/smbfs/inode.c linux-2.6.16-rc4-getsb/fs/smbfs/inode.c
@@ -782,7 +782,7 @@ out:
 }
 
 static struct super_block *smb_get_sb(struct file_system_type *fs_type,
-	int flags, const char *dev_name, void *data)
+	int flags, const char *dev_name, void *data, struct dentry **_root)
 {
 	return get_sb_nodev(fs_type, flags, data, smb_fill_super);
 }
fs/sysfs/mount.c +1 -1
diff -uNrp linux-2.6.16-rc4/fs/sysfs/mount.c linux-2.6.16-rc4-getsb/fs/sysfs/mount.c
@@ -67,7 +67,7 @@ static int sysfs_fill_super(struct super
 }
 
 static struct super_block *sysfs_get_sb(struct file_system_type *fs_type,
-	int flags, const char *dev_name, void *data)
+	int flags, const char *dev_name, void *data, struct dentry **_root)
 {
 	return get_sb_single(fs_type, flags, data, sysfs_fill_super);
 }
fs/sysv/super.c +2 -2
diff -uNrp linux-2.6.16-rc4/fs/sysv/super.c linux-2.6.16-rc4-getsb/fs/sysv/super.c
@@ -507,13 +507,13 @@ failed:
 /* Every kernel module contains stuff like this. */
 
 static struct super_block *sysv_get_sb(struct file_system_type *fs_type,
-	int flags, const char *dev_name, void *data)
+	int flags, const char *dev_name, void *data, struct dentry **_root)
 {
 	return get_sb_bdev(fs_type, flags, dev_name, data, sysv_fill_super);
 }
 
 static struct super_block *v7_get_sb(struct file_system_type *fs_type,
-	int flags, const char *dev_name, void *data)
+	int flags, const char *dev_name, void *data, struct dentry **_root)
 {
 	return get_sb_bdev(fs_type, flags, dev_name, data, v7_fill_super);
 }
fs/udf/super.c +1 -1
diff -uNrp linux-2.6.16-rc4/fs/udf/super.c linux-2.6.16-rc4-getsb/fs/udf/super.c
@@ -95,7 +95,7 @@ static int udf_statfs(struct super_block
 
 /* UDF filesystem type */
 static struct super_block *udf_get_sb(struct file_system_type *fs_type,
-	int flags, const char *dev_name, void *data)
+	int flags, const char *dev_name, void *data, struct dentry **_root)
 {
 	return get_sb_bdev(fs_type, flags, dev_name, data, udf_fill_super);
 }
fs/ufs/super.c +1 -1
diff -uNrp linux-2.6.16-rc4/fs/ufs/super.c linux-2.6.16-rc4-getsb/fs/ufs/super.c
@@ -1311,7 +1311,7 @@ out:
 #endif
 
 static struct super_block *ufs_get_sb(struct file_system_type *fs_type,
-	int flags, const char *dev_name, void *data)
+	int flags, const char *dev_name, void *data, struct dentry **_root)
 {
 	return get_sb_bdev(fs_type, flags, dev_name, data, ufs_fill_super);
 }
fs/vfat/namei.c +1 -1
diff -uNrp linux-2.6.16-rc4/fs/vfat/namei.c linux-2.6.16-rc4-getsb/fs/vfat/namei.c
@@ -1043,7 +1043,7 @@ static int vfat_fill_super(struct super_
 
 static struct super_block *vfat_get_sb(struct file_system_type *fs_type,
 				       int flags, const char *dev_name,
-				       void *data)
+				       void *data, struct dentry **_root)
 {
 	return get_sb_bdev(fs_type, flags, dev_name, data, vfat_fill_super);
 }
fs/xfs/linux-2.6/xfs_super.c +2 -1
diff -uNrp linux-2.6.16-rc4/fs/xfs/linux-2.6/xfs_super.c linux-2.6.16-rc4-getsb/fs/xfs/linux-2.6/xfs_super.c
@@ -914,7 +914,8 @@ linvfs_get_sb(
 	struct file_system_type	*fs_type,
 	int			flags,
 	const char		*dev_name,
-	void			*data)
+	void			*data,
+	struct dentry		**_root)
 {
 	return get_sb_bdev(fs_type, flags, dev_name, data, linvfs_fill_super);
 }
include/linux/ramfs.h +1 -1
diff -uNrp linux-2.6.16-rc4/include/linux/ramfs.h linux-2.6.16-rc4-getsb/include/linux/ramfs.h
@@ -3,7 +3,7 @@
 
 struct inode *ramfs_get_inode(struct super_block *sb, int mode, dev_t dev);
 struct super_block *ramfs_get_sb(struct file_system_type *fs_type,
-	 int flags, const char *dev_name, void *data);
+	 int flags, const char *dev_name, void *data, struct dentry **_root);
 
 #ifndef CONFIG_MMU
 extern unsigned long ramfs_nommu_get_unmapped_area(struct file *file,
ipc/mqueue.c +1 -1
diff -uNrp linux-2.6.16-rc4/ipc/mqueue.c linux-2.6.16-rc4-getsb/ipc/mqueue.c
@@ -203,7 +203,7 @@ static int mqueue_fill_super(struct supe
 
 static struct super_block *mqueue_get_sb(struct file_system_type *fs_type,
 					 int flags, const char *dev_name,
-					 void *data)
+					 void *data, struct dentry **_root)
 {
 	return get_sb_single(fs_type, flags, data, mqueue_fill_super);
 }
kernel/cpuset.c +1 -1
diff -uNrp linux-2.6.16-rc4/kernel/cpuset.c linux-2.6.16-rc4-getsb/kernel/cpuset.c
@@ -386,7 +386,7 @@ static int cpuset_fill_super(struct supe
 
 static struct super_block *cpuset_get_sb(struct file_system_type *fs_type,
 					int flags, const char *unused_dev_name,
-					void *data)
+					void *data, struct dentry **_root)
 {
 	return get_sb_single(fs_type, flags, data, cpuset_fill_super);
 }
kernel/futex.c +1 -1
diff -uNrp linux-2.6.16-rc4/kernel/futex.c linux-2.6.16-rc4-getsb/kernel/futex.c
@@ -886,7 +886,7 @@ asmlinkage long sys_futex(u32 __user *ua
 
 static struct super_block *
 futexfs_get_sb(struct file_system_type *fs_type,
-	       int flags, const char *dev_name, void *data)
+	       int flags, const char *dev_name, void *data, struct dentry **_root)
 {
 	return get_sb_pseudo(fs_type, "futex", NULL, 0xBAD1DEA);
 }
mm/shmem.c +1 -1
diff -uNrp linux-2.6.16-rc4/mm/shmem.c linux-2.6.16-rc4-getsb/mm/shmem.c
@@ -2171,7 +2171,7 @@ static struct vm_operations_struct shmem
 
 
 static struct super_block *shmem_get_sb(struct file_system_type *fs_type,
-	int flags, const char *dev_name, void *data)
+	int flags, const char *dev_name, void *data, struct dentry **_root)
 {
 	return get_sb_nodev(fs_type, flags, data, shmem_fill_super);
 }
net/socket.c +1 -1
diff -uNrp linux-2.6.16-rc4/net/socket.c linux-2.6.16-rc4-getsb/net/socket.c
@@ -328,7 +328,7 @@ static struct super_operations sockfs_op
 };
 
 static struct super_block *sockfs_get_sb(struct file_system_type *fs_type,
-	int flags, const char *dev_name, void *data)
+	int flags, const char *dev_name, void *data, struct dentry **_root)
 {
 	return get_sb_pseudo(fs_type, "socket:", &sockfs_ops, SOCKFS_MAGIC);
 }
net/sunrpc/rpc_pipe.c +1 -1
diff -uNrp linux-2.6.16-rc4/net/sunrpc/rpc_pipe.c linux-2.6.16-rc4-getsb/net/sunrpc/rpc_pipe.c
@@ -814,7 +814,7 @@ out:
 
 static struct super_block *
 rpc_get_sb(struct file_system_type *fs_type,
-		int flags, const char *dev_name, void *data)
+		int flags, const char *dev_name, void *data, struct dentry **_root)
 {
 	return get_sb_single(fs_type, flags, data, rpc_fill_super);
 }
security/selinux/selinuxfs.c +2 -1
diff -uNrp linux-2.6.16-rc4/security/selinux/selinuxfs.c linux-2.6.16-rc4-getsb/security/selinux/selinuxfs.c
@@ -1281,7 +1281,8 @@ out:
 }
 
 static struct super_block *sel_get_sb(struct file_system_type *fs_type,
-				      int flags, const char *dev_name, void *data)
+				      int flags, const char *dev_name, void *data,
+				      struct dentry **_root)
 {
 	return get_sb_single(fs_type, flags, data, sel_fill_super);
 }
author maintainer
#2 lore raw

PATCH 3/5 NFS: Abstract out namespace initialisation

In reply to David Howells

The attached patch abstracts out the namespace initialisation so that temporary namespaces can be set up elsewhere.

---
warthog>diffstat -p1 init-namespace-2616rc4.diff

 fs/namespace.c            |    8 +-------
 include/linux/namespace.h |   15 +++++++++++++++
 2 files changed, 16 insertions(+), 7 deletions(-)
include/linux/namespace.h +15 -0
diff -uNrp linux-2.6.16-rc4-getsb/include/linux/namespace.h linux-2.6.16-rc4-getsb-nfs/include/linux/namespace.h
@@ -17,6 +17,21 @@ extern int copy_namespace(int, struct ta
 extern void __put_namespace(struct namespace *namespace);
 extern struct namespace *dup_namespace(struct task_struct *, struct fs_struct *);
 
+static inline void init_namespace(struct namespace *namespace,
+				  struct vfsmount *mnt)
+{
+	atomic_set(&namespace->count, 1);
+	INIT_LIST_HEAD(&namespace->list);
+	init_waitqueue_head(&namespace->poll);
+	namespace->event = 0;
+	namespace->root = mnt;
+
+	if (mnt) {
+		list_add(&mnt->mnt_list, &namespace->list);
+		mnt->mnt_namespace = namespace;
+	}
+}
+
 static inline void put_namespace(struct namespace *namespace)
 {
 	if (atomic_dec_and_lock(&namespace->count, &vfsmount_lock))
fs/namespace.c +1 -7
diff -uNrp linux-2.6.16-rc4-getsb/fs/namespace.c linux-2.6.16-rc4-getsb-nfs/fs/namespace.c
@@ -1679,13 +1679,7 @@ static void __init init_mount_tree(void)
 	namespace = kmalloc(sizeof(*namespace), GFP_KERNEL);
 	if (!namespace)
 		panic("Can't allocate initial namespace");
-	atomic_set(&namespace->count, 1);
-	INIT_LIST_HEAD(&namespace->list);
-	init_waitqueue_head(&namespace->poll);
-	namespace->event = 0;
-	list_add(&mnt->mnt_list, &namespace->list);
-	namespace->root = mnt;
-	mnt->mnt_namespace = namespace;
+	init_namespace(namespace, mnt);
 
 	init_task.namespace = namespace;
 	read_lock(&tasklist_lock);
author maintainer
#3 lore raw

PATCH 4/5 NFS: Add dentry materialisation op

In reply to David Howells

The attached patch adds a new directory cache management function that prepares a disconnected anonymous function to be connected into the dentry tree. The anonymous dentry is transferred the name and parentage from another dentry.

---
warthog>diffstat -p1 materialise-dentry-2616rc4.diff

 fs/dcache.c            |   18 ++++++++++++++++++
 include/linux/dcache.h |    1 +
 2 files changed, 19 insertions(+)
include/linux/dcache.h +1 -0
diff -uNrp linux-2.6.16-rc4-getsb/include/linux/dcache.h linux-2.6.16-rc4-getsb-nfs/include/linux/dcache.h
@@ -208,6 +208,7 @@ static inline int dname_external(struct 
 extern void d_instantiate(struct dentry *, struct inode *);
 extern struct dentry * d_instantiate_unique(struct dentry *, struct inode *);
 extern void d_delete(struct dentry *);
+extern void d_materialise_dentry(struct dentry *, struct dentry *);
 
 /* allocate/de-allocate */
 extern struct dentry * d_alloc(struct dentry *, const struct qstr *);
fs/dcache.c +18 -0
diff -uNrp linux-2.6.16-rc4-getsb/fs/dcache.c linux-2.6.16-rc4-getsb-nfs/fs/dcache.c
@@ -1345,6 +1345,23 @@ already_unhashed:
 }
 
 /**
+ * d_materialise_dentry - connect a disconnected dentry into the tree
+ * @dentry: dentry to replace
+ * @anon: dentry to place into the tree
+ *
+ * Prepare an anonymous dentry for life in the superblock's dentry tree as a
+ * named dentry in place of the dentry to be replaced.
+ */
+void d_materialise_dentry(struct dentry *dentry, struct dentry *anon)
+{
+	switch_names(dentry, anon);
+	do_switch(dentry->d_name.len, anon->d_name.len);
+	do_switch(dentry->d_name.hash, anon->d_name.hash);
+	do_switch(dentry->d_parent, anon->d_parent);
+	anon->d_flags &= ~DCACHE_DISCONNECTED;
+}
+
+/**
  * d_path - return the path of a dentry
  * @dentry: dentry to report
  * @vfsmnt: vfsmnt to which the dentry belongs
@@ -1755,6 +1772,7 @@ EXPORT_SYMBOL(d_instantiate);
 EXPORT_SYMBOL(d_invalidate);
 EXPORT_SYMBOL(d_lookup);
 EXPORT_SYMBOL(d_move);
+EXPORT_SYMBOL_GPL(d_materialise_dentry);
 EXPORT_SYMBOL(d_path);
 EXPORT_SYMBOL(d_prune_aliases);
 EXPORT_SYMBOL(d_rehash);
author maintainer
#4 lore raw

PATCH 5/5 NFS: Unify NFS superblocks per-protocol per-server

In reply to David Howells

The attached patch makes NFS share superblocks between mounts from the same server over the same protocol.

It does this by creating each superblock with a false root and returning the real root dentry through the new argument added to get_sb() in patch 1/5. The root dentry returned starts off as an anonymous dentry if we don't already have the dentry for its inode, otherwise it simply returns the dentry we already have.

We may thus end up with several trees of dentries in the superblock, and if at some later point one of anonymous tree roots is discovered by normal filesystem activity to be located in another tree within the superblock, the anonymous root is named and materialises attached to the second tree at the appropriate point.

Why modify get_sb() in this way? Why not pass an extra argument to the mount() syscall to indicate the subpath and then pathwalk from the server root to the desired directory? You can't guarantee this will work for two reasons:

(1) The root and intervening nodes may not be accessible to the client.

With NFS2 and NFS3, for instance, mountd is called on the server to get the filehandle for the tip of a path. mountd won't give us handles for anything we don't have permission to access, and so we can't set up NFS inodes for such nodes, and so can't easily set up dentries (we'd have to have ghost inodes or something).

With this patch we don't actually create dentries until we get handles from the server that we can use to set up their inodes, and we don't actually bind them into the tree until we know for sure where they go.

(2) Inaccessible symbolic links.

If we're asked to mount two exports from the server, eg:

mount warthog:/warthog/aaa/xxx /mmm
mount warthog:/warthog/bbb/yyy /nnn

We may not be able to access anything nearer the root than xxx and yyy, but we may find out later that /mmm/www/yyy, say, is actually the same directory as the one mounted on /nnn. What we might then find out, for example, is that /warthog/bbb was actually a symbolic link to /warthog/aaa/xxx/www, but we can't actually determine that by talking to the server until /warthog is made available by NFS.

This would lead to having constructed an errneous dentry tree which we can't easily fix. We can end up with a dentry marked as a directory when it should actually be a symlink, or we could end up with an apparently hardlinked directory.

With this patch we need not make assumptions about the type of a dentry for which we can't retrieve information, nor need we assume we know its place in the grand scheme of things until we actually see that place.

This patch reduces the possibility of aliasing in the inode and page caches for inodes that may be accessed by more than one NFS export. It also reduces the number of superblocks required for NFS where there are many NFS exports being used from a server (home directory server + autofs for example).

This in turn makes it simpler to do local caching of network filesystems, as it can then be guaranteed that there won't be links from multiple inodes in separate superblocks to the same cache file.

Obviously, cache aliasing between different levels of NFS protocol is still a problem, but at least that gives us another key to use when indexing the cache.

The patch also exports some functions required from the core kernel.

---
warthog>diffstat -p1 nfs-unify-sb-2616rc4.diff

 fs/namei.c                |    2 
 fs/namespace.c            |    4 
 fs/nfs/Makefile           |    4 
 fs/nfs/dir.c              |   27 +++++
 fs/nfs/getroot.c          |  220 ++++++++++++++++++++++++++++++++++++++++++++++
 fs/nfs/inode.c            |  198 +++++++++++++++++++++--------------------
 fs/nfs/internal.h         |   30 ++++++
 fs/nfs/nfs3proc.c         |    2 
 fs/nfs/nfs4proc.c         |   61 +-----------
 fs/nfs/nfs4state.c        |    2 
 include/linux/nfs_fs_sb.h |    2 
 11 files changed, 393 insertions(+), 159 deletions(-)
include/linux/nfs_fs_sb.h +0 -2
diff -uNrp linux-2.6.16-rc4-getsb/include/linux/nfs_fs_sb.h linux-2.6.16-rc4-getsb-nfs/include/linux/nfs_fs_sb.h
@@ -28,14 +28,12 @@ struct nfs_server {
 	unsigned int		acdirmax;
 	unsigned int		namelen;
 	char *			hostname;	/* remote hostname */
-	struct nfs_fh		fh;
 	struct sockaddr_in	addr;
 #ifdef CONFIG_NFS_V4
 	/* Our own IP address, as a null-terminated string.
 	 * This is used to generate the clientid, and the callback address.
 	 */
 	char			ip_addr[16];
-	char *			mnt_path;
 	struct nfs4_client *	nfs4_state;	/* all NFSv4 state starts here */
 	struct list_head	nfs4_siblings;	/* List of other nfs_server structs
 						 * that share the same clientid
fs/nfs/Makefile +2 -2
diff -uNrp linux-2.6.16-rc4-getsb/fs/nfs/Makefile linux-2.6.16-rc4-getsb-nfs/fs/nfs/Makefile
@@ -4,8 +4,8 @@
 
 obj-$(CONFIG_NFS_FS) += nfs.o
 
-nfs-y 			:= dir.o file.o inode.o nfs2xdr.o pagelist.o \
-			   proc.o read.o symlink.o unlink.o write.o
+nfs-y 			:= dir.o file.o getroot.o inode.o nfs2xdr.o \
+			   pagelist.o proc.o read.o symlink.o unlink.o write.o
 nfs-$(CONFIG_ROOT_NFS)	+= nfsroot.o mount_clnt.o      
 nfs-$(CONFIG_NFS_V3)	+= nfs3proc.o nfs3xdr.o
 nfs-$(CONFIG_NFS_V3_ACL)	+= nfs3acl.o
fs/nfs/internal.h +30 -0
diff -uNrp linux-2.6.16-rc4-getsb/fs/nfs/internal.h linux-2.6.16-rc4-getsb-nfs/fs/nfs/internal.h
@@ -0,0 +1,30 @@
+/* internal.h: internal NFS definitions
+ *
+ * Copyright (C) 2005 Red Hat, Inc. All Rights Reserved.
+ * Written by David Howells ([email protected])
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version
+ * 2 of the License, or (at your option) any later version.
+ */
+
+
+/*
+ * getroot.c
+ */
+typedef void (*nfs_set_params_func)(struct super_block *sb,
+				    struct nfs_fh *mntfh,
+				    struct nfs_fsinfo *fsinfo);
+
+extern struct dentry *nfs_get_root(struct super_block *sb,
+				   struct nfs_fh *mntfh,
+				   nfs_set_params_func set_params);
+
+#ifdef CONFIG_NFS_V4
+
+extern struct dentry *nfs4_get_root(struct super_block *sb,
+				    const char *mntpath,
+				    nfs_set_params_func set_params);
+
+#endif
fs/nfs/dir.c +26 -1
diff -uNrp linux-2.6.16-rc4-getsb/fs/nfs/dir.c linux-2.6.16-rc4-getsb-nfs/fs/nfs/dir.c
@@ -836,11 +836,12 @@ int nfs_is_exclusive_create(struct inode
 
 static struct dentry *nfs_lookup(struct inode *dir, struct dentry * dentry, struct nameidata *nd)
 {
-	struct dentry *res;
+	struct dentry *res, *anon;
 	struct inode *inode = NULL;
 	int error;
 	struct nfs_fh fhandle;
 	struct nfs_fattr fattr;
+ 	int found_alias = 0;
 
 	dfprintk(VFS, "NFS: lookup(%s/%s)\n",
 		dentry->d_parent->d_name.name, dentry->d_name.name);
@@ -869,6 +870,30 @@ static struct dentry *nfs_lookup(struct 
 	inode = nfs_fhget(dentry->d_sb, &fhandle, &fattr);
 	if (!inode)
 		goto out_unlock;
+
+	/* Search for directory aliases arising from multiple mounts from one server */
+	if (S_ISDIR(inode->i_mode) && (anon = d_find_alias(inode))) {
+		spin_lock(&anon->d_lock);
+		/* Is this a mountpoint that we could splice into our tree? */
+		if (IS_ROOT(anon)) {
+			/* Yes! Convert into an ordinary dentry */
+			d_materialise_dentry(dentry, anon);
+			found_alias = 1;
+		} else if (anon->d_name.len == dentry->d_name.len &&
+			   !memcmp(anon->d_name.name, dentry->d_name.name, dentry->d_name.len) &&
+			   dentry->d_parent == anon->d_parent)
+			found_alias = 1;
+		spin_unlock(&anon->d_lock);
+		if (found_alias) {
+			d_drop(anon);
+			iput(inode);
+			d_rehash(anon);
+			return anon;
+		}
+		/* Doh! Server appears to be aliasing directories */
+		dput(anon);
+	}
+
 no_entry:
 	res = d_add_unique(dentry, inode);
 	if (res != NULL)
fs/nfs/getroot.c +220 -0

220 lines not on this page · raw message

fs/nfs/inode.c +103 -95

364 lines not on this page · raw message

fs/nfs/nfs3proc.c +1 -1
diff -uNrp linux-2.6.16-rc4-getsb/fs/nfs/nfs3proc.c linux-2.6.16-rc4-getsb-nfs/fs/nfs/nfs3proc.c
@@ -86,7 +86,7 @@ do_proc_get_root(struct rpc_clnt *client
 }
 
 /*
- * Bare-bones access to getattr: this is for nfs_read_super.
+ * Bare-bones access to getattr: this is for nfs_get_root/nfs_get_sb
  */
 static int
 nfs3_proc_get_root(struct nfs_server *server, struct nfs_fh *fhandle,
fs/nfs/nfs4proc.c +5 -56

82 lines not on this page · raw message

fs/nfs/nfs4state.c +0 -2
diff -uNrp linux-2.6.16-rc4-getsb/fs/nfs/nfs4state.c linux-2.6.16-rc4-getsb-nfs/fs/nfs/nfs4state.c
@@ -69,8 +69,6 @@ init_nfsv4_state(struct nfs_server *serv
 void
 destroy_nfsv4_state(struct nfs_server *server)
 {
-	kfree(server->mnt_path);
-	server->mnt_path = NULL;
 	if (server->nfs4_state) {
 		nfs4_put_client(server->nfs4_state);
 		server->nfs4_state = NULL;
fs/namei.c +2 -0
diff -uNrp linux-2.6.16-rc4-getsb/fs/namei.c linux-2.6.16-rc4-getsb-nfs/fs/namei.c
@@ -992,6 +992,8 @@ int fastcall link_path_walk(const char *
 	return result;
 }
 
+EXPORT_SYMBOL_GPL(link_path_walk);
+
 int fastcall path_walk(const char * name, struct nameidata *nd)
 {
 	current->total_link_count = 0;
fs/namespace.c +4 -0
diff -uNrp linux-2.6.16-rc4-getsb/fs/namespace.c linux-2.6.16-rc4-getsb-nfs/fs/namespace.c
@@ -86,12 +86,16 @@ struct vfsmount *alloc_vfsmnt(const char
 	return mnt;
 }
 
+EXPORT_SYMBOL_GPL(alloc_vfsmnt);
+
 void free_vfsmnt(struct vfsmount *mnt)
 {
 	kfree(mnt->mnt_devname);
 	kmem_cache_free(mnt_cache, mnt);
 }
 
+EXPORT_SYMBOL_GPL(free_vfsmnt);
+
 /*
  * find the first or last mount at @dentry on vfsmount @mnt depending on
  * @dir. If @dir is set return the first mount else return the last mount.