Whamcloud - gitweb
LU-3245 mdd: Fixed OBF of the FS root
authorHenri Doreau <henri.doreau@cea.fr>
Mon, 29 Apr 2013 13:07:42 +0000 (15:07 +0200)
committerOleg Drokin <oleg.drokin@intel.com>
Sun, 5 May 2013 04:58:40 +0000 (00:58 -0400)
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 <henri.doreau@cea.fr>
Signed-off-by: John L. Hammond <john.hammond@intel.com>
Change-Id: Iffb8bdb71377b878d165e9e48049c6b2ebd14859
Reviewed-on: http://review.whamcloud.com/6209
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Alex Zhuravlev <alexey.zhuravlev@intel.com>
Tested-by: Hudson
Reviewed-by: Fan Yong <fan.yong@intel.com>
Tested-by: Maloo <whamcloud.maloo@gmail.com>
lustre/mdd/mdd_device.c
lustre/tests/sanity.sh

index 7b0524b..237d575 100644 (file)
@@ -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),
index 0f2556c..c53a864 100644 (file)
@@ -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
 #