Skip to contentSkip to conversation

GFS2: Add calls to gfs2_holder_uninit in two error handlers

PATCH New Daniel DeFreez 2 participants 3 messages Apr 15, 2016 – Apr 20, 2016 GFS2 file system

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 GFS2: Add calls to gfs2_holder_uninit in two error handlers

This is a follow-up patch to the question I asked yesterday. These are the two locations I am aware of that do not call gfs2_holder_uninit if gfs2_glock_nq returns an error.

---
 fs/gfs2/aops.c | 3 ++-
 fs/gfs2/file.c | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)
fs/gfs2/aops.c +2 -1
index 1bbbee9..68100df 100644
@@ -1063,7 +1063,7 @@ static ssize_t gfs2_direct_IO(struct kiocb *iocb, struct iov_iter *iter,
 	gfs2_holder_init(ip->i_gl, LM_ST_DEFERRED, 0, &gh);
 	rv = gfs2_glock_nq(&gh);
 	if (rv)
-		return rv;
+		goto out_uninit;
 	rv = gfs2_ok_for_dio(ip, offset);
 	if (rv != 1)
 		goto out; /* dio not valid, fall back to buffered i/o */
@@ -1102,6 +1102,7 @@ static ssize_t gfs2_direct_IO(struct kiocb *iocb, struct iov_iter *iter,
 				  offset, gfs2_get_block_direct, NULL, NULL, 0);
 out:
 	gfs2_glock_dq(&gh);
+out_uninit:
 	gfs2_holder_uninit(&gh);
 	return rv;
 }
fs/gfs2/file.c +2 -1
index 208efc7..97443fc 100644
@@ -160,7 +160,7 @@ static int gfs2_get_flags(struct file *filp, u32 __user *ptr)
 	gfs2_holder_init(ip->i_gl, LM_ST_SHARED, 0, &gh);
 	error = gfs2_glock_nq(&gh);
 	if (error)
-		return error;
+		goto out_uninit;
 
 	fsflags = fsflags_cvt(gfs2_to_fsflags, ip->i_diskflags);
 	if (!S_ISDIR(inode->i_mode) && ip->i_diskflags & GFS2_DIF_JDATA)
@@ -169,6 +169,7 @@ static int gfs2_get_flags(struct file *filp, u32 __user *ptr)
 		error = -EFAULT;
 
 	gfs2_glock_dq(&gh);
+out_uninit:
 	gfs2_holder_uninit(&gh);
 	return error;
 }
Signature · 1 line
2.7.3
#1 lore raw

PATCH 1/1 GFS2: Add calls to gfs2_holder_uninit in two error handlers

----- Original Message -----

Quoted 5 lines

This is a follow-up patch to the question I asked yesterday. These are the two locations I am aware of that do not call gfs2_holder_uninit if gfs2_glock_nq returns an error.

Hi Daniel,

Your patch looks good. I'm currently at the LSF conference, so I'm a bit distracted this week, but hopefully I'll push it to the upstream repository soon.

Regards,

Bob Peterson
Red Hat File Systems

#2 lore raw

PATCH 1/1 GFS2: Add calls to gfs2_holder_uninit in two error handlers

In reply to Daniel DeFreez

----- Original Message -----

Quoted 5 lines

This is a follow-up patch to the question I asked yesterday. These are the two locations I am aware of that do not call gfs2_holder_uninit if gfs2_glock_nq returns an error.

Hi Daniel,

Thanks. Your patch is now applied to the for-next branch of the linux-gfs2 tree:
https://git.kernel.org/cgit/linux/kernel/git/gfs2/linux-gfs2.git/commit/fs/gfs2?h=for-next&id=9c7fe83530a351845719acf1dda0587e8c743588

Regards,

Bob Peterson
Red Hat File Systems