From: Bob Peterson <rpeterso@redhat.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [PATCH 3/4] GFS2: Clear gl_object if gfs2_create_inode fails
Date: Tue, 18 Jul 2017 13:23:04 -0500 [thread overview]
Message-ID: <20170718182305.27798-4-rpeterso@redhat.com> (raw)
In-Reply-To: <20170718182305.27798-1-rpeterso@redhat.com>
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>
---
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
next prev parent reply other threads:[~2017-07-18 18:23 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-18 18:23 [Cluster-devel] [PATCH 0/4] GFS2: Enforce gl_object integrity Bob Peterson
2017-07-18 18:23 ` [Cluster-devel] [PATCH 1/4] GFS2: Introduce helper for clearing gl_object Bob Peterson
2017-08-30 11:15 ` Andreas Gruenbacher
2017-08-30 13:18 ` Bob Peterson
2017-07-18 18:23 ` [Cluster-devel] [PATCH 2/4] GFS2: Set gl_object in inode lookup only after block type check Bob Peterson
2017-07-18 18:53 ` Bob Peterson
2017-07-18 18:23 ` Bob Peterson [this message]
2017-07-18 18:23 ` [Cluster-devel] [PATCH 4/4] GFS2: Clear gl_object when deleting an inode in gfs2_delete_inode Bob Peterson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170718182305.27798-4-rpeterso@redhat.com \
--to=rpeterso@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).