Whamcloud - gitweb
LU-2781 mdt: initialize mti_spec.sp_rm_entry
authorJohn L. Hammond <john.hammond@intel.com>
Tue, 26 Feb 2013 05:08:12 +0000 (23:08 -0600)
committerOleg Drokin <oleg.drokin@intel.com>
Wed, 27 Feb 2013 02:21:35 +0000 (21:21 -0500)
Prevent previous assignments to mti_spec.sp_rm_entry from affecting
the current operation by setting it to 0 in mdt_thread_info_init().

Signed-off-by: John L. Hammond <john.hammond@intel.com>
Change-Id: Iee41cd0e48718338d83b62e0610bd5d23d80dc47
Reviewed-on: http://review.whamcloud.com/5327
Reviewed-by: Niu Yawei <yawei.niu@intel.com>
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Mike Pershin <mike.pershin@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/mdt/mdt_handler.c
lustre/tests/sanityn.sh

index fbdc694..47fedcb 100644 (file)
@@ -3084,6 +3084,7 @@ static void mdt_thread_info_init(struct ptlrpc_request *req,
 
         /* To not check for split by default. */
         info->mti_spec.no_create = 0;
+       info->mti_spec.sp_rm_entry = 0;
 }
 
 static void mdt_thread_info_fini(struct mdt_thread_info *info)
index 269e371..7b91df3 100644 (file)
@@ -2395,7 +2395,7 @@ test_60() {
 }
 run_test 60 "Verify data_version behaviour"
 
-test_70() {
+test_70a() {
        local test_dir=$tdir/test_dir
 
        mkdir -p $DIR1/$tdir
@@ -2411,7 +2411,26 @@ test_70() {
 
        cd $DIR2/$tdir || error "exit directory"
 }
-run_test 70 "cd directory && rm directory"
+run_test 70a "cd directory && rm directory"
+
+test_70b() { # LU-2781
+       local i
+       mkdir -p $DIR1/$tdir
+
+       touch $DIR1/$tdir/file
+       for ((i = 0; i < 32; i++)); do
+           $LFS rm_entry $DIR1/$tdir/non_existent_dir &>/dev/null
+       done
+       rm $DIR1/$tdir/file || error "cannot remove file after rm_entry"
+
+       touch $DIR1/$tdir/file
+       $LFS mkdir -i0 $DIR1/$tdir/test_dir
+       $LFS rm_entry $DIR1/$tdir/test_dir &>/dev/null
+       rm -rf $DIR1/$tdir/test_dir ||
+               error "cannot remove directory after rm_entry"
+       rm $DIR1/$tdir/file || error "cannot remove file after rm_entry"
+}
+run_test 70b "remove files after calling rm_entry"
 
 log "cleanup: ======================================================"