From patchwork Tue Feb 14 15:29:00 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Lei X-Patchwork-Id: 9572133 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id A0E3460589 for ; Tue, 14 Feb 2017 15:31:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 94B0B2843E for ; Tue, 14 Feb 2017 15:31:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BF1A2283E1; Tue, 14 Feb 2017 15:31:47 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9AA1028408 for ; Tue, 14 Feb 2017 15:31:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932088AbdBNP3a (ORCPT ); Tue, 14 Feb 2017 10:29:30 -0500 Received: from mail-ot0-f195.google.com ([74.125.82.195]:34757 "EHLO mail-ot0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754460AbdBNP3T (ORCPT ); Tue, 14 Feb 2017 10:29:19 -0500 Received: by mail-ot0-f195.google.com with SMTP id 73so17457950otj.1; Tue, 14 Feb 2017 07:29:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=OJxMVRr6GL5+ICh5NpzxmvCDJvz4DRXtcYRJQXcw5WU=; b=Pkcq0RYWHgXnQl5HFiubbF0F2dpaTwz7vG9MpSoeVupqGfiedjt+Nn8+5/qieMpToa +29ayYjXsbDZg7R0fnW8OIkXvRvfghDtPnzq4m+0Glm74VTI2OW9d/1I8amwsm8xkI+H 9LK0+UtYhyKmQ/7CmrtmujPPRZPRPuX23j9GU/QkuaMStu6h9nYHHGlG3bdBDKJ87rqi Gp37gwGNLZzIxe3JCzH0rIPnkphEpcfvDB8KEBHzQ8B9BHKPdjLz8W3tn1vX6HYYkp36 RVRl9sCWb7h+uDORa8tm6GG2oh7nz4tdgpA/phvfiFyZofoT/jvXZGlLh86A/2IgAYp3 FJeA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=OJxMVRr6GL5+ICh5NpzxmvCDJvz4DRXtcYRJQXcw5WU=; b=DInQEKG4rGcS3k4qoVh47cY5ZjjEhlT1ZcTDzAFj9yV0j+ig1Cef+0mNtQlrderO/a TPV8FOYx1qpq4stWIhgFLnXpRaMJqx/4DOojyYnMH8za3TEwQy6ESiAVLfEdJKwxykE8 iOHWsgnZ3CysIc7v/Le4992RYqj7CW84tuToGu3wNsOL7AyBi0dg9JV1qeVlySlk4i4v 29195tNgwcvgqO1fZoEWhF/Krn4t9fYELXrJSTaoJCIiKhLaB7C0qObj5bRjJr3mumhr NU0eranR4MNfQ6dgSv5evCz+b3+5LBFwoWpQPkYHlieo4Q5EYfC+dMLCp67bgvFj7/h+ ffCw== X-Gm-Message-State: AMke39keqB1RZl0VgtObNTkugOfdRBTaMwsdQWbx1g6SUcYhbSIvZX5LYs7SZR85s0KRhQ== X-Received: by 10.98.66.82 with SMTP id p79mr32328820pfa.10.1487086158792; Tue, 14 Feb 2017 07:29:18 -0800 (PST) Received: from localhost (li405-222.members.linode.com. [106.187.53.222]) by smtp.gmail.com with ESMTPSA id u129sm1987174pfb.130.2017.02.14.07.29.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 14 Feb 2017 07:29:18 -0800 (PST) From: Ming Lei To: Shaohua Li , Jens Axboe , linux-kernel@vger.kernel.org, linux-raid@vger.kernel.org, linux-block@vger.kernel.org, Christoph Hellwig , NeilBrown Cc: Ming Lei Subject: [PATCH v2 2/5] md: fail if mddev->bio_set can't be created Date: Tue, 14 Feb 2017 23:29:00 +0800 Message-Id: <1487086143-10255-3-git-send-email-tom.leiming@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1487086143-10255-1-git-send-email-tom.leiming@gmail.com> References: <1487086143-10255-1-git-send-email-tom.leiming@gmail.com> Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Signed-off-by: Ming Lei --- 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);