[1/2] Btrfs: skip readonly root for snapshot-aware defragment
diff mbox

Message ID 1391874396-2273-1-git-send-email-wangshilong1991@gmail.com
State Accepted
Headers show

Commit Message

Wang Shilong Feb. 8, 2014, 3:46 p.m. UTC
From: Wang Shilong <wangsl.fnst@cn.fujitsu.com>

Btrfs send is assuming readonly root won't change, let's skip readonly root.

Signed-off-by: Wang Shilong <wangsl.fnst@cn.fujitsu.com>
---
 fs/btrfs/inode.c | 5 +++++
 1 file changed, 5 insertions(+)

Patch
diff mbox

diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 1af34d0..e8dfd83 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -2239,6 +2239,11 @@  static noinline int relink_extent_backref(struct btrfs_path *path,
 		return PTR_ERR(root);
 	}
 
+	if (btrfs_root_readonly(root)) {
+		srcu_read_unlock(&fs_info->subvol_srcu, index);
+		return 0;
+	}
+
 	/* step 2: get inode */
 	key.objectid = backref->inum;
 	key.type = BTRFS_INODE_ITEM_KEY;