From patchwork Thu Oct 11 18:30:11 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Omar Sandoval X-Patchwork-Id: 10637083 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E508F17E3 for ; Thu, 11 Oct 2018 18:30:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D89D02BED9 for ; Thu, 11 Oct 2018 18:30:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D6FDB2BEDE; Thu, 11 Oct 2018 18:30:39 +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=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham 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 8A57D2BEDB for ; Thu, 11 Oct 2018 18:30:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728762AbeJLB7C (ORCPT ); Thu, 11 Oct 2018 21:59:02 -0400 Received: from mail-pg1-f181.google.com ([209.85.215.181]:41178 "EHLO mail-pg1-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729119AbeJLB7C (ORCPT ); Thu, 11 Oct 2018 21:59:02 -0400 Received: by mail-pg1-f181.google.com with SMTP id 23-v6so4566037pgc.8 for ; Thu, 11 Oct 2018 11:30:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osandov-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=i5CA2DVmUK9FVTPCh8E1wZSA/j10L4r/DeujVBBb8lM=; b=eTsh1ub1GwGxS1dTPMFYcgxo+vWF6RbsJx9PtaffJSwuc6n4TFof6Nhrr/0ZKSDXsV ifo+iutVH+TvTdjPZJLVL9aCdyxELbLa7JMH6eSgsAxrEYuS/G+5HNOY30k0zJNFRD8n c30LaopHMTl+5Ztfo59KswHuwRkygowBfEM5qn0CAwpRXMQUoH7gI4Q1FH77Z2pLMqzo qLpZkmu9IAIEaNw0/qXwZIt7zQjfbrBijG2Vs5JLfzCNtGn1MPyEDrOBF98medd29ySb W8/W1v3dbjjtR7XwG4Lqv9O1o1w9zixhtrrunKyJMDF4maxPBFC7UNelJPbCO1HytzGO HehQ== 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:mime-version:content-transfer-encoding; bh=i5CA2DVmUK9FVTPCh8E1wZSA/j10L4r/DeujVBBb8lM=; b=QDMxTOXoy3hlS+dsmJlt/MoBoXRxQWsZDCEi5UQtNp3dTBRC6X1PyaFGl4CUDJIxwF ZD03/E+ctSGLRp+nOPSfHRpvkENsKj/bvzhk/nrcNrKvK5Gn3lTsBX42y+E2b1KCCPwr Utj9dranhvH8YdoNjHsip9ecYNlp5scD6s3Xjb7nrbRQJOQNTdmjc1Brxh2ex3h4XDga BcLynl65FLsEz4jYsiouIH7VOesuCId41LhdB0EcGZ+eFkiasD3hM6rQti3d1ZReeuxe qtm9eFpZSEprUSBcFMPAgERi8QcchI/tyiebT01YP+aP0xJxEM2wPwt0K3Ub6PzpFfHI Bk9A== X-Gm-Message-State: ABuFfoggqVMlIf9L4VMp4SiZR/bcZWNLnFQEK/WjsxgKY/laKJInG+G6 LXxokuwwjZgDrDiEycY41jYzOFkAwuo= X-Google-Smtp-Source: ACcGV602kv4WD79jG5uVVk6dGjih86B+KIxwVCU6P76FptYtSymhEKTYjx1ZAwOwofMLUz3Cbn3ooQ== X-Received: by 2002:a63:a047:: with SMTP id u7-v6mr2405680pgn.145.1539282637397; Thu, 11 Oct 2018 11:30:37 -0700 (PDT) Received: from vader.thefacebook.com ([2620:10d:c090:200::5:2383]) by smtp.gmail.com with ESMTPSA id o2-v6sm57514640pfj.57.2018.10.11.11.30.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 11 Oct 2018 11:30:37 -0700 (PDT) From: Omar Sandoval To: linux-block@vger.kernel.org Cc: Jens Axboe , kernel-team@fb.com Subject: [PATCH 01/13] swim: fix cleanup on setup error Date: Thu, 11 Oct 2018 11:30:11 -0700 Message-Id: <6fc80069461e094f5d018c948873f11b8d4331de.1539282366.git.osandov@fb.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: References: MIME-Version: 1.0 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 From: Omar Sandoval If we fail to allocate the request queue for a disk, we still need to free that disk, not just the previous ones. Additionally, we need to cleanup the previous request queues. Signed-off-by: Omar Sandoval --- drivers/block/swim.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/drivers/block/swim.c b/drivers/block/swim.c index 0e31884a9519..cbe909c51847 100644 --- a/drivers/block/swim.c +++ b/drivers/block/swim.c @@ -887,8 +887,17 @@ static int swim_floppy_init(struct swim_priv *swd) exit_put_disks: unregister_blkdev(FLOPPY_MAJOR, "fd"); - while (drive--) - put_disk(swd->unit[drive].disk); + do { + struct gendisk *disk = swd->unit[drive].disk; + + if (disk) { + if (disk->queue) { + blk_cleanup_queue(disk->queue); + disk->queue = NULL; + } + put_disk(disk); + } + } while (drive--); return err; }