From: Peter Zijlstra <peterz@infradead.org>
To: torvalds@linux-foundation.org, will.deacon@arm.com,
oleg@redhat.com, paulmck@linux.vnet.ibm.com,
benh@kernel.crashing.org, mpe@ellerman.id.au, npiggin@gmail.com
Cc: linux-kernel@vger.kernel.org, mingo@kernel.org,
stern@rowland.harvard.edu, peterz@infradead.org,
Al Viro <viro@zeniv.linux.org.uk>
Subject: [PATCH -v2 2/4] overlayfs: Remove smp_mb__before_spinlock() usage
Date: Wed, 02 Aug 2017 13:38:39 +0200 [thread overview]
Message-ID: <20170802114030.071035909@infradead.org> (raw)
In-Reply-To: 20170802113837.280183420@infradead.org
[-- Attachment #1: peterz-overlayfs.patch --]
[-- Type: text/plain, Size: 1024 bytes --]
While we could replace the smp_mb__before_spinlock() with the new
smp_mb__after_spinlock(), the normal pattern is to use
smp_store_release() to publish an object that is used for
lockless_dereference() -- and mirrors the regular rcu_assign_pointer()
/ rcu_dereference() patterns.
Cc: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
---
fs/overlayfs/readdir.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
--- a/fs/overlayfs/readdir.c
+++ b/fs/overlayfs/readdir.c
@@ -446,14 +446,14 @@ static int ovl_dir_fsync(struct file *fi
ovl_path_upper(dentry, &upperpath);
realfile = ovl_path_open(&upperpath, O_RDONLY);
- smp_mb__before_spinlock();
+
inode_lock(inode);
if (!od->upperfile) {
if (IS_ERR(realfile)) {
inode_unlock(inode);
return PTR_ERR(realfile);
}
- od->upperfile = realfile;
+ smp_store_release(&od->upperfile, realfile);
} else {
/* somebody has beaten us to it */
if (!IS_ERR(realfile))
next prev parent reply other threads:[~2017-08-02 11:44 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-02 11:38 [PATCH -v2 0/4] Getting rid of smp_mb__before_spinlock Peter Zijlstra
2017-08-02 11:38 ` [PATCH -v2 1/4] mm: Rework {set,clear,mm}_tlb_flush_pending() Peter Zijlstra
2017-08-02 13:00 ` Mel Gorman
2017-08-02 13:05 ` Peter Zijlstra
2017-08-02 13:52 ` Mel Gorman
2017-08-02 14:16 ` Peter Zijlstra
2017-08-02 13:00 ` ARC stuff (was Re: [PATCH -v2 1/4] mm: Rework {set,clear,mm}_tlb_flush_pending()) Vineet Gupta
2017-08-02 13:17 ` Peter Zijlstra
2017-08-11 14:15 ` Peter Zijlstra
2017-08-03 15:27 ` [PATCH -v2 1/4] mm: Rework {set,clear,mm}_tlb_flush_pending() Will Deacon
2017-08-11 9:45 ` Peter Zijlstra
2017-08-02 11:38 ` Peter Zijlstra [this message]
2017-08-02 11:38 ` [PATCH -v2 3/4] locking: Introduce smp_mb__after_spinlock() Peter Zijlstra
2017-08-03 15:28 ` Will Deacon
2017-08-03 15:43 ` Nicholas Piggin
2017-08-02 11:38 ` [PATCH -v2 4/4] locking: Remove smp_mb__before_spinlock() Peter Zijlstra
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=20170802114030.071035909@infradead.org \
--to=peterz@infradead.org \
--cc=benh@kernel.crashing.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=mpe@ellerman.id.au \
--cc=npiggin@gmail.com \
--cc=oleg@redhat.com \
--cc=paulmck@linux.vnet.ibm.com \
--cc=stern@rowland.harvard.edu \
--cc=torvalds@linux-foundation.org \
--cc=viro@zeniv.linux.org.uk \
--cc=will.deacon@arm.com \
/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