Skip to content

Commit 04cf7f7

Browse files
Trond Myklebustgregkh
authored andcommitted
NFSv4.1: Fix layoutcommit error handling
commit e59d27e upstream. Firstly, task->tk_status will always return negative error values, so the current tests for 'NFS4ERR_DELEG_REVOKED' etc. are all being ignored. Secondly, clean up the code so that we only need to test task->tk_status once! Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent e5267d1 commit 04cf7f7

1 file changed

Lines changed: 13 additions & 12 deletions

File tree

‎fs/nfs/nfs4proc.c‎

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5983,21 +5983,22 @@ nfs4_layoutcommit_done(struct rpc_task *task, void *calldata)
59835983
return;
59845984

59855985
switch (task->tk_status) { /* Just ignore these failures */
5986-
case NFS4ERR_DELEG_REVOKED: /* layout was recalled */
5987-
case NFS4ERR_BADIOMODE: /* no IOMODE_RW layout for range */
5988-
case NFS4ERR_BADLAYOUT: /* no layout */
5989-
case NFS4ERR_GRACE: /* loca_recalim always false */
5986+
case -NFS4ERR_DELEG_REVOKED: /* layout was recalled */
5987+
case -NFS4ERR_BADIOMODE: /* no IOMODE_RW layout for range */
5988+
case -NFS4ERR_BADLAYOUT: /* no layout */
5989+
case -NFS4ERR_GRACE: /* loca_recalim always false */
59905990
task->tk_status = 0;
5991-
}
5992-
5993-
if (nfs4_async_handle_error(task, server, NULL) == -EAGAIN) {
5994-
rpc_restart_call_prepare(task);
5995-
return;
5996-
}
5997-
5998-
if (task->tk_status == 0)
5991+
break;
5992+
case 0:
59995993
nfs_post_op_update_inode_force_wcc(data->args.inode,
60005994
data->res.fattr);
5995+
break;
5996+
default:
5997+
if (nfs4_async_handle_error(task, server, NULL) == -EAGAIN) {
5998+
rpc_restart_call_prepare(task);
5999+
return;
6000+
}
6001+
}
60016002
}
60026003

60036004
static void nfs4_layoutcommit_release(void *calldata)

0 commit comments

Comments
 (0)