Whamcloud - gitweb
LU-946 lprocfs: List open files in filesystem
[fs/lustre-release.git] / lustre / tests / sanity.sh
index e2e2b96..b9f8686 100644 (file)
@@ -9189,6 +9189,39 @@ test_154c() {
 }
 run_test 154c "lfs path2fid and fid2path multiple arguments"
 
 }
 run_test 154c "lfs path2fid and fid2path multiple arguments"
 
+test_154d() {
+       [[ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.5.53) ]] &&
+               skip "Need MDS version at least 2.5.53" && return
+
+       if remote_mds; then
+               nid=$($LCTL list_nids | sed  "s/\./\\\./g")
+       else
+               nid="0@lo"
+       fi
+       local proc_ofile="mdt.*.exports.'$nid'.open_files"
+       local fd
+       local cmd
+
+       rm -f $DIR/$tfile
+       touch $DIR/$tfile
+
+       fid=$($LFS path2fid $DIR/$tfile)
+       # Open the file
+       fd=$(free_fd)
+       cmd="exec $fd<$DIR/$tfile"
+       eval $cmd
+       fid_list=$(do_facet $SINGLEMDS $LCTL get_param $proc_ofile)
+       echo $fid_list | grep $fid
+       rc=$?
+
+       cmd="exec $fd>/dev/null"
+       eval $cmd
+       if [ $rc -ne 0 ]; then
+               error "FID $fid not found in open files list $fid_list"
+       fi
+}
+run_test 154d "Verify open file fid"
+
 test_155_small_load() {
     local temp=$TMP/$tfile
     local file=$DIR/$tfile
 test_155_small_load() {
     local temp=$TMP/$tfile
     local file=$DIR/$tfile