mirror of
https://github.com/torvalds/linux.git
synced 2026-11-20 13:03:48 +00:00
coda_open() adds O_APPEND to the container file's f_flags after it has
been opened, without updating its cached f_iocb_flags. An O_APPEND write
can therefore overwrite existing data instead of appending. For example,
writing "Z" to a file containing "abc" produces "Zbc" rather than "abcZ".
Pass RWF_APPEND or RWF_NOAPPEND to vfs_iter_write() according to the
incoming IOCB_APPEND state. This also honors changes made with F_SETFL
and per-write append overrides instead of relying on the container's
open-time flags.
Fixes: 164f4064ca ("keep iocb_flags() result cached in struct file")
Cc: [email protected] # 6.9+
Signed-off-by: Hungyu Lin <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Christian Brauner (Amutable) <[email protected]>