Whamcloud - gitweb
Kernels after 2.6.16 not allow resotre s_dev from put_super, fix it.
authorshadow <shadow>
Fri, 14 Sep 2007 07:58:20 +0000 (07:58 +0000)
committershadow <shadow>
Fri, 14 Sep 2007 07:58:20 +0000 (07:58 +0000)
b=13304
i=johann
i=green

lustre/ChangeLog
lustre/include/lustre_disk.h
lustre/llite/llite_internal.h
lustre/llite/llite_lib.c
lustre/llite/super25.c
lustre/obdclass/obd_mount.c

index 1151ea4..b684804 100644 (file)
@@ -243,6 +243,14 @@ Details    : When generating the bio request for lustre file writes the
             will overflow in a similar manner) but other file data or
             filesystem metadata may be corrupted in some cases.
 
+Severity   : normal
+Bugzilla   : 13304
+Frequency  : Always, for kernels after 2.6.16
+Description: Fix warning idr_remove called for id=.. which is not
+             allocated.
+Details    : Last kernels save old s_dev before kill super and not allow 
+             to restore from callback - restore it before call kill_anon_super.
+
 --------------------------------------------------------------------------------
 
 2007-08-27         Cluster File Systems, Inc. <info@clusterfs.com>
index 0cc200a..204c183 100644 (file)
@@ -266,6 +266,9 @@ struct lustre_mount_info {
 
 /* obd_mount.c */
 void lustre_register_client_fill_super(int (*cfs)(struct super_block *sb));
+void lustre_register_kill_super_cb(void (*cfs)(struct super_block *sb));
+
+
 int lustre_common_put_super(struct super_block *sb);
 int lustre_process_log(struct super_block *sb, char *logname, 
                      struct config_llog_instance *cfg);
index 1282a89..4c3094f 100644 (file)
@@ -595,6 +595,7 @@ 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);
 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);
 void ll_clear_inode(struct inode *inode);
 int ll_setattr_raw(struct inode *inode, struct iattr *attr);
index 3a2be46..8c46cdf 100644 (file)
@@ -592,12 +592,29 @@ void client_common_put_super(struct super_block *sb)
         sbi->ll_mdc_exp = NULL;
 
         lustre_throw_orphan_dentries(sb);
-        /* restore s_dev from changed for clustred NFS*/
-        sb->s_dev = sbi->ll_sdev_orig;
 
         EXIT;
 }
 
+void ll_kill_super(struct super_block *sb)
+{
+        struct ll_sb_info *sbi;
+
+        ENTRY;
+
+        /* not init sb ?*/
+        if (!(sb->s_flags & MS_ACTIVE))
+                return;
+
+        sbi = ll_s2sbi(sb);
+        /* we need restore s_dev from changed for clustred NFS before put_super
+         * because new kernels have cached s_dev and change sb->s_dev in 
+         * put_super not affected real removing devices */
+        if (sbi)
+                sb->s_dev = sbi->ll_sdev_orig;
+        EXIT;
+}
+
 char *ll_read_opt(const char *opt, char *data)
 {
         char *value;
index e9147cf..d7fc835 100644 (file)
@@ -115,6 +115,8 @@ static int __init init_lustre_lite(void)
         ll_register_cache(&ll_cache_definition);
 
         lustre_register_client_fill_super(ll_fill_super);
+        lustre_register_kill_super_cb(ll_kill_super);
+
         lustre_register_client_process_config(ll_process_config);
 
         ll_get_random_bytes(seed, sizeof(seed));
@@ -141,6 +143,8 @@ static void __exit exit_lustre_lite(void)
         int rc;
 
         lustre_register_client_fill_super(NULL);
+        lustre_register_kill_super_cb(NULL);
+
         lustre_register_client_process_config(NULL);
 
         ll_unregister_cache(&ll_cache_definition);
index a726c1e..a5a7b97 100644 (file)
@@ -40,6 +40,7 @@
 #include <lustre_param.h>
 
 static int (*client_fill_super)(struct super_block *sb) = NULL;
+static void (*kill_super_cb)(struct super_block *sb) = NULL;
 
 /*********** mount lookup *********/
 
@@ -1944,6 +1945,11 @@ void lustre_register_client_fill_super(int (*cfs)(struct super_block *sb))
         client_fill_super = cfs;
 }
 
+void lustre_register_kill_super_cb(void (*cfs)(struct super_block *sb))
+{
+        kill_super_cb = cfs;
+}
+
 /***************** FS registration ******************/
 
 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
@@ -1969,11 +1975,21 @@ int lustre_get_sb(struct file_system_type *fs_type,
 }
 #endif
 
+void lustre_kill_super(struct super_block *sb)
+{
+        struct lustre_sb_info *lsi = s2lsi(sb);
+
+        if (kill_super_cb && !(lsi->lsi_flags & LSI_SERVER))
+                (*kill_super_cb)(sb);
+
+        kill_anon_super(sb);
+}
+
 struct file_system_type lustre_fs_type = {
         .owner        = THIS_MODULE,
         .name         = "lustre",
         .get_sb       = lustre_get_sb,
-        .kill_sb      = kill_anon_super,
+        .kill_sb      = lustre_kill_super,
         .fs_flags     = FS_BINARY_MOUNTDATA | FS_REQUIRES_DEV,
 };
 
@@ -2010,6 +2026,7 @@ int lustre_unregister_fs(void)
 }
 
 EXPORT_SYMBOL(lustre_register_client_fill_super);
+EXPORT_SYMBOL(lustre_register_kill_super_cb);
 EXPORT_SYMBOL(lustre_common_put_super);
 EXPORT_SYMBOL(lustre_process_log);
 EXPORT_SYMBOL(lustre_end_log);