All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bharath SM <bharathsm.hsk@gmail.com>
To: linux-cifs@vger.kernel.org, sfrench@samba.org, pc@manguebit.com,
	sprasad@microsoft.com, tom@talpey.com, ronniesahlberg@gmail.com
Cc: Bharath SM <bharathsm@microsoft.com>
Subject: [PATCH] smb: enable reuse of deferred file handles for write operations
Date: Tue, 17 Dec 2024 00:01:48 +0530	[thread overview]
Message-ID: <20241216183148.4291-1-bharathsm@microsoft.com> (raw)

Previously, deferred file handles were reused only for read
operations, this commit extends to reusing deferred handles
for write operations.

Signed-off-by: Bharath SM <bharathsm@microsoft.com>
---
 fs/smb/client/file.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/fs/smb/client/file.c b/fs/smb/client/file.c
index a58a3333ecc3..98deff1de74c 100644
--- a/fs/smb/client/file.c
+++ b/fs/smb/client/file.c
@@ -990,7 +990,11 @@ int cifs_open(struct inode *inode, struct file *file)
 	}
 
 	/* Get the cached handle as SMB2 close is deferred */
-	rc = cifs_get_readable_path(tcon, full_path, &cfile);
+	if (OPEN_FMODE(file->f_flags) & FMODE_WRITE) {
+		rc = cifs_get_writable_path(tcon, full_path, FIND_WR_ANY, &cfile);
+	} else {
+		rc = cifs_get_readable_path(tcon, full_path, &cfile);
+	}
 	if (rc == 0) {
 		if (file->f_flags == cfile->f_flags) {
 			file->private_data = cfile;
-- 
2.43.0


             reply	other threads:[~2024-12-16 18:32 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-16 18:31 Bharath SM [this message]
2024-12-16 20:43 ` [PATCH] smb: enable reuse of deferred file handles for write operations Steve French
2024-12-19  9:33   ` Shyam Prasad N
2024-12-19 22:47     ` Paul Aurich
2024-12-23  8:12       ` Bharath SM
2024-12-23 18:48         ` Steve French

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241216183148.4291-1-bharathsm@microsoft.com \
    --to=bharathsm.hsk@gmail.com \
    --cc=bharathsm@microsoft.com \
    --cc=linux-cifs@vger.kernel.org \
    --cc=pc@manguebit.com \
    --cc=ronniesahlberg@gmail.com \
    --cc=sfrench@samba.org \
    --cc=sprasad@microsoft.com \
    --cc=tom@talpey.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.