From 18bf93b84b565859b718aa6a2f1944cd2e44a29b Mon Sep 17 00:00:00 2001 From: kalpak Date: Mon, 2 Feb 2009 07:17:42 +0000 Subject: [PATCH] b=17895 i=adilger i=alex While using HA for Lustre servers with Linux RAID, it is possible that MMP will not detect multiple mounts. To make this work we need to unplug the device queue in RAID when the MMP block is being written. Also while reading the MMP block, we should read it from disk and not the cached one. --- .../patches/ext3-mmp-2.6-rhel4.patch | 24 ++++++++++-- .../patches/ext3-mmp-2.6-sles10.patch | 26 ++++++++++--- .../patches/ext3-mmp-2.6.18-vanilla.patch | 44 +++++++++++++++------- .../patches/ext3-mmp-2.6.22-vanilla.patch | 26 ++++++++++--- 4 files changed, 92 insertions(+), 28 deletions(-) diff --git a/ldiskfs/kernel_patches/patches/ext3-mmp-2.6-rhel4.patch b/ldiskfs/kernel_patches/patches/ext3-mmp-2.6-rhel4.patch index 70578d0..6a5d68a 100644 --- a/ldiskfs/kernel_patches/patches/ext3-mmp-2.6-rhel4.patch +++ b/ldiskfs/kernel_patches/patches/ext3-mmp-2.6-rhel4.patch @@ -20,7 +20,7 @@ Index: linux-2.6.9-67.0.22/fs/ext3/super.c if (sbi->s_dev_proc) { remove_proc_entry(sbi->s_dev_proc->name, proc_root_ext3); sbi->s_dev_proc = NULL; -@@ -1430,6 +1434,314 @@ static unsigned long descriptor_loc(stru +@@ -1441,6 +1445,330 @@ static unsigned long descriptor_loc(stru return (first_data_block + has_super + (bg * sbi->s_blocks_per_group)); } @@ -54,9 +54,25 @@ Index: linux-2.6.9-67.0.22/fs/ext3/super.c + if (*bh) + clear_buffer_uptodate(*bh); + ++#if 0 + brelse(*bh); + + *bh = sb_bread(sb, mmp_block); ++#else ++ if (!*bh) ++ *bh = sb_getblk(sb, mmp_block); ++ if (*bh) { ++ get_bh(*bh); ++ lock_buffer(*bh); ++ (*bh)->b_end_io = end_buffer_read_sync; ++ submit_bh(READ_SYNC, *bh); ++ wait_on_buffer(*bh); ++ if (!buffer_uptodate(*bh)) { ++ brelse(*bh); ++ *bh = NULL; ++ } ++ } ++#endif + if (!*bh) { + ext3_warning(sb, __FUNCTION__, + "Error while reading MMP block %lu", mmp_block); @@ -335,7 +351,7 @@ Index: linux-2.6.9-67.0.22/fs/ext3/super.c static int ext3_fill_super (struct super_block *sb, void *data, int silent) { -@@ -1754,6 +2066,11 @@ static int ext3_fill_super (struct super +@@ -1765,6 +2093,11 @@ static int ext3_fill_super (struct super EXT3_HAS_INCOMPAT_FEATURE(sb, EXT3_FEATURE_INCOMPAT_RECOVER)); @@ -347,7 +363,7 @@ Index: linux-2.6.9-67.0.22/fs/ext3/super.c /* * The first inode we look at is the journal inode. Don't try * root first: it may be modified in the journal! -@@ -1879,6 +2196,8 @@ static int ext3_fill_super (struct super +@@ -1890,6 +2223,8 @@ static int ext3_fill_super (struct super failed_mount3: journal_destroy(sbi->s_journal); failed_mount2: @@ -356,7 +372,7 @@ Index: linux-2.6.9-67.0.22/fs/ext3/super.c for (i = 0; i < db_count; i++) brelse(sbi->s_group_desc[i]); kfree(sbi->s_group_desc); -@@ -2404,6 +2723,11 @@ int ext3_remount (struct super_block * s +@@ -2415,6 +2750,11 @@ int ext3_remount (struct super_block * s return ret; if (!ext3_setup_super (sb, es, 0)) sb->s_flags &= ~MS_RDONLY; diff --git a/ldiskfs/kernel_patches/patches/ext3-mmp-2.6-sles10.patch b/ldiskfs/kernel_patches/patches/ext3-mmp-2.6-sles10.patch index 059ca82..f05fc25 100644 --- a/ldiskfs/kernel_patches/patches/ext3-mmp-2.6-sles10.patch +++ b/ldiskfs/kernel_patches/patches/ext3-mmp-2.6-sles10.patch @@ -20,7 +20,7 @@ Index: linux-2.6.16.60-0.33/fs/ext3/super.c if (sbi->s_dev_proc) { remove_proc_entry(sbi->s_dev_proc->name, proc_root_ext3); sbi->s_dev_proc = NULL; -@@ -1525,6 +1529,313 @@ static unsigned long descriptor_loc(stru +@@ -1525,6 +1529,329 @@ static unsigned long descriptor_loc(stru return (first_data_block + has_super + (bg * sbi->s_blocks_per_group)); } @@ -54,9 +54,25 @@ Index: linux-2.6.16.60-0.33/fs/ext3/super.c + if (*bh) + clear_buffer_uptodate(*bh); + ++#if 0 + brelse(*bh); + + *bh = sb_bread(sb, mmp_block); ++#else ++ if (!*bh) ++ *bh = sb_getblk(sb, mmp_block); ++ if (*bh) { ++ get_bh(*bh); ++ lock_buffer(*bh); ++ (*bh)->b_end_io = end_buffer_read_sync; ++ submit_bh(READ_SYNC, *bh); ++ wait_on_buffer(*bh); ++ if (!buffer_uptodate(*bh)) { ++ brelse(*bh); ++ *bh = NULL; ++ } ++ } ++#endif + if (!*bh) { + ext3_warning(sb, __FUNCTION__, + "Error while reading MMP block %lu", mmp_block); @@ -334,7 +350,7 @@ Index: linux-2.6.16.60-0.33/fs/ext3/super.c static int ext3_fill_super (struct super_block *sb, void *data, int silent) { -@@ -1849,6 +2160,11 @@ static int ext3_fill_super (struct super +@@ -1849,6 +2176,11 @@ static int ext3_fill_super (struct super EXT3_HAS_INCOMPAT_FEATURE(sb, EXT3_FEATURE_INCOMPAT_RECOVER)); @@ -346,7 +362,7 @@ Index: linux-2.6.16.60-0.33/fs/ext3/super.c /* * The first inode we look at is the journal inode. Don't try * root first: it may be modified in the journal! -@@ -1993,6 +2309,8 @@ cantfind_ext3: +@@ -1993,6 +2325,8 @@ cantfind_ext3: failed_mount3: journal_destroy(sbi->s_journal); failed_mount2: @@ -355,7 +371,7 @@ Index: linux-2.6.16.60-0.33/fs/ext3/super.c for (i = 0; i < db_count; i++) brelse(sbi->s_group_desc[i]); kfree(sbi->s_group_desc); -@@ -2463,7 +2781,7 @@ static int ext3_remount (struct super_bl +@@ -2463,7 +2797,7 @@ static int ext3_remount (struct super_bl unsigned long n_blocks_count = 0; unsigned long old_sb_flags; struct ext3_mount_options old_opts; @@ -364,7 +380,7 @@ Index: linux-2.6.16.60-0.33/fs/ext3/super.c #ifdef CONFIG_QUOTA int i; #endif -@@ -2547,6 +2865,11 @@ static int ext3_remount (struct super_bl +@@ -2547,6 +2881,11 @@ static int ext3_remount (struct super_bl } if (!ext3_setup_super (sb, es, 0)) sb->s_flags &= ~MS_RDONLY; diff --git a/ldiskfs/kernel_patches/patches/ext3-mmp-2.6.18-vanilla.patch b/ldiskfs/kernel_patches/patches/ext3-mmp-2.6.18-vanilla.patch index 1c2cd39..80a3e71 100644 --- a/ldiskfs/kernel_patches/patches/ext3-mmp-2.6.18-vanilla.patch +++ b/ldiskfs/kernel_patches/patches/ext3-mmp-2.6.18-vanilla.patch @@ -1,7 +1,7 @@ -Index: linux-2.6.18-92.1.17/fs/ext3/super.c +Index: linux-2.6.18-92.1.22/fs/ext3/super.c =================================================================== ---- linux-2.6.18-92.1.17.orig/fs/ext3/super.c -+++ linux-2.6.18-92.1.17/fs/ext3/super.c +--- linux-2.6.18-92.1.22.orig/fs/ext3/super.c ++++ linux-2.6.18-92.1.22/fs/ext3/super.c @@ -35,6 +35,8 @@ #include #include @@ -20,7 +20,7 @@ Index: linux-2.6.18-92.1.17/fs/ext3/super.c if (sbi->s_dev_proc) { remove_proc_entry(sbi->s_dev_proc->name, proc_root_ext3); sbi->s_dev_proc = NULL; -@@ -1543,6 +1547,313 @@ static ext3_fsblk_t descriptor_loc(struc +@@ -1543,6 +1547,329 @@ static ext3_fsblk_t descriptor_loc(struc return (has_super + ext3_group_first_block_no(sb, bg)); } @@ -54,9 +54,25 @@ Index: linux-2.6.18-92.1.17/fs/ext3/super.c + if (*bh) + clear_buffer_uptodate(*bh); + ++#if 0 + brelse(*bh); + + *bh = sb_bread(sb, mmp_block); ++#else ++ if (!*bh) ++ *bh = sb_getblk(sb, mmp_block); ++ if (*bh) { ++ get_bh(*bh); ++ lock_buffer(*bh); ++ (*bh)->b_end_io = end_buffer_read_sync; ++ submit_bh(READ_SYNC, *bh); ++ wait_on_buffer(*bh); ++ if (!buffer_uptodate(*bh)) { ++ brelse(*bh); ++ *bh = NULL; ++ } ++ } ++#endif + if (!*bh) { + ext3_warning(sb, __FUNCTION__, + "Error while reading MMP block %lu", mmp_block); @@ -334,7 +350,7 @@ Index: linux-2.6.18-92.1.17/fs/ext3/super.c static int ext3_fill_super (struct super_block *sb, void *data, int silent) { -@@ -1875,6 +2186,11 @@ static int ext3_fill_super (struct super +@@ -1875,6 +2202,11 @@ static int ext3_fill_super (struct super EXT3_HAS_INCOMPAT_FEATURE(sb, EXT3_FEATURE_INCOMPAT_RECOVER)); @@ -346,7 +362,7 @@ Index: linux-2.6.18-92.1.17/fs/ext3/super.c /* * The first inode we look at is the journal inode. Don't try * root first: it may be modified in the journal! -@@ -2007,6 +2323,8 @@ cantfind_ext3: +@@ -2007,6 +2339,8 @@ cantfind_ext3: failed_mount4: journal_destroy(sbi->s_journal); failed_mount3: @@ -355,7 +371,7 @@ Index: linux-2.6.18-92.1.17/fs/ext3/super.c percpu_counter_destroy(&sbi->s_freeblocks_counter); percpu_counter_destroy(&sbi->s_freeinodes_counter); percpu_counter_destroy(&sbi->s_dirs_counter); -@@ -2482,7 +2800,7 @@ static int ext3_remount (struct super_bl +@@ -2482,7 +2816,7 @@ static int ext3_remount (struct super_bl ext3_fsblk_t n_blocks_count = 0; unsigned long old_sb_flags; struct ext3_mount_options old_opts; @@ -364,7 +380,7 @@ Index: linux-2.6.18-92.1.17/fs/ext3/super.c #ifdef CONFIG_QUOTA int i; #endif -@@ -2580,6 +2898,11 @@ static int ext3_remount (struct super_bl +@@ -2580,6 +2914,11 @@ static int ext3_remount (struct super_bl } if (!ext3_setup_super (sb, es, 0)) sb->s_flags &= ~MS_RDONLY; @@ -376,10 +392,10 @@ Index: linux-2.6.18-92.1.17/fs/ext3/super.c } } #ifdef CONFIG_QUOTA -Index: linux-2.6.18-92.1.17/include/linux/ext3_fs.h +Index: linux-2.6.18-92.1.22/include/linux/ext3_fs.h =================================================================== ---- linux-2.6.18-92.1.17.orig/include/linux/ext3_fs.h -+++ linux-2.6.18-92.1.17/include/linux/ext3_fs.h +--- linux-2.6.18-92.1.22.orig/include/linux/ext3_fs.h ++++ linux-2.6.18-92.1.22/include/linux/ext3_fs.h @@ -594,13 +594,17 @@ struct ext3_super_block { __le32 s_first_meta_bg; /* First metablock block group */ __le32 s_mkfs_time; /* When the filesystem was created */ @@ -457,10 +473,10 @@ Index: linux-2.6.18-92.1.17/include/linux/ext3_fs.h * Function prototypes */ -Index: linux-2.6.18-92.1.17/include/linux/ext3_fs_sb.h +Index: linux-2.6.18-92.1.22/include/linux/ext3_fs_sb.h =================================================================== ---- linux-2.6.18-92.1.17.orig/include/linux/ext3_fs_sb.h -+++ linux-2.6.18-92.1.17/include/linux/ext3_fs_sb.h +--- linux-2.6.18-92.1.22.orig/include/linux/ext3_fs_sb.h ++++ linux-2.6.18-92.1.22/include/linux/ext3_fs_sb.h @@ -158,6 +158,7 @@ struct ext3_sb_info { /* locality groups */ struct ext3_locality_group *s_locality_groups; diff --git a/ldiskfs/kernel_patches/patches/ext3-mmp-2.6.22-vanilla.patch b/ldiskfs/kernel_patches/patches/ext3-mmp-2.6.22-vanilla.patch index ece021c..0a15100 100644 --- a/ldiskfs/kernel_patches/patches/ext3-mmp-2.6.22-vanilla.patch +++ b/ldiskfs/kernel_patches/patches/ext3-mmp-2.6.22-vanilla.patch @@ -20,7 +20,7 @@ Index: linux-2.6.22.14/fs/ext3/super.c if (sbi->s_dev_proc) { remove_proc_entry(sbi->s_dev_proc->name, proc_root_ext3); sbi->s_dev_proc = NULL; -@@ -1538,6 +1542,313 @@ static ext3_fsblk_t descriptor_loc(struc +@@ -1538,6 +1542,329 @@ static ext3_fsblk_t descriptor_loc(struc return (has_super + ext3_group_first_block_no(sb, bg)); } @@ -54,9 +54,25 @@ Index: linux-2.6.22.14/fs/ext3/super.c + if (*bh) + clear_buffer_uptodate(*bh); + ++#if 0 + brelse(*bh); + + *bh = sb_bread(sb, mmp_block); ++#else ++ if (!*bh) ++ *bh = sb_getblk(sb, mmp_block); ++ if (*bh) { ++ get_bh(*bh); ++ lock_buffer(*bh); ++ (*bh)->b_end_io = end_buffer_read_sync; ++ submit_bh(READ_SYNC, *bh); ++ wait_on_buffer(*bh); ++ if (!buffer_uptodate(*bh)) { ++ brelse(*bh); ++ *bh = NULL; ++ } ++ } ++#endif + if (!*bh) { + ext3_warning(sb, __FUNCTION__, + "Error while reading MMP block %lu", mmp_block); @@ -334,7 +350,7 @@ Index: linux-2.6.22.14/fs/ext3/super.c static int ext3_fill_super (struct super_block *sb, void *data, int silent) { -@@ -1875,6 +2186,11 @@ static int ext3_fill_super (struct super +@@ -1875,6 +2202,11 @@ static int ext3_fill_super (struct super EXT3_HAS_INCOMPAT_FEATURE(sb, EXT3_FEATURE_INCOMPAT_RECOVER)); @@ -346,7 +362,7 @@ Index: linux-2.6.22.14/fs/ext3/super.c /* * The first inode we look at is the journal inode. Don't try * root first: it may be modified in the journal! -@@ -2007,6 +2323,8 @@ cantfind_ext3: +@@ -2007,6 +2339,8 @@ cantfind_ext3: failed_mount4: journal_destroy(sbi->s_journal); failed_mount3: @@ -355,7 +371,7 @@ Index: linux-2.6.22.14/fs/ext3/super.c percpu_counter_destroy(&sbi->s_freeblocks_counter); percpu_counter_destroy(&sbi->s_freeinodes_counter); percpu_counter_destroy(&sbi->s_dirs_counter); -@@ -2482,7 +2800,7 @@ static int ext3_remount (struct super_bl +@@ -2482,7 +2816,7 @@ static int ext3_remount (struct super_bl ext3_fsblk_t n_blocks_count = 0; unsigned long old_sb_flags; struct ext3_mount_options old_opts; @@ -364,7 +380,7 @@ Index: linux-2.6.22.14/fs/ext3/super.c #ifdef CONFIG_QUOTA int i; #endif -@@ -2580,6 +2898,11 @@ static int ext3_remount (struct super_bl +@@ -2580,6 +2914,11 @@ static int ext3_remount (struct super_bl goto restore_opts; if (!ext3_setup_super (sb, es, 0)) sb->s_flags &= ~MS_RDONLY; -- 1.8.3.1