Whamcloud - gitweb
LU-3133 lfsck: remove objects from OST
authorEmoly Liu <emoly.liu@intel.com>
Thu, 28 Mar 2013 17:15:23 +0000 (01:15 +0800)
committerOleg Drokin <oleg.drokin@intel.com>
Mon, 29 Apr 2013 22:09:29 +0000 (18:09 -0400)
In lfsck test, remove_objects() should remove objects from OST,
just like remove_files() removes files from MDT.

Test-Parameters: testlist=lfsck
Signed-off-by: Liu Ying <emoly.liu@intel.com>
Change-Id: I826bea7c780de275c1890e920deb3c8e8e942c53
Reviewed-on: http://review.whamcloud.com/5981
Reviewed-by: Niu Yawei <yawei.niu@intel.com>
Tested-by: Hudson
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Tested-by: Maloo <whamcloud.maloo@gmail.com>
lustre/tests/lfsck.sh
lustre/tests/test-framework.sh

index 9e08e0b..88aa5bd 100644 (file)
@@ -161,7 +161,7 @@ get_files() {
     esac
 
     local files=""
-    local f 
+    local f
     for f in $(seq -f testfile.%g $first $last); do
         test_file=$test_dir/$f
         files="$files $test_file"
@@ -172,29 +172,7 @@ get_files() {
 
 # Remove objects associated with files.
 remove_objects() {
-       local ostdev=$1
-       shift
-       local group=$1
-       shift
-       local objids="$@"
-       local facet=ost$((OSTIDX + 1))
-       local mntpt=$(facet_mntpt $facet)
-       local opts=$OST_MOUNT_OPTS
-       local i
-       local rc
-
-       echo "removing objects from $ostdev on $facet: $objids"
-       if ! do_facet $facet test -b $ostdev; then
-               opts=$(csa_add "$opts" -o loop)
-       fi
-       mount -t $(facet_fstype $facet) $opts $ostdev $mntpt ||
-               return $?
-       rc=0;
-       for i in $objids; do
-               rm $mntpt/O/$group/d$((i % 32))/$i || { rc=$?; break; }
-       done
-       umount -f $mntpt || return $?
-       return $rc
+       do_rpc_nodes $1 remove_ost_objects $@
 }
 
 # Remove files from MDS.
@@ -240,7 +218,7 @@ if is_empty_fs $MOUNT; then
 
     # remove objects associated with files in group $OBJGRP
     # on the OST with index $OSTIDX
-    remove_objects $OSTDEV $OBJGRP $OST_REMOVE ||
+       remove_objects $OSTNODE $OSTDEV $OBJGRP $OST_REMOVE ||
         error "removing objects failed"
 
     # remove files from MDS
index ef5d9fa..afc2488 100644 (file)
@@ -5917,6 +5917,34 @@ run_llverfs()
         llverfs $partial_arg $llverfs_opts $dir
 }
 
+#Remove objects from OST
+remove_ost_objects() {
+       shift
+       local ostdev=$1
+       local group=$2
+       shift 2
+       local objids="$@"
+       local facet=ost$((OSTIDX + 1))
+       local mntpt=$(facet_mntpt $facet)
+       local opts=$OST_MOUNT_OPTS
+       local i
+       local rc
+
+       echo "removing objects from $ostdev on $facet: $objids"
+       if ! do_facet $facet test -b $ostdev; then
+               opts=$(csa_add "$opts" -o loop)
+       fi
+       mount -t $(facet_fstype $facet) $opts $ostdev $mntpt ||
+               return $?
+       rc=0;
+       for i in $objids; do
+               rm $mntpt/O/$group/d$((i % 32))/$i || { rc=$?; break; }
+       done
+       umount -f $mntpt || return $?
+       return $rc
+}
+
+#Remove files from MDT
 remove_mdt_files() {
        local facet=$1
        local mdtdev=$2