From: Bob Peterson Date: Mon, 1 Jun 2020 15:37:09 +0000 (-0400) Subject: gfs2: Only do glock put in gfs2_create_inode for free inodes X-Git-Tag: v5.8-rc1~89^2~7 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=1a0b00d15d4005390b74154e98822fc7d36d36cd;p=thirdparty%2Fkernel%2Flinux.git gfs2: Only do glock put in gfs2_create_inode for free inodes Before this patch, the error path of function gfs2_create_inode would always calls gfs2_glock_put for the inode glock. That's good for inodes that are free. But after they've been added to the vfs inodes, errors will cause the inode to be evicted, and the evict will do the glock put for us. If we do a glock put again, we can try to free the glock while there are still references to it, e.g. revokes pending for the transaction that created it. This patch adds a check: if (free_vfs_inode) before the put, thus solving the problem. Signed-off-by: Bob Peterson Signed-off-by: Andreas Gruenbacher --- diff --git a/fs/gfs2/inode.c b/fs/gfs2/inode.c index 5acd3ce30759b..e3a27fd284dd1 100644 --- a/fs/gfs2/inode.c +++ b/fs/gfs2/inode.c @@ -780,7 +780,8 @@ fail_gunlock2: fail_free_inode: if (ip->i_gl) { glock_clear_object(ip->i_gl, ip); - gfs2_glock_put(ip->i_gl); + if (free_vfs_inode) /* else evict will do the put for us */ + gfs2_glock_put(ip->i_gl); } gfs2_rs_delete(ip, NULL); gfs2_qa_put(ip);