Message ID | 20220112161942.4065665-1-nikita.yushchenko@virtuozzo.com |
---|---|
State | Changes Requested |
Headers | show |
Series | nfs_flock: fail the test if lock/unlock ops fail | expand |
Hi Nikita, [ Cc Alexey ] > Since nfs_flock is testing locking operations, ignoring errors returned > from those operations is nonsense. Makes sense. Reviewed-by: Petr Vorel <pvorel@suse.cz> Kind regards, Petr > Signed-off-by: Nikita Yushchenko <nikita.yushchenko@virtuozzo.com> > --- > testcases/network/nfs/nfslock01/nfs_flock.c | 12 ++++++++---- > 1 file changed, 8 insertions(+), 4 deletions(-) > diff --git a/testcases/network/nfs/nfslock01/nfs_flock.c b/testcases/network/nfs/nfslock01/nfs_flock.c > index a7673c751..a13ddd251 100644 > --- a/testcases/network/nfs/nfslock01/nfs_flock.c > +++ b/testcases/network/nfs/nfslock01/nfs_flock.c > @@ -63,16 +63,20 @@ int main(int argc, char **argv) > continue; > } > - if (writeb_lock(fd, offset, SEEK_SET, BYTES) < 0) > - printf("failed in writeb_lock, Errno = %d", errno); > + if (writeb_lock(fd, offset, SEEK_SET, BYTES) < 0) { > + printf("failed in writeb_lock, Errno = %d\n", errno); > + exit(1); > + } > lseek(fd, offset, SEEK_SET); > /* write to the test file */ > write(fd, buf, BYTES); > - if (unb_lock(fd, offset, SEEK_SET, BYTES) < 0) > - printf("failed in unb_lock, Errno = %d", errno); > + if (unb_lock(fd, offset, SEEK_SET, BYTES) < 0) { > + printf("failed in unb_lock, Errno = %d\n", errno); > + exit(1); > + } > } > exit(0); > }
Hello, On 12. 01. 22 17:19, Nikita Yushchenko via ltp wrote: > Since nfs_flock is testing locking operations, ignoring errors returned > from those operations is nonsense. > > Signed-off-by: Nikita Yushchenko <nikita.yushchenko@virtuozzo.com> > --- > testcases/network/nfs/nfslock01/nfs_flock.c | 12 ++++++++---- > 1 file changed, 8 insertions(+), 4 deletions(-) > > diff --git a/testcases/network/nfs/nfslock01/nfs_flock.c b/testcases/network/nfs/nfslock01/nfs_flock.c > index a7673c751..a13ddd251 100644 > --- a/testcases/network/nfs/nfslock01/nfs_flock.c > +++ b/testcases/network/nfs/nfslock01/nfs_flock.c > @@ -63,16 +63,20 @@ int main(int argc, char **argv) > continue; > } > > - if (writeb_lock(fd, offset, SEEK_SET, BYTES) < 0) > - printf("failed in writeb_lock, Errno = %d", errno); > + if (writeb_lock(fd, offset, SEEK_SET, BYTES) < 0) { > + printf("failed in writeb_lock, Errno = %d\n", errno); > + exit(1); > + } > > lseek(fd, offset, SEEK_SET); > > /* write to the test file */ > write(fd, buf, BYTES); > > - if (unb_lock(fd, offset, SEEK_SET, BYTES) < 0) > - printf("failed in unb_lock, Errno = %d", errno); > + if (unb_lock(fd, offset, SEEK_SET, BYTES) < 0) { > + printf("failed in unb_lock, Errno = %d\n", errno); > + exit(1); > + } > } > exit(0); > } The test program is quite short and simple. Why not rewrite it using the current LTP API and make it even better? Some useful links to help with that: https://github.com/linux-test-project/ltp/wiki/C-Test-Case-Tutorial https://github.com/linux-test-project/ltp/wiki/C-Test-API https://github.com/linux-test-project/ltp/wiki/Test-Writing-Guidelines
Hi Martin, Nikita, > The test program is quite short and simple. Why not rewrite it using the > current LTP API and make it even better? Some useful links to help with > that: +1 It might not make it into this release due git freeze [1], but definitely worth of doing it. Thus I'd accept this patch for upcoming release. Kind regards, Petr > https://github.com/linux-test-project/ltp/wiki/C-Test-Case-Tutorial > https://github.com/linux-test-project/ltp/wiki/C-Test-API > https://github.com/linux-test-project/ltp/wiki/Test-Writing-Guidelines [1] https://lore.kernel.org/ltp/YeFGwLzrR3t%2FVQLq@yuki/
Hi all, > Hi Martin, Nikita, > > The test program is quite short and simple. Why not rewrite it using the > > current LTP API and make it even better? Some useful links to help with > > that: > +1 > It might not make it into this release due git freeze [1], > but definitely worth of doing it. > Thus I'd accept this patch for upcoming release. I'm sorry I completely forgot on this patch. I merged it, because it immediately stops broken test on NFS v3, which would otherwise timeout. The problem itself would deserve debugging. If it's WONFTFIX due rpcbind just not working on netns on NFS v3 [2], we should remove nfslock3t_01 and nfslock3t_ipv6_01 from runtest/net.nfs and disable with TCONF NFS v3 (i.e. -v 3) in nfslock01.sh. I'll try to not forget on posting a RFC patch to linux-nfs ML. Kind regards, Petr [2] https://lore.kernel.org/ltp/3cb5de6e-6f8f-e46a-96bd-a3d88a871f3a@virtuozzo.com/ > Kind regards, > Petr > > https://github.com/linux-test-project/ltp/wiki/C-Test-Case-Tutorial > > https://github.com/linux-test-project/ltp/wiki/C-Test-API > > https://github.com/linux-test-project/ltp/wiki/Test-Writing-Guidelines > [1] https://lore.kernel.org/ltp/YeFGwLzrR3t%2FVQLq@yuki/
diff --git a/testcases/network/nfs/nfslock01/nfs_flock.c b/testcases/network/nfs/nfslock01/nfs_flock.c index a7673c751..a13ddd251 100644 --- a/testcases/network/nfs/nfslock01/nfs_flock.c +++ b/testcases/network/nfs/nfslock01/nfs_flock.c @@ -63,16 +63,20 @@ int main(int argc, char **argv) continue; } - if (writeb_lock(fd, offset, SEEK_SET, BYTES) < 0) - printf("failed in writeb_lock, Errno = %d", errno); + if (writeb_lock(fd, offset, SEEK_SET, BYTES) < 0) { + printf("failed in writeb_lock, Errno = %d\n", errno); + exit(1); + } lseek(fd, offset, SEEK_SET); /* write to the test file */ write(fd, buf, BYTES); - if (unb_lock(fd, offset, SEEK_SET, BYTES) < 0) - printf("failed in unb_lock, Errno = %d", errno); + if (unb_lock(fd, offset, SEEK_SET, BYTES) < 0) { + printf("failed in unb_lock, Errno = %d\n", errno); + exit(1); + } } exit(0); }
Since nfs_flock is testing locking operations, ignoring errors returned from those operations is nonsense. Signed-off-by: Nikita Yushchenko <nikita.yushchenko@virtuozzo.com> --- testcases/network/nfs/nfslock01/nfs_flock.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)