Whamcloud - gitweb
b=22911 Fix incompatibilies between ext4 and ext3 based ldiskfs
authorRobert Read <robert.read@oracle.com>
Wed, 23 Jun 2010 16:30:24 +0000 (09:30 -0700)
committerRobert Read <robert.read@oracle.com>
Fri, 25 Jun 2010 16:44:07 +0000 (09:44 -0700)
i=girish
i=rread
a=adilger
a=yangsheng

lustre/lvfs/fsfilt_ext3.c
lustre/utils/mkfs_lustre.c

index 82f8879..d2e4c18 100644 (file)
@@ -622,9 +622,21 @@ static int fsfilt_ext3_iocontrol(struct inode *inode, struct file *file,
         ENTRY;
 
         /* FIXME: Can't do this because of nested transaction deadlock */
         ENTRY;
 
         /* FIXME: Can't do this because of nested transaction deadlock */
-        if (cmd == EXT3_IOC_SETFLAGS && (*(int *)arg) & EXT3_JOURNAL_DATA_FL) {
-                CERROR("can't set data journal flag on file\n");
-                RETURN(-EPERM);
+        if (cmd == EXT3_IOC_SETFLAGS) {
+                /* We can't enable data journaling on OST objects, because
+                * this forces the transaction to be closed in order to
+                * flush the journal, but the caller will already have a
+                * compound transaction open to update the last_rcvd file,
+                * and this thread would deadlock trying to set the flag. */
+                if ((*(int *)arg) & EXT3_JOURNAL_DATA_FL) {
+                        CERROR("can't set data journal flag on file\n");
+                        RETURN(-EPERM);
+                }
+                /* Because the MDS does not see the EXTENTS_FL set on the
+                 * OST objects, mask this flag into all set flags.  It is
+                 * not legal to clear this flag in any case, so we are not
+                 * changing the functionality by doing this.  b=22911 */
+                *(int *)arg |= EXT3_I(inode)->i_flags & EXT3_EXTENTS_FL;
         }
 
 #ifdef HAVE_EXT4_LDISKFS
         }
 
 #ifdef HAVE_EXT4_LDISKFS
index 5c11296..1960bb2 100644 (file)
@@ -517,34 +517,29 @@ static int is_e2fsprogs_feature_supp(const char *feature)
         return ret;
 }
 
         return ret;
 }
 
-static void disp_old_kernel_msg(char *feature)
-{
-       fprintf(stderr, "WARNING: ldiskfs filesystem does not support \"%s\" "
-               "feature.\n\n", feature);
-}
-
 static void enable_default_backfs_features(struct mkfs_opts *mop)
 {
         struct utsname uts;
 static void enable_default_backfs_features(struct mkfs_opts *mop)
 {
         struct utsname uts;
-        int maj_high, maj_low, min;
         int ret;
 
         int ret;
 
-        if (IS_MDT(&mop->mo_ldd))
-                strscat(mop->mo_mkfsopts, " -O dir_index,extents,dirdata",
-                                sizeof(mop->mo_mkfsopts));
-        else
+        if (IS_OST(&mop->mo_ldd))
                 strscat(mop->mo_mkfsopts, " -O dir_index,extents",
                 strscat(mop->mo_mkfsopts, " -O dir_index,extents",
-                                sizeof(mop->mo_mkfsopts));
-
+                        sizeof(mop->mo_mkfsopts));
+        else if (IS_MDT(&mop->mo_ldd))
+                strscat(mop->mo_mkfsopts, " -O dir_index,dirdata",
+                        sizeof(mop->mo_mkfsopts));
+        else
+                strscat(mop->mo_mkfsopts, " -O dir_index",
+                        sizeof(mop->mo_mkfsopts));
 
         /* Upstream e2fsprogs called our uninit_groups feature uninit_bg,
          * check for both of them when testing e2fsprogs features. */
 
         /* Upstream e2fsprogs called our uninit_groups feature uninit_bg,
          * check for both of them when testing e2fsprogs features. */
-        if (is_e2fsprogs_feature_supp("uninit_groups") == 0)
-                strscat(mop->mo_mkfsopts, ",uninit_groups",
-                        sizeof(mop->mo_mkfsopts));
-        else if (is_e2fsprogs_feature_supp("uninit_bg") == 0)
+        if (is_e2fsprogs_feature_supp("uninit_bg") == 0)
                 strscat(mop->mo_mkfsopts, ",uninit_bg",
                         sizeof(mop->mo_mkfsopts));
                 strscat(mop->mo_mkfsopts, ",uninit_bg",
                         sizeof(mop->mo_mkfsopts));
+        else if (is_e2fsprogs_feature_supp("uninit_groups") == 0)
+                strscat(mop->mo_mkfsopts, ",uninit_groups",
+                        sizeof(mop->mo_mkfsopts));
         else
                 disp_old_e2fsprogs_msg("uninit_bg", 1);
 
         else
                 disp_old_e2fsprogs_msg("uninit_bg", 1);
 
@@ -552,22 +547,14 @@ static void enable_default_backfs_features(struct mkfs_opts *mop)
         if (ret)
                 return;
 
         if (ret)
                 return;
 
-        sscanf(uts.release, "%d.%d.%d", &maj_high, &maj_low, &min);
-        printf("%d %d %d\n", maj_high, maj_low, min);
-
         /* Multiple mount protection is enabled only if failover node is
          * specified and if kernel version is higher than 2.6.9 */
         if (failover) {
         /* Multiple mount protection is enabled only if failover node is
          * specified and if kernel version is higher than 2.6.9 */
         if (failover) {
-                if (KERNEL_VERSION(maj_high, maj_low, min) >=
-                    KERNEL_VERSION(2,6,9)) {
-                        if (is_e2fsprogs_feature_supp("mmp") == 0)
-                                strscat(mop->mo_mkfsopts, ",mmp",
-                                        sizeof(mop->mo_mkfsopts));
-                        else
-                                disp_old_e2fsprogs_msg("mmp", 1);
-                } else {
-                        disp_old_kernel_msg("mmp");
-                }
+                if (is_e2fsprogs_feature_supp("mmp") == 0)
+                        strscat(mop->mo_mkfsopts, ",mmp",
+                                sizeof(mop->mo_mkfsopts));
+                else
+                        disp_old_e2fsprogs_msg("mmp", 1);
         }
 }
 /* Build fs according to type */
         }
 }
 /* Build fs according to type */