From mboxrd@z Thu Jan 1 00:00:00 1970 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 4EEFBC41535 for ; Tue, 19 Dec 2023 14:41:07 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B713A6B0075; Tue, 19 Dec 2023 09:41:06 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id B21176B007B; Tue, 19 Dec 2023 09:41:06 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9E8F96B007D; Tue, 19 Dec 2023 09:41:06 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 8C0096B0075 for ; Tue, 19 Dec 2023 09:41:06 -0500 (EST) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 4FBA9120B42 for ; Tue, 19 Dec 2023 14:41:06 +0000 (UTC) X-FDA: 81583830132.15.A44962B Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf01.hostedemail.com (Postfix) with ESMTP id 5E6844001D for ; Tue, 19 Dec 2023 14:41:04 +0000 (UTC) Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=V5PvhW36; spf=pass (imf01.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=1702996864; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=7TWKhr2LMbpjEPBw/2MEwrqBs0s6c+M03rN98iODU4U=; b=4EsxpnI2hSmSFkJVuVfC7/XPut8waf3pDpB33d+1bGbybFFdAHizh8XUCGlwb+rxFq8t4c Nn7nBnjZUtD/K16knd/d9fN0Ib7LG8I9kguihDacBGYgbM5R7eTb8dBEV2rJ534fsPm7oA SKxOZDyuNzgRnPbGqa5qF5UCHXWmbGw= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1702996864; a=rsa-sha256; cv=none; b=6zxHIssD5kJkpAFtLYFRpVuFQmqozsXqrcdYN6fsWOGwndIi0R/tpACyHazcK9U8Vu0y6k s2TAzZV2R3hyQYUVoKCfSmHv/PDwOBReIRTsoMJcKrFphY5jTKx7TBOZZhSp3NVLyMnyTn 7Goec0pq3J2G6H5+O2qSgT9PauGhqy4= ARC-Authentication-Results: i=1; imf01.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=V5PvhW36; spf=pass (imf01.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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1702996863; h=from:from:reply-to:subject:subject:date:date:message-id:message-id:to: cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=7TWKhr2LMbpjEPBw/2MEwrqBs0s6c+M03rN98iODU4U=; b=V5PvhW36zgn9bUfp7QkaovVgBgG3DaOwYc5mrjBDLXbBaTg9AZ5yHjXApyDIEEivmb7Wdl e238mlVJd8uPIO1XGM4PGmxtagLZzc+GwOe+gwPXDw/6sJa62YQCLfE6G8Tf3+8+OBDkcL yMVFGWmyQyttkicyu9Ccf0qMItnAQJI= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-53-pxkXtkAlOI-jeHJPe9wIAw-1; Tue, 19 Dec 2023 09:41:01 -0500 X-MC-Unique: pxkXtkAlOI-jeHJPe9wIAw-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E7A47299E748; Tue, 19 Dec 2023 14:40:59 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.39.195.169]) by smtp.corp.redhat.com (Postfix) with ESMTP id 27B1F1121306; Tue, 19 Dec 2023 14:40:57 +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 In-Reply-To: <488523.1702996313@warthog.procyon.org.uk> References: <488523.1702996313@warthog.procyon.org.uk> <367107fa03540f7ddd2e8de51c751348bd7eb42c.camel@kernel.org> <20231213152350.431591-1-dhowells@redhat.com> <20231213152350.431591-13-dhowells@redhat.com> Cc: dhowells@redhat.com, Jeff Layton , Steve French , Matthew Wilcox , Marc Dionne , Paulo Alcantara , Shyam Prasad N , Tom Talpey , Dominique Martinet , Eric Van Hensbergen , Ilya Dryomov , Christian Brauner , linux-cachefs@redhat.com, linux-afs@lists.infradead.org, linux-cifs@vger.kernel.org, linux-nfs@vger.kernel.org, ceph-devel@vger.kernel.org, v9fs@lists.linux.dev, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v4 12/39] netfs: Add iov_iters to (sub)requests to describe various buffers MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <488793.1702996856.1@warthog.procyon.org.uk> Content-Transfer-Encoding: quoted-printable Date: Tue, 19 Dec 2023 14:40:56 +0000 Message-ID: <488794.1702996856@warthog.procyon.org.uk> X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.3 X-Stat-Signature: xwjte8eeoe883ha7m8ysxjxi1ijir4ho X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: 5E6844001D X-Rspam-User: X-HE-Tag: 1702996864-885149 X-HE-Meta: U2FsdGVkX1+S8SNUT0veCnSJubQyxhMLHFvc0Bdd6r2nCiGwbq63thJeorzk0FmOA3ArbknoRroaeZR0c04Bsg6MUu8WmYwOx0WhNhH+itmz0iZmBPaVajAhVa70uOl7EyhbXAUXaCZogbkKKGiTLkbpTChqURr0auPCOz6jRRzSsj4B86LQGiv9CWis+b9TFM+KBhszVgF3s3YAjaD59QKMpHoNA0H2BVTXsh0F/ef9nOM6iy28oFVkA5FZyZqW6PUtTM5C39tDV8DK4ZLboZOu/nzw6U5xU3g7giDpODhyd9ugj2KrNq9gw6tqjJeZYA7v/KI3BYXOaPfc40HXODB9yRSMwj/uXWMQ/OztCZR/yXI7Q2YZ34fiJplg0Dau1Jg1ZynVlQ8RxVcDoKFe6RaFouILHrVX4hXumpgPl67Ipaf0TSf2/hnocCRG0uuWvWmMklGLTHu+QSS9worEdlCjsBQo62bWZTJ4On/dSjAJB5BA+zyj2+hAXfVunVz0/klqzquXsr99yxU/FjjZaz7WiGBLwvnf9quoVklR+JE6e3DcmTxS0y8k/6nGDDC+ojNIWgeUi5ZPrR+F8bSvRms+q0MWcAQrZZREaAULUoyhZhSOqvUfbmnzc4I0SSlmAduX5VJBCRdXMYKXTNyRWNxR0FOudZ8jtOLNdnu8PYWpP0GJHkalDQ3eNT5WawYAZP4pBngfq/52kelNjIB+Ntt1mumH31Ke6Gq+J9cC4Eym5pVRO4jOVBzivs7SyrB+fau5waetw5Copbh3qK9+hEB+K54BK+q7o5NgRn7BRKxWWILMtMLM3fyvu6ti4tfM6I69NbKQ7HcsR2U6AFQH8fZYbqTJlB9BQT3rfk33SyqEl5rhS2w/7OEwqi+nJCJVR/DaMamlQRuT8Ex1M7MMXvf/JRq5u9zhOmGlli1d+m//fE6pdbfFIt9mlxLEsuFGfe8wC/MiJlEPDggRI7Z zBl0Rxqg r1jThSylecTuP+EoZG/erQ7JTbBqqMYPi+a02LOLa3ST9a0Yo3JuQ8BXTa3lnohyCI/0Vdlq0DyKgMqLBPYPk6vpGm/hHmUJ+QQOmApLNOr575EN4067g5uW8KUoEtz7NGeUYDrzlW3V7o5vJudgzgTeFRCNaE/q07PM6R/c1n1y5Zm2ekhwDierjAFNh77IkXm6i3KG3DG3EKwJu4pIq/HSNniDUGXIdra5zqjte/rB+I44tg93JccfclLJ7Ad2aMqssRm4i/p9gje4ePJXAuYmyBQ== 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: List-Subscribe: List-Unsubscribe: David Howells wrote: > > > @@ -88,6 +78,11 @@ static void netfs_read_from_server(struct netfs_i= o_request *rreq, > > > struct netfs_io_subrequest *subreq) > > > { > > > netfs_stat(&netfs_n_rh_download); > > > + if (iov_iter_count(&subreq->io_iter) !=3D subreq->len - subreq->tr= ansferred) > > > + pr_warn("R=3D%08x[%u] ITER PRE-MISMATCH %zx !=3D %zx-%zx %lx\n", > > > + rreq->debug_id, subreq->debug_index, > > > + iov_iter_count(&subreq->io_iter), subreq->len, > > > + subreq->transferred, subreq->flags); > > = > > pr_warn is a bit alarmist, esp given the cryptic message. Maybe demot= e > > this to INFO or DEBUG? > > = > > Does this indicate a bug in the client or that the server is sending u= s > > malformed frames? > = > Good question. The network filesystem updated subreq->transferred to in= dicate > it had transferred X amount of data, but the iterator had been updated t= o > indicate Y amount of data was transferred. They really ought to match a= s it > may otherwise indicate an underrun (and potential leakage of old data). > Overruns are less of a problem since the iterator would have to 'go nega= tive' > as it were. > = > However, it might be better just to leave io_iter unchecked since we end= up > resetting it anyway each time we reinvoke the ->issue_read() op. It's a= lways > possible that it will get copied and a different iterator get passed to = the > network layer or cache fs - and so the change to the iterator then has t= o be > manually propagated just to avoid the warning. Actually, it's more complicated than that. It's an assertion that netfsli= b is doing the right prep. This assertion is checked both when we initially ma= ke a request (in which case it definitely shouldn't fire) and when we perform a resubmission on partial/complete read failure when we need to carefully revalidate the numbers to make sure we don't end up with holes or wrinkles= in the buffer. Anyway, it shouldn't happen - but if it does, it probably presages data corruption. David