aboutsummaryrefslogtreecommitdiffstats
path: root/fs/open.c
diff options
context:
space:
mode:
authorLukas Czerner <lczerner@redhat.com>2014-04-12 10:05:37 -0400
committerTheodore Ts'o <tytso@mit.edu>2014-04-12 10:05:37 -0400
commit0790b31b69374ddadefebb156251b319e5b43345 (patch)
treeac6daf0dc694e27eaf143cd619459156c4ea477f /fs/open.c
parent23fffa925ea2c9a2bcb1a4453e2c542635aa3545 (diff)
fs: disallow all fallocate operation on active swapfile
Currently some file system have IS_SWAPFILE check in their fallocate implementations and some do not. However we should really prevent any fallocate operation on swapfile so move the check to vfs and remove the redundant checks from the file systems fallocate implementations. Signed-off-by: Lukas Czerner <lczerner@redhat.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'fs/open.c')
-rw-r--r--fs/open.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/fs/open.c b/fs/open.c
index adf34202213a..7b823daa6a93 100644
--- a/fs/open.c
+++ b/fs/open.c
@@ -263,6 +263,13 @@ int do_fallocate(struct file *file, int mode, loff_t offset, loff_t len)
263 return -EPERM; 263 return -EPERM;
264 264
265 /* 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 /*
266 * Revalidate the write permissions, in case security policy has 273 * Revalidate the write permissions, in case security policy has
267 * changed since the files were opened. 274 * changed since the files were opened.
268 */ 275 */