Whamcloud - gitweb
LU-260 Add open-unlinked dir regression test case.
[fs/lustre-release.git] / lustre / tests / sanity.sh
index 107035b..bd56ac5 100644 (file)
@@ -6849,8 +6849,17 @@ test_155_load() {
     local list=$(comma_list $(osts_nodes))
     local big=$(do_nodes $list grep "cache" /proc/cpuinfo | \
         awk '{sum+=$4} END{print sum}')
+    local min_avail=$(lctl get_param -n osc.*[oO][sS][cC]-[^M]*.kbytesavail | \
+        sort -n | head -1)
+    local large_file_size=$((big * 2))
 
-    log big is $big K
+    log "cache size on OSS is $big KB"
+    log "large file size is $large_file_size KB"
+    log "min available OST size is $min_avail KB"
+
+    [ $min_avail -le $large_file_size ] && \
+        skip "the minimum available OST size needs > $large_file_size KB" && \
+        return 0
 
     dd if=/dev/urandom of=$temp bs=6096 count=1 || \
         error "dd of=$temp bs=6096 count=1 failed"
@@ -6870,14 +6879,14 @@ test_155_load() {
     echo "12345" >>$file
     cmp $temp $file || error "$temp $file differ (append2)"
 
-    dd if=/dev/urandom of=$temp bs=$((big*2)) count=1k || \
-        error "dd of=$temp bs=$((big*2)) count=1k failed"
+    dd if=/dev/urandom of=$temp bs=$large_file_size count=1k || \
+        error "dd of=$temp bs=$large_file_size count=1k failed"
     cp $temp $file
     ls -lh $temp $file
     cancel_lru_locks osc
     cmp $temp $file || error "$temp $file differ"
 
-    rm -f $temp
+    rm -f $temp $file
     true
 }
 
@@ -7411,6 +7420,25 @@ test_180b() {
 }
 run_test 180b "test obdecho directly on obdfilter"
 
+test_181() { # bug 22177
+       mkdir -p $DIR/$tdir || error "creating dir $DIR/$tdir"
+       # create enough files to index the directory
+       createmany -o $DIR/$tdir/foobar 4000
+       # print attributes for debug purpose
+       lsattr -d .
+       # open dir
+       multiop_bg_pause $DIR/$tdir D_Sc || return 1
+       MULTIPID=$!
+       # remove the files & current working dir
+       unlinkmany $DIR/$tdir/foobar 4000
+       rmdir $DIR/$tdir
+       kill -USR1 $MULTIPID
+       wait $MULTIPID
+       stat $DIR/$tdir && error "open-unlinked dir was not removed!"
+       return 0
+}
+run_test 181 "Test open-unlinked dir ========================"
+
 # OST pools tests
 POOL=${POOL:-cea1}
 TGT_COUNT=$OSTCOUNT