linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Liu Bo <liubo2009@cn.fujitsu.com>
To: <linux-btrfs@vger.kernel.org>
Subject: [PATCH 2/4] Btrfs: fix a bug of writting free space cache with nodatacow option
Date: Wed, 4 Jul 2012 21:52:56 +0800	[thread overview]
Message-ID: <1341409978-22423-2-git-send-email-liubo2009@cn.fujitsu.com> (raw)
In-Reply-To: <1341409978-22423-1-git-send-email-liubo2009@cn.fujitsu.com>

We can set a block group readonly when we relocate the block group.

If the block group covers the disk offset where our free space
cache inode is going to write, it will force the free space cache
inode into cow_file_range(), which is not allowed due to free space
cache design.

Signed-off-by: Liu Bo <liubo2009@cn.fujitsu.com>
---
 fs/btrfs/inode.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 1f72817..4892396 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -1245,7 +1245,11 @@ next_slot:
 				goto out_check;
 			if (extent_type == BTRFS_FILE_EXTENT_REG && !force)
 				goto out_check;
-			if (btrfs_extent_readonly(root, disk_bytenr))
+			/*
+			 * nolock means that we're free space cache inode, and
+			 * free space cache inode cannot go to cow_file_range().
+			 */
+			if (btrfs_extent_readonly(root, disk_bytenr) && !nolock)
 				goto out_check;
 			if (btrfs_cross_ref_exist(trans, root, ino,
 						  found_key.offset -
-- 
1.6.5.2


  reply	other threads:[~2012-07-04 13:55 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-04 13:52 [PATCH 1/4] Btrfs: do not abort transaction in prealloc case Liu Bo
2012-07-04 13:52 ` Liu Bo [this message]
2012-07-04 13:52 ` [PATCH 3/4] Btrfs: add ro notification to dump_space_info Liu Bo
2012-07-04 13:52 ` [PATCH 4/4] Btrfs: do not count in readonly bytes Liu Bo

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=1341409978-22423-2-git-send-email-liubo2009@cn.fujitsu.com \
    --to=liubo2009@cn.fujitsu.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).