From patchwork Wed Jul 26 01:02:29 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Williams X-Patchwork-Id: 9864083 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 8FCA1602B1 for ; Wed, 26 Jul 2017 01:08:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8DE6727CEA for ; Wed, 26 Jul 2017 01:08:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7F5EC27E63; Wed, 26 Jul 2017 01:08:57 +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.9 required=2.0 tests=BAYES_00,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 65E7627CEA for ; Wed, 26 Jul 2017 01:08:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751446AbdGZBIz (ORCPT ); Tue, 25 Jul 2017 21:08:55 -0400 Received: from mga06.intel.com ([134.134.136.31]:51006 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751047AbdGZBIz (ORCPT ); Tue, 25 Jul 2017 21:08:55 -0400 Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga104.jf.intel.com with ESMTP; 25 Jul 2017 18:08:54 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.40,413,1496127600"; d="scan'208";a="1155386500" Received: from dwillia2-desk3.jf.intel.com (HELO dwillia2-desk3.amr.corp.intel.com) ([10.54.39.125]) by orsmga001.jf.intel.com with ESMTP; 25 Jul 2017 18:08:54 -0700 Subject: [PATCH] brd: fix brd_rw_page() vs copy_to_brd_setup errors From: Dan Williams To: axboe@fb.com Cc: Jens Axboe , linux-block@vger.kernel.org, Ross Zwisler , Matthew Wilcox Date: Tue, 25 Jul 2017 18:02:29 -0700 Message-ID: <150103091559.7874.16803761117298861951.stgit@dwillia2-desk3.amr.corp.intel.com> User-Agent: StGit/0.17.1-9-g687f 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 As is done in zram_rw_page, pmem_rw_page, and btt_rw_page, don't call page_endio in the error case since do_mpage_readpage and __mpage_writepage will resubmit on error. Calling page_endio in the error case leads to double completion. Cc: Jens Axboe Cc: Matthew Wilcox Cc: Ross Zwisler Signed-off-by: Dan Williams --- Noticed this while looking at unrelated brd code... drivers/block/brd.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/block/brd.c b/drivers/block/brd.c index 104b71c0490d..055255ea131d 100644 --- a/drivers/block/brd.c +++ b/drivers/block/brd.c @@ -327,7 +327,13 @@ static int brd_rw_page(struct block_device *bdev, sector_t sector, { struct brd_device *brd = bdev->bd_disk->private_data; int err = brd_do_bvec(brd, page, PAGE_SIZE, 0, is_write, sector); - page_endio(page, is_write, err); + + /* + * In the error case we expect the upper layer to retry, so we + * can't trigger page_endio yet. + */ + if (err == 0) + page_endio(page, is_write, 0); return err; }