Patchwork [-next] ext4: fix missing unlock on error in ext4_punch_hole()

login
register
mail settings
Submitter Wei Yongjun
Date June 18, 2013, 3:40 a.m.
Message ID <CAPgLHd-2_uHg9q_7nQway8uCigH=wgXxiGm9auYDNL_pByzJHA@mail.gmail.com>
Download mbox | patch
Permalink /patch/252104/
State Accepted
Headers show

Comments

Wei Yongjun - June 18, 2013, 3:40 a.m.
From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>

Add the missing unlock before return from function ext4_punch_hole()
in the error handling case.
Introduced by commit 1cdec9ca46c2c2a7ce452659f43dac64ad5fbc85.
(ext4: Avoid unnecessarily writing back dirty pages before hole punching)

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
---
 fs/ext4/inode.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)


--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Theodore Ts'o - June 18, 2013, 3:05 p.m.
On Tue, Jun 18, 2013 at 11:40:34AM +0800, Wei Yongjun wrote:
> From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
> 
> Add the missing unlock before return from function ext4_punch_hole()
> in the error handling case.
> Introduced by commit 1cdec9ca46c2c2a7ce452659f43dac64ad5fbc85.
> (ext4: Avoid unnecessarily writing back dirty pages before hole punching)
> 
> Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>

Hi Wei,

Thanks for pointing this out!  I've folded this patch into the commit
"ext4: avoid unnecessarily writing back dirty pages before hole
punching".

					- Ted
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index 2644679..06136b5 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -3538,7 +3538,7 @@  int ext4_punch_hole(struct file *file, loff_t offset, loff_t length)
 	if (ext4_should_order_data(inode)) {
 		ret = ext4_begin_ordered_punch_hole(inode, offset, length);
 		if (ret)
-			return ret;
+			goto out_mutex;
 	}
 
 	/* Now release the pages and zero block aligned part of pages*/