Re: [PATCH] ksmbd: delete only the stream whose handle has delete-on-close

From: Namjae Jeon

Date: Tue Dec 01 2026 - 09:35:09 EST


On Tue, Dec 1, 2026 at 1:10 PM Ian Bridges <icb@xxxxxxxxxxxx> 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@xxxxxxxxxxxxxxx
> Signed-off-by: Ian Bridges <icb@xxxxxxxxxxxx>
With this patch, closing a handle opened with FILE_DELETE_ON_CLOSE
removes the stream xattr even if another handle to the same stream is
still open. The stream should be deleted only when the last handle to
that stream is closed.
Thanks.