From patchwork Fri Aug 23 16:12:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 13775480 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 2F4A1C52D7C for ; Fri, 23 Aug 2024 16:12:56 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BE2D46B0341; Fri, 23 Aug 2024 12:12:55 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B92286B0342; Fri, 23 Aug 2024 12:12:55 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A5A156B0343; Fri, 23 Aug 2024 12:12:55 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 852FB6B0341 for ; Fri, 23 Aug 2024 12:12:55 -0400 (EDT) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 19E0481DB7 for ; Fri, 23 Aug 2024 16:12:55 +0000 (UTC) X-FDA: 82484003910.20.F27DEAA Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf21.hostedemail.com (Postfix) with ESMTP id AFB8F1C001F for ; Fri, 23 Aug 2024 16:12:52 +0000 (UTC) Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=LpWj2SkP; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf21.hostedemail.com: domain of dhowells@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1724429512; a=rsa-sha256; cv=none; b=wGDSEwrV8uojBbzxNuSYfQMtazFRrAkC2EhzEK3ya4opKWKBLPsN4GFZHchbOMK5OXc2QK M2Yil2IDupmSLPVZhg3DsVk6tARHPIfk7zST6HCYqd+x7zC1qNXOCXz0axa8FpSWo6Dc0V WSvXO+2N6U0vSk9OIKGuNDxEaf9lymI= ARC-Authentication-Results: i=1; imf21.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=LpWj2SkP; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf21.hostedemail.com: domain of dhowells@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1724429512; 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=C4kdxje9pJwe2F8kxgsN+SQonQ75sAMbOz8YwNBazmI=; b=O8ldGcECRQv7XBeW64X6MiSnnEgDLsro8ocusI3q55pm0YDRCK8SQ28YA7r4REkithi1Mn zw/29bB3RxJQLr91FGc/ZRecfT1XCEiP//B4Htmt0gwEo1QeSOoKhk5tEoavKfKC2mMZAO /dw7H2E/W+wurdlX2Ex35Y7U2E76NpE= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1724429571; 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=C4kdxje9pJwe2F8kxgsN+SQonQ75sAMbOz8YwNBazmI=; b=LpWj2SkP51jpUmkjArjNRAdXzF9hZhS/XCQwcbfMJ5Dv6DNul3TkRGeA/VBqXAOSSaGLY6 3eSmKPU43PAwi5Ue9CsxbVZRAtobdLsuCu6nHWj6AERw6wwEkUnVf7ewW5dkYA44mCBq1R 7ECo28grhBTUnRaCfNtoLwZ0Xst5I18= Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-542-tWlcgTiVMRa8lhTgu6q_UA-1; Fri, 23 Aug 2024 12:12:44 -0400 X-MC-Unique: tWlcgTiVMRa8lhTgu6q_UA-1 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (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 mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id CFCD01955D47; Fri, 23 Aug 2024 16:12:41 +0000 (UTC) Received: from warthog.procyon.org.uk.com (unknown [10.42.28.30]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 9B46D19560A3; Fri, 23 Aug 2024 16:12:37 +0000 (UTC) From: David Howells To: Christian Brauner Cc: David Howells , Pankaj Raghav , Jeff Layton , Matthew Wilcox , netfs@lists.linux.dev, 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-erofs@lists.ozlabs.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Steve French , Paulo Alcantara Subject: [PATCH 4/5] cifs: Fix short read handling Date: Fri, 23 Aug 2024 17:12:05 +0100 Message-ID: <20240823161209.434705-5-dhowells@redhat.com> In-Reply-To: <20240823161209.434705-1-dhowells@redhat.com> References: <20240823161209.434705-1-dhowells@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 X-Rspamd-Queue-Id: AFB8F1C001F X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: y8ktbj4yqc6ome5niet7h6t9isedpbmu X-HE-Tag: 1724429572-828907 X-HE-Meta: U2FsdGVkX19++F5BMSROhYpLZi97nparqKEUCz4saAVWKcjiW786lyqRsP8tucMEUnB/8JBoiY750wWWkxSnp4R+Epj20K+4GjS0hVc2tRg+Lz2jeJtGwESGoi8HBlR2g71ZoDj/i1bOSzLq3BQVPp8YalkckSrWs38FTIbuRmPRqW8Y+RC8WZgwDRwLkYDk92VP1SNwOoKPGt3g3Oh2n9c++Fvp66JRl5clD4c4rC8jOPCeqL3eCVpueer2LAlLmhgowIYGaKpYp7fxV69pSClemLlCQUv1GUorDs1khnhgldJ/a/wduBpk0UN24AkAbYAIvmfRY+iICx+QihmBffyUWeKuwCx3qM2LATzL7d5hLPTwnffqJpaR7ThE38rixihdqpEZk0/mda4N4ok2PGhiqAY46KgBybfT3dGSuy+wjskENYLWZsQ0zDVJlYd7/KIzos8E0d/7m7I/ln803z1LBiysrW4L8ado5b7nd2dnvZm+wZWiZYOTpqeK1gbja8CYqdNZB1CJCN57/8ijIAPXP81kQ6/G3XsgaI0Y2jMt+LhwD6YCn/8XixoIjVobNV0gqX6+vuC0UYYYpXIG4ioSCV9JyKHLut+Pzf88O/nAvrE+yCOlHLTKr1vihhjTm6rwZTq7K935rOPlQMnQl2gWkL/6wX+SMRXhsMsrY6Bx2fblI39aAAax9Wn42ZG1tfEKRmqhGmxnheiSyaK8e8SMlBq0UwVRwRm3/lscRyouvBxr+y/q9O/CqQSNJDwkghsOhSmfQ4Oc8RvPj/wKBWZuBPyVeRngTKOzHRVvZFiJUVM5Qxpb45SaXrX4eqxWfUHG8C+bQYBYnbJPqCGd69NTEhN0yNocPM+6dViDAjYJP/hpOdfOvP/QJYuMqHkMFuSIQsCQ2+/bd5W/vba229u0gxiXpRYjaYwPe5tV4lceKDCzB64nRP8gT52xgeGc5aY/87JdMii7LETnhcw QgO0Haxa 05Z73r9gplWiIILnTqHNJBMfCId3xV2lJmSjdGg7pGAY+inK0tm30NZvaETRx2uaZepV8jMlQny0kgNARIDGX3Qv3OP3J3hs4UEPyjVsgj7BtDmFZDEPR81shV0Cqv1pL6Cki1WynD5Uw/n4LJccHSwFo0PskqRmQzogxbkwQmKuKCH+aRLWYnInn0hlkiD+WixYzQgENPS7jFibY0BE8fehEmj0FW8EdvA0zQMlzo1w3rlTYfjk4OEPZlGVOQpO27WeWraGWGqJADZIFKCk1+51mhDPU4MYJ7duze3AUA9eaK330QWskKO0voUFqlG1E2yd3vtAA3XgPqqZBm5zYN11MWvQIBm0QvFGikQtafOEjKK/797ygp99Vn0WkABFmMqdpZMyeOAFS4UxpD4mz0Fx1htJ5uDSusE9iriI9hB4pAgw9wjdWxBfmPcEhFAjwnoTh2fz4sD/E2/zqRahhASl8P8OEOF8JJcdf 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: Fix smb2_readv_callback() to always take -ENODATA as indicating we hit EOF and to always set the NETFS_SREQ_HIT_EOF flag rather than only doing it under some circumstances. Fixes: 942ad91e2956 ("netfs, cifs: Fix handling of short DIO read") Signed-off-by: David Howells cc: Steve French cc: Paulo Alcantara cc: Jeff Layton cc: linux-cifs@vger.kernel.org cc: netfs@lists.linux.dev cc: linux-fsdevel@vger.kernel.org --- fs/smb/client/smb2pdu.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/fs/smb/client/smb2pdu.c b/fs/smb/client/smb2pdu.c index e182fdbec887..9829784e8ec5 100644 --- a/fs/smb/client/smb2pdu.c +++ b/fs/smb/client/smb2pdu.c @@ -4601,16 +4601,8 @@ smb2_readv_callback(struct mid_q_entry *mid) rdata->got_bytes); if (rdata->result == -ENODATA) { - /* We may have got an EOF error because fallocate - * failed to enlarge the file. - */ - if (rdata->subreq.start + rdata->subreq.transferred < rdata->subreq.rreq->i_size) - rdata->result = 0; - if (rdata->subreq.start + rdata->subreq.transferred + rdata->got_bytes >= - ictx->remote_i_size) { - __set_bit(NETFS_SREQ_HIT_EOF, &rdata->subreq.flags); - rdata->result = 0; - } + __set_bit(NETFS_SREQ_HIT_EOF, &rdata->subreq.flags); + rdata->result = 0; } else { if (rdata->got_bytes < rdata->actual_len && rdata->subreq.start + rdata->subreq.transferred + rdata->got_bytes ==