All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ext4: fix unbalanced up_write() in ext4_ext_truncate() error path
@ 2011-05-10 18:12 Eric Gouriou
  2011-05-23  1:43 ` Ted Ts'o
  0 siblings, 1 reply; 2+ messages in thread
From: Eric Gouriou @ 2011-05-10 18:12 UTC (permalink / raw)
  To: Theodore Ts'o; +Cc: linux-ext4, Eric Gouriou

ext4_ext_truncate() should not invoke up_write(&EXT4_I(inode)->i_data_sem)
when ext4_orphan_add() returns an error, as it hasn't performed a
down_write() yet. This trivial patch fixes this by moving the up_write()
invocation above the out_stop label.

Signed-off-by: Eric Gouriou <egouriou@google.com>
---
 fs/ext4/extents.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
index e363f21..ae3c9e6 100644
--- a/fs/ext4/extents.c
+++ b/fs/ext4/extents.c
@@ -3443,8 +3443,9 @@ void ext4_ext_truncate(struct inode *inode)
 	if (IS_SYNC(inode))
 		ext4_handle_sync(handle);
 
-out_stop:
 	up_write(&EXT4_I(inode)->i_data_sem);
+
+out_stop:
 	/*
 	 * If this was a simple ftruncate() and the file will remain alive,
 	 * then we need to clear up the orphan record which we created above.
-- 
1.7.3.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] ext4: fix unbalanced up_write() in ext4_ext_truncate() error path
  2011-05-10 18:12 [PATCH] ext4: fix unbalanced up_write() in ext4_ext_truncate() error path Eric Gouriou
@ 2011-05-23  1:43 ` Ted Ts'o
  0 siblings, 0 replies; 2+ messages in thread
From: Ted Ts'o @ 2011-05-23  1:43 UTC (permalink / raw)
  To: Eric Gouriou; +Cc: linux-ext4

On Tue, May 10, 2011 at 11:12:57AM -0700, Eric Gouriou wrote:
> ext4_ext_truncate() should not invoke up_write(&EXT4_I(inode)->i_data_sem)
> when ext4_orphan_add() returns an error, as it hasn't performed a
> down_write() yet. This trivial patch fixes this by moving the up_write()
> invocation above the out_stop label.
> 
> Signed-off-by: Eric Gouriou <egouriou@google.com>

Thanks, applied to the ext4 tree!

					- Ted

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-05-23  1:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-05-10 18:12 [PATCH] ext4: fix unbalanced up_write() in ext4_ext_truncate() error path Eric Gouriou
2011-05-23  1:43 ` Ted Ts'o

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.