GFS2: Don't do glock put on when inode creation fails
authorBob Peterson <rpeterso@redhat.com>
Fri, 4 Dec 2015 19:04:34 +0000 (13:04 -0600)
committerBob Peterson <rpeterso@redhat.com>
Fri, 18 Dec 2015 17:04:46 +0000 (11:04 -0600)
Currently the error path of function gfs2_inode_lookup calls function
gfs2_glock_put corresponding to an earlier call to gfs2_glock_get for
the inode glock. That's wrong because the error path also calls
iget_failed() which eventually calls iput, which eventually calls
gfs2_evict_inode, which does another gfs2_glock_put. This double-put
can cause the glock reference count to get off.

Signed-off-by: Bob Peterson <rpeterso@redhat.com>
fs/gfs2/inode.c

index 87fa5992e12a81e97b82b4741b73a98402b52499..009b551a5d8cdf0a019e184922a3bf934f578738 100644 (file)
@@ -198,7 +198,6 @@ fail_iopen:
                gfs2_glock_put(io_gl);
 fail_put:
        ip->i_gl->gl_object = NULL;
-       gfs2_glock_put(ip->i_gl);
 fail:
        iget_failed(inode);
        return ERR_PTR(error);