<div dir="ltr"><div dir="ltr"><div class="gmail_default" style="font-size:small"><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Jun 10, 2022 at 5:44 AM Petr Vorel <<a href="mailto:pvorel@suse.cz">pvorel@suse.cz</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Signed-off-by: Petr Vorel <<a href="mailto:pvorel@suse.cz" target="_blank">pvorel@suse.cz</a>><br>
---<br>
Hi NFS developers,<br>
<br>
your comments are welcome. This is an effort how to support NFS tests on<br>
all filesystems available on SUT. Using $TST_MNTPOINT means test run in<br>
loop, each time different filesystem is used. It's implemented via<br>
formatted loop device (the same way as in LTP C API).<br>
<br>
Code is also at: <a href="https://github.com/pevik/ltp/tree/shell/all_filesystems.v2" rel="noreferrer" target="_blank">https://github.com/pevik/ltp/tree/shell/all_filesystems.v2</a><br>
<br>
But this requires restarting NFS server (otherwise legacy testcases/lib/daemonlib.sh<br>
would have to be used), which is IMHO not optimal.<br>
<br>
Without that (or only run 'systemctl reload nfs-server' or exportfs -r<br>
on remote side) it cannot be umounted after testing - debugging with<br>
fuser, code at:<br>
<a href="https://github.com/pevik/ltp/commit/3656d035d43445a107154ef397ef1db2fad2c4f0" rel="noreferrer" target="_blank">https://github.com/pevik/ltp/commit/3656d035d43445a107154ef397ef1db2fad2c4f0</a><br>
<br>
The problem is that loop device is still referenced by nfs server and<br>
thus cannot be unmounted. Can this be somehow fixed? Is it even wanted<br>
to have tests on loop device (the only reasonable way to support more<br>
filesystems)? Also tests will run much longer (we could filter out some<br>
filesystems not supported, if there are any).<br>
<br>
# LTP_SINGLE_FS_TYPE=ext2 PATH="/opt/ltp/testcases/bin:$PATH" nfs07.sh -v 3 -t tcp -i3<br>
## NOTE: testing itself is OK<br>
nfs07 1 TINFO: initialize 'lhost' 'ltp_ns_veth2' interface<br>
nfs07 1 TINFO: add local addr <a href="http://10.0.0.2/24" rel="noreferrer" target="_blank">10.0.0.2/24</a><br>
nfs07 1 TINFO: add local addr fd00:1:1:1::2/64<br>
nfs07 1 TINFO: initialize 'rhost' 'ltp_ns_veth1' interface<br>
nfs07 1 TINFO: add remote addr <a href="http://10.0.0.1/24" rel="noreferrer" target="_blank">10.0.0.1/24</a><br>
nfs07 1 TINFO: add remote addr fd00:1:1:1::1/64<br>
nfs07 1 TINFO: Network config (local -- remote):<br>
nfs07 1 TINFO: ltp_ns_veth2 -- ltp_ns_veth1<br>
nfs07 1 TINFO: <a href="http://10.0.0.2/24" rel="noreferrer" target="_blank">10.0.0.2/24</a> -- <a href="http://10.0.0.1/24" rel="noreferrer" target="_blank">10.0.0.1/24</a><br>
nfs07 1 TINFO: fd00:1:1:1::2/64 -- fd00:1:1:1::1/64<br>
tst_device.c:89: TINFO: Found free device 0 '/dev/loop0'<br>
tst_supported_fs_types.c:148: TINFO: WARNING: testing only ext2<br>
tst_supported_fs_types.c:89: TINFO: Kernel supports ext2<br>
tst_supported_fs_types.c:51: TINFO: mkfs.ext2 does exist<br>
nfs07 1 TINFO: Testing on ext2<br>
nfs07 1 TINFO: Formatting ext2 with opts='/dev/loop0'<br>
nfs07 1 TINFO: timeout per run is 0h 5m 0s<br>
nfs07 1 TINFO: mount.nfs: (linux nfs-utils 2.6.1)<br>
nfs07 1 TINFO: setup NFSv3, socket type tcp<br>
nfs07 1 TINFO: Mounting NFS: mount -v -t nfs -o proto=tcp,vers=3 10.0.0.2:/tmp/LTP_nfs07.A3PIB82iUv/mntpoint/3/tcp /tmp/LTP_nfs07.A3PIB82iUv/mntpoint/3/0<br>
nfs07 1 TPASS: All files and directories were correctly listed<br>
nfs07 2 TPASS: All files and directories were correctly listed<br>
nfs07 3 TPASS: All files and directories were correctly listed<br>
nfs07 4 TINFO: Cleaning up testcase<br>
<br>
## DEBUGGING CODE in nfs_cleanup()<br>
nfs07 4 TINFO: fuser -mv /tmp/LTP_nfs07.P1XS9smc5w ($TST_TMPDIR)<br>
USER PID ACCESS COMMAND<br>
/tmp/LTP_nfs07.P1XS9smc5w:<br>
root kernel mount /tmp<br>
root 2125 ..c.. tst_timeout_kil<br>
nfs07 4 TINFO: fuser -mv /tmp/LTP_nfs07.P1XS9smc5w/mntpoint ($TST_MNTPOINT)<br>
USER PID ACCESS COMMAND<br>
/tmp/LTP_nfs07.P1XS9smc5w/mntpoint:<br>
root kernel mount /tmp/LTP_nfs07.P1XS9smc5w/mntpoint<br>
nfs07 4 TINFO: fuser -mv /tmp/LTP_nfs07.P1XS9smc5w/mntpoint/3/0<br>
USER PID ACCESS COMMAND<br>
/tmp/LTP_nfs07.P1XS9smc5w/mntpoint/3/0:<br>
root kernel mount /tmp/LTP_nfs07.P1XS9smc5w/mntpoint/3/0<br>
<br>
## from nfs_cleanup()<br>
## grep -q "$local_dir" /proc/mounts && umount $local_dir<br>
nfs07 4 TINFO: umount /tmp/LTP_nfs07.P1XS9smc5w/mntpoint/3/0<br>
umount: /tmp/LTP_nfs07.P1XS9smc5w/mntpoint: target is busy.<br></blockquote><div><br></div><div><div class="gmail_default" style="font-size:small"><span class="gmail_default"></span>Maybe try with `umount -fl`?</div></div><div><br></div><div><div class="gmail_default" style="font-size:small">unmount manual says:</div></div><div><div class="gmail_default" style="font-size:small"> -f, --force force unmount (in case of an unreachable NFS system)</div><div class="gmail_default" style="font-size:small"> -l, --lazy detach the filesystem now, clean up things later<br></div><div class="gmail_default" style="font-size:small"></div></div></div><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div>Regards,<br></div><div>Li Wang<br></div></div></div></div>