getting "dirdata length set incorrectly" running e2fsck
(LU-1366)
|
|
| Status: | Resolved |
| Project: | Lustre |
| Component/s: | None |
| Affects Version/s: | Lustre 2.4.0, Lustre 2.1.2, Lustre 2.1.5 |
| Fix Version/s: | Lustre 2.4.0, Lustre 2.1.5 |
| Type: | Technical task | Priority: | Blocker |
| Reporter: | Andreas Dilger | Assignee: | Emoly Liu |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | LB | ||
| Environment: |
MDT needs to be formatted with --mkfsoptions="-O extents". This is not a normal configuration, but has been seen in the field |
||
| Issue Links: |
|
||||||||
| Rank (Obsolete): | 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. |
| Comments |
| Comment by Emoly Liu [ 19/Jan/13 ] |
|
I write a conf-sanity test for this case, but I can't reproduce the failure. No symlink error found by e2fsck if MDT is formatted with "-O extents". test_72() { #LU-2634
#enable "-O extents" to overwrite "^extents"
local mdsdev=$(mdsdevname 1)
local ostdev=$(ostdevname 1)
add ${SINGLEMDS} $(mkfs_opts ${SINGLEMDS} ${mdsdev}) \
--reformat --mkfsoptions=\\\"-O extents\\\" $mdsdev ||
error "start mds with "-O extents failed""
add ost1 $(mkfs_opts ost1 ${ostdev}) --reformat ${ostdev}
start_mgsmds || error "MDT start fail"
start_ost || error "OST0 start fail"
mount_client $MOUNT || error "Unable to mount client"
#create 100 short symlinks
local fn=100
mkdir -p $DIR/$tdir
createmany -o $DIR/$tdir/$tfile-%d $fn || error "create files failed"
echo "create $fn short symlinks"
for i in $(seq -w 1 $fn); do
ln -s $DIR/$tdir/$tfile-$i $MOUNT/$tfile-$i
done
#umount
umount_client $MOUNT || error "umount client failed"
stop_ost || error "stop ost failed"
stop_mds || error "stop mds failed"
#run e2fsck
local cmd="$E2FSCK -fnvd $mdsdev"
local rc=0
do_facet ${SINGLEMDS} $cmd || rc=$?
echo "$cmd return $rc"
[ $rc -gt 0 ] && error "e2fsck $rc errors found"
return $rc
}
run_test 72 "Short symlink won't cause e2fsck error if MDT is formatted with extents enabled"
This is the output on my local machine. == conf-sanity test 72: Short symlink won't cause e2fsck error if MDT is formatted with extents enabled == 01:53:26 (1358531606) Permanent disk data: formatting backing filesystem ldiskfs on /dev/loop0 Permanent disk data: formatting backing filesystem ldiskfs on /dev/loop0 348 inodes used (0.35%)
192 regular files |
| Comment by Emoly Liu [ 19/Jan/13 ] |
|
Probably because option "extents" is in front of "^extents"?
|
| Comment by Emoly Liu [ 20/Jan/13 ] |
|
When I use --mkfsoptions=\\\"-O ^extents,extents\\\", the error "Fast symlink xxx has EXTENT_FL set. Clear? no" can be reproduced. |
| Comment by Andreas Dilger [ 22/Jan/13 ] |
|
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. |
| Comment by Emoly Liu [ 23/Jan/13 ] |
|
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: 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. |
| Comment by Emoly Liu [ 24/Jan/13 ] |
|
patch tracking at http://review.whamcloud.com/5154 |
| Comment by Andreas Dilger [ 25/Jan/13 ] |
|
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; } |
| Comment by Emoly Liu [ 27/Jan/13 ] |
|
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. |
| Comment by Emoly Liu [ 18/Feb/13 ] |
|
b2_1 port is at http://review.whamcloud.com/5458 |
| Comment by Peter Jones [ 18/Feb/13 ] |
|
Landed for 2.4 |