Skip to content

Commit

Permalink
fsnotify: replace igrab() with ihold() on attach connector
Browse files Browse the repository at this point in the history
We must have a reference on inode, so ihold is cheaper.

Link: https://lore.kernel.org/r/[email protected]
Reviewed-by: Matthew Bobrowski <[email protected]>
Signed-off-by: Amir Goldstein <[email protected]>
Signed-off-by: Jan Kara <[email protected]>
  • Loading branch information
amir73il authored and jankara committed Aug 11, 2021
1 parent af579be commit 09ddbe6
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions fs/notify/mark.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 09ddbe6

Please sign in to comment.