From: ChenXiaoSong <chenxiaosong@chenxiaosong.com>
To: Ian Bridges <icb@fastmail.org>, linkinjeon@kernel.org
Cc: senozhatsky@chromium.org, tom@talpey.com, gael.blivet@gmail.com,
linux-cifs@vger.kernel.org, linux-kernel@vger.kernel.org,
stable@vger.kernel.org
Subject: Re: [PATCH] ksmbd: delete only the stream whose handle has delete-on-close
Date: Tue, 1 Dec 2026 14:23:21 +0800 [thread overview]
Message-ID: <786d0399-5091-461b-b8bc-eed6fd9f2d50@chenxiaosong.com> (raw)
In-Reply-To: <20261201041029.2181504-1-icb@fastmail.org>
Reviewed-by: ChenXiaoSong <chenxiaosong@kylinos.cn>
On 12/1/26 12:10, Ian Bridges wrote:
> A delete-on-close open of a named stream sets a flag on the inode
> instead of on the handle. The next stream handle of the file to close
> takes the flag and deletes its own stream. So when another stream
> handle of the file closes first, that other stream is deleted, and the
> stream that was opened with delete-on-close is kept.
>
> The stream is removed with the credentials of the closing handle. A
> user who cannot write the file can open one stream with delete-on-close
> and make another user's handle delete a different stream on close.
>
> Record delete-on-close on the stream handle, as
> FileDispositionInformation on a stream handle already does. Deleting a
> stream never removes the file, so delete-on-close of a stream no longer
> makes a new delete-on-close open close the disconnected durable handles
> of the file.
>
> Fixes: f44158485826 ("cifsd: add file operations")
> Cc:stable@vger.kernel.org
> Signed-off-by: Ian Bridges<icb@fastmail.org>
> ---
> Tested on ksmbd-for-next 87ff512becd4, on x86_64 with KASAN. A script
> opened named streams of one file with and without delete-on-close, as
> the owner and as a user who cannot write the file, and closed the
> handles in different orders. On the base, the first stream handle to
> close deleted its own stream. With the patch, only the streams opened
> with delete-on-close were deleted, and FileDispositionInformation on a
> stream behaved as on the base. smbtorture gives the same results as on
> the base, and KASAN reported nothing.
>
> This patch was developed with LLM assistance.
>
> fs/smb/server/vfs_cache.c | 41 ++++++++++++++++++---------------------
> fs/smb/server/vfs_cache.h | 1 +
> 2 files changed, 20 insertions(+), 22 deletions(-)
--
ChenXiaoSong <chenxiaosong@chenxiaosong.com>
Chinese Homepage: https://chenxiaosong.com
English Homepage: https://chenxiaosong.com/en
prev parent reply other threads:[~2026-12-01 6:23 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-01 4:10 Ian Bridges
2026-12-01 6:23 ` ChenXiaoSong [this message]
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=786d0399-5091-461b-b8bc-eed6fd9f2d50@chenxiaosong.com \
--to=chenxiaosong@chenxiaosong.com \
--cc=gael.blivet@gmail.com \
--cc=icb@fastmail.org \
--cc=linkinjeon@kernel.org \
--cc=linux-cifs@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=senozhatsky@chromium.org \
--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
all inboxes | Powered by JetHome®