This is a note to let you know that I've just added the patch titled fsnotify: replace igrab() with ihold() on attach connector to the 5.10-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: fsnotify-replace-igrab-with-ihold-on-attach-connecto.patch and it can be found in the queue-5.10 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. commit 9e9faa98289c361324c9508f83eb20698e12ba10 Author: Amir Goldstein <amir73il@xxxxxxxxx> Date: Tue Aug 10 18:12:17 2021 +0300 fsnotify: replace igrab() with ihold() on attach connector [ Upstream commit 09ddbe69c9925b42cb9529f60678c25b241d8b18 ] We must have a reference on inode, so ihold is cheaper. Link: https://lore.kernel.org/r/20210810151220.285179-2-amir73il@xxxxxxxxx Reviewed-by: Matthew Bobrowski <repnop@xxxxxxxxxx> Signed-off-by: Amir Goldstein <amir73il@xxxxxxxxx> Signed-off-by: Jan Kara <jack@xxxxxxx> Signed-off-by: Chuck Lever <chuck.lever@xxxxxxxxxx> Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx> diff --git a/fs/notify/mark.c b/fs/notify/mark.c index 7af98a7c33c27..3c8fc77d3f072 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