From patchwork Thu Oct 11 18:30:22 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Omar Sandoval X-Patchwork-Id: 10637107 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 4606D69B1 for ; Thu, 11 Oct 2018 18:30:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3751B2BEE1 for ; Thu, 11 Oct 2018 18:30:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3570B2BEE0; Thu, 11 Oct 2018 18:30:50 +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 DB7AE2BEEE for ; Thu, 11 Oct 2018 18:30:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729154AbeJLB7M (ORCPT ); Thu, 11 Oct 2018 21:59:12 -0400 Received: from mail-pg1-f194.google.com ([209.85.215.194]:39985 "EHLO mail-pg1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729175AbeJLB7M (ORCPT ); Thu, 11 Oct 2018 21:59:12 -0400 Received: by mail-pg1-f194.google.com with SMTP id n31-v6so4570696pgm.7 for ; Thu, 11 Oct 2018 11:30:48 -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=OW+N/ciED27CxbZv1LEba5SEww3LPafMQJoQCiFCVXc=; b=xXVNcIPdIC+pyj2OMX2S9S/6N3aSkqKXafPvpMk5ujzR5a9lx0HIJsydlVhgBSMBzc VSpf0aLyhBSSMjdg6ZnQjDkCTxvJTstc9V8B1AxcF6bEdy8vOpASJI1ETw978iJu31QJ Gow6GKzCWFkoRRgJhjPoaSFUc5/M8p39rg4uh9e2PIxh7zJjZ1Eeud4LyT73JKSNXBEF UTlC/irHYey7VVqj4l0P92vc8ERwuCzayVNwGB6sFwED1qlLIEDnxtkLD0K31LcqdukK X9H0m2uNchMj97rZPUwj8w1zXQm1Qbu7YfY7DzEpd1GO3X89SRZ6S5ihDrSoxKpCUr4T GVmQ== 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=OW+N/ciED27CxbZv1LEba5SEww3LPafMQJoQCiFCVXc=; b=kRvny/ps3897lhathHUAf2v50X1QtFXBc+nD8PNRYTzNZ5ihrQ/oIim6HARqVA7FYe yvk+UMzx6Cil+1dQIIO1y7hkJ1410PUAPeFkuFr+Jrs8t1O7Ojnj6rUrE6YggeU0YP05 bwEQhTB84Yk0G7f/zS/yCUtlXvXOiYoFzmQLHbD1rI+BRhne/BnAOzOoGUe7kWu1t1OL ChMNniSjiuKvzLrNisFAw1YpQluKZbvQhEAczGWjFRS3m4hNLRlpvm8KmjUSjMGE4BNX WJ1irPw5Z7/Kt8b7PmZmRSXXxbCm2n22nnmc2iHCiTtGHX2m+axEvFl2JrtwEY+qqjHt GInw== X-Gm-Message-State: ABuFfohdjS1f93Yjt3ikjCPeuTTuRjedj9WcU7x4o9Ujsclcwzp/Xijo eX4Xc3LgTVPo6q88lU7d7xFkCmtE8HY= X-Google-Smtp-Source: ACcGV626Yw2xw7K6bi0YHjkm/G+CaL36L5c8UHMhHIICtQhvxnJh9LfTrlcg7yOIm/acOtf1Tjy5RA== X-Received: by 2002:a62:c05a:: with SMTP id x87-v6mr2614581pff.149.1539282647678; Thu, 11 Oct 2018 11:30:47 -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.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 11 Oct 2018 11:30:47 -0700 (PDT) From: Omar Sandoval To: linux-block@vger.kernel.org Cc: Jens Axboe , kernel-team@fb.com Subject: [PATCH 12/13] floppy: end whole request on error Date: Thu, 11 Oct 2018 11:30:22 -0700 Message-Id: <4b575ac74fab6d233b891f8c12dadaea3873931c.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 floppy_end_request() gets passed an error, it should end the whole request, not just the current segment. Signed-off-by: Omar Sandoval --- drivers/block/floppy.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c index f2b6f4da1034..acbafd831ea3 100644 --- a/drivers/block/floppy.c +++ b/drivers/block/floppy.c @@ -2210,13 +2210,15 @@ static int do_format(int drive, struct format_descr *tmp_format_req) static void floppy_end_request(struct request *req, blk_status_t error) { - unsigned int nr_sectors = current_count_sectors; + unsigned int nr_bytes; unsigned int drive = (unsigned long)req->rq_disk->private_data; /* current_count_sectors can be zero if transfer failed */ if (error) - nr_sectors = blk_rq_cur_sectors(req); - if (__blk_end_request(req, error, nr_sectors << 9)) + nr_bytes = blk_rq_bytes(req); + else + nr_bytes = current_count_sectors << 9; + if (__blk_end_request(req, error, nr_bytes)) return; /* We're done with the request */