gfs2: Only do glock put in gfs2_create_inode for free inodes
authorBob Peterson <rpeterso@redhat.com>
Mon, 1 Jun 2020 15:37:09 +0000 (11:37 -0400)
committerAndreas Gruenbacher <agruenba@redhat.com>
Tue, 2 Jun 2020 19:23:55 +0000 (21:23 +0200)
commit1a0b00d15d4005390b74154e98822fc7d36d36cd
tree0d671aa212844ec12431f8a86be8bcf9f34c73cd
parentea22eee4e6027d8927099de344f7fff43c507ef9
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 <rpeterso@redhat.com>
Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
fs/gfs2/inode.c