Skip to contentSkip to conversation

Fuse: honor RLIMIT_FSIZE in fuse_file_fallocate

PATCH Applied Liu Bo 2 participants 2 messages Apr 17, 2019 – Apr 18, 2019

Subsystems (2)
lore
Share & tools
lore

Liu Bo

author
#0 lore raw

PATCH 1/1 Fuse: honor RLIMIT_FSIZE in fuse_file_fallocate

fstests generic/228 reported this failure that fuse fallocate does not honor what 'ulimit -f' has set.

This adds the necessary inode_newsize_ok() check.

---
 fs/fuse/file.c | 7 +++++++
 1 file changed, 7 insertions(+)
fs/fuse/file.c +7 -0
index 44e76b00e985..7c9bfeff0dd2 100644
@@ -3051,6 +3051,13 @@ static long fuse_file_fallocate(struct file *file, int mode, loff_t offset,
 		}
 	}
 
+	if (!(mode & FALLOC_FL_KEEP_SIZE) &&
+	    offset + length > i_size_read(inode)) {
+		err = inode_newsize_ok(inode, offset + length);
+		if (err)
+			return err;
+	}
+
 	if (!(mode & FALLOC_FL_KEEP_SIZE))
 		set_bit(FUSE_I_SIZE_UNSTABLE, &fi->state);
 
Signature · 1 line
2.20.1.2.gb21ebb6
maintainer Applied
#1 lore raw
Quoted 5 lines · Liu Bo

fstests generic/228 reported this failure that fuse fallocate does not honor what 'ulimit -f' has set.

This adds the necessary inode_newsize_ok() check.

Applied, thanks.

Miklos