From fd2cbdeaba1fbc56dbd394c0b232399d256f154e Mon Sep 17 00:00:00 2001 From: Jeff Layton Date: Tue, 17 May 2016 07:05:21 -0400 Subject: [PATCH] pnfs: rework LAYOUTGET error handling IS_ERR can't handle errors in the range of -NFS4ERR_* error codes. Signed-off-by: Jeff Layton --- fs/nfs/nfs4proc.c | 12 +++++++----- fs/nfs/pnfs.c | 4 ++-- include/linux/errno.h | 1 + 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index 1254ed84c760..c2583ca6c8b6 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c @@ -7884,8 +7884,12 @@ nfs4_layoutget_handle_exception(struct rpc_task *task, status = -EOVERFLOW; goto out; } - status = -NFS4ERR_RECALLCONFLICT; - break; + /* Fallthrough */ + case -NFS4ERR_RECALLCONFLICT: + nfs4_handle_exception(server, -NFS4ERR_RECALLCONFLICT, + exception); + status = -ERECALLCONFLICT; + goto out; case -NFS4ERR_EXPIRED: case -NFS4ERR_BAD_STATEID: exception->timeout = 0; @@ -7917,9 +7921,7 @@ nfs4_layoutget_handle_exception(struct rpc_task *task, } status = nfs4_handle_exception(server, status, exception); - if (status == 0) - status = task->tk_status; - if (exception->retry && status != -NFS4ERR_RECALLCONFLICT) + if (exception->retry) status = -EAGAIN; out: dprintk("<-- %s\n", __func__); diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c index 13e1b57b22bf..deb609c9cd8a 100644 --- a/fs/nfs/pnfs.c +++ b/fs/nfs/pnfs.c @@ -1633,9 +1633,9 @@ lookup_again: lseg = send_layoutget(lo, ctx, &stateid, &arg, &timeout, gfp_flags); trace_pnfs_update_layout(ino, pos, count, iomode, lo, lseg, PNFS_UPDATE_LAYOUT_SEND_LAYOUTGET); - if (IS_ERR_OR_NULL(lseg)) { + if (IS_ERR(lseg)) { switch(PTR_ERR(lseg)) { - case -NFS4ERR_RECALLCONFLICT: + case -ERECALLCONFLICT: if (time_after(jiffies, giveup)) lseg = NULL; /* Fallthrough */ diff --git a/include/linux/errno.h b/include/linux/errno.h index 89627b9187f9..7ce9fb1b7d28 100644 --- a/include/linux/errno.h +++ b/include/linux/errno.h @@ -28,5 +28,6 @@ #define EBADTYPE 527 /* Type not supported by server */ #define EJUKEBOX 528 /* Request initiated, but will not complete before timeout */ #define EIOCBQUEUED 529 /* iocb queued, will get completion event */ +#define ERECALLCONFLICT 530 /* conflict with recalled state */ #endif -- 2.5.5