Received: by 2002:a05:6a10:eb17:0:0:0:0 with SMTP id hx23csp428568pxb; Thu, 9 Sep 2021 04:22:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwk0smJUsaSMgRGqtlbmZeiQ6YZ/QHtv4/OTmayDnjMoFimkJcjFAAketHu0jIKUifseN2X X-Received: by 2002:a05:6402:5:: with SMTP id d5mr2633283edu.359.1631186538662; Thu, 09 Sep 2021 04:22:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631186538; cv=none; d=google.com; s=arc-20160816; b=Ld/GqKRoubjti9EI9eCDjw2R3hPZvGICL4Qaob5tkjE2KHqLRpj+pn9li4bmznGYuq IGYYKJeu0TwqCOElp0kNsD2iR63tUsMJ6q43AA+vIpITs7ewx6axw55joXcvTOxNsbbf crZK554GfdpfMImh6U7w7UjmgNoJMfFzD+LBeH5R1idKQZjALF5gyRQc/wFviisksWch KXk4QpmYKSavfANfm938ogC5EhxPAZRlDyV7yzsUnNSxruJL/B5KnrFAIu4DWnhMX/6p x8QvQrZFt4UZE49EtCtrbZ4KuxpyjichRCo+Qxe1Whoarp0m+cN+EAamMMTm6CboThFv njBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=eBdVhI0kcw3JwSK5QRLhLU755/zLdNcWhAWcUbZ5EOw=; b=qB5l7DbLc0qcVFozwncyoytlkRdftiDgNTwEfQ0UVixGnznxjw0h50OlUu/S2Z4Fho TLV0SI6V/nRagfXWWAacviLR3/66rzKxkrlOBLn4mL3fwwDa6uNNbgb2+2GlhXa9vVVf umgtc2KNZ1nncYDLwpEm1oy9riCnDep4BitPxVjS2sgfCMFDFA3weVT1XbvIg85eDNCw Qlm6RboafPrX1qnoProwUTpiBnenccwnp/EPml+PL7Z39V/tgivNuHi4uyBGndAe3okB z8/yL+RzV3559mrmCRDHzJU4z0cEF0PfYe+zn79lFaQA+Qs+WWdW1Ptnybn0VuN57Hjm Aw7g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=rL5ragHC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h4si2017863edt.426.2021.09.09.04.21.55; Thu, 09 Sep 2021 04:22:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=rL5ragHC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236265AbhIILVF (ORCPT + 99 others); Thu, 9 Sep 2021 07:21:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59012 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236270AbhIILUz (ORCPT ); Thu, 9 Sep 2021 07:20:55 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2F375C06175F; Thu, 9 Sep 2021 04:19:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=eBdVhI0kcw3JwSK5QRLhLU755/zLdNcWhAWcUbZ5EOw=; b=rL5ragHCDt81/zHRNRaEYSaweU CSnmLghKvvYl4zCzMyryv/InNxXFGqJtCP+9EHkVwu7AfmGoU3jfX2eX0mVfzIVjzncHYfZVNKAuw wxzv6Y0SskesZd5TiP1+OBXIRyu0Wk4ByswZYLOg/rl6pyynpS0KVtJJAchPr4uqrMrhV2pR/Eirf qWP1sYj9LHbPSgdxeh+ZZM4h7HS3DMOyIoVessLMxaD0U8Gs2EByx5K+cdbOcqVEd5N1JCWTtMGoO KPMUO5IyUCczwPotsN3jbcQEBcRl6vCPtLAnwXtrkIiYEnJH8F1iquIh5K0DvILwbhlAJCY0VbGT9 +gSxt8lg==; Received: from hch by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1mOI46-009ktL-OB; Thu, 09 Sep 2021 11:18:02 +0000 Date: Thu, 9 Sep 2021 12:17:58 +0100 From: Christoph Hellwig To: Andreas Gruenbacher Cc: Linus Torvalds , Alexander Viro , Christoph Hellwig , "Darrick J. Wong" , Jan Kara , Matthew Wilcox , cluster-devel@redhat.com, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, ocfs2-devel@oss.oracle.com Subject: Re: [PATCH v7 14/19] iomap: Fix iomap_dio_rw return value for user copies Message-ID: References: <20210827164926.1726765-1-agruenba@redhat.com> <20210827164926.1726765-15-agruenba@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210827164926.1726765-15-agruenba@redhat.com> X-SRS-Rewrite: SMTP reverse-path rewritten from by casper.infradead.org. See http://www.infradead.org/rpr.html Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Aug 27, 2021 at 06:49:21PM +0200, Andreas Gruenbacher wrote: > When a user copy fails in one of the helpers of iomap_dio_rw, fail with > -EFAULT instead of returning 0. This matches what iomap_dio_bio_actor > returns when it gets an -EFAULT from bio_iov_iter_get_pages. With these > changes, iomap_dio_actor now consistently fails with -EFAULT when a user > page cannot be faulted in. > > Signed-off-by: Andreas Gruenbacher > --- > fs/iomap/direct-io.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/fs/iomap/direct-io.c b/fs/iomap/direct-io.c > index 9398b8c31323..8054f5d6c273 100644 > --- a/fs/iomap/direct-io.c > +++ b/fs/iomap/direct-io.c > @@ -370,7 +370,7 @@ iomap_dio_hole_actor(loff_t length, struct iomap_dio *dio) > { > length = iov_iter_zero(length, dio->submit.iter); > dio->size += length; > - return length; > + return length ? length : -EFAULT; What's wrong with a good old: if (!length) return -EFAULT; return length? Besides this nit and the fact that the patch needs a reabse it looks good to me: Reviewed-by: Christoph Hellwig