diff options
author | Amir Goldstein <amir73il@gmail.com> | 2021-08-10 17:12:17 +0200 |
---|---|---|
committer | Jan Kara <jack@suse.cz> | 2021-08-11 13:50:28 +0200 |
commit | 09ddbe69c9925b42cb9529f60678c25b241d8b18 (patch) | |
tree | 493f36edb663f201b75ade8fbee8efa865086264 /fs/notify | |
parent | fanotify: add pidfd support to the fanotify API (diff) | |
download | linux-09ddbe69c9925b42cb9529f60678c25b241d8b18.tar.xz linux-09ddbe69c9925b42cb9529f60678c25b241d8b18.zip |
fsnotify: replace igrab() with ihold() on attach connector
We must have a reference on inode, so ihold is cheaper.
Link: https://lore.kernel.org/r/20210810151220.285179-2-amir73il@gmail.com
Reviewed-by: Matthew Bobrowski <repnop@google.com>
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'fs/notify')
-rw-r--r-- | fs/notify/mark.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/fs/notify/mark.c b/fs/notify/mark.c index d32ab349db74..80459db58f63 100644 --- a/fs/notify/mark.c +++ b/fs/notify/mark.c @@ -493,8 +493,11 @@ static int fsnotify_attach_connector_to_object(fsnotify_connp_t *connp, conn->fsid.val[0] = conn->fsid.val[1] = 0; conn->flags = 0; } - if (conn->type == FSNOTIFY_OBJ_TYPE_INODE) - inode = igrab(fsnotify_conn_inode(conn)); + if (conn->type == FSNOTIFY_OBJ_TYPE_INODE) { + inode = fsnotify_conn_inode(conn); + ihold(inode); + } + /* * cmpxchg() provides the barrier so that readers of *connp can see * only initialized structure |