Linux EXT4 FS development
 help / color / mirror / Atom feed
From: Jan Kara <jack@suse.cz>
To: <linux-fsdevel@vger.kernel.org>
Cc: Christian Brauner <brauner@kernel.org>,
	aivazian.tigran@gmail.com, Ted Tso <tytso@mit.edu>,
	<linux-ext4@vger.kernel.org>,
	OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>,
	Jan Kara <jack@suse.cz>
Subject: [PATCH v2 07/10] minix: Fix possibly missing inode write on fsync(2)
Date: Mon, 25 May 2026 10:58:13 +0200	[thread overview]
Message-ID: <20260525085821.769119-17-jack@suse.cz> (raw)
In-Reply-To: <20260525085035.12891-1-jack@suse.cz>

Use mmb inode buffer writeout infrastructure to reliably write out
inode's buffer on fsync(2).

Signed-off-by: Jan Kara <jack@suse.cz>
---
 fs/minix/inode.c | 12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)

diff --git a/fs/minix/inode.c b/fs/minix/inode.c
index 9c6bac248907..401056fb682e 100644
--- a/fs/minix/inode.c
+++ b/fs/minix/inode.c
@@ -649,7 +649,7 @@ static struct buffer_head * V1_minix_update_inode(struct inode * inode)
 		raw_inode->i_zone[0] = old_encode_dev(inode->i_rdev);
 	else for (i = 0; i < 9; i++)
 		raw_inode->i_zone[i] = minix_inode->u.i1_data[i];
-	mark_buffer_dirty(bh);
+	mmb_mark_inode_buffer_dirty(bh, &minix_i(inode)->i_metadata_bhs);
 	return bh;
 }
 
@@ -678,7 +678,7 @@ static struct buffer_head * V2_minix_update_inode(struct inode * inode)
 		raw_inode->i_zone[0] = old_encode_dev(inode->i_rdev);
 	else for (i = 0; i < 10; i++)
 		raw_inode->i_zone[i] = minix_inode->u.i2_data[i];
-	mark_buffer_dirty(bh);
+	mmb_mark_inode_buffer_dirty(bh, &minix_i(inode)->i_metadata_bhs);
 	return bh;
 }
 
@@ -693,14 +693,6 @@ static int minix_write_inode(struct inode *inode, struct writeback_control *wbc)
 		bh = V2_minix_update_inode(inode);
 	if (!bh)
 		return -EIO;
-	if (wbc->sync_mode == WB_SYNC_ALL && buffer_dirty(bh)) {
-		sync_dirty_buffer(bh);
-		if (buffer_req(bh) && !buffer_uptodate(bh)) {
-			printk("IO error syncing minix inode [%s:%08llx]\n",
-				inode->i_sb->s_id, inode->i_ino);
-			err = -EIO;
-		}
-	}
 	brelse (bh);
 	return err;
 }
-- 
2.51.0


  parent reply	other threads:[~2026-05-25  8:58 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-25  8:58 [PATCH v2 0/10] fs: Fix missed inode write during fsync Jan Kara
2026-05-25  8:58 ` [PATCH v2 01/10] affs: Drop support for metadata bh tracking Jan Kara
2026-05-25 10:06   ` David Sterba
2026-05-25  8:58 ` [PATCH v2 02/10] ext4: Allocate mapping_metadata_bhs struct on demand Jan Kara
2026-06-03 13:41   ` Theodore Tso
2026-05-25  8:58 ` [PATCH v2 03/10] fs: Writeout inode buffer from mmb_sync() Jan Kara
2026-05-25  8:58 ` [PATCH v2 04/10] ext2: Fix possibly missing inode write on fsync(2) Jan Kara
2026-05-25  8:58 ` [PATCH v2 05/10] udf: " Jan Kara
2026-05-25  8:58 ` [PATCH v2 06/10] fat: " Jan Kara
2026-05-25  8:58 ` Jan Kara [this message]
2026-05-25  8:58 ` [PATCH v2 08/10] bfs: " Jan Kara
2026-05-25  8:58 ` [PATCH v2 09/10] ext4: Use mmb infrastructure for inode buffer writeout Jan Kara
2026-06-03 13:41   ` Theodore Tso
2026-05-25  8:58 ` [PATCH v2 10/10] fs: Fix missed inode writeback when racing with __writeback_single_inode Jan Kara
2026-06-02  7:22 ` [PATCH v2 0/10] fs: Fix missed inode write during fsync Jan Kara

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=20260525085821.769119-17-jack@suse.cz \
    --to=jack@suse.cz \
    --cc=aivazian.tigran@gmail.com \
    --cc=brauner@kernel.org \
    --cc=hirofumi@mail.parknet.co.jp \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=tytso@mit.edu \
    /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