Skip to contentSkip to conversation

btrfs-progs: add extra points to warn about extra chunk profiles

PATCH New Qu Wenruo 1 participant 3 messages Nov 19 Btrfs file system

lore
Share & tools
lore

Qu Wenruo

author
#0 lore raw

cover btrfs-progs: add extra points to warn about extra chunk profiles

This is inspired by a private user report, that after replacing a missing device from a degraded RAID1 fs, the fs can no longer tolerate missing the old good device.

It turns out that during dev-replace, a new system chunk is created, and since dev-replace destination can not be utilized for chunk allocation, the new system chunk is SINGLE, thus can no longer tolerate missing that device.

We need a better solution to this long existing SINGLE-chunk problem, but for now at least warn the user about this for both balance (success path) and dev-replace.

Qu Wenruo (2):
btrfs-progs: always check if the fs has multiple profiles after
balance
btrfs-progs: warn about multiple profiles after dev-replace

 cmds/balance.c | 1 +
 cmds/replace.c | 5 ++++-
 2 files changed, 5 insertions(+), 1 deletion(-)

--
2.56.0

author
#1 lore raw

PATCH 1/2 btrfs-progs: always check if the fs has multiple profiles after balance

Currently btrfs-progs will give an warning if the fs has multiple different profiles for DATA/METADATA/SYSTEM chunks.

However this only covers canceled/paused balance, not a normally finished balance.

But it's very simple to get mutliple profiles using filters. E.g. limit= or usage= with convert= filters will only convert part of the chunks.

So add such warning to cover the finished/error cases.

---
 cmds/balance.c | 1 +
 1 file changed, 1 insertion(+)
cmds/balance.c +1 -0
index 96ae04d6da7a..673cd6dd4632 100644
@@ -365,6 +365,7 @@ static int do_balance(const char *path, struct btrfs_ioctl_balance_args *args,
 			   args->stat.completed, args->stat.considered);
 	}
 
+	btrfs_warn_multiple_profiles(fd);
 out:
 	close(fd);
 	return ret;
Signature · 1 line
2.56.0
author
#2 lore raw

PATCH 2/2 btrfs-progs: warn about multiple profiles after dev-replace

In reply to Qu Wenruo

There is a private user report that, after replacing a missing device from a degraded RAID1 raid, the fs is unable to tolerant a missing device anymore.

It turns out that a new SINGLE system chunk is created during that dev-replace, which will reject mounts if that device is missing.

We have several sub-commands that will warn about such situation, e.g. "btrfs filesystem" and "btrfs balance".

Add "btrfs replace start" to also do the warning before exiting.

This warning will be output even if we failed to start replace, this is not the worst thing, as the end user have more chance to note the unexpected profiles.

---
 cmds/replace.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
cmds/replace.c +4 -1
index bd17ea94842b..bb89fcc0d4f3 100644
@@ -355,13 +355,16 @@ static int cmd_replace_start(const struct cmd_struct *cmd,
 			goto leave_with_error;
 		}
 	}
+	btrfs_warn_multiple_profiles(fdmnt);
 	close(fdmnt);
 	return 0;
 
 leave_with_error:
 	free(dstdev);
-	if (fdmnt != -1)
+	if (fdmnt != -1) {
+		btrfs_warn_multiple_profiles(fdmnt);
 		close(fdmnt);
+	}
 	if (fddstdev != -1)
 		close(fddstdev);
 	return 1;
Signature · 1 line
2.56.0