From patchwork Thu Oct 11 19:20:41 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Omar Sandoval X-Patchwork-Id: 10637219 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 9A83769B1 for ; Thu, 11 Oct 2018 19:21:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8AB022C00F for ; Thu, 11 Oct 2018 19:21:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 895A72C020; Thu, 11 Oct 2018 19:21:00 +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 2DB192C050 for ; Thu, 11 Oct 2018 19:21:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726867AbeJLCtd (ORCPT ); Thu, 11 Oct 2018 22:49:33 -0400 Received: from mail-pf1-f182.google.com ([209.85.210.182]:34095 "EHLO mail-pf1-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729564AbeJLCtd (ORCPT ); Thu, 11 Oct 2018 22:49:33 -0400 Received: by mail-pf1-f182.google.com with SMTP id k19-v6so4908991pfi.1 for ; Thu, 11 Oct 2018 12:20:58 -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=nEhDYYk2WaVxtjO8gCIROsT/NhDe7aCx+Eu3ke4oLBCUQejnuyASOwAJrK1txlHaqk gntl6FrI1PPO74k6FUkIhvTueeYsCouqQzracd6H5c6dfm+6hz5m+J4zs0T05ADgz8QM xzd7K+Sz05IW5yscxhMEj8gUa3117T3FlEsVvZeakJzkusc/P1e6GQTyrjxkgiUi7H2c Ci4CF589gECrcI8P8I8AE3Pmd26IXuxbTBPBTRVMVik0oDmkkABusRZR6r1aTj8a4IBU YW4+6gN31Ni0RpcALNE0MvxDav1hJ2QDGZ1aPZO1t/eMcv/6VZIY0UrVM7x3RRa1S9Bo kkVA== 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=AYZIAi6REnJ/WO16UmSawSaQss19INxg95yO2K6iV0JwvGBtXkDrufXY8eNRFisGM5 /rDw3u3cLIAuS1xluEBIPCURO3nft4zfz7L1pfaD42Wwar6CQvKCHLe2+v7/qFqWzzJP ovS3XI2Oa70X7b0+pJMmIEk/+kLr/dLf2iTDxbOBSniFDX0z1BdZSe3Lv9yoGYnlqJC9 itmCDWaHsbvQMUW/hXahGAopoq3Vp3wnoBHnWs+x3K7yNuWWLT40tfP29VRFOsvQppRs yXCjO+1aTrxaqcOhELYRVI1d0AZ3DY6N5ax9UiGb8w9MWbsjNMpiFfg0ovw07YBY3w8u PZMg== X-Gm-Message-State: ABuFfoh0rlTMDHIV1BMsAY7a22vFbibdjn6c0bFzBR0o9iuaHMcTq4Z4 y7j/ttLFRx1g7x0PyfYBtUkOoTe/to0= X-Google-Smtp-Source: ACcGV60Z+Hhl+0xRdVLLOGUg/AZ/NWpAVRC4DesHvDtI4ZDM7TnnIBpc7IsvXKrJvuLBHMyY6mO/ew== X-Received: by 2002:a62:8708:: with SMTP id i8-v6mr2831541pfe.150.1539285658069; Thu, 11 Oct 2018 12:20:58 -0700 (PDT) Received: from vader.thefacebook.com ([2620:10d:c090:200::5:2383]) by smtp.gmail.com with ESMTPSA id y24-v6sm44378838pfi.24.2018.10.11.12.20.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 11 Oct 2018 12:20:57 -0700 (PDT) From: Omar Sandoval To: linux-block@vger.kernel.org Cc: Jens Axboe , kernel-team@fb.com Subject: [PATCH v2 01/11] swim: fix cleanup on setup error Date: Thu, 11 Oct 2018 12:20:41 -0700 Message-Id: <6fc80069461e094f5d018c948873f11b8d4331de.1539284959.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; }