From: Olga Kornievskaia Date: Sun, 18 Jun 2023 21:32:25 +0000 (-0400) Subject: NFSv4.1: freeze the session table upon receiving NFS4ERR_BADSESSION X-Git-Tag: v6.1.39~242 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c2bf8d7b8f025f4f8583daf8e6977ef742452b58;p=platform%2Fkernel%2Flinux-starfive.git NFSv4.1: freeze the session table upon receiving NFS4ERR_BADSESSION [ Upstream commit c907e72f58ed979a24a9fdcadfbc447c51d5e509 ] When the client received NFS4ERR_BADSESSION, it schedules recovery and start the state manager thread which in turn freezes the session table and does not allow for any new requests to use the no-longer valid session. However, it is possible that before the state manager thread runs, a new operation would use the released slot that received BADSESSION and was therefore not updated its sequence number. Such re-use of the slot can lead the application errors. Fixes: 5c441544f045 ("NFSv4.x: Handle bad/dead sessions correctly in nfs41_sequence_process()") Signed-off-by: Olga Kornievskaia Signed-off-by: Trond Myklebust Signed-off-by: Sasha Levin --- diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index 70e7635..177cb7b 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c @@ -921,6 +921,7 @@ out: out_noaction: return ret; session_recover: + set_bit(NFS4_SLOT_TBL_DRAINING, &session->fc_slot_table.slot_tbl_state); nfs4_schedule_session_recovery(session, status); dprintk("%s ERROR: %d Reset session\n", __func__, status); nfs41_sequence_free_slot(res);