[LTP] [PATCH] nfs_flock: fail the test if lock/unlock ops fail

Petr Vorel pvorel@suse.cz
Thu Jan 13 18:21:08 CET 2022


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);
>  }


More information about the ltp mailing list