From c864582b5d4541c7830d628457e55cd859aee005 Mon Sep 17 00:00:00 2001 From: Henri Doreau Date: Mon, 29 Apr 2013 15:07:42 +0200 Subject: [PATCH] LU-3245 mdd: Fixed OBF of the FS root Added a check to prevent fid access to the filesystem root directory from returning EINVAL. Added a sanity check accordingly. Signed-off-by: Henri Doreau Signed-off-by: John L. Hammond Change-Id: Iffb8bdb71377b878d165e9e48049c6b2ebd14859 Reviewed-on: http://review.whamcloud.com/6209 Reviewed-by: Andreas Dilger Reviewed-by: Alex Zhuravlev Tested-by: Hudson Reviewed-by: Fan Yong Tested-by: Maloo --- lustre/mdd/mdd_device.c | 2 +- lustre/tests/sanity.sh | 12 +++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/lustre/mdd/mdd_device.c b/lustre/mdd/mdd_device.c index 7b0524b..237d575 100644 --- a/lustre/mdd/mdd_device.c +++ b/lustre/mdd/mdd_device.c @@ -562,7 +562,7 @@ 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)) { + if (!fid_is_norm(f) && !fid_is_igif(f) && !fid_is_root(f)) { 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 0f2556c..c53a864 100644 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -8796,11 +8796,6 @@ dot_lustre_fid_permission_check() { mrename $test_dir/$tdir $MOUNT/.lustre/fid && error "rename to $MOUNT/.lustre/fid should fail." - echo "rename .lustre to itself" - fid=$($LFS path2fid $MOUNT) - mrename $MOUNT/.lustre $MOUNT/.lustre/fid/$fid/.lustre && - error "rename .lustre to itself should fail." - local old_obf_mode=$(stat --format="%a" $DIR/.lustre/fid) local new_obf_mode=777 @@ -11198,6 +11193,13 @@ test_232() { } run_test 232 "failed lock should not block umount" +test_233() { + local fid=$($LFS path2fid $MOUNT) + 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" + # # tests that do cleanup/setup should be run at the end # -- 1.8.3.1