From patchwork Fri Feb 10 10:56:15 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Lei X-Patchwork-Id: 9566513 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 A50BA601C3 for ; Fri, 10 Feb 2017 10:58:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 936A82854A for ; Fri, 10 Feb 2017 10:58:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8827128564; Fri, 10 Feb 2017 10:58:04 +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 218422854A for ; Fri, 10 Feb 2017 10:58:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752535AbdBJK5Z (ORCPT ); Fri, 10 Feb 2017 05:57:25 -0500 Received: from mail-pf0-f193.google.com ([209.85.192.193]:36203 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752628AbdBJK5C (ORCPT ); Fri, 10 Feb 2017 05:57:02 -0500 Received: by mail-pf0-f193.google.com with SMTP id 19so2391739pfo.3; Fri, 10 Feb 2017 02:56:45 -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=02pla5viv/q705UaDzyKyzDeoXJc8CLwNPP16E/2U6g=; b=d3RymON3K6MSl+VWXTCxGufojUT7EMEnYKN7f5kFkZIR5u0cWVGUXYLITNYGuJLR7P YKSgGaJM5v+ECOZJz2XRQViGNjU8s+n7RWtUIKAhTgaq8EXI3iVNrIvBpDqviOjj+YNL zpfBtA9J+ffCtdyJuYryMBZvWRx5x2MZifxZvDrghQWnV2KR8DdhkRq8FW8AhkyOU7Sx TyfvMJSX2p1kv/q7/27nFgQkjmnax4aV/PFhtzXF9xzTkstb2nfOrQfVDiMMmqIAq2nk 42D7G1bobpMo1IImsp6dPRaOEuAiw0Awk3Yc+bftJ9QP6BSfAm0sFIk4VDEkszxdnT9v gX4w== 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=02pla5viv/q705UaDzyKyzDeoXJc8CLwNPP16E/2U6g=; b=rcLb/w+UQ8zrXDkj5XTez8Il6V/esWOXeEY8cUZ7zpagrecGNz0Dqyz+uKs9jqIlNN O7r2vR1Q/yawBAtY7WiZxSu5X/X5Y3vg1pRmPNCZRQSEOE2L5/BE6NutcBdybpr62m/D F5g4a5cddVetwf7cvQLGi1RmQqfm6JmnEbKBU76aRuOs6pkJqsV9A4qf3WXB7DXaN3LO yWsIREGaQe9ZR+no3gOJkJ3r9ME6uHfVnTkpHaogIumP2z1wE7A17QozhccOH9zGwbca ev50OLxkPXCts53bVCnvZJeEQC5i+TaZ4/MQlx1+nT/j/s3KYgdIfqE32oLyhp2OVrh+ Lb4g== X-Gm-Message-State: AMke39krUPdT3foqH9gazuxtqchTvtCFO5DEmbQqS6u63/ByLOD3Q+zQyGj+/yroL0KvwA== X-Received: by 10.84.233.206 with SMTP id m14mr10701377pln.104.1486724204932; Fri, 10 Feb 2017 02:56:44 -0800 (PST) Received: from localhost (li405-222.members.linode.com. [106.187.53.222]) by smtp.gmail.com with ESMTPSA id a24sm4559013pfh.33.2017.02.10.02.56.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 10 Feb 2017 02:56:44 -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 v1 3/5] md: fail if mddev->bio_set can't be created Date: Fri, 10 Feb 2017 18:56:15 +0800 Message-Id: <1486724177-14817-4-git-send-email-tom.leiming@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1486724177-14817-1-git-send-email-tom.leiming@gmail.com> References: <1486724177-14817-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. Signed-off-by: Ming Lei Reviewed-by: Christoph Hellwig --- 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 4c1b82defa78..3425c2b779a6 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c @@ -5270,8 +5270,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);