Skip to content

Commit 94fd197

Browse files
author
Miklos Szeredi
committed
ovl: don't fail copy up if no fileattr support on upper
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 <chf.fritz@googlemail.com> Fixes: 72db821 ("ovl: copy up sync/noatime fileattr flags") Cc: <stable@vger.kernel.org> # v5.15 Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
1 parent 4ee7e4a commit 94fd197

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

fs/overlayfs/copy_up.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,9 @@ static int ovl_copy_fileattr(struct inode *inode, struct path *old,
157157
*/
158158
if (oldfa.flags & OVL_PROT_FS_FLAGS_MASK) {
159159
err = ovl_set_protattr(inode, new->dentry, &oldfa);
160-
if (err)
160+
if (err == -EPERM)
161+
pr_warn_once("copying fileattr: no xattr on upper\n");
162+
else if (err)
161163
return err;
162164
}
163165

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

168170
err = ovl_real_fileattr_get(new, &newfa);
169171
if (err) {
172+
/*
173+
* Returning an error if upper doesn't support fileattr will
174+
* result in a regression, so revert to the old behavior.
175+
*/
176+
if (err == -ENOTTY || err == -EINVAL) {
177+
pr_warn_once("copying fileattr: no support on upper\n");
178+
return 0;
179+
}
170180
pr_warn("failed to retrieve upper fileattr (%pd2, err=%i)\n",
171181
new->dentry, err);
172182
return err;

0 commit comments

Comments
 (0)