summaryrefslogtreecommitdiff
path: root/drivers/md
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/md')
-rw-r--r--drivers/md/md.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c
index 023aecd0295..adf960d8a7c 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -1727,7 +1727,7 @@ static ssize_t
level_show(mddev_t *mddev, char *page)
{
mdk_personality_t *p = mddev->pers;
- if (p == NULL)
+ if (p == NULL && mddev->raid_disks == 0)
return 0;
if (mddev->level >= 0)
return sprintf(page, "RAID-%d\n", mddev->level);
@@ -1740,6 +1740,8 @@ static struct md_sysfs_entry md_level = __ATTR_RO(level);
static ssize_t
raid_disks_show(mddev_t *mddev, char *page)
{
+ if (mddev->raid_disks == 0)
+ return 0;
return sprintf(page, "%d\n", mddev->raid_disks);
}