Skip to content

Commit 2cb6f96

Browse files
committed
SMB3: force unmount was failing to close deferred close files
In investigating a failure with xfstest generic/392 it was noticed that mounts were reusing a superblock that should already have been freed. This turned out to be related to deferred close files keeping a reference count until the closetimeo expired. Currently the only way an fs knows that mount is beginning is when force unmount is called, but when this, ie umount_begin(), is called all deferred close files on the share (tree connection) should be closed immediately (unless shared by another mount) to avoid using excess resources on the server and to avoid reusing a superblock which should already be freed. In umount_begin, close all deferred close handles for that share if this is the last mount using that share on this client (ie send the SMB3 close request over the wire for those that have been already closed by the app but that we have kept a handle lease open for and have not sent closes to the server for yet). Reported-by: David Howells <[email protected]> Acked-by: Bharath SM <[email protected]> Cc: <[email protected]> Fixes: 78c0963 ("Cifs: Fix kernel oops caused by deferred close for files.") Signed-off-by: Steve French <[email protected]>
1 parent ba8c2b7 commit 2cb6f96

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

fs/cifs/cifsfs.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -744,6 +744,7 @@ static void cifs_umount_begin(struct super_block *sb)
744744
spin_unlock(&tcon->tc_lock);
745745
spin_unlock(&cifs_tcp_ses_lock);
746746

747+
cifs_close_all_deferred_files(tcon);
747748
/* cancel_brl_requests(tcon); */ /* BB mark all brl mids as exiting */
748749
/* cancel_notify_requests(tcon); */
749750
if (tcon->ses && tcon->ses->server) {

0 commit comments

Comments
 (0)