linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Gurudas Pai <gurudas.pai@oracle.com>
To: Travis Shivers <ttshivers@gmail.com>
Cc: linux-btrfs@vger.kernel.org
Subject: Re: Btrfs Storage Array Corrupted
Date: Tue, 28 Feb 2012 17:41:45 -0800	[thread overview]
Message-ID: <4F4D8259.2090209@oracle.com> (raw)
In-Reply-To: <CAPeorG-1EtMAu9XzSNqMW-=QwhN-_bZorLXy9Pr5N+J-LKPzTg@mail.gmail.com>



># btrfs-debug-tree /dev/sdh
couldn't open because of unsupported option features (8).
btrfs-debug-tree: disk-io.c:679: open_ctree_fd: Assertion `!(1)' failed




See if following patch helps.

Author: Chris Mason<chris.mason@oracle.com>
Date:   Wed Feb 22 12:36:24 2012 -0500

     Btrfs: clear the extent uptodate bits during parent transid failures

     If btrfs reads a block and finds a parent transid mismatch, it clears
     the uptodate flags on the extent buffer, and the pages inside it.  But
     we only clear the uptodate bits in the state tree if the block straddles
     more than one page.

     This is from an old optimization from to reduce contention on the extent
     state tree.  But it is buggy because the code that retries a read from
     a different copy of the block is going to find the uptodate state bits
     set and skip the IO.

     The end result of the bug is that we'll never actually read the good
     copy (if there is one).

     The fix here is to always clear the uptodate state bits, which is safe
     because this code is only called when the parent transid fails.

     Signed-off-by: Chris Mason<chris.mason@oracle.com>

diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
index 1e8d5e5..a4dc892 100644
--- a/fs/btrfs/extent_io.c
+++ b/fs/btrfs/extent_io.c
@@ -3852,10 +3852,9 @@ int clear_extent_buffer_uptodate(struct extent_io_tree *tree,
  	num_pages = num_extent_pages(eb->start, eb->len);
  	clear_bit(EXTENT_BUFFER_UPTODATE,&eb->bflags);

-	if (eb_straddles_pages(eb)) {
-		clear_extent_uptodate(tree, eb->start, eb->start + eb->len - 1,
-				      cached_state, GFP_NOFS);
-	}
+	clear_extent_uptodate(tree, eb->start, eb->start + eb->len - 1,
+			      cached_state, GFP_NOFS);
+
  	for (i = 0; i<  num_pages; i++) {
  		page = extent_buffer_page(eb, i);
  		if (page)
--


  parent reply	other threads:[~2012-02-29  1:41 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-29  0:13 Btrfs Storage Array Corrupted Travis Shivers
2012-02-29  0:34 ` Fajar A. Nugraha
2012-02-29  1:41 ` Gurudas Pai [this message]
2012-02-29  2:50   ` Chris Mason
2012-02-29  3:00     ` Travis Shivers
2012-02-29  3:16       ` cwillu
2012-02-29  3:36         ` Travis Shivers
2012-02-29 13:59           ` Chris Mason
2012-02-29 21:57             ` Travis Shivers
2012-02-29 22:14               ` Chris Mason
2012-02-29 23:11                 ` Travis Shivers
2012-02-29 23:44                   ` Chris Mason
2012-02-29 23:58                     ` Travis Shivers
2012-03-16 17:30                       ` Travis Shivers
     [not found]                       ` <CAPeorG-Zrr-fTaYmHHKQ5=0jL9ZqjbTypGzo7je3g=MJDPmXcA@mail.gmail.com>
2012-03-26 23:15                         ` Travis Shivers

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4F4D8259.2090209@oracle.com \
    --to=gurudas.pai@oracle.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=ttshivers@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).