generic/504: Check inode number accurately
authorXiao Yang <yangx.jy@cn.fujitsu.com>
Mon, 3 Sep 2018 09:36:20 +0000 (17:36 +0800)
committerEryu Guan <guaneryu@gmail.com>
Sun, 9 Sep 2018 14:16:05 +0000 (22:16 +0800)
If inode number is equal to the line number of locks which is
first column in /proc/locks, generic/504 will match wrong number
and get PASS. For example:
-----------------------------------------------------------
inode 12
...
12: FLOCK  ADVISORY  WRITE 1615 00:2e:37889 0 EOF
-----------------------------------------------------------

We should match correct inode number by six column in /proc/locks.

Signed-off-by: Xiao Yang <yangx.jy@cn.fujitsu.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
tests/generic/504

index c7d015db08e83206a4a4cb93d1a10bc36a23acd1..21d8605136c0170abf44dc6064ff6507bc8e2540 100755 (executable)
@@ -51,7 +51,7 @@ flock -x 9
 cat /proc/locks >> $seqres.full
 
 # Checking
-grep -qw $tf_inode /proc/locks || echo "lock info not found"
+grep -q ":$tf_inode " /proc/locks || echo "lock info not found"
 
 # success, all done
 status=0