Skip to content

Commit d180891

Browse files
Trond Myklebustamschuma-ntap
authored andcommitted
SUNRPC: Don't change task->tk_status after the call to rpc_exit_task
Some calls to rpc_exit_task() may deliberately change the value of task->tk_status, for instance because it gets checked by the RPC call's rpc_release() callback. That makes it wrong to reset the value to task->tk_rpc_status. In particular this causes a bug where the rpc_call_done() callback tries to fail over a set of pNFS/flexfiles writes to a different IP address, but the reset of task->tk_status causes nfs_commit_release_pages() to immediately mark the file as having a fatal error. Fixes: 3949419 ("SUNRPC: Fix races with rpc_killall_tasks()") Cc: stable@vger.kernel.org # 6.1.x Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com> Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
1 parent 4b71e24 commit d180891

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

net/sunrpc/sched.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -927,11 +927,10 @@ static void __rpc_execute(struct rpc_task *task)
927927
*/
928928
do_action = task->tk_action;
929929
/* Tasks with an RPC error status should exit */
930-
if (do_action != rpc_exit_task &&
930+
if (do_action && do_action != rpc_exit_task &&
931931
(status = READ_ONCE(task->tk_rpc_status)) != 0) {
932932
task->tk_status = status;
933-
if (do_action != NULL)
934-
do_action = rpc_exit_task;
933+
do_action = rpc_exit_task;
935934
}
936935
/* Callbacks override all actions */
937936
if (task->tk_callback) {

0 commit comments

Comments
 (0)