Whamcloud - gitweb
LU-163 Input valid 'mnt' parameter for 'dentry_open()'
authornasf <yong.fan@whamcloud.com>
Fri, 3 Jun 2011 16:55:27 +0000 (00:55 +0800)
committerOleg Drokin <green@whamcloud.com>
Thu, 9 Jun 2011 15:52:51 +0000 (08:52 -0700)
It is required by new kernel (rhel6) for 'get_name()'
when re-export lustre through NFS.

Change-Id: I732ba2a91b6e1420e8e46910fddca67d04cedcde
Signed-off-by: nasf <yong.fan@whamcloud.com>
Reviewed-on: http://review.whamcloud.com/892
Tested-by: Hudson
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Tested-by: Maloo <whamcloud.maloo@gmail.com>
lustre/include/lustre_disk.h
lustre/llite/llite_internal.h
lustre/llite/llite_lib.c
lustre/llite/llite_nfs.c
lustre/obdclass/obd_mount.c

index 07c0ca8..4dc85ab 100644 (file)
@@ -467,7 +467,8 @@ struct lustre_mount_info {
 #ifdef __KERNEL__
 
 /* obd_mount.c */
-void lustre_register_client_fill_super(int (*cfs)(struct super_block *sb));
+void lustre_register_client_fill_super(int (*cfs)(struct super_block *sb,
+                                                  struct vfsmount *mnt));
 void lustre_register_kill_super_cb(void (*cfs)(struct super_block *sb));
 
 
index 7d0f68d..6411381 100644 (file)
@@ -414,6 +414,7 @@ struct ll_sb_info {
                                                  * clustred nfs */
         struct rmtacl_ctl_table   ll_rct;
         struct eacl_table         ll_et;
+        struct vfsmount          *ll_mnt;
 };
 
 #define LL_DEFAULT_MAX_RW_CHUNK      (32 * 1024 * 1024)
@@ -713,7 +714,7 @@ extern struct super_operations lustre_super_operations;
 
 char *ll_read_opt(const char *opt, char *data);
 void ll_lli_init(struct ll_inode_info *lli);
-int ll_fill_super(struct super_block *sb);
+int ll_fill_super(struct super_block *sb, struct vfsmount *mnt);
 void ll_put_super(struct super_block *sb);
 void ll_kill_super(struct super_block *sb);
 struct inode *ll_inode_from_lock(struct ldlm_lock *lock);
index 3ee3ca0..954f4ff 100644 (file)
@@ -162,7 +162,8 @@ static struct dentry_operations ll_d_root_ops = {
         .d_revalidate = ll_revalidate_nd,
 };
 
-static int client_common_fill_super(struct super_block *sb, char *md, char *dt)
+static int client_common_fill_super(struct super_block *sb, char *md, char *dt,
+                                    struct vfsmount *mnt)
 {
         struct inode *root = 0;
         struct ll_sb_info *sbi = ll_s2sbi(sb);
@@ -518,6 +519,7 @@ static int client_common_fill_super(struct super_block *sb, char *md, char *dt)
         uuid = obd_get_uuid(sbi->ll_md_exp);
         if (uuid != NULL)
                 sb->s_dev = get_uuid2int(uuid->uuid, strlen(uuid->uuid));
+        sbi->ll_mnt = mnt;
 
         RETURN(err);
 out_root:
@@ -844,7 +846,7 @@ static inline int ll_bdi_register(struct backing_dev_info *bdi)
 #endif
 }
 
-int ll_fill_super(struct super_block *sb)
+int ll_fill_super(struct super_block *sb, struct vfsmount *mnt)
 {
         struct lustre_profile *lprof;
         struct lustre_sb_info *lsi = s2lsi(sb);
@@ -922,7 +924,7 @@ int ll_fill_super(struct super_block *sb)
         sprintf(md, "%s-%s", lprof->lp_md, ll_instance);
 
         /* connections, registrations, sb setup */
-        err = client_common_fill_super(sb, md, dt);
+        err = client_common_fill_super(sb, md, dt, mnt);
 
 out_free:
         if (md)
index c3e327c..99a9943 100644 (file)
@@ -228,7 +228,8 @@ static int ll_get_name(struct dentry *dentry, char *name,
         if (!dir->i_fop)
                 GOTO(out, rc = -EINVAL);
 
-        filp = ll_dentry_open(dget(dentry), NULL, O_RDONLY, current_cred());
+        filp = ll_dentry_open(dget(dentry), mntget(ll_i2sbi(dir)->ll_mnt),
+                              O_RDONLY, current_cred());
         if (IS_ERR(filp))
                 GOTO(out, rc = PTR_ERR(filp));
 
index 852eaa5..e92d1c2 100644 (file)
@@ -56,7 +56,8 @@
 #include <lustre_disk.h>
 #include <lustre_param.h>
 
-static int (*client_fill_super)(struct super_block *sb) = NULL;
+static int (*client_fill_super)(struct super_block *sb,
+                                struct vfsmount *mnt) = NULL;
 static void (*kill_super_cb)(struct super_block *sb) = NULL;
 
 /*********** mount lookup *********/
@@ -1438,8 +1439,7 @@ static void server_wait_finished(struct vfsmount *mnt)
                cfs_block_sigs(blocked);
                if (rc < 0) {
                        LCONSOLE_EMERG("Danger: interrupted umount %s with "
-                                      "%d refs!\n",
-                                     mnt->mnt_devname,
+                                      "%d refs!\n", mnt->mnt_devname,
                                       atomic_read(&mnt->mnt_count));
                        break;
                }
@@ -2076,6 +2076,10 @@ invalid:
         RETURN(-EINVAL);
 }
 
+struct lustre_mount_data2 {
+        void *lmd2_data;
+        struct vfsmount *lmd2_mnt;
+};
 
 /** This is the entry point for the mount call into Lustre.
  * This is called when a server or client is mounted,
@@ -2085,6 +2089,7 @@ invalid:
 int lustre_fill_super(struct super_block *sb, void *data, int silent)
 {
         struct lustre_mount_data *lmd;
+        struct lustre_mount_data2 *lmd2 = data;
         struct lustre_sb_info *lsi;
         int rc;
         ENTRY;
@@ -2103,7 +2108,7 @@ int lustre_fill_super(struct super_block *sb, void *data, int silent)
         cfs_lockdep_off();
 
         /* Figure out the lmd from the mount options */
-        if (lmd_parse((char *)data, lmd)) {
+        if (lmd_parse((char *)(lmd2->lmd2_data), lmd)) {
                 lustre_put_lsi(sb);
                 GOTO(out, rc = -EINVAL);
         }
@@ -2124,7 +2129,7 @@ int lustre_fill_super(struct super_block *sb, void *data, int silent)
                         }
                         /* Connect and start */
                         /* (should always be ll_fill_super) */
-                        rc = (*client_fill_super)(sb);
+                        rc = (*client_fill_super)(sb, lmd2->lmd2_mnt);
                         /* c_f_s will call lustre_common_put_super on failure */
                 }
         } else {
@@ -2155,7 +2160,8 @@ out:
 
 /* We can't call ll_fill_super by name because it lives in a module that
    must be loaded after this one. */
-void lustre_register_client_fill_super(int (*cfs)(struct super_block *sb))
+void lustre_register_client_fill_super(int (*cfs)(struct super_block *sb,
+                                                  struct vfsmount *mnt))
 {
         client_fill_super = cfs;
 }
@@ -2168,17 +2174,18 @@ void lustre_register_kill_super_cb(void (*cfs)(struct super_block *sb))
 /***************** FS registration ******************/
 
 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18))
-struct super_block * lustre_get_sb(struct file_system_type *fs_type,
-                               int flags, const char *devname, void * data)
+struct super_block * lustre_get_sb(struct file_system_type *fs_type, int flags,
+                                   const char *devname, void * data)
 {
         return get_sb_nodev(fs_type, flags, data, lustre_fill_super);
 }
 #else
-int lustre_get_sb(struct file_system_type *fs_type,
-                               int flags, const char *devname, void * data,
-                               struct vfsmount *mnt)
+int lustre_get_sb(struct file_system_type *fs_type, int flags,
+                  const char *devname, void * data, struct vfsmount *mnt)
 {
-        return get_sb_nodev(fs_type, flags, data, lustre_fill_super, mnt);
+        struct lustre_mount_data2 lmd2 = {data, mnt};
+
+        return get_sb_nodev(fs_type, flags, &lmd2, lustre_fill_super, mnt);
 }
 #endif