[LTP] [PATCH] nfs_lib.sh: run exportfs at "server side" in LTP_NETNS case

Petr Vorel pvorel@suse.cz
Thu Jan 13 16:50:30 CET 2022


Hi Nikita,

[ Cc Alexey ]

> In LTP_NETNS case, nfs server is the root namespace and nfs client is
> the ltp namespace.

> Then, exportfs shall be executed locally, without tst_rhost_run.

> Otherwise, things implicitly depend on /var/lib/nfs being the same in
> the root namespace and the ltp namespace.
Not sure if I understand your use case. Do you run rpc.statd (or what is using
/var/lib/nfs) in non-default net namespace?

> Signed-off-by: Nikita Yushchenko <nikita.yushchenko@virtuozzo.com>
> ---
>  testcases/network/nfs/nfs_stress/nfs_lib.sh | 10 ++++++++--
>  1 file changed, 8 insertions(+), 2 deletions(-)

> diff --git a/testcases/network/nfs/nfs_stress/nfs_lib.sh b/testcases/network/nfs/nfs_stress/nfs_lib.sh
> index b01215136..b50ccf196 100644
> --- a/testcases/network/nfs/nfs_stress/nfs_lib.sh
> +++ b/testcases/network/nfs/nfs_stress/nfs_lib.sh
> @@ -81,8 +81,14 @@ nfs_setup_server()
>  {
>  	local export_cmd="exportfs -i -o fsid=$$,no_root_squash,rw *:$remote_dir"

> -	if ! tst_rhost_run -c "test -d $remote_dir"; then
> -		tst_rhost_run -s -c "mkdir -p $remote_dir; $export_cmd"
> +	if [ -n "$LTP_NETNS" ]; then
Please use tst_net_use_netns (as in the patch I Cc you just now).

Shouldn't be also $LTP_NFS_NETNS_USE_LO considered?

Kind regards,
Petr

> +		if ! test -d $remote_dir; then
> +			mkdir -p $remote_dir; $export_cmd
> +		fi
> +	else
> +		if ! tst_rhost_run -c "test -d $remote_dir"; then
> +			tst_rhost_run -s -c "mkdir -p $remote_dir; $export_cmd"
> +		fi
>  	fi
>  }


More information about the ltp mailing list