All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ming Lei <tom.leiming@gmail.com>
To: Shaohua Li <shli@kernel.org>, Jens Axboe <axboe@fb.com>,
	linux-kernel@vger.kernel.org, linux-raid@vger.kernel.org,
	linux-block@vger.kernel.org,
	Christoph Hellwig <hch@infradead.org>, NeilBrown <neilb@suse.com>
Cc: Ming Lei <tom.leiming@gmail.com>
Subject: [PATCH v2 2/5] md: fail if mddev->bio_set can't be created
Date: Tue, 14 Feb 2017 23:29:00 +0800	[thread overview]
Message-ID: <1487086143-10255-3-git-send-email-tom.leiming@gmail.com> (raw)
In-Reply-To: <1487086143-10255-1-git-send-email-tom.leiming@gmail.com>

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>
---
 drivers/md/md.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/md/md.c b/drivers/md/md.c
index 7e9a495e4160..b5e2adf3493b 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -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);
-- 
2.7.4

  parent reply	other threads:[~2017-02-14 15:29 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-14 15:28 [PATCH v2 0/5] md: use bio_clone_fast() Ming Lei
2017-02-14 15:28 ` [PATCH v2 1/5] block: introduce bio_clone_bioset_partial() Ming Lei
2017-02-14 15:29 ` Ming Lei [this message]
2017-02-14 15:29 ` [PATCH v2 3/5] md/raid1: use bio_clone_bioset_partial() in case of write behind Ming Lei
2017-02-14 15:29 ` [PATCH v2 4/5] md: remove unnecessary check on mddev Ming Lei
2017-02-14 15:29 ` [PATCH v2 5/5] md: fast clone bio in bio_clone_mddev() Ming Lei
2017-02-14 16:01   ` Christoph Hellwig
2017-02-15 19:20     ` Shaohua Li
2017-02-15 23:19       ` Shaohua Li
2017-02-15 23:19         ` Shaohua Li
2017-02-14 15:31 ` [PATCH v2 0/5] md: use bio_clone_fast() Jens Axboe
2017-02-14 15:31   ` Jens Axboe
2017-02-15 19:19 ` Shaohua Li

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1487086143-10255-3-git-send-email-tom.leiming@gmail.com \
    --to=tom.leiming@gmail.com \
    --cc=axboe@fb.com \
    --cc=hch@infradead.org \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-raid@vger.kernel.org \
    --cc=neilb@suse.com \
    --cc=shli@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.