From 0747ade4c5ecc35fbd96bc3329d1aed124b69d77 Mon Sep 17 00:00:00 2001 From: shadow Date: Fri, 14 Sep 2007 07:58:20 +0000 Subject: [PATCH] Kernels after 2.6.16 not allow resotre s_dev from put_super, fix it. b=13304 i=johann i=green --- lustre/ChangeLog | 8 ++++++++ lustre/include/lustre_disk.h | 3 +++ lustre/llite/llite_internal.h | 1 + lustre/llite/llite_lib.c | 21 +++++++++++++++++++-- lustre/llite/super25.c | 4 ++++ lustre/obdclass/obd_mount.c | 19 ++++++++++++++++++- 6 files changed, 53 insertions(+), 3 deletions(-) diff --git a/lustre/ChangeLog b/lustre/ChangeLog index 1151ea4..b684804 100644 --- a/lustre/ChangeLog +++ b/lustre/ChangeLog @@ -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. diff --git a/lustre/include/lustre_disk.h b/lustre/include/lustre_disk.h index 0cc200a..204c183 100644 --- a/lustre/include/lustre_disk.h +++ b/lustre/include/lustre_disk.h @@ -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); diff --git a/lustre/llite/llite_internal.h b/lustre/llite/llite_internal.h index 1282a89..4c3094f 100644 --- a/lustre/llite/llite_internal.h +++ b/lustre/llite/llite_internal.h @@ -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); diff --git a/lustre/llite/llite_lib.c b/lustre/llite/llite_lib.c index 3a2be46..8c46cdf 100644 --- a/lustre/llite/llite_lib.c +++ b/lustre/llite/llite_lib.c @@ -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; diff --git a/lustre/llite/super25.c b/lustre/llite/super25.c index e9147cf..d7fc835 100644 --- a/lustre/llite/super25.c +++ b/lustre/llite/super25.c @@ -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); diff --git a/lustre/obdclass/obd_mount.c b/lustre/obdclass/obd_mount.c index a726c1e..a5a7b97 100644 --- a/lustre/obdclass/obd_mount.c +++ b/lustre/obdclass/obd_mount.c @@ -40,6 +40,7 @@ #include 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); -- 1.8.3.1