All of lore.kernel.org
 help / color / mirror / Atom feed
From: Qu Wenruo <wqu@suse.com>
To: linux-btrfs@vger.kernel.org
Subject: [PATCH v5 06/11] btrfs: reject raid5/6 fs for subpage
Date: Fri, 18 Jun 2021 15:24:32 +0800	[thread overview]
Message-ID: <20210618072437.207550-7-wqu@suse.com> (raw)
In-Reply-To: <20210618072437.207550-1-wqu@suse.com>

Raid5/6 is not only unsafe due to its write-hole problem, but also has
tons of hardcoded PAGE_SIZE.

So disable it for subpage support for now.

Signed-off-by: Qu Wenruo <wqu@suse.com>
---
 fs/btrfs/disk-io.c | 10 ++++++++++
 fs/btrfs/volumes.c |  8 ++++++++
 2 files changed, 18 insertions(+)

diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index 544bb7a82e57..2af13bb48812 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -3417,6 +3417,16 @@ int __cold open_ctree(struct super_block *sb, struct btrfs_fs_devices *fs_device
 			goto fail_alloc;
 		}
 	}
+	if (sectorsize != PAGE_SIZE) {
+		if (btrfs_super_incompat_flags(fs_info->super_copy) &
+			BTRFS_FEATURE_INCOMPAT_RAID56) {
+			btrfs_err(fs_info,
+	"raid5/6 is not yet supported for sector size %u with page size %lu",
+				sectorsize, PAGE_SIZE);
+			err = -EINVAL;
+			goto fail_alloc;
+		}
+	}
 
 	ret = btrfs_init_workqueues(fs_info, fs_devices);
 	if (ret) {
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index 582695cee9d1..1e0829f342f8 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -3937,11 +3937,19 @@ static inline int validate_convert_profile(struct btrfs_fs_info *fs_info,
 	if (!(bargs->flags & BTRFS_BALANCE_ARGS_CONVERT))
 		return true;
 
+	if (fs_info->sectorsize < PAGE_SIZE &&
+		bargs->target & BTRFS_BLOCK_GROUP_RAID56_MASK) {
+		btrfs_err(fs_info,
+	"RAID5/6 is not supported yet for sectorsize %u with page size %lu",
+			  fs_info->sectorsize, PAGE_SIZE);
+		goto invalid;
+	}
 	/* Profile is valid and does not have bits outside of the allowed set */
 	if (alloc_profile_is_valid(bargs->target, 1) &&
 	    (bargs->target & ~allowed) == 0)
 		return true;
 
+invalid:
 	btrfs_err(fs_info, "balance: invalid convert %s profile %s",
 			type, btrfs_bg_type_to_raid_name(bargs->target));
 	return false;
-- 
2.32.0


  parent reply	other threads:[~2021-06-18  7:25 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-18  7:24 [PATCH v5 00/11] btrfs: add data write support for subpage Qu Wenruo
2021-06-18  7:24 ` [PATCH v5 01/11] btrfs: extract relocation page read and dirty part into its own function Qu Wenruo
2021-06-18  7:24 ` [PATCH v5 02/11] btrfs: make relocate_one_page() to handle subpage case Qu Wenruo
2021-06-18  7:24 ` [PATCH v5 03/11] btrfs: fix wild subpage writeback which does not have ordered extent Qu Wenruo
2021-06-18  7:24 ` [PATCH v5 04/11] btrfs: disable inline extent creation for subpage Qu Wenruo
2021-06-18  7:24 ` [PATCH v5 05/11] btrfs: allow submit_extent_page() to do bio split " Qu Wenruo
2021-06-18  7:24 ` Qu Wenruo [this message]
2021-06-18  7:24 ` [PATCH v5 07/11] btrfs: fix a crash caused by race between prepare_pages() and btrfs_releasepage() Qu Wenruo
2021-06-18  7:24 ` [PATCH v5 08/11] btrfs: fix a use-after-free bug in writeback subpage helper Qu Wenruo
2021-06-18  7:24 ` [PATCH v5 09/11] btrfs: fix a subpage false alert for relocating partial preallocated data extents Qu Wenruo
2021-06-18  7:24 ` [PATCH v5 10/11] btrfs: fix a subpage relocation data corruption Qu Wenruo
2021-06-18  7:24 ` [PATCH v5 11/11] btrfs: allow read-write for 4K sectorsize on 64K page size systems Qu Wenruo

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=20210618072437.207550-7-wqu@suse.com \
    --to=wqu@suse.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.