[PATCH] ovl: add O_LARGEFILE flag when copyup files

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

 



From: George Wang <xuw2015@xxxxxxxxx>

now ovl only use O_RDONLY for lower and O_WRONLY for upper file. But if
the file size larger than MAX_NON_LFS(1UL << 31 -1), will suffer
-EOVERFLOW. We should add O_LARGEFILE flag to make it work. Following
script can reproduct it:

work
truncate: cannot open ‘work/sparse’ for writing: Value too large for
defined data type

Reported-by: Alkis Georgopoulos <alkisg@xxxxxxxxx>
Signed-off-by: George Wang <xuw2015@xxxxxxxxx>
---
 fs/overlayfs/copy_up.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/overlayfs/copy_up.c b/fs/overlayfs/copy_up.c
index 84d693d..e8ed965 100644
--- a/fs/overlayfs/copy_up.c
+++ b/fs/overlayfs/copy_up.c
@@ -81,11 +81,11 @@ static int ovl_copy_up_data(struct path *old, struct path *new, loff_t len)
 	if (len == 0)
 		return 0;
 
-	old_file = ovl_path_open(old, O_RDONLY);
+	old_file = ovl_path_open(old, O_RDONLY | O_LARGEFILE);
 	if (IS_ERR(old_file))
 		return PTR_ERR(old_file);
 
-	new_file = ovl_path_open(new, O_WRONLY);
+	new_file = ovl_path_open(new, O_WRONLY | O_LARGEFILE);
 	if (IS_ERR(new_file)) {
 		error = PTR_ERR(new_file);
 		goto out_fput;
-- 
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