Re: [RFC PATCH 05/11] smb/server: keep notify watches on file handles
Namjae Jeon <[email protected]> Sat, 25 Jul 2026 22:51:59 +0900
| Newsgroups | org.kernel.vger.linux-cifs |
|---|---|
| Message-ID | <CAKYAXd8AO6FNFNSMopMReX5=LJB1b44N3rQ7GtCU47g9tCwVKA@mail.gmail.com> |
> @@ -182,6 +182,21 @@ static int ksmbd_notify_add(struct ksmbd_file *fp, u32 mask, u32 filter,
> struct fsnotify_mark *mark;
> int err = 0;
>
> + mutex_lock(&fp->notify_lock);
> + if (fp->notify) {
> + spin_lock(&fp->notify->lock);
> + fp->notify->filter |= filter;
> + fp->notify->mask |= mask;
This changes the watch semantics for later CHANGE_NOTIFY requests by
unioning their filter into the existing watch. CHANGE_NOTIFY request
is queued per open, but it must not reconfigure the underlying
directory watch.
> + spin_unlock(&fp->notify->lock);
> + fsnotify_modify_mark_mask(fp->notify->mark, mask, 0);
> + ksmbd_debug(NOTIFY,
> + "Updated fsnotify mark, inode %llu, mask 0x%x\n",
> + (unsigned long long)file_inode(fp->filp)->i_ino,
> + fp->notify->mark->mask);
> + *notify_out = fp->notify;
> + goto out;
> + }
> +