[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <174786678489.1385038.14963089920680674888.stgit@frogsfrogsfrogs>
Date: Wed, 21 May 2025 15:44:35 -0700
From: "Darrick J. Wong" <djwong@...nel.org>
To: tytso@....edu
Cc: linux-ext4@...r.kernel.org
Subject: [PATCH 5/7] fuse2fs: only flush O_SYNC files on close
From: Darrick J. Wong <djwong@...nel.org>
Don't call ext2fs_flush2() from op_release unless the file was opened
with either synchronous write flag.
XXX: Maybe this should be replaced with actual incore state tracking for
inodes?
Signed-off-by: "Darrick J. Wong" <djwong@...nel.org>
---
misc/fuse2fs.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/misc/fuse2fs.c b/misc/fuse2fs.c
index 6fae10e9473ea5..b0d3e3ea479d72 100644
--- a/misc/fuse2fs.c
+++ b/misc/fuse2fs.c
@@ -2673,11 +2673,15 @@ static int op_release(const char *path EXT2FS_ATTR((unused)),
FUSE2FS_CHECK_MAGIC(fs, fh, FUSE2FS_FILE_MAGIC);
dbg_printf(ff, "%s: ino=%d\n", __func__, fh->ino);
pthread_mutex_lock(&ff->bfl);
- if (fs_writeable(fs) && fh->open_flags & EXT2_FILE_WRITE) {
+
+ if ((fp->flags & O_SYNC) &&
+ fs_writeable(fs) &&
+ (fh->open_flags & EXT2_FILE_WRITE)) {
err = ext2fs_flush2(fs, EXT2_FLAG_FLUSH_NO_SYNC);
if (err)
ret = translate_error(fs, fh->ino, err);
}
+
fp->fh = 0;
pthread_mutex_unlock(&ff->bfl);
Powered by blists - more mailing lists