Merge branch 'for-3.19' of git://linux-nfs.org/~bfields/linux
[cascardo/linux.git] / fs / open.c
index 192c429..813be03 100644 (file)
--- a/fs/open.c
+++ b/fs/open.c
@@ -295,6 +295,17 @@ int vfs_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;
 }
@@ -517,7 +528,7 @@ SYSCALL_DEFINE2(fchmod, unsigned int, fd, umode_t, mode)
        int err = -EBADF;
 
        if (f.file) {
-               audit_inode(NULL, f.file->f_path.dentry, 0);
+               audit_file(f.file);
                err = chmod_common(&f.file->f_path, mode);
                fdput(f);
        }
@@ -643,7 +654,7 @@ SYSCALL_DEFINE3(fchown, unsigned int, fd, uid_t, user, gid_t, group)
        error = mnt_want_write_file(f.file);
        if (error)
                goto out_fput;
-       audit_inode(NULL, f.file->f_path.dentry, 0);
+       audit_file(f.file);
        error = chown_common(&f.file->f_path, user, group);
        mnt_drop_write_file(f.file);
 out_fput: