From patchwork Wed Mar 29 14:13:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 13192510 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 5EE85C74A5B for ; Wed, 29 Mar 2023 14:14:11 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A2E206B0074; Wed, 29 Mar 2023 10:14:10 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9DC296B0075; Wed, 29 Mar 2023 10:14:10 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 87DF56B0078; Wed, 29 Mar 2023 10:14:10 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 79F8C6B0074 for ; Wed, 29 Mar 2023 10:14:10 -0400 (EDT) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 43FDC1401E5 for ; Wed, 29 Mar 2023 14:14:10 +0000 (UTC) X-FDA: 80622130260.23.13103B8 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf04.hostedemail.com (Postfix) with ESMTP id 64EC940025 for ; Wed, 29 Mar 2023 14:14:07 +0000 (UTC) Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=beBy+dD0; spf=pass (imf04.hostedemail.com: domain of dhowells@redhat.com designates 170.10.133.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=1680099247; a=rsa-sha256; cv=none; b=YBV+lx8vwAg9JSpRKj9y14/0J/580cj4o8YLdRZy1uU6xpsNbngTSkuQNVifFdfVgXs3r+ O/fESI+GDcBzhaOlrUGCWvUVWcbdhLNMkLU5AEHIOVA7M6rn596c3c2+jAkUFHe7k8cYW6 XCEPcB/FFv31wg470WD41MAkWRZyalI= ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=beBy+dD0; spf=pass (imf04.hostedemail.com: domain of dhowells@redhat.com designates 170.10.133.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=1680099247; 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=6pT30KDqJIBkblQSKqodwLluz3/mfmwgVXqgKphsg7igR9TJ18YpY3yDJbHi4vFmFI/g/i rqg/J1S0Uo7OjMTKMGCPV1YDHcYa2rrjED/Z976K7hPsWFnlmucS2PqA7Xv/UFDrdu6BI9 y4zRwIzz0lr4eliq35/wdXcCYx8wJdY= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1680099246; 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=beBy+dD022NdWtdaVKpwN4DF5Zv3960mDrhNFTVvEAOGATKOBtVvvg4/ScRqkNKm5PnO1y /Mt1spWdGcjxaOd2khxraHm1drcUpTrtrNvnVpwc32UatUTTollwfO/4wOAgPlLhezjkXK 1c85G+Vadt0vdvVC6gb68f/GpPMfyQc= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-516-Xdb9sur-PoeNk1trWuucgw-1; Wed, 29 Mar 2023 10:14:03 -0400 X-MC-Unique: Xdb9sur-PoeNk1trWuucgw-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 080F01C06EE7; Wed, 29 Mar 2023 14:14:02 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.33.36.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id 94AC618EC6; Wed, 29 Mar 2023 14:13:59 +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: [RFC PATCH v2 01/48] netfs: Fix netfs_extract_iter_to_sg() for ITER_UBUF/IOVEC Date: Wed, 29 Mar 2023 15:13:07 +0100 Message-Id: <20230329141354.516864-2-dhowells@redhat.com> In-Reply-To: <20230329141354.516864-1-dhowells@redhat.com> References: <20230329141354.516864-1-dhowells@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 X-Rspam-User: X-Rspamd-Queue-Id: 64EC940025 X-Rspamd-Server: rspam01 X-Stat-Signature: nqewoswmbaoz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N/M2J2VAxpL/YndsWt0PLMEnjtVLEYrCS/WpZvEopuWr6H6IhL43ptDpzizrGbDaZLn8B6e00q5m4yLzhS6jWBgRUP611MzEar4fH39W7zj3MTeHng+vwkegbzxWJ2BLA9QIY1y0HTnh0iMio17HxinD6ALkHV9KOyI2/lbEpx3+IQt5144VgZw8BQdZtLqAezn8F4W92mM0Gq8P3+zQcpl7G6zvi1L1bNleYjZQriEmW6UyjlmbwbsssDOxzKpM0nNtuslkjgdieWdc9cBvGOOtIUchv8efnjWNT4XJmGrZsI+5l6RjM6J4ucg0bNy2go1Ur626bd46VMEHqf/zrqCPGKCl6Tl/aCeG7aY2LcKrmNeS1tpawkDTAkniEbapuYiU2A6Cs6pe4nDj6mzHvrrYbrkzX6M/KAOCklegjaAzHvE07ql 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 --- 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;