summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaulo Alcantara <pc@manguebit.com>2025-04-28 11:05:00 -0300
committerSteve French <stfrench@microsoft.com>2025-05-01 13:00:58 -0500
commit07a2cfafe6f1a6adcd6d0c582a5562a6720de7cb (patch)
treefb6b8daba389e0388d2165c9eabeb930ad0434d5
parent62d2e366f280eb1426ae981cf09af8cf64236efb (diff)
downloadlinux-07a2cfafe6f1a6adcd6d0c582a5562a6720de7cb.tar.gz
linux-07a2cfafe6f1a6adcd6d0c582a5562a6720de7cb.tar.bz2
linux-07a2cfafe6f1a6adcd6d0c582a5562a6720de7cb.zip
smb: client: fix delay on concurrent opens
Customers have reported open(2) calls being delayed by 30s or so, and looking through the network traces, it is related to the client not sending lease break acks to the server when a lease is being downgraded from RWH to RW while having an open handle, causing concurrent opens to be delayed and then impacting performance. MS-SMB2 3.2.5.19.2: | If all open handles on this file are closed (that is, File.OpenTable | is empty for this file), the client SHOULD consider it as an implicit | acknowledgment of the lease break. No explicit acknowledgment is | required. Since we hold an active reference of the open file to process the lease break, then we should always send a lease break ack if required by the server. Cc: linux-cifs@vger.kernel.org Cc: David Howells <dhowells@redhat.com> Reported-by: Pierguido Lambri <plambri@redhat.com> Fixes: da787d5b7498 ("SMB3: Do not send lease break acknowledgment if all file handles have been closed") Signed-off-by: Paulo Alcantara (Red Hat) <pc@manguebit.com> Signed-off-by: Steve French <stfrench@microsoft.com>
-rw-r--r--fs/smb/client/file.c13
1 files changed, 3 insertions, 10 deletions
diff --git a/fs/smb/client/file.c b/fs/smb/client/file.c
index 851b74f557c1..c6f523e6ce6f 100644
--- a/fs/smb/client/file.c
+++ b/fs/smb/client/file.c
@@ -3144,19 +3144,12 @@ oplock_break_ack:
oplock_break_cancelled = cfile->oplock_break_cancelled;
_cifsFileInfo_put(cfile, false /* do not wait for ourself */, false);
- /*
- * MS-SMB2 3.2.5.19.1 and 3.2.5.19.2 (and MS-CIFS 3.2.5.42) do not require
- * an acknowledgment to be sent when the file has already been closed.
- */
- spin_lock(&cinode->open_file_lock);
- /* check list empty since can race with kill_sb calling tree disconnect */
- if (!oplock_break_cancelled && !list_empty(&cinode->openFileList)) {
- spin_unlock(&cinode->open_file_lock);
+ /* MS-SMB2 3.2.5.19.1 and 3.2.5.19.2 (and MS-CIFS 3.2.5.42) */
+ if (!oplock_break_cancelled) {
rc = server->ops->oplock_response(tcon, persistent_fid,
volatile_fid, net_fid, cinode);
cifs_dbg(FYI, "Oplock release rc = %d\n", rc);
- } else
- spin_unlock(&cinode->open_file_lock);
+ }
cifs_put_tlink(tlink);
out: