Whamcloud - gitweb
LU-4279 mdd: Fixed OBF of the FS .lustre 90/10490/3
authorBruno Faccini <bruno.faccini@intel.com>
Tue, 26 Nov 2013 10:46:07 +0000 (11:46 +0100)
committerOleg Drokin <oleg.drokin@intel.com>
Sun, 1 Jun 2014 06:15:40 +0000 (06:15 +0000)
Added a check to prevent fid access to the filesystem .lustre
directory from returning EINVAL.
Added a sanity check accordingly.

Lustre-change: http://review.whamcloud.com/8360
Lustre-commit: 09c7765939789b0505644f8d220e5be8262c7e06

Signed-off-by: Bruno Faccini <bruno.faccini@intel.com>
Reviewed-by: Fan Yong <fan.yong@intel.com>
Reviewed-by: Sebastien Buisson <sebastien.buisson@bull.net>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Change-Id: I4895648a6e1a99b4e3964ff86fc020ef7b8dc9a4
Reviewed-on: http://review.whamcloud.com/10490
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
lustre/mdd/mdd_device.c
lustre/tests/sanity.sh

index e70cd2a..2c7a2da 100644 (file)
@@ -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),
index 13d47ee..3ba6551 100644 (file)
@@ -11973,7 +11973,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; }
 
@@ -11981,7 +11981,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"