Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp874800rwl; Wed, 12 Apr 2023 05:29:21 -0700 (PDT) X-Google-Smtp-Source: AKy350ZZifh3yjap4Doq3TZCsRPB2TFkoeD6aoEWk6l2+MZlyFQQV+TCsU+m6jf0UWij5KY8Yzuw X-Received: by 2002:a05:6a20:6595:b0:e4:9940:d7c2 with SMTP id p21-20020a056a20659500b000e49940d7c2mr5604939pzh.14.1681302560902; Wed, 12 Apr 2023 05:29:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681302560; cv=none; d=google.com; s=arc-20160816; b=e86v82ZLIXAUOyYhOmPB1rdsnMsJDixjbVK+QK5fPWWBuOseizlUjdSippwTBcPMne 14YCeVkQGiC0fFyeJY7ibyg+IyMasuVJJRgzIygnaXDVFdIS7hbKKjGhmrl0P7yju9Th 2MKNhoBvCoXNGL+F9zMkQav2SBBH4lTPcXHwywJJvWl1w0az4VHHdzf6+Z04Dh9HRdO0 //lydb4xtOf0Z3bp44nn5cq0lLI4SNshU2Z/dXWyHSUlCiVknQMuZtiiNL8tcXWRpnGI MwZUoOoKt5XW+gxfHK6WoveN731bXloAG33IvJzDQnwxSz9kBBLsP9jCzKn+bh4nHVve +hsw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:content-transfer-encoding :content-id:mime-version:subject:cc:to:from:organization :dkim-signature; bh=oDvpuO+outR1fzDI82r+racSPaiTDWT0/eKdzaYnWqM=; b=yOprJz607goPLA2NczrjQbPgxyVurNIGQnwv+l9NgxnP710U1ncGt61jUdcAA3vBrJ YG07ndIJ/ry+k3PuZnZR1aiVNlArJNWH0RNP5YPYk/W+xvgBIqT8cqXYRQ55+XeVqIB+ DKYeI2QuVlG8PIJTu63a0UOERIs84MkSBr96N/PzCY3tPcMmPcMbRM00ziHWykK+wUCt 1okWmb864ER0g9DHIkQHAArJcAL2Ho7Cn+5Zx20qaI7ayLyzBV+fB071NDbgtoTNPQEu szP2aw4rgS+WeSScPP3WxkjmobOy9dsjir5arf9/HtGK1A49zs85NgBhgckrwU68wNsU 8wNw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=QCGiLJ8a; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v185-20020a6261c2000000b0062545446afcsi15383391pfb.165.2023.04.12.05.29.09; Wed, 12 Apr 2023 05:29:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=QCGiLJ8a; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230182AbjDLMTv (ORCPT + 99 others); Wed, 12 Apr 2023 08:19:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57876 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229620AbjDLMTu (ORCPT ); Wed, 12 Apr 2023 08:19:50 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E4C213581 for ; Wed, 12 Apr 2023 05:19:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1681301945; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=oDvpuO+outR1fzDI82r+racSPaiTDWT0/eKdzaYnWqM=; b=QCGiLJ8aMZMnFqD7/8F0/cO+qa7fIFHKatHq5aj2O3+Og6MObgG9pBJrCF+p1fX1stuCci 8SU7xVTmN1h31m2nyyp4289vRMuih9j+qvwzXzeP6IwJxKemRAk9kvxOvqMivmZ7ZsumMA sZLAOs2Ko1RBkxggHuZ42V3jrMGB7Zg= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-263-mTzkuoVFP_29896gGCW_Bg-1; Wed, 12 Apr 2023 08:19:00 -0400 X-MC-Unique: mTzkuoVFP_29896gGCW_Bg-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 7959780C8C1; Wed, 12 Apr 2023 12:18:59 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.33.36.177]) by smtp.corp.redhat.com (Postfix) with ESMTP id 378F0492B00; Wed, 12 Apr 2023 12:18:58 +0000 (UTC) Organization: Red Hat UK Ltd. Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 3798903 From: David Howells To: torvalds@linux-foundation.org cc: dhowells@redhat.com, Jeff Layton , Steve French , Shyam Prasad N , Rohith Surabattula , linux-cachefs@redhat.com, linux-cifs@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] netfs: Fix netfs_extract_iter_to_sg() for ITER_UBUF/IOVEC MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <110099.1681301937.1@warthog.procyon.org.uk> Content-Transfer-Encoding: quoted-printable Date: Wed, 12 Apr 2023 13:18:57 +0100 Message-ID: <110100.1681301937@warthog.procyon.org.uk> X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Linus, Could you apply this, please? It doesn't affect anything yet, but I have patches in the works that will use it. Thanks, David --- netfs: Fix netfs_extract_iter_to_sg() for ITER_UBUF/IOVEC Fix netfs_extract_iter_to_sg() for ITER_UBUF and ITER_IOVEC to set the siz= e of the page to the part of the page extracted, not the remaining amount of data in the extracted page array at that point. This doesn't yet affect anything as cifs, the only current user, only passes in non-user-backed iterators. Fixes: 018584697533 ("netfs: Add a function to extract an iterator into a = scatterlist") Signed-off-by: David Howells Reviewed-by: Jeff Layton cc: Steve French cc: Shyam Prasad N cc: Rohith Surabattula cc: linux-cachefs@redhat.com cc: linux-cifs@vger.kernel.org cc: linux-fsdevel@vger.kernel.org --- fs/netfs/iterator.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/netfs/iterator.c b/fs/netfs/iterator.c index e9a45dea748a..8a4c86687429 100644 --- a/fs/netfs/iterator.c +++ b/fs/netfs/iterator.c @@ -139,7 +139,7 @@ static ssize_t netfs_extract_user_to_sg(struct iov_ite= r *iter, size_t seg =3D min_t(size_t, PAGE_SIZE - off, len); = *pages++ =3D NULL; - sg_set_page(sg, page, len, off); + sg_set_page(sg, page, seg, off); sgtable->nents++; sg++; len -=3D seg;