diff --git a/lustre/include/obd_support.h b/lustre/include/obd_support.h index 41774c91dd..e5f8a8f476 100644 --- a/lustre/include/obd_support.h +++ b/lustre/include/obd_support.h @@ -649,6 +649,7 @@ extern bool obd_enable_fname_encoding; #define OBD_FAIL_FID_LOOKUP 0x1505 #define OBD_FAIL_FID_NOLMA 0x1506 #define OBD_FAIL_FID_MULTI 0x1507 +#define OBD_FAIL_FID_HALF 0x1508 /* LFSCK */ #define OBD_FAIL_LFSCK_DELAY1 0x1600 diff --git a/lustre/osd-ldiskfs/osd_handler.c b/lustre/osd-ldiskfs/osd_handler.c index 760e9efa72..a1bdfde227 100644 --- a/lustre/osd-ldiskfs/osd_handler.c +++ b/lustre/osd-ldiskfs/osd_handler.c @@ -4317,6 +4317,10 @@ static void osd_get_ldiskfs_dirent_param(struct ldiskfs_dentry_param *param, param->edp_len = sizeof(struct lu_fid) + 1; fid_cpu_to_be((struct lu_fid *)param->edp_data, (struct lu_fid *)fid); + if (CFS_FAIL_CHECK(OBD_FAIL_FID_HALF)) { + CDEBUG(D_INFO, "Place half of FID in dentry param\n"); + param->edp_len += sizeof(struct lu_fid) / 2; + } if (CFS_FAIL_CHECK(OBD_FAIL_FID_MULTI)) { CDEBUG(D_INFO, "Place multiple FIDs in dentry param\n"); /* place multiple FIDs in dentry param to test the robustness diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index 055fe203cc..deecb4ad0e 100755 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -36302,7 +36302,7 @@ test_910() } run_test 910 "Test the erasure_coding module" -test_920() +test_920a() { mount | grep lustre mkdir -p $DIR/$tdir @@ -36314,7 +36314,39 @@ test_920() lfs path2fid $DIR/$tdir/$tfile # Verify it's a normal FID stat $DIR/$tdir/$tfile || error "File not found after creation" } -run_test 920 "Test multy LUFID" +run_test 920a "Test multy LUFID" + +test_920b() +{ + mount | grep lustre + mkdir -p $DIR/$tdir + + #define OBD_FAIL_FID_HALF 0x1508 + do_facet $SINGLEMDS $LCTL set_param fail_loc=0x1508 + touch $DIR/$tdir/$tfile || error "touch failed" +} +run_test 920b "Test one plus half LUFID" + +test_920c() +{ + mount | grep lustre + mkdir -p $DIR/$tdir + + #define OBD_FAIL_FID_MULTI 0x1507 + do_facet $SINGLEMDS $LCTL set_param fail_loc=0x1507 + touch $DIR/$tdir/$tfile || error "touch failed" + stop mds1 + local dev=$(mdsdevname 1) + do_facet mds1 "$DEBUGFS -R 'ls -lD /ROOT/$tdir' $dev" + local inode=$(do_facet mds1 "$DEBUGFS -R 'ls -lD /ROOT/$tdir' $dev" | \ + awk -v tfile="$tfile" '$NF == tfile { print $1 }') + [[ -n "$inode" ]] || error "failed to get inode number for $tfile" + do_facet mds1 "$DEBUGFS -w -R 'clri <$inode>' $dev" + do_facet mds1 "$DEBUGFS -R 'ls -lD /ROOT/$tdir' $dev" + start mds1 $dev $MDS_MOUNT_OPTS || error "cannot start mds1" +} +run_test 920c "Test multiple FIDs output on error" + complete_test $SECONDS [ -f $EXT2_DEV ] && rm $EXT2_DEV || true