public inbox for linux-cifs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] smb: client: fix delay on concurrent opens
@ 2025-04-28 14:05 Paulo Alcantara
  2025-04-28 14:40 ` Steve French
  2025-04-30 14:15 ` Steve French
  0 siblings, 2 replies; 14+ messages in thread
From: Paulo Alcantara @ 2025-04-28 14:05 UTC (permalink / raw)
  To: smfrench
  Cc: linux-cifs, David Howells, Pierguido Lambri,
	Paulo Alcantara (Red Hat)

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>
---
 fs/smb/client/file.c | 13 +++----------
 1 file changed, 3 insertions(+), 10 deletions(-)

diff --git a/fs/smb/client/file.c b/fs/smb/client/file.c
index 9e8f404b9e56..be9a07f2e8c6 100644
--- a/fs/smb/client/file.c
+++ b/fs/smb/client/file.c
@@ -3146,19 +3146,12 @@ void cifs_oplock_break(struct work_struct *work)
 	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:
-- 
2.49.0


^ permalink raw reply related	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2025-05-12 22:57 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-28 14:05 [PATCH] smb: client: fix delay on concurrent opens Paulo Alcantara
2025-04-28 14:40 ` Steve French
2025-04-28 14:44   ` Paulo Alcantara
2025-04-30 14:15 ` Steve French
2025-04-30 19:14   ` Paulo Alcantara
     [not found]     ` <CAH2r5mu74CbSKRVi0P7LD57j3t=KxqLX_M6V+qvi-aRE2t9YTw@mail.gmail.com>
2025-04-30 19:44       ` Paulo Alcantara
2025-05-05 10:41     ` Bharath SM
2025-05-05 13:12       ` Paulo Alcantara
2025-05-05 14:16         ` Bharath SM
2025-05-05 15:05           ` Paulo Alcantara
2025-05-09 11:22             ` Shyam Prasad N
2025-05-12 13:31               ` Paulo Alcantara
2025-05-12 22:47                 ` Steve French
2025-05-12 22:57                   ` Paulo Alcantara

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox