Whamcloud - gitweb
LU-4279 mdd: Fixed OBF of the FS .lustre 60/8360/3
authorBruno Faccini <bruno.faccini@intel.com>
Tue, 26 Nov 2013 10:46:07 +0000 (11:46 +0100)
committerOleg Drokin <oleg.drokin@intel.com>
Mon, 2 Dec 2013 13:27:45 +0000 (13:27 +0000)
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 <bruno.faccini@intel.com>
Change-Id: I3002e8dd1b834a0b6b87fe707e12573c2accb58c
Reviewed-on: http://review.whamcloud.com/8360
Reviewed-by: Fan Yong <fan.yong@intel.com>
Reviewed-by: Sebastien Buisson <sebastien.buisson@bull.net>
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/mdd/mdd_device.c
lustre/tests/sanity.sh

index 0f53539..adb0fdc 100644 (file)
@@ -564,7 +564,8 @@ static int obf_lookup(const struct lu_env *env, struct md_object *p,
                 GOTO(out, rc = -EINVAL);
         }
 
                 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),
                CWARN("%s: "DFID" is invalid, sequence should be "
                      ">= "LPX64" or within ["LPX64","LPX64"].\n",
                      mdd2obd_dev(mdd)->obd_name, PFID(f),
index 306157f..97fed43 100644 (file)
@@ -11799,7 +11799,7 @@ test_232() {
 }
 run_test 232 "failed lock should not block umount"
 
 }
 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; }
 
        [ $(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'"
 }
        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"
 
 test_234() {
        local p="$TMP/sanityN-$TESTNAME.parameters"