Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1924535imu; Wed, 12 Dec 2018 06:42:49 -0800 (PST) X-Google-Smtp-Source: AFSGD/Wjsc/aOFnO8NxWTwJ4geJObBgfSLUG3NpGudVwbYTLtzkuledlHlxaXSqUfdHGdLUPVtcK X-Received: by 2002:a63:902:: with SMTP id 2mr17256191pgj.219.1544625769432; Wed, 12 Dec 2018 06:42:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544625769; cv=none; d=google.com; s=arc-20160816; b=FZzTLzhqBTz4fujaIXrWBrHrsbux+14B/7TznnkDHVZoTX5RFibOk2DxJCIyeaNeL1 IMtY0lGeSA/CgJqeRkCcsNihe+QBcdwXs3fbFeaOU0blkrjU5r8f/NMVvH9Jn4LFgVVL IfpaINspK0fmX7/nN/dTq/c5h3iVYwfJ8UwXLUk7eNBcKKHP61hOW+9bR0vEEfAq7Imv oV3V08dqe7BXjhPTtgub/W1CIeYX/PAuGmPhnnQ6Gp13DaOhNvSmKOjagoeH+LIp6zZU uSc1RxFg70xcgSY4uunn4+f+R7zHHx6BlvAGgGhngml6ncdp6WSF394aNd/6a0KO2Otp I6Tw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=FHDeGAQyWcDhIVbCTUtP4kii1KeAT+QIECUj4tPwFSw=; b=mDsnNHB0nPfHov868UpbhTMQ3EwlGsP5NQCMcLVPcsDiMfZCNWfxvKE+NhKsGMlukl 0vniNyBrC+DRWgWJER4vX0g5snBYT6OhviuxJL3vxlJpQKrlhKk07QzhqhHr37l9rvJj 1oUzG3ebFstAjPTPizIYTRe32rGdPzcMxM+BQS6n8nuhEiSI3alPZl4zKXQQmLunFGDh fnSYqIhzaOBSL3z/L+Tljw5YHD8ajcWPUC1ZeQbMijf3XSNHL3FUbqYlsoUOa2YFUwIE xo7l5r+J8RanhJpTWpnBRU/QIOoBO3A25sUfnwfWwDUK6p2AjHyJif0VwizviLKBRdE/ 8Nfw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y2si13909072pgl.148.2018.12.12.06.42.34; Wed, 12 Dec 2018 06:42:49 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726470AbeLLOle (ORCPT + 99 others); Wed, 12 Dec 2018 09:41:34 -0500 Received: from mx2.suse.de ([195.135.220.15]:58160 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726223AbeLLOle (ORCPT ); Wed, 12 Dec 2018 09:41:34 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 5511BAFB6; Wed, 12 Dec 2018 14:41:33 +0000 (UTC) Date: Wed, 12 Dec 2018 08:41:30 -0600 From: Goldwyn Rodrigues To: Avi Kivity Cc: linux-kernel , linux-aio@kvack.org Subject: Re: Spurious EIO on AIO+DIO+RWF_NOWAIT Message-ID: <20181212144130.pifm7w7eznw6jtwn@merlin> References: <9bab0f40-5748-f147-efeb-5aac4fd44533@scylladb.com> <20181210124823.iw4mxmdqpsdfeap4@merlin> <8fb27ba4-c100-5d08-71b6-ef393d7bcae1@scylladb.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <8fb27ba4-c100-5d08-71b6-ef393d7bcae1@scylladb.com> User-Agent: NeoMutt/20180323 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 14:05 12/12, Avi Kivity wrote: > On 12/10/18 2:48 PM, Goldwyn Rodrigues wrote: > > On 13:19 09/12, Avi Kivity wrote: > > > I have an application that receives spurious EIO when running with > > > RWF_NOWAIT enabled. Removing RWF_NOWAIT causes those EIOs to disappear. The > > > application uses AIO+DIO, and errors were seen on both xfs and ext4. > > > > > > > > > I suspect the following code: > > > > > > > > > /* > > > ?* Process one completed BIO.? No locks are held. > > > ?*/ > > > static blk_status_t dio_bio_complete(struct dio *dio, struct bio *bio) > > > { > > > ??????? struct bio_vec *bvec; > > > ??????? unsigned i; > > > ??????? blk_status_t err = bio->bi_status; > > > > > > ??????? if (err) { > > > ??????????????? if (err == BLK_STS_AGAIN && (bio->bi_opf & REQ_NOWAIT)) > > > ??????????????????????? dio->io_error = -EAGAIN; > > > ??????????????? else > > > ??????????????????????? dio->io_error = -EIO; > > > ??????? } > > > > > > Could it be that REQ_NOWAIT was dropped from bio->bi_opf? or that > > > bio->bi_status got changed along the way? > > > > > I don't think REQ_NOWAIT is dropped. I am assuming bio->bi_status error > > is set differently. Is the blk queue being stopped? Is it possible to > > instrument the kernel in your testcase? > > > > I traced the function, and I see bio->bi_status == BLK_STS_NOTSUPP and > bio->bi_opf == REQ_OP_WRITE|REQ_SYNC|REQ_NOMERGE|REQ_FUA|REQ_NOWAIT. > Presumably the NOTSUPP is the result of NOWAIT not being supported down the > stack, but shouldn't it be detected earlier? And not converted to EIO? > I don't think there is a way to detect it earlier. However, I think we should return -EOPNOTSUPP if the lower layers do not support REQ_NOWAIT. I will write a patch to modify this. -- Goldwyn