Commit 9c1b2808 authored by Bob Peterson's avatar Bob Peterson

GFS2: Clear gl_object if gfs2_create_inode fails

If function gfs2_create_inode fails after the inode has been
created (for example, if the inode_refresh fails for some reason)
the function was setting gl_object but never clearing it again.
The glocks are left pointing to a freed inode. This patch adds
the calls to clear gl_object in the appropriate error paths.
Signed-off-by: default avatarBob Peterson <rpeterso@redhat.com>
Reviewed-by: default avatarAndreas Gruenbacher <agruenba@redhat.com>
parent 4d7c18c7
...@@ -775,14 +775,17 @@ static int gfs2_create_inode(struct inode *dir, struct dentry *dentry, ...@@ -775,14 +775,17 @@ static int gfs2_create_inode(struct inode *dir, struct dentry *dentry,
return error; return error;
fail_gunlock3: fail_gunlock3:
glock_clear_object(io_gl, ip);
gfs2_glock_dq_uninit(&ip->i_iopen_gh); gfs2_glock_dq_uninit(&ip->i_iopen_gh);
gfs2_glock_put(io_gl); gfs2_glock_put(io_gl);
fail_gunlock2: fail_gunlock2:
if (io_gl) if (io_gl)
clear_bit(GLF_INODE_CREATING, &io_gl->gl_flags); clear_bit(GLF_INODE_CREATING, &io_gl->gl_flags);
fail_free_inode: fail_free_inode:
if (ip->i_gl) if (ip->i_gl) {
glock_clear_object(ip->i_gl, ip);
gfs2_glock_put(ip->i_gl); gfs2_glock_put(ip->i_gl);
}
gfs2_rsqa_delete(ip, NULL); gfs2_rsqa_delete(ip, NULL);
fail_free_acls: fail_free_acls:
if (default_acl) if (default_acl)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment