public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
From: "Yan Zheng" <yanzheng@21cn.com>
To: linux-btrfs@vger.kernel.org
Subject: [Btrfs-devel][PATCH] Properly release lock in pin_down_bytes
Date: Fri, 11 Jul 2008 03:20:51 +0800	[thread overview]
Message-ID: <3d0408630807101220l562b23caxe08afbaff27c1913@mail.gmail.com> (raw)

Hello,

When buffer isn't uptodate, pin_down_bytes may leave the tree locked
after it returns.

Regards
YZ
---
diff -r 3f0eee804974 extent-tree.c
--- a/extent-tree.c	Thu Jun 26 10:34:20 2008 -0400
+++ b/extent-tree.c	Fri Jul 11 03:20:00 2008 +0800
@@ -1441,8 +1441,8 @@ static int pin_down_bytes(struct btrfs_r
 		struct extent_buffer *buf;
 		buf = btrfs_find_tree_block(root, bytenr, num_bytes);
 		if (buf) {
-			if (!btrfs_try_tree_lock(buf) &&
-			    btrfs_buffer_uptodate(buf, 0)) {
+			if (btrfs_buffer_uptodate(buf, 0) &&
+			    !btrfs_try_tree_lock(buf)) {
 				u64 transid =
 				    root->fs_info->running_transaction->transid;
 				u64 header_transid =

                 reply	other threads:[~2008-07-10 19:20 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=3d0408630807101220l562b23caxe08afbaff27c1913@mail.gmail.com \
    --to=yanzheng@21cn.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