Linux CIFS filesystem development
 help / color / mirror / Atom feed
From: Paulo Alcantara <pc@manguebit.org>
To: linux-cifs@vger.kernel.org
Cc: David Howells <dhowells@redhat.com>,
	Namjae Jeon <linkinjeon@kernel.org>,
	Ronnie Sahlberg <ronniesahlberg@gmail.com>,
	Shyam Prasad N <sprasad@microsoft.com>,
	Tom Talpey <tom@talpey.com>, Bharath SM <bharathsm@microsoft.com>,
	stable@vger.kernel.org
Subject: [PATCH v2 2/2] smb: client: flush deferred handles of other names before a hard link open
Date: Wed, 11 Nov 2026 10:53:24 -0300	[thread overview]
Message-ID: <20261111135324.4028153-2-pc@manguebit.org> (raw)
In-Reply-To: <20261111135324.4028153-1-pc@manguebit.org>

cifs_open() flushes an inode's deferred closes before opening a different
name (hard link) of it, so the open can take a fresh lease rather than be
reissued without one (see "smb: client: retry a hard link open without a
lease").  cifs_get_hardlink_path() only triggered that flush when a cached
handle had the same open flags as the new open, so a differently accessed
name - written then read, say - skipped it and opened without a lease.

Match on the name instead: flush when a cached handle for another name of
the inode is open, so those opens keep lease caching too.

Fixes: 262b73ef442e ("smb3 client: fix open hardlink on deferred close file error")
Cc: stable@vger.kernel.org
Reviewed-by: Namjae Jeon <linkinjeon@kernel.org>
Signed-off-by: Paulo Alcantara <pc@manguebit.org>
---
 fs/smb/client/file.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/smb/client/file.c b/fs/smb/client/file.c
index 1247d73740a0..f51653cb6432 100644
--- a/fs/smb/client/file.c
+++ b/fs/smb/client/file.c
@@ -2737,7 +2737,7 @@ cifs_get_hardlink_path(struct cifs_tcon *tcon, struct inode *inode,
 	spin_lock(&cinode->open_file_lock);
 
 	list_for_each_entry(open_file, &cinode->openFileList, flist) {
-		if (file->f_flags == open_file->f_flags) {
+		if (open_file->dentry != file_dentry(file)) {
 			rc = -EINVAL;
 			break;
 		}
-- 
2.56.0


  reply	other threads:[~2026-11-11 13:53 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-11 13:53 [PATCH v2 1/2] smb: client: retry a hard link open without a lease Paulo Alcantara
2026-11-11 13:53 ` Paulo Alcantara [this message]
2026-11-11 15:11   ` [PATCH v2 2/2] smb: client: flush deferred handles of other names before a hard link open Paulo Alcantara
2026-11-11 14:44 ` [PATCH v2 1/2] smb: client: retry a hard link open without a lease Namjae Jeon

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=20261111135324.4028153-2-pc@manguebit.org \
    --to=pc@manguebit.org \
    --cc=bharathsm@microsoft.com \
    --cc=dhowells@redhat.com \
    --cc=linkinjeon@kernel.org \
    --cc=linux-cifs@vger.kernel.org \
    --cc=ronniesahlberg@gmail.com \
    --cc=sprasad@microsoft.com \
    --cc=stable@vger.kernel.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox