2011-03-09 18:14:02

by Andy Adamson

[permalink] [raw]
Subject: [PATCH Cthon2011 fixes 1/3] NFSv4.1: Retry CREATE_SESSION on NFS4ERR_DELAY

From: Ricardo Labiaga <[email protected]>

Fix bug where we currently retry the EXCHANGEID call again, eventhough
we already have a valid clientid. Instead, delay and retry the CREATE_SESSION
call.

Signed-off-by: Ricardo Labiaga <[email protected]>
---
fs/nfs/nfs4proc.c | 12 +++++++++++-
1 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 36b3c44..8edb1fc 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -5083,10 +5083,20 @@ int nfs4_proc_create_session(struct nfs_client *clp)
int status;
unsigned *ptr;
struct nfs4_session *session = clp->cl_session;
+ long timeout = 0;
+ int err;

dprintk("--> %s clp=%p session=%p\n", __func__, clp, session);

- status = _nfs4_proc_create_session(clp);
+ do {
+ status = _nfs4_proc_create_session(clp);
+ if (status == -NFS4ERR_DELAY) {
+ err = nfs4_delay(clp->cl_rpcclient, &timeout);
+ if (err)
+ status = err;
+ }
+ } while (status == -NFS4ERR_DELAY);
+
if (status)
goto out;

--
1.6.6



2011-03-09 18:14:03

by Andy Adamson

[permalink] [raw]
Subject: [PATCH Cthon2011 fixes 3/3] NFSv4.1 reclaim complete must wait for completion

From: Andy Adamson <[email protected]>

Signed-off-by: Andy Adamson <[email protected]>
---
fs/nfs/nfs4proc.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 8edb1fc..0bce091 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -5435,6 +5435,9 @@ static int nfs41_proc_reclaim_complete(struct nfs_client *clp)
status = PTR_ERR(task);
goto out;
}
+ status = nfs4_wait_for_completion_rpc_task(task);
+ if (status == 0)
+ status = task->tk_status;
rpc_put_task(task);
return 0;
out:
--
1.6.6


2011-03-10 06:55:42

by Benny Halevy

[permalink] [raw]
Subject: Re: [PATCH Cthon2011 fixes 3/3] NFSv4.1 reclaim complete must wait for completion

On 2011-03-09 10:13, [email protected] wrote:
> From: Andy Adamson <[email protected]>
>
> Signed-off-by: Andy Adamson <[email protected]>
> ---
> fs/nfs/nfs4proc.c | 3 +++
> 1 files changed, 3 insertions(+), 0 deletions(-)
>
> diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
> index 8edb1fc..0bce091 100644
> --- a/fs/nfs/nfs4proc.c
> +++ b/fs/nfs/nfs4proc.c
> @@ -5435,6 +5435,9 @@ static int nfs41_proc_reclaim_complete(struct nfs_client *clp)
> status = PTR_ERR(task);
> goto out;
> }
> + status = nfs4_wait_for_completion_rpc_task(task);
> + if (status == 0)
> + status = task->tk_status;

nit: spaces => tabs

Benny

> rpc_put_task(task);
> return 0;
> out:

2011-03-09 18:14:03

by Andy Adamson

[permalink] [raw]
Subject: [PATCH Cthon2011 fixes 2/3] NFSv4: remove duplicate clientid in struct nfs_client

From: Andy Adamson <[email protected]>

Signed-off-by: Andy Adamson <[email protected]>
---
fs/nfs/nfs4xdr.c | 4 ++--
include/linux/nfs_fs_sb.h | 2 --
2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c
index 353ef5d..2221fa2 100644
--- a/fs/nfs/nfs4xdr.c
+++ b/fs/nfs/nfs4xdr.c
@@ -1687,7 +1687,7 @@ static void encode_create_session(struct xdr_stream *xdr,

p = reserve_space(xdr, 20 + 2*28 + 20 + len + 12);
*p++ = cpu_to_be32(OP_CREATE_SESSION);
- p = xdr_encode_hyper(p, clp->cl_ex_clid);
+ p = xdr_encode_hyper(p, clp->cl_clientid);
*p++ = cpu_to_be32(clp->cl_seqid); /*Sequence id */
*p++ = cpu_to_be32(args->flags); /*flags */

@@ -4770,7 +4770,7 @@ static int decode_exchange_id(struct xdr_stream *xdr,
p = xdr_inline_decode(xdr, 8);
if (unlikely(!p))
goto out_overflow;
- xdr_decode_hyper(p, &clp->cl_ex_clid);
+ xdr_decode_hyper(p, &clp->cl_clientid);
p = xdr_inline_decode(xdr, 12);
if (unlikely(!p))
goto out_overflow;
diff --git a/include/linux/nfs_fs_sb.h b/include/linux/nfs_fs_sb.h
index 7f71698..e52f010 100644
--- a/include/linux/nfs_fs_sb.h
+++ b/include/linux/nfs_fs_sb.h
@@ -73,8 +73,6 @@ struct nfs_client {
#endif /* CONFIG_NFS_V4 */

#ifdef CONFIG_NFS_V4_1
- /* clientid returned from EXCHANGE_ID, used by session operations */
- u64 cl_ex_clid;
/* The sequence id to use for the next CREATE_SESSION */
u32 cl_seqid;
/* The flags used for obtaining the clientid during EXCHANGE_ID */
--
1.6.6