Linux CIFS filesystem development
 help / color / mirror / Atom feed
From: ChenXiaoSong <chenxiaosong@chenxiaosong.com>
To: smfrench@gmail.com, linkinjeon@kernel.org, pc@manguebit.org,
	ronniesahlberg@gmail.com, sprasad@microsoft.com, tom@talpey.com,
	bharathsm@microsoft.com, senozhatsky@chromium.org,
	dhowells@redhat.com, metze@samba.org
Cc: linux-cifs@vger.kernel.org, ChenXiaoSong <chenxiaosong@kylinos.cn>
Subject: [PATCH 3/9] smb/client: prepare notify ioctl per-open state
Date: Wed,  1 Jul 2026 08:25:01 +0000	[thread overview]
Message-ID: <20260701082507.786487-4-chenxiaosong@chenxiaosong.com> (raw)
In-Reply-To: <20260701082507.786487-1-chenxiaosong@chenxiaosong.com>

From: ChenXiaoSong <chenxiaosong@kylinos.cn>

This patch was split out to make it easier to review.

Ensure smb3_notify() has directory private data before requests.
This gives later changes a per-open state container while preserving
the existing per-notify SMB2_open/SMB2_close behavior.

Signed-off-by: ChenXiaoSong <chenxiaosong@kylinos.cn>
---
 fs/smb/client/smb2ops.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/fs/smb/client/smb2ops.c b/fs/smb/client/smb2ops.c
index 06e9322a762a..349126deb22e 100644
--- a/fs/smb/client/smb2ops.c
+++ b/fs/smb/client/smb2ops.c
@@ -2376,9 +2376,11 @@ smb3_notify(const unsigned int xid, struct file *pfile,
 	struct dentry *dentry = pfile->f_path.dentry;
 	struct inode *inode = file_inode(pfile);
 	struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
+	struct cifsFileInfo *cfile;
 	struct cifs_open_parms oparms;
 	struct cifs_fid fid;
 	struct cifs_tcon *tcon;
+	struct tcon_link *tlink;
 	const unsigned char *path;
 	char *returned_ioctl_info = NULL;
 	void *page = alloc_dentry_path();
@@ -2412,6 +2414,20 @@ smb3_notify(const unsigned int xid, struct file *pfile,
 		notify.data_len = 0;
 	}
 
+	if (!pfile->private_data) {
+		tlink = cifs_sb_tlink(cifs_sb);
+		if (IS_ERR(tlink)) {
+			rc = PTR_ERR(tlink);
+			goto notify_exit;
+		}
+		cfile = cifs_new_dir_fileinfo(pfile, tlink);
+		cifs_put_tlink(tlink);
+		if (!cfile) {
+			rc = -ENOMEM;
+			goto notify_exit;
+		}
+	}
+
 	tcon = cifs_sb_master_tcon(cifs_sb);
 	oparms = (struct cifs_open_parms) {
 		.tcon = tcon,
-- 
2.54.0


  parent reply	other threads:[~2026-07-01  8:25 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-01  8:24 [PATCH 0/9] smb/client: improve change notify support ChenXiaoSong
2026-07-01  8:24 ` [PATCH 1/9] smb/client: factor out cifs_new_dir_fileinfo() ChenXiaoSong
2026-07-01  8:25 ` [PATCH 2/9] smb/client: close cached notify handles on closedir ChenXiaoSong
2026-07-01  8:25 ` ChenXiaoSong [this message]
2026-07-01  8:25 ` [PATCH 4/9] smb/client: cache SMB3 change notify handles ChenXiaoSong
2026-07-01  8:25 ` [PATCH 5/9] smb/client: retry change notify after invalid cached handle ChenXiaoSong
2026-07-01  8:25 ` [PATCH 6/9] smb/client: add helpers for sending cancel requests ChenXiaoSong
2026-07-01  8:25 ` [PATCH 7/9] smb/client: remember async ids from SMB2 pending responses ChenXiaoSong
2026-07-01  8:25 ` [PATCH 8/9] smb/client: send SMB2 cancel requests ChenXiaoSong
2026-07-01  8:25 ` [PATCH 9/9] smb/client: make SMB2 change notify interruptible ChenXiaoSong

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=20260701082507.786487-4-chenxiaosong@chenxiaosong.com \
    --to=chenxiaosong@chenxiaosong.com \
    --cc=bharathsm@microsoft.com \
    --cc=chenxiaosong@kylinos.cn \
    --cc=dhowells@redhat.com \
    --cc=linkinjeon@kernel.org \
    --cc=linux-cifs@vger.kernel.org \
    --cc=metze@samba.org \
    --cc=pc@manguebit.org \
    --cc=ronniesahlberg@gmail.com \
    --cc=senozhatsky@chromium.org \
    --cc=smfrench@gmail.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox