Skip to content

Commit 9e31678

Browse files
bharathsm-msSteve French
authored andcommitted
SMB3: fix lease break timeout when multiple deferred close handles for the same file.
Solution is to send lease break ack immediately even in case of deferred close handles to avoid lease break request timing out and let deferred closed handle gets closed as scheduled. Later patches could optimize cases where we then close some of these handles sooner for the cases where lease break is to 'none' Cc: [email protected] Signed-off-by: Bharath SM <[email protected]> Signed-off-by: Steve French <[email protected]>
1 parent 5efdd91 commit 9e31678

File tree

1 file changed

+1
-19
lines changed

1 file changed

+1
-19
lines changed

fs/cifs/file.c

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5061,8 +5061,6 @@ void cifs_oplock_break(struct work_struct *work)
50615061
struct TCP_Server_Info *server = tcon->ses->server;
50625062
int rc = 0;
50635063
bool purge_cache = false;
5064-
bool is_deferred = false;
5065-
struct cifs_deferred_close *dclose;
50665064

50675065
wait_on_bit(&cinode->flags, CIFS_INODE_PENDING_WRITERS,
50685066
TASK_UNINTERRUPTIBLE);
@@ -5098,22 +5096,6 @@ void cifs_oplock_break(struct work_struct *work)
50985096
cifs_dbg(VFS, "Push locks rc = %d\n", rc);
50995097

51005098
oplock_break_ack:
5101-
/*
5102-
* When oplock break is received and there are no active
5103-
* file handles but cached, then schedule deferred close immediately.
5104-
* So, new open will not use cached handle.
5105-
*/
5106-
spin_lock(&CIFS_I(inode)->deferred_lock);
5107-
is_deferred = cifs_is_deferred_close(cfile, &dclose);
5108-
spin_unlock(&CIFS_I(inode)->deferred_lock);
5109-
if (is_deferred &&
5110-
cfile->deferred_close_scheduled &&
5111-
delayed_work_pending(&cfile->deferred)) {
5112-
if (cancel_delayed_work(&cfile->deferred)) {
5113-
_cifsFileInfo_put(cfile, false, false);
5114-
goto oplock_break_done;
5115-
}
5116-
}
51175099
/*
51185100
* releasing stale oplock after recent reconnect of smb session using
51195101
* a now incorrect file handle is not a data integrity issue but do
@@ -5125,7 +5107,7 @@ void cifs_oplock_break(struct work_struct *work)
51255107
cinode);
51265108
cifs_dbg(FYI, "Oplock release rc = %d\n", rc);
51275109
}
5128-
oplock_break_done:
5110+
51295111
_cifsFileInfo_put(cfile, false /* do not wait for ourself */, false);
51305112
cifs_done_oplock_break(cinode);
51315113
}

0 commit comments

Comments
 (0)