[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 <[email protected]> Thu, 28 May 2026 06:55:45 +0000
Newsgroups dev.linux.lists.v9fs
Message-ID <SE1P216MB1244C510206B0E41478E1843FB092@SE1P216MB1244.KORP216.PROD.OUTLOOK.COM>
Hello,

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). 

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,

Khanh