summaryrefslogtreecommitdiffstats
path: root/fs/overlayfs/super.c
diff options
context:
space:
mode:
authorMiklos Szeredi <mszeredi@suse.cz>2014-12-13 00:59:45 +0100
committerMiklos Szeredi <mszeredi@suse.cz>2014-12-13 00:59:45 +0100
commit3e01cee3b980f96463cb6f378ab05303a99903d9 (patch)
tree59ad7b720642aeeaa4c6706703125b8332b44454 /fs/overlayfs/super.c
parent3d3c6b89399a1b5e8a59ffbb8cb2a7797a9ef154 (diff)
downloadlinux-3e01cee3b980f96463cb6f378ab05303a99903d9.tar.gz
linux-3e01cee3b980f96463cb6f378ab05303a99903d9.tar.bz2
linux-3e01cee3b980f96463cb6f378ab05303a99903d9.zip
ovl: check whiteout on lowest layer as well
Not checking whiteouts on lowest layer was an optimization (there's nothing to white out there), but it could result in inconsitent behavior when a layer previously used as upper/middle is later used as lowest. Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
Diffstat (limited to 'fs/overlayfs/super.c')
-rw-r--r--fs/overlayfs/super.c27
1 files changed, 10 insertions, 17 deletions
diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c
index f72b82fdc1e6..5dbc6789fd5f 100644
--- a/fs/overlayfs/super.c
+++ b/fs/overlayfs/super.c
@@ -350,16 +350,12 @@ struct dentry *ovl_lookup(struct inode *dir, struct dentry *dentry,
if (IS_ERR(this))
goto out;
- /*
- * If this is not the lowermost layer, check whiteout and opaque
- * directory.
- */
- if (poe->numlower && this) {
+ if (this) {
if (ovl_is_whiteout(this)) {
dput(this);
this = NULL;
upperopaque = true;
- } else if (ovl_is_opaquedir(this)) {
+ } else if (poe->numlower && ovl_is_opaquedir(this)) {
upperopaque = true;
}
}
@@ -384,19 +380,16 @@ struct dentry *ovl_lookup(struct inode *dir, struct dentry *dentry,
goto out_put;
if (!this)
continue;
-
+ if (ovl_is_whiteout(this)) {
+ dput(this);
+ break;
+ }
/*
- * If this is not the lowermost layer, check whiteout and opaque
- * directory.
+ * Only makes sense to check opaque dir if this is not the
+ * lowermost layer.
*/
- if (i < poe->numlower - 1) {
- if (ovl_is_whiteout(this)) {
- dput(this);
- break;
- } else if (ovl_is_opaquedir(this)) {
- opaque = true;
- }
- }
+ if (i < poe->numlower - 1 && ovl_is_opaquedir(this))
+ opaque = true;
/*
* If this is a non-directory then stop here.
*