Merge branch 'for-upstream' of git://git.kernel.org/pub/scm/linux/kernel/git/bluetoot...
[deliverable/linux.git] / fs / open.c
index b1bf3d542d5d0a5bc0394ea65d1b504c7d60cdeb..813be037b412907e040fe2b94861cfcbf14fc91f 100644 (file)
--- a/fs/open.c
+++ b/fs/open.c
@@ -222,7 +222,7 @@ SYSCALL_DEFINE2(ftruncate64, unsigned int, fd, loff_t, length)
 #endif /* BITS_PER_LONG == 32 */
 
 
-int do_fallocate(struct file *file, int mode, loff_t offset, loff_t len)
+int vfs_fallocate(struct file *file, int mode, loff_t offset, loff_t len)
 {
        struct inode *inode = file_inode(file);
        long ret;
@@ -295,9 +295,21 @@ int do_fallocate(struct file *file, int mode, loff_t offset, loff_t len)
 
        sb_start_write(inode->i_sb);
        ret = file->f_op->fallocate(file, mode, offset, len);
+
+       /*
+        * Create inotify and fanotify events.
+        *
+        * To keep the logic simple always create events if fallocate succeeds.
+        * This implies that events are even created if the file size remains
+        * unchanged, e.g. when using flag FALLOC_FL_KEEP_SIZE.
+        */
+       if (ret == 0)
+               fsnotify_modify(file);
+
        sb_end_write(inode->i_sb);
        return ret;
 }
+EXPORT_SYMBOL_GPL(vfs_fallocate);
 
 SYSCALL_DEFINE4(fallocate, int, fd, int, mode, loff_t, offset, loff_t, len)
 {
@@ -305,7 +317,7 @@ SYSCALL_DEFINE4(fallocate, int, fd, int, mode, loff_t, offset, loff_t, len)
        int error = -EBADF;
 
        if (f.file) {
-               error = do_fallocate(f.file, mode, offset, len);
+               error = vfs_fallocate(f.file, mode, offset, len);
                fdput(f);
        }
        return error;
This page took 0.025167 seconds and 5 git commands to generate.