Skip to contentSkip to conversation

gfs2: if finish_open returns error, clean up iopen glock mess

PATCH Superseded Bob Peterson 1 participant 1 message Nov 15, 2019 1 message not in the archive GFS2 file system

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

PATCH 1/1 gfs2: if finish_open returns error, clean up iopen glock mess

Hi,

Before this patch, if anything went wrong in function gfs2_create_inode it would goto fail_gunlock3 and clean up the iopen glock it had just created and locked. However, if function finish_open returns an error it did not. That meant subsequent attempts to create the file were seen as glock recursion errors on the iopen glock.

This patch adds additional checking for an error from finish_open and cleans up the iopen glock appropriately.

---
 fs/gfs2/inode.c | 6 ++++++
 1 file changed, 6 insertions(+)
fs/gfs2/inode.c +6 -0
index dcb5d363f9b9..acfc57e1cb53 100644
@@ -772,6 +772,12 @@ static int gfs2_create_inode(struct inode *dir, struct dentry *dentry,
 	gfs2_glock_dq_uninit(ghs);
 	gfs2_glock_dq_uninit(ghs + 1);
 	clear_bit(GLF_INODE_CREATING, &io_gl->gl_flags);
+	if (error) {
+		glock_clear_object(io_gl, ip);
+		clear_bit(GLF_INODE_CREATING, &io_gl->gl_flags);
+		gfs2_glock_dq_uninit(&ip->i_iopen_gh);
+		gfs2_glock_put(io_gl);
+	}
 	return error;
 
 fail_gunlock3: