]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
md: fail if mddev->bio_set can't be created
authorMing Lei <tom.leiming@gmail.com>
Tue, 14 Feb 2017 15:29:00 +0000 (23:29 +0800)
committerShaohua Li <shli@fb.com>
Wed, 15 Feb 2017 19:23:24 +0000 (11:23 -0800)
The current behaviour is to fall back to allocate
bio from 'fs_bio_set', that isn't a correct way
because it might cause deadlock.

So this patch simply return failure if mddev->bio_set
can't be created.

Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Ming Lei <tom.leiming@gmail.com>
Signed-off-by: Shaohua Li <shli@fb.com>
drivers/md/md.c

index 13020e5c8cc0b7eedcf909790b7df44cffc977cb..137a1fe124e8c09b2a8d5382840120c541d8d8f4 100644 (file)
@@ -5228,8 +5228,11 @@ int md_run(struct mddev *mddev)
                sysfs_notify_dirent_safe(rdev->sysfs_state);
        }
 
-       if (mddev->bio_set == NULL)
+       if (mddev->bio_set == NULL) {
                mddev->bio_set = bioset_create(BIO_POOL_SIZE, 0);
+               if (!mddev->bio_set)
+                       return -ENOMEM;
+       }
 
        spin_lock(&pers_lock);
        pers = find_pers(mddev->level, mddev->clevel);