[PATCH] Btrfs: fix incompat flags setting

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The new snappy code reveals this old bug in btrfs, which happened to
work for LZO.

	# mkfs.btrfs /dev/loop2
	# mount /dev/loop2
	# umount /mnt
	# btrfsck /dev/loop2
	couldn't open because of unsupported option features (10).

The corresponding incompat flag was set, though we didn't mount with
snappy enabled.

Signed-off-by: Li Zefan <lizf@xxxxxxxxxxxxxx>
---

This patch is for the snappy branch.

---
 fs/btrfs/disk-io.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index 5924163..27101e4 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -2115,9 +2115,9 @@ struct btrfs_root *open_ctree(struct super_block *sb,
 
 	features = btrfs_super_incompat_flags(disk_super);
 	features |= BTRFS_FEATURE_INCOMPAT_MIXED_BACKREF;
-	if (tree_root->fs_info->compress_type & BTRFS_COMPRESS_LZO)
+	if (tree_root->fs_info->compress_type == BTRFS_COMPRESS_LZO)
 		features |= BTRFS_FEATURE_INCOMPAT_COMPRESS_LZO;
-	if (tree_root->fs_info->compress_type & BTRFS_COMPRESS_SNAPPY)
+	if (tree_root->fs_info->compress_type == BTRFS_COMPRESS_SNAPPY)
 		features |= BTRFS_FEATURE_INCOMPAT_COMPRESS_SNAPPY;
 	btrfs_set_super_incompat_flags(disk_super, features);
 
-- 
1.7.3.1

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux