diff options
author | Mauro Carvalho Chehab <m.chehab@samsung.com> | 2014-05-21 22:03:15 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <m.chehab@samsung.com> | 2014-05-21 22:03:15 -0400 |
commit | e899966f626f1f657a4a7bac736c0b9ae5a243ea (patch) | |
tree | a4bb8362d871da67b41fee27bb85ad0bc83e0591 /fs/open.c | |
parent | ba0d342ecc21fbbe2f6c178f4479944d1fb34f3b (diff) | |
parent | 4b660a7f5c8099d88d1a43d8ae138965112592c7 (diff) |
Merge tag 'v3.15-rc6' into patchwork
Linux 3.15-rc6
* tag 'v3.15-rc6': (1314 commits)
Linux 3.15-rc6
Btrfs: send, fix incorrect ref access when using extrefs
Btrfs: fix EIO on reading file after ioctl clone works on it
scripts/checksyscalls.sh: Make renameat optional
asm-generic: Add renameat2 syscall
ia64: add renameat2 syscall
parisc: add renameat2 syscall
m68k: add renameat2 syscall
sysfs: make sure read buffer is zeroed
ahci: imx: PLL clock needs 100us to settle down
PCI: Wrong register used to check pending traffic
target: fix memory leak on XCOPY
random: fix BUG_ON caused by accounting simplification
clk: tegra: Fix wrong value written to PLLE_AUX
staging: rtl8723au: Do not reset wdev->iftype in netdev_close()
ACPI / video: Revert native brightness quirk for ThinkPad T530
staging: rtl8723au: Use correct pipe type for USB interrupts
crush: decode and initialize chooseleaf_vary_r
libceph: fix corruption when using page_count 0 page in rbd
arm64: fix pud_huge() for 2-level pagetables
...
Diffstat (limited to 'fs/open.c')
-rw-r--r-- | fs/open.c | 21 |
1 files changed, 9 insertions, 12 deletions
@@ -254,17 +254,22 @@ int do_fallocate(struct file *file, int mode, loff_t offset, loff_t len) | |||
254 | return -EBADF; | 254 | return -EBADF; |
255 | 255 | ||
256 | /* | 256 | /* |
257 | * It's not possible to punch hole or perform collapse range | 257 | * We can only allow pure fallocate on append only files |
258 | * on append only file | ||
259 | */ | 258 | */ |
260 | if (mode & (FALLOC_FL_PUNCH_HOLE | FALLOC_FL_COLLAPSE_RANGE) | 259 | if ((mode & ~FALLOC_FL_KEEP_SIZE) && IS_APPEND(inode)) |
261 | && IS_APPEND(inode)) | ||
262 | return -EPERM; | 260 | return -EPERM; |
263 | 261 | ||
264 | if (IS_IMMUTABLE(inode)) | 262 | if (IS_IMMUTABLE(inode)) |
265 | return -EPERM; | 263 | return -EPERM; |
266 | 264 | ||
267 | /* | 265 | /* |
266 | * We can not allow to do any fallocate operation on an active | ||
267 | * swapfile | ||
268 | */ | ||
269 | if (IS_SWAPFILE(inode)) | ||
270 | ret = -ETXTBSY; | ||
271 | |||
272 | /* | ||
268 | * Revalidate the write permissions, in case security policy has | 273 | * Revalidate the write permissions, in case security policy has |
269 | * changed since the files were opened. | 274 | * changed since the files were opened. |
270 | */ | 275 | */ |
@@ -286,14 +291,6 @@ int do_fallocate(struct file *file, int mode, loff_t offset, loff_t len) | |||
286 | if (((offset + len) > inode->i_sb->s_maxbytes) || ((offset + len) < 0)) | 291 | if (((offset + len) > inode->i_sb->s_maxbytes) || ((offset + len) < 0)) |
287 | return -EFBIG; | 292 | return -EFBIG; |
288 | 293 | ||
289 | /* | ||
290 | * There is no need to overlap collapse range with EOF, in which case | ||
291 | * it is effectively a truncate operation | ||
292 | */ | ||
293 | if ((mode & FALLOC_FL_COLLAPSE_RANGE) && | ||
294 | (offset + len >= i_size_read(inode))) | ||
295 | return -EINVAL; | ||
296 | |||
297 | if (!file->f_op->fallocate) | 294 | if (!file->f_op->fallocate) |
298 | return -EOPNOTSUPP; | 295 | return -EOPNOTSUPP; |
299 | 296 | ||