Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp175744ybl; Mon, 2 Dec 2019 09:09:57 -0800 (PST) X-Google-Smtp-Source: APXvYqxfJp2Of8kyPu+8nrjhpjgnryuTRHEcBacYJfOx5nL+OhxukioHl39HnpWqqQu7NMfod9fl X-Received: by 2002:a50:f9c7:: with SMTP id a7mr18939259edq.3.1575306597753; Mon, 02 Dec 2019 09:09:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575306597; cv=none; d=google.com; s=arc-20160816; b=Ligoq8cv+huOZl/KH6hFUv2GOYz0hc4ufhyWTD62qcMZJxVysYV9y2tjAhcreO3ewd PBIXhIODXJfcCfQK3m8S2ncFgX1gjpqt0CgR6klgAgwlquFqFGn3g9SH+g4Egi6q0iK6 G2S53i5gsAzAXZ0t2ToQo/Vgahn1KiNnWDv9yD8+47pS7paScHvWpDBch283XSajATZJ dV/ziQgzZ4A/SxGuKXQiFDeWNJxCOxXL7NlvgT8vO474VOa8nib1OwwzvfX58YMGHG0j ZpXQ6ZYdrhVwqVpLOn2y9jkaXH9xx17LW4hmerhZ/M/EE1fWwXJhnmHMrchbBucuIvf4 6VKg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=BcglRaGep1GKTanrUcF7KHchUGiMPbVv1u4sFWn/C04=; b=Oy0Pwi17dyh12/G/Xyj9ZkR/RuIggSbF6emw00QWtMGOp5S4W9LdEzpyOe0KYGEWaD ioq5R+t7NiNX5M1RrcQHRrY8qJ++AcaX3Uc52O4TjEN0F+3PlSHn/K1rRcyc01FRkJ1Z XmDMJ89loz3t2EPfUmgTUSHbR629MMEH+FjKrlOqwMEW224Kud1/lPPNPRhUmVbjl3WH Qahc5xnrWhSRCDM34N3UtyEvjzZE4Z3dn6ZfgqG+MGdLCg39mS32fbN9SgWUWaZ7aT/a q0vZsLSJq7tfQHmGBGP5PKXOzjsFuJ1GJpi59hETcISA6DwPnDX0Dh2ybusQObjYZ55Z Lq9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=CeUIdf7z; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f11si12433202edn.424.2019.12.02.09.09.25; Mon, 02 Dec 2019 09:09:57 -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; dkim=pass header.i=@chromium.org header.s=google header.b=CeUIdf7z; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727831AbfLBRGL (ORCPT + 99 others); Mon, 2 Dec 2019 12:06:11 -0500 Received: from mail-io1-f68.google.com ([209.85.166.68]:44293 "EHLO mail-io1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727601AbfLBRGL (ORCPT ); Mon, 2 Dec 2019 12:06:11 -0500 Received: by mail-io1-f68.google.com with SMTP id z23so39282iog.11 for ; Mon, 02 Dec 2019 09:06:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=BcglRaGep1GKTanrUcF7KHchUGiMPbVv1u4sFWn/C04=; b=CeUIdf7zfJkvsqlV1h8nSKP+ClCgoWj5xy62q0+PEiDKFA2Z++Rp/4hquyCRzLmqz+ /w3EEp7905sgnqlRvpttWRk6M2B8VtT0i50nh+QyiW9q7DeIwC9YYlCTN/GBZB+ku2LE Ur7QJZlAGnpNlkaXw8RI71YbNDNw+g5qNyDAo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=BcglRaGep1GKTanrUcF7KHchUGiMPbVv1u4sFWn/C04=; b=llckw1OxeFwcGsftZJGcCM43nU8o1m5W89yp5vQyw+SnJ63jc3kBnQ1d4gvC9oHZZ6 QTHp9eyyLNNa/H3tcCS1LVwaW6uudOZO4vD/YTOfWdKHAxbvR/IZhM3zOXI9KYGgBefg efPux6aEmfODxnkn/mx/mTH+0M1Gm76/TDMFlc3cUrmLIwvJu7LwdQFyVA4NUbm6gI0p +fxYvwvdfpXJ7X00s3tgAojvV+WHw8836k60k317CeEd88bs1JUa+qbAcA0R3JcngNtl KqbEtlGK3FbAj/RcLg94E6dzBB2JGaMDP3SDbSqWYLqRbAnupOn7/xHtz87CgOWDYQK6 hOsQ== X-Gm-Message-State: APjAAAX+tmjIB5eRhqqyiNH0ojR9Z48yyfVxbclpp6+IpZa4KCGp8qzs rA/OzkubAMhBgn4nsJNCSt51wtUtlq1Hk+bQzbTpjA== X-Received: by 2002:a6b:ec0f:: with SMTP id c15mr6648604ioh.149.1575306370163; Mon, 02 Dec 2019 09:06:10 -0800 (PST) MIME-Version: 1.0 References: <20191114235008.185111-1-evgreen@chromium.org> <20191114154903.v7.1.I0b2734bafaa1bd6831dec49cdb4730d04be60fc8@changeid> In-Reply-To: <20191114154903.v7.1.I0b2734bafaa1bd6831dec49cdb4730d04be60fc8@changeid> From: Gwendal Grignou Date: Mon, 2 Dec 2019 09:05:59 -0800 Message-ID: Subject: Re: [PATCH v7 1/2] loop: Report EOPNOTSUPP properly To: Evan Green Cc: Jens Axboe , Martin K Petersen , Christoph Hellwig , Ming Lei , "Darrick J . Wong" , Alexis Savery , Douglas Anderson , Bart Van Assche , linux-block@vger.kernel.org, linux-kernel Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Reviewed-by: Gwendal Grignou On Thu, Nov 14, 2019 at 3:50 PM Evan Green wrote: > > Properly plumb out EOPNOTSUPP from loop driver operations, which may > get returned when for instance a discard operation is attempted but not > supported by the underlying block device. Before this change, everything > was reported in the log as an I/O error, which is scary and not > helpful in debugging. > > Signed-off-by: Evan Green > --- > > Changes in v7: > - Use errno_to_blk_status() (Christoph) > > Changes in v6: > - Updated tags > > Changes in v5: None > Changes in v4: None > Changes in v3: > - Updated tags > > Changes in v2: > - Unnested error if statement (Bart) > > drivers/block/loop.c | 7 +++++-- > 1 file changed, 5 insertions(+), 2 deletions(-) > > diff --git a/drivers/block/loop.c b/drivers/block/loop.c > index ef6e251857c8..6a9fe1f9fe84 100644 > --- a/drivers/block/loop.c > +++ b/drivers/block/loop.c > @@ -461,7 +461,7 @@ static void lo_complete_rq(struct request *rq) > if (!cmd->use_aio || cmd->ret < 0 || cmd->ret == blk_rq_bytes(rq) || > req_op(rq) != REQ_OP_READ) { > if (cmd->ret < 0) > - ret = BLK_STS_IOERR; > + ret = errno_to_blk_status(cmd->ret); > goto end_io; > } > > @@ -1950,7 +1950,10 @@ static void loop_handle_cmd(struct loop_cmd *cmd) > failed: > /* complete non-aio request */ > if (!cmd->use_aio || ret) { > - cmd->ret = ret ? -EIO : 0; > + if (ret == -EOPNOTSUPP) > + cmd->ret = ret; > + else > + cmd->ret = ret ? -EIO : 0; > blk_mq_complete_request(rq); > } > } > -- > 2.21.0 >