From: Dominique Martinet <asmadeus@codewreck.org>
To: "Khánh Trần Ngọc" <khanhtranngoccva@gmail.com>,
linux-fsdevel@vger.kernel.org
Cc: "v9fs@lists.linux.dev" <v9fs@lists.linux.dev>
Subject: Re: [BUG] 9p filesystem does not honor turning off O_APPEND if a file handle is opened with O_APPEND
Date: Fri, 29 May 2026 10:49:37 +0900 [thread overview]
Message-ID: <ahjwsYmrhwFW3mkX@codewreck.org> (raw)
In-Reply-To: <SE1P216MB1244C510206B0E41478E1843FB092@SE1P216MB1244.KORP216.PROD.OUTLOOK.COM>
+linux-fsdevel@ in to
Khánh Trần Ngọc wrote on Thu, May 28, 2026 at 06:55:45AM +0000:
> I recently found a bug while interacting with 9p filesystems on
> WSL. If a handle is opened with O_APPEND, then this flag can no longer
> be removed using F_SETFL despite 9pfs misreporting that the flag was
> removed successfully. The underlying filesystem continues to append to
> the end while the O_APPEND flag is gone when F_GETFL is called, and
> the seek cursor continues to progress as if removing O_APPEND actually
> worked.
>
> If removing O_APPEND is not meant to be supported, F_SETFL should have
> returned an error (EPERM seems to be the most suitable as that handle
> may only append data).
Thanks for the report, it's definitely a bug, but I'm not quite sure how
to deal with it...
As I see it (setfl() in fs/fcntl.c), we have two choices: flag every
inodes as S_APPEND so the IS_APPEND() check fails, but I'm afraid that
will have other side effects somewhere; or we need to update the
check_flags() file operation to pass the filp (or at least
filp->f_flags) so we can decide if the O_APPEND flag changed...
Thanksfully only nfs seems to be using check_flags(), so I think that
way is likely to be the easiest, but it's likely to take a bit of time.
If someone closer to the vfs has an opinon that'd be welcome.
(leaving the rest of the original mail below for anyone not on v9fs@)
>
> Tested environment:
> WSL version: 2.6.3.0
> Kernel version: 6.6.87.2-1
> WSLg version: 1.0.71
> MSRDC version: 1.2.6353
> Direct3D version: 1.611.1-81528511
> DXCore version: 10.0.26100.1-240331-1435.ge-release
> Windows version: 10.0.26200.8457
>
> Original issue: https://github.com/microsoft/WSL/issues/40649
Thanks,
--
Dominique Martinet | Asmadeus
prev parent reply other threads:[~2026-05-29 1:57 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <SE1P216MB12443CDB57EA1BD32A45FAEFFB092@SE1P216MB1244.KORP216.PROD.OUTLOOK.COM>
2026-05-28 6:55 ` [BUG] 9p filesystem does not honor turning off O_APPEND if a file handle is opened with O_APPEND Khánh Trần Ngọc
2026-05-29 1:49 ` Dominique Martinet [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=ahjwsYmrhwFW3mkX@codewreck.org \
--to=asmadeus@codewreck.org \
--cc=khanhtranngoccva@gmail.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=v9fs@lists.linux.dev \
/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