aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
Diffstat (limited to 'fs')
-rw-r--r--fs/overlayfs/dir.c7
-rw-r--r--fs/overlayfs/super.c12
2 files changed, 14 insertions, 5 deletions
diff --git a/fs/overlayfs/dir.c b/fs/overlayfs/dir.c
index 795ab65ccdf5..52f6de5d40a9 100644
--- a/fs/overlayfs/dir.c
+++ b/fs/overlayfs/dir.c
@@ -904,6 +904,13 @@ static int ovl_rename2(struct inode *olddir, struct dentry *old,
904 if (!overwrite && new_is_dir && !old_opaque && new_opaque) 904 if (!overwrite && new_is_dir && !old_opaque && new_opaque)
905 ovl_remove_opaque(newdentry); 905 ovl_remove_opaque(newdentry);
906 906
907 /*
908 * Old dentry now lives in different location. Dentries in
909 * lowerstack are stale. We cannot drop them here because
910 * access to them is lockless. This could be only pure upper
911 * or opaque directory - numlower is zero. Or upper non-dir
912 * entry - its pureness is tracked by flag opaque.
913 */
907 if (old_opaque != new_opaque) { 914 if (old_opaque != new_opaque) {
908 ovl_dentry_set_opaque(old, new_opaque); 915 ovl_dentry_set_opaque(old, new_opaque);
909 if (!overwrite) 916 if (!overwrite)
diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c
index 588a4b51ab0c..619ad4b016d2 100644
--- a/fs/overlayfs/super.c
+++ b/fs/overlayfs/super.c
@@ -76,12 +76,14 @@ enum ovl_path_type ovl_path_type(struct dentry *dentry)
76 if (oe->__upperdentry) { 76 if (oe->__upperdentry) {
77 type = __OVL_PATH_UPPER; 77 type = __OVL_PATH_UPPER;
78 78
79 if (oe->numlower) { 79 /*
80 if (S_ISDIR(dentry->d_inode->i_mode)) 80 * Non-dir dentry can hold lower dentry from previous
81 type |= __OVL_PATH_MERGE; 81 * location. Its purity depends only on opaque flag.
82 } else if (!oe->opaque) { 82 */
83 if (oe->numlower && S_ISDIR(dentry->d_inode->i_mode))
84 type |= __OVL_PATH_MERGE;
85 else if (!oe->opaque)
83 type |= __OVL_PATH_PURE; 86 type |= __OVL_PATH_PURE;
84 }
85 } else { 87 } else {
86 if (oe->numlower > 1) 88 if (oe->numlower > 1)
87 type |= __OVL_PATH_MERGE; 89 type |= __OVL_PATH_MERGE;