linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Josef Bacik <josef@redhat.com>
To: linux-btrfs@vger.kernel.org
Subject: [PATCH 6/7] Btrfs: fix btrfs_destroy_marked_extents
Date: Fri,  1 Jun 2012 09:55:54 -0400	[thread overview]
Message-ID: <1338558955-4944-7-git-send-email-josef@redhat.com> (raw)
In-Reply-To: <1338558955-4944-1-git-send-email-josef@redhat.com>

So we're forcing the eb's to have their ref count set to 1 so invalidatepage
works but this breaks lots of things, for example root nodes, and is just
plain wrong, we don't need to just evict all of this stuff.  Also drop the
invalidatepage altogether and add a page_cache_release().  With this patch
we no longer hang when trying to access the root nodes after an aborted
transaction and we no longer leak memory.  Thanks,

Signed-off-by: Josef Bacik <josef@redhat.com>
---
 fs/btrfs/disk-io.c |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index 050db9b..ea2b1d2 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -3519,11 +3519,9 @@ static int btrfs_destroy_marked_extents(struct btrfs_root *root,
 			     &(&BTRFS_I(page->mapping->host)->io_tree)->buffer,
 					       offset >> PAGE_CACHE_SHIFT);
 			spin_unlock(&dirty_pages->buffer_lock);
-			if (eb) {
+			if (eb)
 				ret = test_and_clear_bit(EXTENT_BUFFER_DIRTY,
 							 &eb->bflags);
-				atomic_set(&eb->refs, 1);
-			}
 			if (PageWriteback(page))
 				end_page_writeback(page);
 
@@ -3537,8 +3535,8 @@ static int btrfs_destroy_marked_extents(struct btrfs_root *root,
 				spin_unlock_irq(&page->mapping->tree_lock);
 			}
 
-			page->mapping->a_ops->invalidatepage(page, 0);
 			unlock_page(page);
+			page_cache_release(page);
 		}
 	}
 
-- 
1.7.7.6


  parent reply	other threads:[~2012-06-01 13:56 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-01 13:55 Transaction abort fixes Josef Bacik
2012-06-01 13:55 ` [PATCH 1/7] Btrfs: pass locked_page into extent_clear_unlock_delalloc if theres an error Josef Bacik
2012-06-01 13:55 ` [PATCH 2/7] Btrfs: fix locking in btrfs_destroy_delayed_refs Josef Bacik
2012-06-01 13:55 ` [PATCH 3/7] Btrfs: check the return code of btrfs_save_ino_cache Josef Bacik
2012-06-04 18:07   ` Josef Bacik
2012-06-01 13:55 ` [PATCH 4/7] Btrfs: wake up transaction waiters when aborting a transaction Josef Bacik
2012-06-01 13:55 ` [PATCH 5/7] Btrfs: abort the transaction if the commit fails Josef Bacik
2012-06-01 13:55 ` Josef Bacik [this message]
2012-06-01 13:55 ` [PATCH 7/7] Btrfs: unlock everything properly in the error case for nocow Josef Bacik

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=1338558955-4944-7-git-send-email-josef@redhat.com \
    --to=josef@redhat.com \
    --cc=linux-btrfs@vger.kernel.org \
    /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).