rpc_pipefs: call fsnotify_{unlink,rmdir}() hooks [Linux 5.3]

This Linux kernel change "rpc_pipefs: call fsnotify_{unlink,rmdir}() hooks" is included in the Linux 5.3 release. This change is authored by Amir Goldstein <amir73il [at] gmail.com> on Sun May 26 17:34:04 2019 +0300. The commit for this change in Linux stable tree is a35d632 (patch).

rpc_pipefs: call fsnotify_{unlink,rmdir}() hooks

This will allow generating fsnotify delete events after the
fsnotify_nameremove() hook is removed from d_delete().

Cc: Trond Myklebust <trond.myklebust@hammerspace.com>
Cc: Anna Schumaker <anna.schumaker@netapp.com>
Reviewed-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Jan Kara <jack@suse.cz>

There are 4 lines of Linux source code added/deleted in this change. Code changes to Linux kernel are as follows.

 net/sunrpc/rpc_pipe.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/net/sunrpc/rpc_pipe.c b/net/sunrpc/rpc_pipe.c
index 126d314..73bd629 100644
--- a/net/sunrpc/rpc_pipe.c
+++ b/net/sunrpc/rpc_pipe.c
@@ -598,6 +598,8 @@ static int __rpc_rmdir(struct inode *dir, struct dentry *dentry)

    dget(dentry);
    ret = simple_rmdir(dir, dentry);
+   if (!ret)
+       fsnotify_rmdir(dir, dentry);
    d_delete(dentry);
    dput(dentry);
    return ret;
@@ -609,6 +611,8 @@ static int __rpc_unlink(struct inode *dir, struct dentry *dentry)

    dget(dentry);
    ret = simple_unlink(dir, dentry);
+   if (!ret)
+       fsnotify_unlink(dir, dentry);
    d_delete(dentry);
    dput(dentry);
    return ret;

Leave a Reply

Your email address will not be published. Required fields are marked *