Bash supports file discriptor assignment in this way. So remove the hard
coded numbers. Also close this opened fd in cleanup.
Signed-off-by: Murphy Zhou <xzhou@redhat.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
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>
Regression test case for kernel patchset:
fs/lock: show locks info owned by dead/invisible processes
Open new fd by exec shell built-in, then require exclusive lock
by flock(1) command. Checking /proc/locks for the lock info.
This patchset post by Konstantin Khorenko <khorenko@virtuozzo.com>
has not been merged v4.18-rc8.
[Eryu: require $FLOCK_PROG and add more comments]
Signed-off-by: Xiong Murphy Zhou <xzhou@redhat.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>