Details

    • Technical task
    • Resolution: Fixed
    • Blocker
    • Lustre 2.4.0, Lustre 2.1.5
    • Lustre 2.4.0, Lustre 2.1.2, Lustre 2.1.5
    • MDT needs to be formatted with {{--mkfsoptions="-O extents"}}. This is not a normal configuration, but has been seen in the field
    • 6163

    Description

      Short symlinks on MDT filesystems formatted with the "extents" feature appear to be created with the EXT4_EXTENTS_FL in osd-ldiskfs, but that shouldn't be happening. e2fsck considers this a corruption and deletes the symlink.

      While we have never formatted MDT filesystems with "extents" enabled, some users have done this, or enabled it after formatting, and the MDS should not corrupt such filesystems.

      Attachments

        Issue Links

          Activity

            [LU-2634] short symlinks on MDT with "extents" have EXT4_EXTENTS_FL set
            pjones Peter Jones added a comment -

            Landed for 2.4

            pjones Peter Jones added a comment - Landed for 2.4
            emoly.liu Emoly Liu added a comment - b2_1 port is at http://review.whamcloud.com/5458
            emoly.liu Emoly Liu added a comment -

            Thanks for Andreas' comment! I saw the code in ext4/ldiskfs_symlink(). Now I know my previous change to ext4/ldiskfs is not a right place. It should be fixed in lustre osd-ldiskfs level not ext4/ldiskfs level.

            BTW, I test the change above in osd_ldiskfs_writelink() and it works.

            emoly.liu Emoly Liu added a comment - Thanks for Andreas' comment! I saw the code in ext4/ldiskfs_symlink(). Now I know my previous change to ext4/ldiskfs is not a right place. It should be fixed in lustre osd-ldiskfs level not ext4/ldiskfs level. BTW, I test the change above in osd_ldiskfs_writelink() and it works.

            Looking at the ext4 code in the kernel, it shows something like:

            static int ext4_symlink(struct inode *dir,
                                    struct dentry *dentry, const char *symname)
            {
                    if (l < EXT4_N_BLOCKS * 4) {
                            /* clear the extent format for fast symlink */
                            ext4_clear_inode_flag(inode, EXT4_INODE_EXTENTS);
                            inode->i_op = &ext4_fast_symlink_inode_operations;
                    }
            

            It appears we should be doing the same thing in our own code:

             static int osd_ldiskfs_writelink(struct inode *inode, char *buffer, int buflen)
             {
            +        /* clear the extent format for fast symlink */
            +        ldiskfs_clear_inode_flag(inode, LDISKFS_INODE_EXTENTS);
            
                     memcpy((char *)&LDISKFS_I(inode)->i_data, (char *)buffer, buflen);
                     LDISKFS_I(inode)->i_disksize = buflen;
                     i_size_write(inode, buflen);
                     inode->i_sb->s_op->dirty_inode(inode);
            
                     return 0;
             }
            
            adilger Andreas Dilger added a comment - Looking at the ext4 code in the kernel, it shows something like: static int ext4_symlink(struct inode *dir, struct dentry *dentry, const char *symname) { if (l < EXT4_N_BLOCKS * 4) { /* clear the extent format for fast symlink */ ext4_clear_inode_flag(inode, EXT4_INODE_EXTENTS); inode->i_op = &ext4_fast_symlink_inode_operations; } It appears we should be doing the same thing in our own code: static int osd_ldiskfs_writelink(struct inode *inode, char *buffer, int buflen) { + /* clear the extent format for fast symlink */ + ldiskfs_clear_inode_flag(inode, LDISKFS_INODE_EXTENTS); memcpy(( char *)&LDISKFS_I(inode)->i_data, ( char *)buffer, buflen); LDISKFS_I(inode)->i_disksize = buflen; i_size_write(inode, buflen); inode->i_sb->s_op->dirty_inode(inode); return 0; }
            emoly.liu Emoly Liu added a comment - patch tracking at http://review.whamcloud.com/5154
            emoly.liu Emoly Liu added a comment -

            Since the feature extents is disabled by default in current mkfs.lustre code, the patch only needs to fix the problem in the following two situations:
            1. if the users still format MDT with "-O extents", we will prevent setting EXT4_INODE_EXTENTS flag to the new fast symlink inodes;
            2. if the users disable extents feature but the old data already have extents flag, we will clear EXT4_INODE_EXTENTS for the old fast symlink inodes and write back to disk to avoid e2fsck error.

            Now the patch can pass my local test for the above two situations. BTW, because the part of patch for situation 1 has avoided to set that extent flag for new inodes, it's hard to reproduce situation 2 in conf-sanity test. I simulate it manually and it works.

            emoly.liu Emoly Liu added a comment - Since the feature extents is disabled by default in current mkfs.lustre code, the patch only needs to fix the problem in the following two situations: 1. if the users still format MDT with "-O extents", we will prevent setting EXT4_INODE_EXTENTS flag to the new fast symlink inodes; 2. if the users disable extents feature but the old data already have extents flag, we will clear EXT4_INODE_EXTENTS for the old fast symlink inodes and write back to disk to avoid e2fsck error. Now the patch can pass my local test for the above two situations. BTW, because the part of patch for situation 1 has avoided to set that extent flag for new inodes, it's hard to reproduce situation 2 in conf-sanity test. I simulate it manually and it works.

            Sorry, it seems mkfs.lustre works too hard to clear the "extents" option from the MDT feature list. It could also be enabled with tune2fs after formatting.

            adilger Andreas Dilger added a comment - Sorry, it seems mkfs.lustre works too hard to clear the "extents" option from the MDT feature list. It could also be enabled with tune2fs after formatting.
            emoly.liu Emoly Liu added a comment -

            When I use --mkfsoptions=\\\"-O ^extents,extents\\\", the error "Fast symlink xxx has EXTENT_FL set. Clear? no" can be reproduced.

            emoly.liu Emoly Liu added a comment - When I use --mkfsoptions=\\\"-O ^extents,extents\\\", the error "Fast symlink xxx has EXTENT_FL set. Clear? no" can be reproduced.
            emoly.liu Emoly Liu added a comment -

            Probably because option "extents" is in front of "^extents"?

            -O extents,dirdata,uninit_bg,^extents,dir_nlink,quota,huge_file,flex_bg

            emoly.liu Emoly Liu added a comment - Probably because option "extents" is in front of "^extents"? -O extents,dirdata,uninit_bg,^extents,dir_nlink,quota,huge_file,flex_bg

            People

              emoly.liu Emoly Liu
              adilger Andreas Dilger
              Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: