aboutsummaryrefslogtreecommitdiffstats
path: root/fs/overlayfs/inode.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/overlayfs/inode.c')
-rw-r--r--fs/overlayfs/inode.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/fs/overlayfs/inode.c b/fs/overlayfs/inode.c
index 07d74b24913b..04f124884687 100644
--- a/fs/overlayfs/inode.c
+++ b/fs/overlayfs/inode.c
@@ -205,7 +205,7 @@ static int ovl_readlink(struct dentry *dentry, char __user *buf, int bufsiz)
205 205
206static bool ovl_is_private_xattr(const char *name) 206static bool ovl_is_private_xattr(const char *name)
207{ 207{
208 return strncmp(name, "trusted.overlay.", 14) == 0; 208 return strncmp(name, OVL_XATTR_PRE_NAME, OVL_XATTR_PRE_LEN) == 0;
209} 209}
210 210
211int ovl_setxattr(struct dentry *dentry, const char *name, 211int ovl_setxattr(struct dentry *dentry, const char *name,
@@ -238,7 +238,10 @@ out:
238static bool ovl_need_xattr_filter(struct dentry *dentry, 238static bool ovl_need_xattr_filter(struct dentry *dentry,
239 enum ovl_path_type type) 239 enum ovl_path_type type)
240{ 240{
241 return type == OVL_PATH_UPPER && S_ISDIR(dentry->d_inode->i_mode); 241 if ((type & (__OVL_PATH_PURE | __OVL_PATH_UPPER)) == __OVL_PATH_UPPER)
242 return S_ISDIR(dentry->d_inode->i_mode);
243 else
244 return false;
242} 245}
243 246
244ssize_t ovl_getxattr(struct dentry *dentry, const char *name, 247ssize_t ovl_getxattr(struct dentry *dentry, const char *name,
@@ -299,7 +302,7 @@ int ovl_removexattr(struct dentry *dentry, const char *name)
299 if (ovl_need_xattr_filter(dentry, type) && ovl_is_private_xattr(name)) 302 if (ovl_need_xattr_filter(dentry, type) && ovl_is_private_xattr(name))
300 goto out_drop_write; 303 goto out_drop_write;
301 304
302 if (type == OVL_PATH_LOWER) { 305 if (!OVL_TYPE_UPPER(type)) {
303 err = vfs_getxattr(realpath.dentry, name, NULL, 0); 306 err = vfs_getxattr(realpath.dentry, name, NULL, 0);
304 if (err < 0) 307 if (err < 0)
305 goto out_drop_write; 308 goto out_drop_write;
@@ -321,7 +324,7 @@ out:
321static bool ovl_open_need_copy_up(int flags, enum ovl_path_type type, 324static bool ovl_open_need_copy_up(int flags, enum ovl_path_type type,
322 struct dentry *realdentry) 325 struct dentry *realdentry)
323{ 326{
324 if (type != OVL_PATH_LOWER) 327 if (OVL_TYPE_UPPER(type))
325 return false; 328 return false;
326 329
327 if (special_file(realdentry->d_inode->i_mode)) 330 if (special_file(realdentry->d_inode->i_mode))
@@ -430,5 +433,4 @@ struct inode *ovl_new_inode(struct super_block *sb, umode_t mode,
430 } 433 }
431 434
432 return inode; 435 return inode;
433
434} 436}