All of lore.kernel.org
 help / color / mirror / Atom feed
From: Li Chen <me@linux.beauty>
To: Mark Fasheh <mark@fasheh.com>, Joel Becker <jlbec@evilplan.org>,
	Joseph Qi <joseph.qi@linux.alibaba.com>,
	ocfs2-devel@lists.linux.dev, linux-kernel@vger.kernel.org
Cc: Jan Kara <jack@suse.com>, Li Chen <me@linux.beauty>
Subject: [PATCH 3/3] ocfs2: use READ_ONCE for lockless jinode reads
Date: Fri, 30 Jan 2026 11:12:32 +0800	[thread overview]
Message-ID: <20260130031232.60780-4-me@linux.beauty> (raw)
In-Reply-To: <20260130031232.60780-1-me@linux.beauty>

ocfs2 journal commit callback reads jbd2_inode dirty range fields without
holding journal->j_list_lock.

Use READ_ONCE() for these reads to correct the concurrency assumptions.

Suggested-by: Jan Kara <jack@suse.com>
Signed-off-by: Li Chen <me@linux.beauty>
---
 fs/ocfs2/journal.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/fs/ocfs2/journal.c b/fs/ocfs2/journal.c
index 85239807dec7..7032284cdbd6 100644
--- a/fs/ocfs2/journal.c
+++ b/fs/ocfs2/journal.c
@@ -902,8 +902,11 @@ int ocfs2_journal_alloc(struct ocfs2_super *osb)
 
 static int ocfs2_journal_submit_inode_data_buffers(struct jbd2_inode *jinode)
 {
-	return filemap_fdatawrite_range(jinode->i_vfs_inode->i_mapping,
-			jinode->i_dirty_start, jinode->i_dirty_end);
+	struct address_space *mapping = jinode->i_vfs_inode->i_mapping;
+	loff_t dirty_start = READ_ONCE(jinode->i_dirty_start);
+	loff_t dirty_end = READ_ONCE(jinode->i_dirty_end);
+
+	return filemap_fdatawrite_range(mapping, dirty_start, dirty_end);
 }
 
 int ocfs2_journal_init(struct ocfs2_super *osb, int *dirty)
-- 
2.52.0

  parent reply	other threads:[~2026-01-30  3:13 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-30  3:12 [PATCH 0/3] jbd2/ext4/ocfs2: READ_ONCE for lockless jinode reads Li Chen
2026-01-30  3:12 ` [PATCH 1/3] jbd2: use " Li Chen
2026-02-02 16:40   ` Jan Kara
2026-02-02 16:52     ` Jan Kara
2026-01-30  3:12 ` [PATCH 2/3] ext4: " Li Chen
2026-02-02 16:41   ` Jan Kara
2026-01-30  3:12 ` Li Chen [this message]
2026-01-30  5:27   ` [PATCH 3/3] ocfs2: " Matthew Wilcox
2026-01-30 12:26     ` Li Chen
2026-01-30 16:36       ` Matthew Wilcox
2026-02-01  4:37         ` Li Chen
2026-02-02 17:17         ` Jan Kara
2026-02-03 12:10           ` Li Chen
2026-02-03 12:37             ` 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=20260130031232.60780-4-me@linux.beauty \
    --to=me@linux.beauty \
    --cc=jack@suse.com \
    --cc=jlbec@evilplan.org \
    --cc=joseph.qi@linux.alibaba.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark@fasheh.com \
    --cc=ocfs2-devel@lists.linux.dev \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.