Skip to content

Commit

Permalink
ovl: don't fail copy up if no fileattr support on upper
Browse files Browse the repository at this point in the history
Christoph Fritz is reporting that failure to copy up fileattr when upper
doesn't support fileattr or xattr results in a regression.

Return success in these failure cases; this reverts overlayfs to the old
behavior.

Add a pr_warn_once() in these cases to still let the user know about the
copy up failures.

Reported-by: Christoph Fritz <[email protected]>
Fixes: 72db821 ("ovl: copy up sync/noatime fileattr flags")
Cc: <[email protected]> # v5.15
Signed-off-by: Miklos Szeredi <[email protected]>
  • Loading branch information
Miklos Szeredi committed Jan 14, 2022
1 parent 4ee7e4a commit 94fd197
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion fs/overlayfs/copy_up.c
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,9 @@ static int ovl_copy_fileattr(struct inode *inode, struct path *old,
*/
if (oldfa.flags & OVL_PROT_FS_FLAGS_MASK) {
err = ovl_set_protattr(inode, new->dentry, &oldfa);
if (err)
if (err == -EPERM)
pr_warn_once("copying fileattr: no xattr on upper\n");
else if (err)
return err;
}

Expand All @@ -167,6 +169,14 @@ static int ovl_copy_fileattr(struct inode *inode, struct path *old,

err = ovl_real_fileattr_get(new, &newfa);
if (err) {
/*
* Returning an error if upper doesn't support fileattr will
* result in a regression, so revert to the old behavior.
*/
if (err == -ENOTTY || err == -EINVAL) {
pr_warn_once("copying fileattr: no support on upper\n");
return 0;
}
pr_warn("failed to retrieve upper fileattr (%pd2, err=%i)\n",
new->dentry, err);
return err;
Expand Down

0 comments on commit 94fd197

Please sign in to comment.