From 09c7765939789b0505644f8d220e5be8262c7e06 Mon Sep 17 00:00:00 2001 From: Bruno Faccini Date: Tue, 26 Nov 2013 11:46:07 +0100 Subject: [PATCH] LU-4279 mdd: Fixed OBF of the FS .lustre Added a check to prevent fid access to the filesystem .lustre directory from returning EINVAL. Added a sanity check accordingly. Signed-off-by: Bruno Faccini Change-Id: I3002e8dd1b834a0b6b87fe707e12573c2accb58c Reviewed-on: http://review.whamcloud.com/8360 Reviewed-by: Fan Yong Reviewed-by: Sebastien Buisson Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Oleg Drokin --- lustre/mdd/mdd_device.c | 3 ++- lustre/tests/sanity.sh | 18 ++++++++++++++++-- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/lustre/mdd/mdd_device.c b/lustre/mdd/mdd_device.c index 0f53539..adb0fdc 100644 --- a/lustre/mdd/mdd_device.c +++ b/lustre/mdd/mdd_device.c @@ -564,7 +564,8 @@ static int obf_lookup(const struct lu_env *env, struct md_object *p, GOTO(out, rc = -EINVAL); } - if (!fid_is_norm(f) && !fid_is_igif(f) && !fid_is_root(f)) { + if (!fid_is_norm(f) && !fid_is_igif(f) && !fid_is_root(f) && + !fid_seq_is_dot(f->f_seq)) { CWARN("%s: "DFID" is invalid, sequence should be " ">= "LPX64" or within ["LPX64","LPX64"].\n", mdd2obd_dev(mdd)->obd_name, PFID(f), diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index 306157f..97fed43 100644 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -11799,7 +11799,7 @@ test_232() { } run_test 232 "failed lock should not block umount" -test_233() { +test_233a() { [ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.3.64) ] || { skip "Need MDS version at least 2.3.64"; return; } @@ -11807,7 +11807,21 @@ test_233() { stat $MOUNT/.lustre/fid/$fid > /dev/null || error "cannot access $MOUNT using its FID '$fid'" } -run_test 233 "checking that OBF of the FS root succeeds" +run_test 233a "checking that OBF of the FS root succeeds" + +test_233b() { + [ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.5.90) ] || + { skip "Need MDS version at least 2.5.90"; return; } + + local fid=$($LFS path2fid $MOUNT/.lustre) + stat $MOUNT/.lustre/fid/$fid > /dev/null || + error "cannot access $MOUNT/.lustre using its FID '$fid'" + + fid=$($LFS path2fid $MOUNT/.lustre/fid) + stat $MOUNT/.lustre/fid/$fid > /dev/null || + error "cannot access $MOUNT/.lustre/fid using its FID '$fid'" +} +run_test 233b "checking that OBF of the FS .lustre succeeds" test_234() { local p="$TMP/sanityN-$TESTNAME.parameters" -- 1.8.3.1