]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
ovl: propagate IOCB_APPEND flag on writes to realfile
authorAmir Goldstein <amir73il@gmail.com>
Tue, 29 Aug 2023 13:25:47 +0000 (16:25 +0300)
committerAmir Goldstein <amir73il@gmail.com>
Mon, 30 Oct 2023 22:12:54 +0000 (00:12 +0200)
If ovl file is opened O_APPEND, the underlying realfile is also
opened O_APPEND, so it makes sense to propagate the IOCB_APPEND flags
on sync writes to realfile, just as we do with aio writes.

Effectively, because sync ovl writes are protected by inode lock,
this change only makes a difference if the realfile is written to (size
extending writes) from underneath overlayfs.  The behavior in this case
is undefined, so it is ok if we change the behavior (to fail the ovl
IOCB_APPEND write).

Signed-off-by: Amir Goldstein <amir73il@gmail.com>
fs/overlayfs/file.c

index 4dccef12a33a8e90bc10e9f87660cf650cc157f2..32eb90713ff8efa3f7d18c71143a1c019ae15c26 100644 (file)
@@ -264,7 +264,7 @@ static void ovl_file_accessed(struct file *file)
 }
 
 #define OVL_IOCB_MASK \
-       (IOCB_NOWAIT | IOCB_HIPRI | IOCB_DSYNC | IOCB_SYNC)
+       (IOCB_NOWAIT | IOCB_HIPRI | IOCB_DSYNC | IOCB_SYNC | IOCB_APPEND)
 
 static rwf_t iocb_to_rw_flags(int flags)
 {