From patchwork Fri Mar 31 16:08:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 13196162 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 74EE1C761A6 for ; Fri, 31 Mar 2023 16:09:37 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E08FE6B0074; Fri, 31 Mar 2023 12:09:36 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id DB6626B0075; Fri, 31 Mar 2023 12:09:36 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C7E2C6B0078; Fri, 31 Mar 2023 12:09:36 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id BA6316B0074 for ; Fri, 31 Mar 2023 12:09:36 -0400 (EDT) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 86090C107C for ; Fri, 31 Mar 2023 16:09:36 +0000 (UTC) X-FDA: 80629678752.18.DF14396 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf27.hostedemail.com (Postfix) with ESMTP id B896640029 for ; Fri, 31 Mar 2023 16:09:32 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=ac3dk7Cy; spf=pass (imf27.hostedemail.com: domain of dhowells@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1680278972; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=fsOLHSRSLMInNcD449MTPXsGwp1kWYvONeYqTpf/Ez4=; b=4UH/mMOGrepTpUU4uVihxDf8A1rJ3+w2QrrOwYBiH2mgWlC9/WRm97K3Jx1aDPEQloItw3 PpDf8CsnPQjBsYD/CAFiv+5frbkAvZfb7E8oajU8Gp0OHPcTHn9/fW0J/dyBX5hs2UtQZY gan969lOTlvVRlRaVLUy+wg34L3YRuA= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=ac3dk7Cy; spf=pass (imf27.hostedemail.com: domain of dhowells@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1680278972; a=rsa-sha256; cv=none; b=VurOxltdVZR6E6JAd8C/Thb19BzbxSdxIgLGlsyujCRnabwvvjuu+kuU4ILnum2SUQkmHD Btx1HAIOFCYFa4zS2v58MFfA9pjGys9+RlJDrfO5rYbzltFi24UIs65pwrQbkw2f7fGnfZ Z+t/viVIY1uMYQk/4zb9FMsf8lmtrGo= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1680278972; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=fsOLHSRSLMInNcD449MTPXsGwp1kWYvONeYqTpf/Ez4=; b=ac3dk7CykEzP8MlLpKqYjILvXOQ871HViHO9l7bAuVx24JOcOy4pYPXsbclqlTc9L03c32 iodOndV/tsWuAXvzav6Ml1xOgNHxdloDQ4i1Tf/ApYmDwS6Dj9y/Xz+WhbmYjkM67Jr2cQ xAGFD+V2T0TuXYUnSVu8tXNTwStLmt4= 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-613-JBunTOtONMCZ2eDMDHE0OA-1; Fri, 31 Mar 2023 12:09:25 -0400 X-MC-Unique: JBunTOtONMCZ2eDMDHE0OA-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 56800855425; Fri, 31 Mar 2023 16:09:24 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.33.36.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id CF52D4042AC0; Fri, 31 Mar 2023 16:09:21 +0000 (UTC) From: David Howells To: Matthew Wilcox , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: David Howells , Al Viro , Christoph Hellwig , Jens Axboe , Jeff Layton , Christian Brauner , Chuck Lever III , Linus Torvalds , netdev@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Steve French , Shyam Prasad N , Rohith Surabattula , linux-cachefs@redhat.com, linux-cifs@vger.kernel.org Subject: [PATCH v3 01/55] netfs: Fix netfs_extract_iter_to_sg() for ITER_UBUF/IOVEC Date: Fri, 31 Mar 2023 17:08:20 +0100 Message-Id: <20230331160914.1608208-2-dhowells@redhat.com> In-Reply-To: <20230331160914.1608208-1-dhowells@redhat.com> References: <20230331160914.1608208-1-dhowells@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 X-Rspamd-Queue-Id: B896640029 X-Stat-Signature: kh3x53hchwjajqo1pg69xutpj7r6r1d9 X-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/NqexRAfyYnBsFcvreOTvtUbYGdx+Q36JivF/u28XriSjAEMR3G0pBT1FeW2hudCfT1QnVrjxkeE53jTvBdxhe2Swk09FBg9S6rf53F374TIVFuuvpIb6THMJKvhUbGHtaraArfTUUsdakJITwdgWs61xmHiIeDsVU7n3QSpgxvOwKU06Oad9UYuVxPc1aeTaIAfOli8D3pp08MD3YpK7chLSrTgGbM9X3bmQIbXImgS03XdLf5AI+YpBGSyhPgqNO5I4OSc9rRmlaaufqAEaKKl7k6GO4995F7Kq/suCQnYW/sEdg94kZMemSkN7cmZPvM1MfA7KA0JgWQU84OtQ7JUkvFSHoC93Cur8nwQ/R2fm26XV/DjHdUVn3OXJOnOSyHL20Ii6E1Mh4AcHXO/3t+RaLkSLYd5MT8a4 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Fix netfs_extract_iter_to_sg() for ITER_UBUF and ITER_IOVEC to set the size 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 cc: 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 Reviewed-by: Jeff Layton --- 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_iter *iter, size_t seg = min_t(size_t, PAGE_SIZE - off, len); *pages++ = NULL; - sg_set_page(sg, page, len, off); + sg_set_page(sg, page, seg, off); sgtable->nents++; sg++; len -= seg;