mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Will Deacon <will.deacon@arm.com>
To: linux-fsdevel@vger.kernel.org
Cc: peterz@infradead.org, viro@zeniv.linux.org.uk,
	willy@infradead.org, linux-kernel@vger.kernel.org,
	Will Deacon <will.deacon@arm.com>
Subject: [PATCH v2 2/2] fs: dcache: Use READ_ONCE when accessing i_dir_seq
Date: Mon, 19 Feb 2018 14:55:55 +0000	[thread overview]
Message-ID: <1519052155-6361-3-git-send-email-will.deacon@arm.com> (raw)
In-Reply-To: <1519052155-6361-1-git-send-email-will.deacon@arm.com>

i_dir_seq is subject to concurrent modification by a cmpxchg or
store-release operation, so ensure that the relaxed access in
d_alloc_parallel uses READ_ONCE.

Reported-by: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Will Deacon <will.deacon@arm.com>
---
 fs/dcache.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/dcache.c b/fs/dcache.c
index b243deec298c..5716ab04e1db 100644
--- a/fs/dcache.c
+++ b/fs/dcache.c
@@ -2502,7 +2502,7 @@ struct dentry *d_alloc_parallel(struct dentry *parent,
 	}
 
 	hlist_bl_lock(b);
-	if (unlikely(parent->d_inode->i_dir_seq != seq)) {
+	if (unlikely(READ_ONCE(parent->d_inode->i_dir_seq) != seq)) {
 		hlist_bl_unlock(b);
 		rcu_read_unlock();
 		goto retry;
-- 
2.1.4

  parent reply	other threads:[~2018-02-19 14:55 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-19 14:55 [PATCH v2 0/2] A couple of i_dir_seq fixes for fs/dcache.c Will Deacon
2018-02-19 14:55 ` [PATCH v2 1/2] fs: dcache: Avoid livelock between d_alloc_parallel and __d_add Will Deacon
2018-02-19 14:55 ` Will Deacon [this message]
2018-02-26 18:05 ` [PATCH v2 0/2] A couple of i_dir_seq fixes for fs/dcache.c Will Deacon

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=1519052155-6361-3-git-send-email-will.deacon@arm.com \
    --to=will.deacon@arm.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peterz@infradead.org \
    --cc=viro@zeniv.linux.org.uk \
    --cc=willy@infradead.org \
    /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

Powered by JetHome