Whamcloud - gitweb
LU-7925 llite: avoid clearing i_nlink for inodes in use
[fs/lustre-release.git] / lustre / tests / sanity.sh
index 9c1770b..21b7f1e 100755 (executable)
@@ -14538,6 +14538,35 @@ test_402() {
 }
 run_test 402 "Return ENOENT to lod_generate_and_set_lovea"
 
+test_403() {
+       local file1=$DIR/$tfile.1
+       local file2=$DIR/$tfile.2
+       local tfile=$TMP/$tfile
+
+       rm -f $file1 $file2 $tfile
+
+       touch $file1
+       ln $file1 $file2
+
+       # 30 sec OBD_TIMEOUT in ll_getattr()
+       # right before populating st_nlink
+       $LCTL set_param fail_loc=0x80001409
+       stat -c %h $file1 > $tfile &
+
+       # create an alias, drop all locks and reclaim the dentry
+       < $file2
+       cancel_lru_locks mdc
+       cancel_lru_locks osc
+       sysctl -w vm.drop_caches=2
+
+       wait
+
+       [ `cat $tfile` -gt 0 ] || error "wrong nlink count: `cat $tfile`"
+
+       rm -f $tfile $file1 $file2
+}
+run_test 403 "i_nlink should not drop to zero due to aliasing"
+
 #
 # tests that do cleanup/setup should be run at the end
 #