aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteve French <stfrench@microsoft.com>2023-06-11 11:23:32 -0500
committerSteve French <stfrench@microsoft.com>2023-06-14 10:15:01 -0500
commitc774e6779f38bf36f0cce65e30793704bab4b0d7 (patch)
treed7c1ae595c14e100bc6ab7d6b53285e80437ed18
parent5e90aa21eb1372736e08cee0c0bf47735c5c4b95 (diff)
downloadlinux-c774e6779f38bf36f0cce65e30793704bab4b0d7.tar.gz
cifs: fix lease break oops in xfstest generic/098
umount can race with lease break so need to check if tcon->ses->server is still valid to send the lease break response. Reviewed-by: Bharath SM <bharathsm@microsoft.com> Reviewed-by: Shyam Prasad N <sprasad@microsoft.com> Fixes: 59a556aebc43 ("SMB3: drop reference to cfile before sending oplock break") Signed-off-by: Steve French <stfrench@microsoft.com>
-rw-r--r--fs/smb/client/file.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/fs/smb/client/file.c b/fs/smb/client/file.c
index df88b8c04d03d..051283386e229 100644
--- a/fs/smb/client/file.c
+++ b/fs/smb/client/file.c
@@ -4942,9 +4942,13 @@ oplock_break_ack:
* disconnected since oplock already released by the server
*/
if (!oplock_break_cancelled) {
- rc = tcon->ses->server->ops->oplock_response(tcon, persistent_fid,
+ /* check for server null since can race with kill_sb calling tree disconnect */
+ if (tcon->ses && tcon->ses->server) {
+ rc = tcon->ses->server->ops->oplock_response(tcon, persistent_fid,
volatile_fid, net_fid, cinode);
- cifs_dbg(FYI, "Oplock release rc = %d\n", rc);
+ cifs_dbg(FYI, "Oplock release rc = %d\n", rc);
+ } else
+ pr_warn_once("lease break not sent for unmounted share\n");
}
cifs_done_oplock_break(cinode);