linux-unionfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Amir Goldstein <amir73il@gmail.com>
To: Miklos Szeredi <miklos@szeredi.hu>
Cc: linux-unionfs@vger.kernel.org
Subject: [PATCH 3/4] ovl: propagate IOCB_APPEND flag on writes to realfile
Date: Tue, 12 Sep 2023 20:36:52 +0300	[thread overview]
Message-ID: <20230912173653.3317828-4-amir73il@gmail.com> (raw)
In-Reply-To: <20230912173653.3317828-1-amir73il@gmail.com>

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 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/overlayfs/file.c b/fs/overlayfs/file.c
index 98f0dedffc0f..ffebffa710b5 100644
--- a/fs/overlayfs/file.c
+++ b/fs/overlayfs/file.c
@@ -263,7 +263,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)
 {
-- 
2.34.1


  parent reply	other threads:[~2023-09-12 17:37 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-12 17:36 [PATCH 0/4] Overlayfs aio cleanups Amir Goldstein
2023-09-12 17:36 ` [PATCH 1/4] ovl: protect copying of realinode attributes to ovl inode Amir Goldstein
2023-09-24  9:28   ` Amir Goldstein
2023-09-26 21:17     ` Amir Goldstein
2023-10-01 14:11       ` Amir Goldstein
2023-09-12 17:36 ` [PATCH 2/4] ovl: use simpler function to convert iocb to rw flags Amir Goldstein
2023-09-12 17:36 ` Amir Goldstein [this message]
2023-09-12 17:36 ` [PATCH 4/4] ovl: move ovl_file_accessed() to aio completion Amir Goldstein
2023-09-28  5:11   ` Amir Goldstein

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=20230912173653.3317828-4-amir73il@gmail.com \
    --to=amir73il@gmail.com \
    --cc=linux-unionfs@vger.kernel.org \
    --cc=miklos@szeredi.hu \
    /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;
as well as URLs for NNTP newsgroup(s).