dup07:Close the file before unlink it.

When unlink() a file in nfs environment,it will rename the file to a
.nfs<xxxxx> file if any process still has that file open.And this file
could not be deleted until it is closed.So we always get the following
warning which makes testcase "dup07" failed:
0  TWARN  :  tst_rmdir: rmobj(/mnt/nfsv3/ltp-ZtzSE27611/dupKuEr3H)
failed:
unlink(/mnt/nfsv3/ltp-ZtzSE27611/dupKuEr3H/.nfs000000000110cb3800000066)
failed; errno=16: Device or resource busy

Close the created/dup file before unlink() it to fix this issue.

Signed-off-by: Shuang Qiu <shuang.qiu@oracle.com>
Reviewed-by: Jan Stancek <jstancek@redhat.com>
Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
1 file changed