[PATCH v2] ovl: add warning and replace some errnos when failing from copy-up

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Currently when failing from copy-up there is no meaningful message
to indicate what was happeing and also directly exposing some copy-up
errors to user probably makes confusing. For example, if copy-up failed
by upperdir/workdir are belong to different project quotas, open(2) with
write mode will present error as -EXDEV(Cross-device link).

This patch adds proper warning message and replaces
errno(-EXDEV, -EOPNOTSUPP) with -EIO when failing from copy-up.

Signed-off-by: Chengguang Xu <cgxu519@xxxxxxx>
---
v1->v2:
- Only replace -EXDEV and -EOPNOTSUPP because other errnos are meaningful.
(Suggested by Amir)
- Leave NFS export related copy-up warning as is because warning on copy up
failure along is not a good enough hint.
(Suggested by Amir)

 fs/overlayfs/copy_up.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/fs/overlayfs/copy_up.c b/fs/overlayfs/copy_up.c
index 8bede07..a6bfe3c 100644
--- a/fs/overlayfs/copy_up.c
+++ b/fs/overlayfs/copy_up.c
@@ -825,6 +825,19 @@ int ovl_copy_up_flags(struct dentry *dentry, int flags)
 	}
 	revert_creds(old_cred);
 
+	if (err) {
+		if (err == -EXDEV) {
+			pr_warn_ratelimited("overlayfs: copy up failed, probably caused by project quota. (%pd2, err=%i)\n",
+				    dentry, err);
+			err = -EIO;
+		} else {
+			pr_warn_ratelimited("overlayfs: copy up failed. (%pd2, err=%i)\n",
+				    dentry, err);
+			if (err == -EOPNOTSUPP)
+				err = -EIO;
+		}
+	}
+
 	return err;
 }
 
-- 
1.8.3.1

--
To unsubscribe from this list: send the line "unsubscribe linux-unionfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Filesystems Devel]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux