Linux-Raid Archives on lore.kernel.org
 help / color / Atom feed
* [PATCH 1/1] It should be FAILED when raid has not enough active disks
@ 2021-02-09  9:39 Xiao Ni
  2021-03-08 15:50 ` Jes Sorensen
  0 siblings, 1 reply; 2+ messages in thread
From: Xiao Ni @ 2021-02-09  9:39 UTC (permalink / raw)
  To: jes; +Cc: linux-raid, ncroxon

It can't remove the disk if there are not enough disks. For example, raid5 can't remove the
second disk. If the second disk is unplug from machine, it's better show missing and the raid
should be FAILED. It's better for administrator to monitor the raid.

Signed-off-by: Xiao Ni <xni@redhat.com>
---
 Detail.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/Detail.c b/Detail.c
index f8dea6f..cd26fb0 100644
--- a/Detail.c
+++ b/Detail.c
@@ -355,9 +355,14 @@ int Detail(char *dev, struct context *c)
 	avail = xcalloc(array.raid_disks, 1);
 
 	for (d = 0; d < array.raid_disks; d++) {
-
-		if ((disks[d*2].state & (1<<MD_DISK_SYNC)) ||
-		    (disks[d*2+1].state & (1<<MD_DISK_SYNC))) {
+		char *dv, *dv_rep;
+		dv = map_dev_preferred(disks[d*2].major,
+				disks[d*2].minor, 0, c->prefer);
+		dv_rep = map_dev_preferred(disks[d*2+1].major,
+				disks[d*2+1].minor, 0, c->prefer);
+
+		if ((dv && (disks[d*2].state & (1<<MD_DISK_SYNC))) ||
+		    (dv_rep && (disks[d*2+1].state & (1<<MD_DISK_SYNC)))) {
 			avail_disks ++;
 			avail[d] = 1;
 		} else
@@ -789,7 +794,8 @@ This is pretty boring
 						       &max_devices, n_devices);
 			else
 				printf("   %s", dv);
-		}
+		} else if (disk.major | disk.minor)
+			printf("   missing");
 		if (!c->brief)
 			printf("\n");
 	}
-- 
2.7.5


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH 1/1] It should be FAILED when raid has not enough active disks
  2021-02-09  9:39 [PATCH 1/1] It should be FAILED when raid has not enough active disks Xiao Ni
@ 2021-03-08 15:50 ` Jes Sorensen
  0 siblings, 0 replies; 2+ messages in thread
From: Jes Sorensen @ 2021-03-08 15:50 UTC (permalink / raw)
  To: Xiao Ni; +Cc: linux-raid, ncroxon

On 2/9/21 4:39 AM, Xiao Ni wrote:
> It can't remove the disk if there are not enough disks. For example, raid5 can't remove the
> second disk. If the second disk is unplug from machine, it's better show missing and the raid
> should be FAILED. It's better for administrator to monitor the raid.
> 
> Signed-off-by: Xiao Ni <xni@redhat.com>
> ---
>  Detail.c | 14 ++++++++++----
>  1 file changed, 10 insertions(+), 4 deletions(-)

Applied!

Thanks,
Jes


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-09  9:39 [PATCH 1/1] It should be FAILED when raid has not enough active disks Xiao Ni
2021-03-08 15:50 ` Jes Sorensen

Linux-Raid Archives on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-raid/0 linux-raid/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-raid linux-raid/ https://lore.kernel.org/linux-raid \
		linux-raid@vger.kernel.org
	public-inbox-index linux-raid

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-raid


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git