Commit 48fab5d7 authored by Amir Goldstein's avatar Amir Goldstein Committed by Miklos Szeredi

ovl: fix nested overlayfs mount

When the upper overlayfs checks "trusted.overlay.*" xattr on the underlying
overlayfs mount, it gets -EPERM, which confuses the upper overlayfs.

Fix this by returning -EOPNOTSUPP instead of -EPERM from
ovl_own_xattr_get() and ovl_own_xattr_set().  This behavior is consistent
with the behavior of ovl_listxattr(), which filters out the private
overlayfs xattrs.

Note: nested overlays are deprecated.  But this change makes sense
regardless: these xattrs are private to the overlay and should always be
hidden.  Hence getting and setting them should indicate this.

[SzMi: Use EOPNOTSUPP instead of ENODATA and use it for both getting and
setting "trusted.overlay." xattrs.  This is a perfectly valid error code
for "we don't support this prefix", which is the case here.]
Signed-off-by: default avatarAmir Goldstein <amir73il@gmail.com>
Signed-off-by: default avatarMiklos Szeredi <mszeredi@redhat.com>
parent 6b2d5fe4
...@@ -603,7 +603,7 @@ static int ovl_own_xattr_get(const struct xattr_handler *handler, ...@@ -603,7 +603,7 @@ static int ovl_own_xattr_get(const struct xattr_handler *handler,
struct dentry *dentry, struct inode *inode, struct dentry *dentry, struct inode *inode,
const char *name, void *buffer, size_t size) const char *name, void *buffer, size_t size)
{ {
return -EPERM; return -EOPNOTSUPP;
} }
static int ovl_own_xattr_set(const struct xattr_handler *handler, static int ovl_own_xattr_set(const struct xattr_handler *handler,
...@@ -611,7 +611,7 @@ static int ovl_own_xattr_set(const struct xattr_handler *handler, ...@@ -611,7 +611,7 @@ static int ovl_own_xattr_set(const struct xattr_handler *handler,
const char *name, const void *value, const char *name, const void *value,
size_t size, int flags) size_t size, int flags)
{ {
return -EPERM; return -EOPNOTSUPP;
} }
static int ovl_other_xattr_get(const struct xattr_handler *handler, static int ovl_other_xattr_get(const struct xattr_handler *handler,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment