Whamcloud - gitweb
b=21564 Print mmp_check_interval in kmmpd
[fs/lustre-release.git] / ldiskfs / kernel_patches / patches / ext4-mmp-rhel5.patch
index 812d9a9..94c8c1c 100644 (file)
@@ -1,8 +1,8 @@
-Index: linux-2.6.18-128.1.6/fs/ext4/super.c
+Index: linux-stage/fs/ext4/super.c
 ===================================================================
---- linux-2.6.18-128.1.6.orig/fs/ext4/super.c
-+++ linux-2.6.18-128.1.6/fs/ext4/super.c
-@@ -36,6 +36,8 @@
+--- linux-stage.orig/fs/ext4/super.c
++++ linux-stage/fs/ext4/super.c
+@@ -38,6 +38,8 @@
  #include <linux/log2.h>
  #include <linux/crc16.h>
  #include <asm/uaccess.h>
@@ -11,7 +11,7 @@ Index: linux-2.6.18-128.1.6/fs/ext4/super.c
  
  #include "ext4.h"
  #include "ext4_jbd2.h"
-@@ -547,6 +549,8 @@ static void ext4_put_super(struct super_
+@@ -617,6 +619,8 @@ static void ext4_put_super(struct super_
                invalidate_bdev(sbi->journal_bdev, 0);
                ext4_blkdev_remove(sbi);
        }
@@ -20,7 +20,7 @@ Index: linux-2.6.18-128.1.6/fs/ext4/super.c
        sb->s_fs_info = NULL;
        kfree(sbi);
        return;
-@@ -766,6 +770,328 @@ static int ext4_show_options(struct seq_
+@@ -864,6 +868,345 @@ static int ext4_show_options(struct seq_
        return 0;
  }
  
@@ -74,7 +74,7 @@ Index: linux-2.6.18-128.1.6/fs/ext4/super.c
 +      }
 +#endif
 +      if (!*bh) {
-+              ext4_warning(sb, __FUNCTION__,
++              ext4_warning(sb, __func__,
 +                           "Error while reading MMP block %lu", mmp_block);
 +              return -EIO;
 +      }
@@ -152,21 +152,21 @@ Index: linux-2.6.18-128.1.6/fs/ext4/super.c
 +               * (s_mmp_update_interval * 60) seconds.
 +               */
 +              if (retval && (failed_writes % 60) == 0) {
-+                      ext4_error(sb, __FUNCTION__,
++                      ext4_error(sb, __func__,
 +                                 "Error writing to MMP block");
 +                      failed_writes++;
 +              }
 +
 +              if (!(le32_to_cpu(es->s_feature_incompat) &
 +                  EXT4_FEATURE_INCOMPAT_MMP)) {
-+                      ext4_warning(sb, __FUNCTION__, "kmmpd being stopped "
++                      ext4_warning(sb, __func__, "kmmpd being stopped "
 +                                   "since MMP feature has been disabled.");
 +                      EXT4_SB(sb)->s_mmp_tsk = 0;
 +                      goto failed;
 +              }
 +
 +              if (sb->s_flags & MS_RDONLY) {
-+                      ext4_warning(sb, __FUNCTION__, "kmmpd being stopped "
++                      ext4_warning(sb, __func__, "kmmpd being stopped "
 +                                   "since filesystem has been remounted as "
 +                                   "readonly.");
 +                      EXT4_SB(sb)->s_mmp_tsk = 0;
@@ -198,7 +198,7 @@ Index: linux-2.6.18-128.1.6/fs/ext4/super.c
 +                      if (mmp->mmp_time != mmp_check->mmp_time ||
 +                          memcmp(mmp->mmp_nodename, mmp_check->mmp_nodename,
 +                                 sizeof(mmp->mmp_nodename)))
-+                              dump_mmp_msg(sb, mmp_check, __FUNCTION__,
++                              dump_mmp_msg(sb, mmp_check, __func__,
 +                                           "Error while updating MMP info. "
 +                                           "The filesystem seems to have "
 +                                           "been multiply mounted.");
@@ -254,11 +254,12 @@ Index: linux-2.6.18-128.1.6/fs/ext4/super.c
 +      struct mmp_struct *mmp = NULL;
 +      u32 seq;
 +      unsigned int mmp_check_interval = le16_to_cpu(es->s_mmp_update_interval);
++      unsigned int wait_time = 0;
 +      int retval;
 +
 +      if (mmp_block < le32_to_cpu(es->s_first_data_block) ||
 +          mmp_block >= ext4_blocks_count(es)) {
-+              ext4_warning(sb, __FUNCTION__,
++              ext4_warning(sb, __func__,
 +                           "Invalid MMP block in superblock");
 +              goto failed;
 +      }
@@ -284,19 +285,31 @@ Index: linux-2.6.18-128.1.6/fs/ext4/super.c
 +              goto skip;
 +
 +      if (seq == EXT4_MMP_SEQ_FSCK) {
-+              dump_mmp_msg(sb, mmp, __FUNCTION__,
++              dump_mmp_msg(sb, mmp, __func__,
 +                           "fsck is running on the filesystem");
 +              goto failed;
 +      }
 +
-+      schedule_timeout_uninterruptible(HZ * (2 * mmp_check_interval + 1));
++      wait_time = min(mmp_check_interval * 2 + 1,
++              mmp_check_interval + 60);
++
++      /* Print MMP interval if more than 20 secs. */
++      if (wait_time > EXT4_MMP_MIN_CHECK_INTERVAL * 4)
++              ext4_warning(sb, __func__, "MMP interval %u higher than "
++                           "expected, please wait.\n", wait_time * 2);
++
++      if (schedule_timeout_interruptible(HZ * wait_time) != 0) {
++              ext4_warning(sb, __func__, "MMP startup interrupted, failing "
++                           "mount\n");
++              goto failed;
++      }
 +
 +      retval = read_mmp_block(sb, &bh, mmp_block);
 +      if (retval)
 +              goto failed;
 +      mmp = (struct mmp_struct *)(bh->b_data);
 +      if (seq != le32_to_cpu(mmp->mmp_seq)) {
-+              dump_mmp_msg(sb, mmp, __FUNCTION__,
++              dump_mmp_msg(sb, mmp, __func__,
 +                           "Device is already active on another node.");
 +              goto failed;
 +      }
@@ -314,14 +327,18 @@ Index: linux-2.6.18-128.1.6/fs/ext4/super.c
 +      /*
 +       * wait for MMP interval and check mmp_seq.
 +       */
-+      schedule_timeout_uninterruptible(HZ * (2 * mmp_check_interval + 1));
++      if (schedule_timeout_interruptible(HZ * wait_time) != 0) {
++              ext4_warning(sb, __func__, "MMP startup interrupted, failing "
++                           "mount\n");
++              goto failed;
++      }
 +
 +      retval = read_mmp_block(sb, &bh, mmp_block);
 +      if (retval)
 +              goto failed;
 +      mmp = (struct mmp_struct *)(bh->b_data);
 +      if (seq != le32_to_cpu(mmp->mmp_seq)) {
-+              dump_mmp_msg(sb, mmp, __FUNCTION__,
++              dump_mmp_msg(sb, mmp, __func__,
 +                           "Device is already active on another node.");
 +              goto failed;
 +      }
@@ -334,7 +351,7 @@ Index: linux-2.6.18-128.1.6/fs/ext4/super.c
 +                                           MINOR(sb->s_dev));
 +      if (IS_ERR(EXT4_SB(sb)->s_mmp_tsk)) {
 +              EXT4_SB(sb)->s_mmp_tsk = 0;
-+              ext4_warning(sb, __FUNCTION__, "Unable to create kmmpd thread "
++              ext4_warning(sb, __func__, "Unable to create kmmpd thread "
 +                           "for %s.", sb->s_id);
 +              goto failed;
 +      }
@@ -349,7 +366,7 @@ Index: linux-2.6.18-128.1.6/fs/ext4/super.c
  
  static struct dentry *ext4_get_dentry(struct super_block *sb, void *vobjp)
  {
-@@ -775,7 +1101,6 @@ static struct dentry *ext4_get_dentry(st
+@@ -873,7 +1216,6 @@ static struct dentry *ext4_get_dentry(st
        struct inode *inode;
        struct dentry *result;
  
@@ -357,7 +374,7 @@ Index: linux-2.6.18-128.1.6/fs/ext4/super.c
        if (ino < EXT4_FIRST_INO(sb) && ino != EXT4_ROOT_INO)
                return ERR_PTR(-ESTALE);
        if (ino > le32_to_cpu(EXT4_SB(sb)->s_es->s_inodes_count))
-@@ -2258,6 +2583,11 @@ static int ext4_fill_super(struct super_
+@@ -2407,6 +2749,11 @@ static int ext4_fill_super(struct super_
                          EXT4_HAS_INCOMPAT_FEATURE(sb,
                                    EXT4_FEATURE_INCOMPAT_RECOVER));
  
@@ -369,25 +386,25 @@ Index: linux-2.6.18-128.1.6/fs/ext4/super.c
        /*
         * The first inode we look at is the journal inode.  Don't try
         * root first: it may be modified in the journal!
-@@ -2445,6 +2775,8 @@ failed_mount3:
+@@ -2621,6 +2968,8 @@ failed_mount3:
        percpu_counter_destroy(&sbi->s_freeinodes_counter);
        percpu_counter_destroy(&sbi->s_dirs_counter);
-       percpu_counter_destroy(&sbi->s_dirtyblocks_counter);
+       percpu_counter_destroy(&sbi->s_dirtyblocks_counter);
 +      if (sbi->s_mmp_tsk)
 +              kthread_stop(sbi->s_mmp_tsk);
  failed_mount2:
        for (i = 0; i < db_count; i++)
                brelse(sbi->s_group_desc[i]);
-@@ -2918,7 +3250,7 @@ static int ext4_remount(struct super_blo
+@@ -3142,7 +3491,7 @@ static int ext4_remount(struct super_blo
        struct ext4_mount_options old_opts;
        ext4_group_t g;
-       unsigned int journal_ioprio = DEFAULT_JOURNAL_IOPRIO;
+       unsigned int journal_ioprio = DEFAULT_JOURNAL_IOPRIO;
 -      int err;
 +      int err = 0;
  #ifdef CONFIG_QUOTA
        int i;
  #endif
-@@ -3042,6 +3374,13 @@ static int ext4_remount(struct super_blo
+@@ -3278,6 +3627,13 @@ static int ext4_remount(struct super_blo
                                goto restore_opts;
                        if (!ext4_setup_super(sb, es, 0))
                                sb->s_flags &= ~MS_RDONLY;
@@ -400,12 +417,12 @@ Index: linux-2.6.18-128.1.6/fs/ext4/super.c
 +                              }
                }
        }
- #ifdef CONFIG_QUOTA
-Index: linux-2.6.18-128.1.6/fs/ext4/ext4.h
+       if (sbi->s_journal == NULL)
+Index: linux-stage/fs/ext4/ext4.h
 ===================================================================
---- linux-2.6.18-128.1.6.orig/fs/ext4/ext4.h
-+++ linux-2.6.18-128.1.6/fs/ext4/ext4.h
-@@ -658,7 +658,7 @@ struct ext4_super_block {
+--- linux-stage.orig/fs/ext4/ext4.h
++++ linux-stage/fs/ext4/ext4.h
+@@ -665,7 +665,7 @@ struct ext4_super_block {
        __le16  s_want_extra_isize;     /* New inodes should reserve # bytes */
        __le32  s_flags;                /* Miscellaneous flags */
        __le16  s_raid_stride;          /* RAID stride */
@@ -414,7 +431,7 @@ Index: linux-2.6.18-128.1.6/fs/ext4/ext4.h
        __le64  s_mmp_block;            /* Block for multi-mount protection */
        __le32  s_raid_stripe_width;    /* blocks on all data disks (N*stride)*/
        __u8    s_log_groups_per_flex;  /* FLEX_BG group size */
-@@ -775,7 +775,8 @@ static inline int ext4_valid_inum(struct
+@@ -782,7 +782,8 @@ static inline int ext4_valid_inum(struct
                                         EXT4_FEATURE_INCOMPAT_META_BG| \
                                         EXT4_FEATURE_INCOMPAT_EXTENTS| \
                                         EXT4_FEATURE_INCOMPAT_64BIT| \
@@ -424,8 +441,8 @@ Index: linux-2.6.18-128.1.6/fs/ext4/ext4.h
  #define EXT4_FEATURE_RO_COMPAT_SUPP   (EXT4_FEATURE_RO_COMPAT_SPARSE_SUPER| \
                                         EXT4_FEATURE_RO_COMPAT_LARGE_FILE| \
                                         EXT4_FEATURE_RO_COMPAT_GDT_CSUM| \
-@@ -956,6 +957,39 @@ void ext4_get_group_no_and_offset(struct
-                       unsigned long *blockgrpp, ext4_grpblk_t *offsetp);
+@@ -995,6 +996,39 @@ do {                                                                      \
+ #endif
  
  /*
 + * This structure will be used for multiple mount protection. It will be
@@ -464,11 +481,11 @@ Index: linux-2.6.18-128.1.6/fs/ext4/ext4.h
   * Function prototypes
   */
  
-Index: linux-2.6.18-128.1.6/fs/ext4/ext4_sb.h
+Index: linux-stage/fs/ext4/ext4_sb.h
 ===================================================================
---- linux-2.6.18-128.1.6.orig/fs/ext4/ext4_sb.h
-+++ linux-2.6.18-128.1.6/fs/ext4/ext4_sb.h
-@@ -148,6 +148,8 @@ struct ext4_sb_info {
+--- linux-stage.orig/fs/ext4/ext4_sb.h
++++ linux-stage/fs/ext4/ext4_sb.h
+@@ -149,6 +149,8 @@ struct ext4_sb_info {
  
        unsigned int s_log_groups_per_flex;
        struct flex_groups *s_flex_groups;