md: don't allow bitmap file to be added to raid0/linear.
authorNeilBrown <neilb@suse.de>
Fri, 8 Aug 2014 05:40:24 +0000 (15:40 +1000)
committerNeilBrown <neilb@suse.de>
Fri, 8 Aug 2014 05:43:20 +0000 (15:43 +1000)
An array can only accept a bitmap if it will call bitmap_daemon_work
periodically, which means it needs a thread running.

If there is no thread, don't allow a bitmap to be added.

Signed-off-by: NeilBrown <neilb@suse.de>
drivers/md/md.c

index eb8c93dff7c6ff6e4f9c3f97449f8b5434a88c33..1294238610df0237cfe524d200278f37c9232bb3 100644 (file)
@@ -5961,7 +5961,7 @@ static int set_bitmap_file(struct mddev *mddev, int fd)
        int err = 0;
 
        if (mddev->pers) {
-               if (!mddev->pers->quiesce)
+               if (!mddev->pers->quiesce || !mddev->thread)
                        return -EBUSY;
                if (mddev->recovery || mddev->sync_thread)
                        return -EBUSY;
@@ -6263,7 +6263,7 @@ static int update_array_info(struct mddev *mddev, mdu_array_info_t *info)
                rv = update_raid_disks(mddev, info->raid_disks);
 
        if ((state ^ info->state) & (1<<MD_SB_BITMAP_PRESENT)) {
-               if (mddev->pers->quiesce == NULL)
+               if (mddev->pers->quiesce == NULL || mddev->thread == NULL)
                        return -EINVAL;
                if (mddev->recovery || mddev->sync_thread)
                        return -EBUSY;