From: ChenXiaoSong <chenxiaosong@chenxiaosong.com>
To: linkinjeon@kernel.org, tom@talpey.com, senozhatsky@chromium.org,
chenxiaosong@chenxiaosong.com
Cc: linux-cifs@vger.kernel.org, ChenXiaoSong <chenxiaosong@kylinos.cn>
Subject: [PATCH 03/12] smb/server: add debug type for change notify
Date: Sat, 26 Sep 2026 09:05:09 +0000 [thread overview]
Message-ID: <20260926090518.78547-4-chenxiaosong@chenxiaosong.com> (raw)
In-Reply-To: <20260926090518.78547-1-chenxiaosong@chenxiaosong.com>
From: ChenXiaoSong <chenxiaosong@kylinos.cn>
Add KSMBD_DEBUG_NOTIFY and expose it as "notify" to print logs
for the change notify feature.
Example:
ksmbd.control --debug=notify
[ksmbd.control/802]: INFO: smb auth vfs oplock ipc conn rdma [notify]
Signed-off-by: ChenXiaoSong <chenxiaosong@kylinos.cn>
---
fs/smb/server/glob.h | 3 ++-
fs/smb/server/notify.c | 12 ++++++++++++
fs/smb/server/server.c | 2 +-
fs/smb/server/smb2pdu.c | 2 +-
4 files changed, 16 insertions(+), 3 deletions(-)
diff --git a/fs/smb/server/glob.h b/fs/smb/server/glob.h
index 4ea187af2348..5131bad88d96 100644
--- a/fs/smb/server/glob.h
+++ b/fs/smb/server/glob.h
@@ -21,10 +21,11 @@ extern int ksmbd_debug_types;
#define KSMBD_DEBUG_IPC BIT(4)
#define KSMBD_DEBUG_CONN BIT(5)
#define KSMBD_DEBUG_RDMA BIT(6)
+#define KSMBD_DEBUG_NOTIFY BIT(7)
#define KSMBD_DEBUG_ALL (KSMBD_DEBUG_SMB | KSMBD_DEBUG_AUTH | \
KSMBD_DEBUG_VFS | KSMBD_DEBUG_OPLOCK | \
KSMBD_DEBUG_IPC | KSMBD_DEBUG_CONN | \
- KSMBD_DEBUG_RDMA)
+ KSMBD_DEBUG_RDMA | KSMBD_DEBUG_NOTIFY)
#ifdef pr_fmt
#undef pr_fmt
diff --git a/fs/smb/server/notify.c b/fs/smb/server/notify.c
index 18cf0005a037..502ec551c01e 100644
--- a/fs/smb/server/notify.c
+++ b/fs/smb/server/notify.c
@@ -39,6 +39,7 @@ static void smb2_notify_cancel(void **argv)
{
struct ksmbd_notify_req *notify_req = argv[0];
+ ksmbd_debug(NOTIFY, "Wake pending notify request\n");
wake_up(¬ify_req->wait);
}
@@ -66,6 +67,11 @@ ksmbd_notify_validate_req(struct ksmbd_work *work,
return ERR_PTR(-ENOENT);
}
+ ksmbd_debug(NOTIFY,
+ "fid %llu:%llu, handle notify request, filter 0x%x, flags 0x%x\n",
+ fp->persistent_id, fp->volatile_id,
+ le32_to_cpu(req->CompletionFilter), le16_to_cpu(req->Flags));
+
if (le32_to_cpu(req->OutputBufferLength) >
work->conn->vals->max_trans_size) {
pr_err("Notify output buffer length %u exceeds maximum %u\n",
@@ -121,6 +127,8 @@ static int ksmbd_notify_wait(struct ksmbd_work *work,
spin_unlock(&fp->f_lock);
read_unlock(&work->sess->file_table.lock);
+ ksmbd_debug(NOTIFY, "Notify request pending, async id %d\n",
+ work->async_id);
smb2_send_interim_resp(work, STATUS_PENDING);
err = wait_event_interruptible(notify_req->wait,
@@ -195,8 +203,12 @@ int ksmbd_handle_notify(struct ksmbd_work *work,
if (work->state == KSMBD_WORK_CLOSED) {
rsp->hdr.Status = STATUS_NOTIFY_CLEANUP;
+ ksmbd_debug(NOTIFY, "Notify handle closed, async id %d\n",
+ work->async_id);
} else {
rsp->hdr.Status = STATUS_CANCELLED;
+ ksmbd_debug(NOTIFY, "Notify request cancelled, async id %d\n",
+ work->async_id);
}
smb2_send_interim_resp(work, rsp->hdr.Status);
work->send_no_response = 1;
diff --git a/fs/smb/server/server.c b/fs/smb/server/server.c
index 0827c8c51006..958e952223aa 100644
--- a/fs/smb/server/server.c
+++ b/fs/smb/server/server.c
@@ -564,7 +564,7 @@ static ssize_t kill_server_store(const struct class *class,
static const char * const debug_type_strings[] = {"smb", "auth", "vfs",
"oplock", "ipc", "conn",
- "rdma"};
+ "rdma", "notify"};
static ssize_t debug_show(const struct class *class, const struct class_attribute *attr,
char *buf)
diff --git a/fs/smb/server/smb2pdu.c b/fs/smb/server/smb2pdu.c
index 1f45a0836fe9..eb15cda699b7 100644
--- a/fs/smb/server/smb2pdu.c
+++ b/fs/smb/server/smb2pdu.c
@@ -11830,7 +11830,7 @@ int smb2_notify(struct ksmbd_work *work)
struct smb2_change_notify_req *req;
struct smb2_change_notify_rsp *rsp;
- ksmbd_debug(SMB, "Received smb2 notify\n");
+ ksmbd_debug(NOTIFY, "Received smb2 notify\n");
WORK_BUFFERS(work, req, rsp);
--
2.55.0
next prev parent reply other threads:[~2026-09-26 9:06 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-26 9:05 [PATCH 00/12] smb/server: change notify support ChenXiaoSong
2026-09-26 9:05 ` [PATCH 01/12] smb/server: move change notify handling into notify.c ChenXiaoSong
2026-09-26 9:05 ` [PATCH 02/12] smb/server: add more validation for change notify requests ChenXiaoSong
2026-09-26 9:05 ` ChenXiaoSong [this message]
2026-09-26 9:05 ` [PATCH 04/12] smb/server: support non-recursive directory change watches ChenXiaoSong
2026-09-27 10:51 ` Namjae Jeon
2026-09-28 0:38 ` ChenXiaoSong
2026-09-26 9:05 ` [PATCH 05/12] smb/server: support recursive " ChenXiaoSong
2026-09-26 9:05 ` [PATCH 06/12] smb/server: keep notify watches on file handles ChenXiaoSong
2026-09-26 9:05 ` [PATCH 07/12] smb/server: save simple notify events ChenXiaoSong
2026-09-27 10:31 ` Namjae Jeon
2026-09-28 1:27 ` ChenXiaoSong
2026-09-26 9:05 ` [PATCH 08/12] smb/server: save old names for rename " ChenXiaoSong
2026-09-26 9:05 ` [PATCH 09/12] smb/server: match " ChenXiaoSong
2026-09-26 9:05 ` [PATCH 10/12] smb/server: encode " ChenXiaoSong
2026-09-26 9:05 ` [PATCH 11/12] smb/server: send notify events to the client ChenXiaoSong
2026-09-26 9:05 ` [PATCH 12/12] smb/server: break directory leases before sending notify events 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=20260926090518.78547-4-chenxiaosong@chenxiaosong.com \
--to=chenxiaosong@chenxiaosong.com \
--cc=chenxiaosong@kylinos.cn \
--cc=linkinjeon@kernel.org \
--cc=linux-cifs@vger.kernel.org \
--cc=senozhatsky@chromium.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