2015-06-04 15:14:40

by Dominique Martinet

[permalink] [raw]
Subject: [PATCH] NFSv4: handle nfs4_get_referral failure

nfs4_proc_lookup_common is supposed to return a posix error, we have to
handle any error returned that isn't errno

Reported-by: Olga Kornievskaia <[email protected]>
Signed-off-by: Frank S. Filz <[email protected]>
Signed-off-by: Dominique Martinet <[email protected]>
---

Other way of fixing it would be to return something like -EIO directly
in nfs4_get_referral, but I believe handling exception is the right
thing to do.
Only other return code atm is -ENOMEM which probably isn't recoverable?

fs/nfs/nfs4proc.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 627f37c..e7fbf24 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -3356,6 +3356,8 @@ static int nfs4_proc_lookup_common(struct rpc_clnt **clnt, struct inode *dir,
goto out;
case -NFS4ERR_MOVED:
err = nfs4_get_referral(client, dir, name, fattr, fhandle);
+ if (err == -NFS4ERR_MOVED)
+ err = nfs4_handle_exception(NFS_SERVER(dir), err, &exception);
goto out;
case -NFS4ERR_WRONGSEC:
err = -EPERM;
--
2.4.2


2015-06-04 15:13:27

by Frank Filz

[permalink] [raw]
Subject: RE: [PATCH] NFSv4: handle nfs4_get_referral failure

More detail on this,

Basically what is going on is that a migration event has been detected in
nfs4_get_referral, but the migration recovery is not actually initiated.

We tripped over this because Ganesha intends to support referrals, but the
implementation is incomplete (not all FSALs support referrals, and we don't
necessarily change the fsid) and thus Ganesha's returning an NFS4ERR_MOVED
winds up looking like a migration event to the client (of course we don't
support migration either).

Thanks

Frank

> -----Original Message-----
> From: Dominique Martinet [mailto:[email protected]]
> Sent: Thursday, June 4, 2015 11:04 AM
> To: [email protected]; Anna Schumaker; Trond Myklebust
> Cc: [email protected]; Dominique Martinet; Frank S. Filz
> Subject: [PATCH] NFSv4: handle nfs4_get_referral failure
>
> nfs4_proc_lookup_common is supposed to return a posix error, we have to
> handle any error returned that isn't errno
>
> Reported-by: Olga Kornievskaia <[email protected]>
> Signed-off-by: Frank S. Filz <[email protected]>
> Signed-off-by: Dominique Martinet <[email protected]>
> ---
>
> Other way of fixing it would be to return something like -EIO directly in
> nfs4_get_referral, but I believe handling exception is the right thing to
do.
> Only other return code atm is -ENOMEM which probably isn't recoverable?
>
> fs/nfs/nfs4proc.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index 627f37c..e7fbf24
> 100644
> --- a/fs/nfs/nfs4proc.c
> +++ b/fs/nfs/nfs4proc.c
> @@ -3356,6 +3356,8 @@ static int nfs4_proc_lookup_common(struct
> rpc_clnt **clnt, struct inode *dir,
> goto out;
> case -NFS4ERR_MOVED:
> err = nfs4_get_referral(client, dir, name, fattr,
> fhandle);
> + if (err == -NFS4ERR_MOVED)
> + err =
> nfs4_handle_exception(NFS_SERVER(dir), err, &exception);
> goto out;
> case -NFS4ERR_WRONGSEC:
> err = -EPERM;
> --
> 2.4.2