summaryrefslogtreecommitdiffstats
path: root/fs/overlayfs/readdir.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2014-10-28 18:27:28 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2014-10-28 18:27:28 -0400
commitd45f00ae43e63eff1b3d79df20610ae1ef645ebd (patch)
tree49b273720e044e74116a2d98668a11aac49a3214 /fs/overlayfs/readdir.c
parent54ef6df3f3f1353d99c80c437259d317b2cd1cbd (diff)
downloadblackbird-op-linux-d45f00ae43e63eff1b3d79df20610ae1ef645ebd.tar.gz
blackbird-op-linux-d45f00ae43e63eff1b3d79df20610ae1ef645ebd.zip
overlayfs: barriers for opening upper-layer directory
make sure that a) all stores done by opening struct file don't leak past storing the reference in od->upperfile b) the lockless side has read dependency barrier Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/overlayfs/readdir.c')
-rw-r--r--fs/overlayfs/readdir.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/overlayfs/readdir.c b/fs/overlayfs/readdir.c
index 910553f37aca..8c8ce9d87ba3 100644
--- a/fs/overlayfs/readdir.c
+++ b/fs/overlayfs/readdir.c
@@ -454,12 +454,13 @@ static int ovl_dir_fsync(struct file *file, loff_t start, loff_t end,
if (!od->is_upper && ovl_path_type(dentry) == OVL_PATH_MERGE) {
struct inode *inode = file_inode(file);
- realfile = od->upperfile;
+ realfile =lockless_dereference(od->upperfile);
if (!realfile) {
struct path upperpath;
ovl_path_upper(dentry, &upperpath);
realfile = ovl_path_open(&upperpath, O_RDONLY);
+ smp_mb__before_spinlock();
mutex_lock(&inode->i_mutex);
if (!od->upperfile) {
if (IS_ERR(realfile)) {
OpenPOWER on IntegriCloud