aboutsummaryrefslogtreecommitdiffstats
path: root/fs/gfs2/inode.c
diff options
context:
space:
mode:
authorBob Peterson <rpeterso@redhat.com>2017-07-18 13:26:07 -0400
committerBob Peterson <rpeterso@redhat.com>2017-08-09 10:36:26 -0400
commit9c1b28081f43c0f14ccbcad02a6e0f227c072da2 (patch)
treebba27d1d2d13615052798da96a320dfcfd083aa3 /fs/gfs2/inode.c
parent4d7c18c7df89ef549f2de79b0faf873b49dea57a (diff)
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: Bob Peterson <rpeterso@redhat.com> Reviewed-by: Andreas Gruenbacher <agruenba@redhat.com>
Diffstat (limited to 'fs/gfs2/inode.c')
-rw-r--r--fs/gfs2/inode.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/fs/gfs2/inode.c b/fs/gfs2/inode.c
index fd6e1da3c5ab..1427328c6c86 100644
--- a/fs/gfs2/inode.c
+++ b/fs/gfs2/inode.c
@@ -775,14 +775,17 @@ static int gfs2_create_inode(struct inode *dir, struct dentry *dentry,
775 return error; 775 return error;
776 776
777fail_gunlock3: 777fail_gunlock3:
778 glock_clear_object(io_gl, ip);
778 gfs2_glock_dq_uninit(&ip->i_iopen_gh); 779 gfs2_glock_dq_uninit(&ip->i_iopen_gh);
779 gfs2_glock_put(io_gl); 780 gfs2_glock_put(io_gl);
780fail_gunlock2: 781fail_gunlock2:
781 if (io_gl) 782 if (io_gl)
782 clear_bit(GLF_INODE_CREATING, &io_gl->gl_flags); 783 clear_bit(GLF_INODE_CREATING, &io_gl->gl_flags);
783fail_free_inode: 784fail_free_inode:
784 if (ip->i_gl) 785 if (ip->i_gl) {
786 glock_clear_object(ip->i_gl, ip);
785 gfs2_glock_put(ip->i_gl); 787 gfs2_glock_put(ip->i_gl);
788 }
786 gfs2_rsqa_delete(ip, NULL); 789 gfs2_rsqa_delete(ip, NULL);
787fail_free_acls: 790fail_free_acls:
788 if (default_acl) 791 if (default_acl)