Skip to content

Commit c774e67

Browse files
committed
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: 59a556a ("SMB3: drop reference to cfile before sending oplock break") Signed-off-by: Steve French <stfrench@microsoft.com>
1 parent 5e90aa2 commit c774e67

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

fs/smb/client/file.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4942,9 +4942,13 @@ void cifs_oplock_break(struct work_struct *work)
49424942
* disconnected since oplock already released by the server
49434943
*/
49444944
if (!oplock_break_cancelled) {
4945-
rc = tcon->ses->server->ops->oplock_response(tcon, persistent_fid,
4945+
/* check for server null since can race with kill_sb calling tree disconnect */
4946+
if (tcon->ses && tcon->ses->server) {
4947+
rc = tcon->ses->server->ops->oplock_response(tcon, persistent_fid,
49464948
volatile_fid, net_fid, cinode);
4947-
cifs_dbg(FYI, "Oplock release rc = %d\n", rc);
4949+
cifs_dbg(FYI, "Oplock release rc = %d\n", rc);
4950+
} else
4951+
pr_warn_once("lease break not sent for unmounted share\n");
49484952
}
49494953

49504954
cifs_done_oplock_break(cinode);

0 commit comments

Comments
 (0)