From: Bob Peterson Date: Tue, 18 Jul 2017 13:23:04 -0500 Subject: [Cluster-devel] [PATCH 3/4] GFS2: Clear gl_object if gfs2_create_inode fails In-Reply-To: <20170718182305.27798-1-rpeterso@redhat.com> References: <20170718182305.27798-1-rpeterso@redhat.com> Message-ID: <20170718182305.27798-4-rpeterso@redhat.com> List-Id: To: cluster-devel.redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 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 --- fs/gfs2/inode.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fs/gfs2/inode.c b/fs/gfs2/inode.c index 69f66e83920a..e366c634e22d 100644 --- a/fs/gfs2/inode.c +++ b/fs/gfs2/inode.c @@ -776,11 +776,13 @@ static int gfs2_create_inode(struct inode *dir, struct dentry *dentry, return error; fail_gunlock3: + glock_clear_object(io_gl, ip); gfs2_glock_dq_uninit(&ip->i_iopen_gh); gfs2_glock_put(io_gl); fail_gunlock2: if (io_gl) clear_bit(GLF_INODE_CREATING, &io_gl->gl_flags); + glock_clear_object(ip->i_gl, ip); fail_free_inode: if (ip->i_gl) gfs2_glock_put(ip->i_gl); -- 2.13.3