From aea35b00bb5fd40d91dad066f61058dc9d208979 Mon Sep 17 00:00:00 2001 From: shadow Date: Tue, 25 Sep 2007 15:13:21 +0000 Subject: [PATCH 1/1] Merge fixes from b1_6 to HEAD. Bugzilla : 10786 Description: omit set fsid for export NFS Bugzilla : 13304 Description: Fix warning idr_remove called for id=.. which is not allocated in kernels up 2.6.16 --- lustre/ChangeLog | 14 ++++++++++++++ lustre/include/lustre_disk.h | 3 +++ lustre/llite/llite_internal.h | 2 ++ lustre/llite/llite_lib.c | 25 +++++++++++++++++++++++-- lustre/llite/super25.c | 4 ++++ lustre/obdclass/obd_mount.c | 21 +++++++++++++++++++-- 6 files changed, 65 insertions(+), 4 deletions(-) diff --git a/lustre/ChangeLog b/lustre/ChangeLog index a185b2d..d89e36b 100644 --- a/lustre/ChangeLog +++ b/lustre/ChangeLog @@ -301,6 +301,20 @@ Bugzilla : 13616 Description: Kernel patches update for RHEL5 2.6.18-8.1.10.el5. Details : Modify the target file & which_kernel. +Severity : enhancement +Bugzilla : 10786 +Description: omit set fsid for export NFS +Details : fix set/restore device id for avoid EMFILE error and mark lustre fs + as FS_REQUIRES_DEV for avoid problems with generate fsid. + +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-10 Cluster File Systems, Inc. diff --git a/lustre/include/lustre_disk.h b/lustre/include/lustre_disk.h index 2393080..2c93c3b 100644 --- a/lustre/include/lustre_disk.h +++ b/lustre/include/lustre_disk.h @@ -269,6 +269,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 835ab91..b3157fc 100644 --- a/lustre/llite/llite_internal.h +++ b/lustre/llite/llite_internal.h @@ -288,6 +288,7 @@ struct ll_sb_info { enum stats_track_type ll_stats_track_type; int ll_stats_track_id; int ll_rw_stats_on; + dev_t ll_sdev_orig; /* save s_dev before assign for clustred nfs*/ }; #define LL_DEFAULT_MAX_RW_CHUNK (32 * 1024 * 1024) @@ -573,6 +574,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 8107969..d757a59 100644 --- a/lustre/llite/llite_lib.c +++ b/lustre/llite/llite_lib.c @@ -337,13 +337,14 @@ static int client_common_fill_super(struct super_block *sb, char *md, char *dt, sbi->ll_flags |= LL_SBI_OSS_CAPA; } + sbi->ll_sdev_orig = sb->s_dev; #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)) /* We set sb->s_dev equal on all lustre clients in order to support * NFS export clustering. NFSD requires that the FSID be the same * on all clients. */ /* s_dev is also used in lt_compare() to compare two fs, but that is * only a node-local comparison. */ - + /* XXX: this will not work with LMV */ sb->s_dev = get_uuid2int(sbi2mdc(sbi)->cl_target_uuid.uuid, strlen(sbi2mdc(sbi)->cl_target_uuid.uuid)); @@ -703,7 +704,7 @@ void client_common_put_super(struct super_block *sb) prune_deathrow(sbi, 0); list_del(&sbi->ll_conn_chain); - + obd_fid_fini(sbi->ll_dt_exp); obd_disconnect(sbi->ll_dt_exp); sbi->ll_dt_exp = NULL; @@ -715,6 +716,26 @@ void client_common_put_super(struct super_block *sb) sbi->ll_md_exp = NULL; lustre_throw_orphan_dentries(sb); + + 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; } diff --git a/lustre/llite/super25.c b/lustre/llite/super25.c index ea1564c..f526048 100644 --- a/lustre/llite/super25.c +++ b/lustre/llite/super25.c @@ -138,6 +138,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)); @@ -174,6 +176,8 @@ static void __exit exit_lustre_lite(void) capa_count[CAPA_SITE_CLIENT]); 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 990c3cf..b070f25 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 *********/ @@ -2113,6 +2114,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)) @@ -2138,12 +2144,22 @@ 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->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, - .fs_flags = FS_BINARY_MOUNTDATA, + .kill_sb = lustre_kill_super, + .fs_flags = FS_BINARY_MOUNTDATA | FS_REQUIRES_DEV, }; #else @@ -2179,6 +2195,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