linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] jbd2: clear BH_Delay & BH_Unwritten in journal_unmap_buffer
@ 2012-02-07 22:07 Eric Sandeen
  2012-02-08  4:34 ` Eric Sandeen
  2012-02-09  3:12 ` Ted Ts'o
  0 siblings, 2 replies; 3+ messages in thread
From: Eric Sandeen @ 2012-02-07 22:07 UTC (permalink / raw)
  To: ext4 development

journal_unmap_buffer()'s zap_buffer: code clears a lot of buffer head
state ala discard_buffer(), but does not touch _Delay or _Unwritten
as discard_buffer() does.

This can be problematic in some areas of the ext4 code which assume
that if they have found a buffer marked unwritten or delay, then it's
a live one.  Perhaps those spots should check whether it is mapped
as well, but if jbd2 is going to tear down a buffer, let's really
tear it down completely.

Without this I get some fsx failures on sub-page-block filesystems
up until v3.2, at which point 4e96b2dbbf1d7e81f22047a50f862555a6cb87cb
and 189e868fa8fdca702eb9db9d8afc46b5cb9144c9 make the failures go
away, because buried within that large change is some more flag
clearing.  I still think it's worth doing in jbd2, since
->invalidatepage leads here directly, and it's the right place
to clear away these flags.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Cc: stable@vger.kernel.org
---

diff --git a/fs/jbd2/transaction.c b/fs/jbd2/transaction.c
index 35ae096..52653306 100644
--- a/fs/jbd2/transaction.c
+++ b/fs/jbd2/transaction.c
@@ -1949,6 +1949,8 @@ zap_buffer_unlocked:
 	clear_buffer_mapped(bh);
 	clear_buffer_req(bh);
 	clear_buffer_new(bh);
+	clear_buffer_delay(bh);
+	clear_buffer_unwritten(bh);
 	bh->b_bdev = NULL;
 	return may_free;
 }



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

* Re: [PATCH] jbd2: clear BH_Delay & BH_Unwritten in journal_unmap_buffer
  2012-02-07 22:07 [PATCH] jbd2: clear BH_Delay & BH_Unwritten in journal_unmap_buffer Eric Sandeen
@ 2012-02-08  4:34 ` Eric Sandeen
  2012-02-09  3:12 ` Ted Ts'o
  1 sibling, 0 replies; 3+ messages in thread
From: Eric Sandeen @ 2012-02-08  4:34 UTC (permalink / raw)
  To: ext4 development

On 2/7/12 4:07 PM, Eric Sandeen wrote:
> journal_unmap_buffer()'s zap_buffer: code clears a lot of buffer head
> state ala discard_buffer(), but does not touch _Delay or _Unwritten
> as discard_buffer() does.
> 
> This can be problematic in some areas of the ext4 code which assume
> that if they have found a buffer marked unwritten or delay, then it's
> a live one.  Perhaps those spots should check whether it is mapped
> as well, but if jbd2 is going to tear down a buffer, let's really
> tear it down completely.
> 
> Without this I get some fsx failures on sub-page-block filesystems
> up until v3.2, at which point 4e96b2dbbf1d7e81f22047a50f862555a6cb87cb
> and 189e868fa8fdca702eb9db9d8afc46b5cb9144c9 make the failures go
> away, because buried within that large change is some more flag
> clearing.  I still think it's worth doing in jbd2, since
> ->invalidatepage leads here directly, and it's the right place
> to clear away these flags.

Addresses CVE-2011-4086 BTW.

> Signed-off-by: Eric Sandeen <sandeen@redhat.com>
> Cc: stable@vger.kernel.org
> ---
> 
> diff --git a/fs/jbd2/transaction.c b/fs/jbd2/transaction.c
> index 35ae096..52653306 100644
> --- a/fs/jbd2/transaction.c
> +++ b/fs/jbd2/transaction.c
> @@ -1949,6 +1949,8 @@ zap_buffer_unlocked:
>  	clear_buffer_mapped(bh);
>  	clear_buffer_req(bh);
>  	clear_buffer_new(bh);
> +	clear_buffer_delay(bh);
> +	clear_buffer_unwritten(bh);
>  	bh->b_bdev = NULL;
>  	return may_free;
>  }
> 
> 
> --
> 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


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

* Re: [PATCH] jbd2: clear BH_Delay & BH_Unwritten in journal_unmap_buffer
  2012-02-07 22:07 [PATCH] jbd2: clear BH_Delay & BH_Unwritten in journal_unmap_buffer Eric Sandeen
  2012-02-08  4:34 ` Eric Sandeen
@ 2012-02-09  3:12 ` Ted Ts'o
  1 sibling, 0 replies; 3+ messages in thread
From: Ted Ts'o @ 2012-02-09  3:12 UTC (permalink / raw)
  To: Eric Sandeen; +Cc: ext4 development

On Tue, Feb 07, 2012 at 04:07:20PM -0600, Eric Sandeen wrote:
> journal_unmap_buffer()'s zap_buffer: code clears a lot of buffer head
> state ala discard_buffer(), but does not touch _Delay or _Unwritten
> as discard_buffer() does.
> 
> This can be problematic in some areas of the ext4 code which assume
> that if they have found a buffer marked unwritten or delay, then it's
> a live one.  Perhaps those spots should check whether it is mapped
> as well, but if jbd2 is going to tear down a buffer, let's really
> tear it down completely.
> 
> Without this I get some fsx failures on sub-page-block filesystems
> up until v3.2, at which point 4e96b2dbbf1d7e81f22047a50f862555a6cb87cb
> and 189e868fa8fdca702eb9db9d8afc46b5cb9144c9 make the failures go
> away, because buried within that large change is some more flag
> clearing.  I still think it's worth doing in jbd2, since
> ->invalidatepage leads here directly, and it's the right place
> to clear away these flags.
> 
> Signed-off-by: Eric Sandeen <sandeen@redhat.com>
> Cc: stable@vger.kernel.org

Thanks, applied.

					- Ted

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

end of thread, other threads:[~2012-02-09  3:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-02-07 22:07 [PATCH] jbd2: clear BH_Delay & BH_Unwritten in journal_unmap_buffer Eric Sandeen
2012-02-08  4:34 ` Eric Sandeen
2012-02-09  3:12 ` Ted Ts'o

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).