From patchwork Thu Aug 22 22:06:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 13774266 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 ABE8CC3DA4A for ; Thu, 22 Aug 2024 22:07:08 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 137D96B017F; Thu, 22 Aug 2024 18:07:08 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 0C0DB6B0182; Thu, 22 Aug 2024 18:07:08 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E7C7C6B0183; Thu, 22 Aug 2024 18:07:07 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id C70606B017F for ; Thu, 22 Aug 2024 18:07:07 -0400 (EDT) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 52B2BA9D01 for ; Thu, 22 Aug 2024 22:07:07 +0000 (UTC) X-FDA: 82481267694.26.6E22E9C Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf26.hostedemail.com (Postfix) with ESMTP id 9143A140026 for ; Thu, 22 Aug 2024 22:07:05 +0000 (UTC) Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=gF8Lz+6u; spf=pass (imf26.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=1724364344; 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:references:dkim-signature; bh=kxWA4xqBbcQ0SKYTS5195o7goMEsBuv2jCniBGikgOg=; b=r9D8qjAQEDADkH/cx49lhXsFO8jDp/8WQwqNZqNd/3Cdv6qbQrG2pi0cx1n2J5GC7fmVZf 2qleeN7tzmVkBl5UFHEwNHNE562PbK0Wv+E8bHDKA3UiPkUYxIOJgL/3Da6aaXo6ceHG6S 9VfdJdmJiLXmJYSW3uDRbNaga4A99VA= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1724364344; a=rsa-sha256; cv=none; b=009PptXGSikQnO8ZHhMhyCx/saPVeHQjblExUr6HWhDOlgCEs5V0CjERfVd++8SyfzyjRx oGg1M9wKs2wykn5IjAkdtolKvOhS/+bz9yfXG2aHPfHjL39bGoMNDITRqKgiHUGrX9bfLb 4ZigjDjXdJUx/koFXtEuykF2Sg8h4yA= ARC-Authentication-Results: i=1; imf26.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=gF8Lz+6u; spf=pass (imf26.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=1724364424; 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; bh=kxWA4xqBbcQ0SKYTS5195o7goMEsBuv2jCniBGikgOg=; b=gF8Lz+6usJwCFj8na1ht7OsK9e1TzW3MwU4JEOXCnBaIEY7y68ifgVspNJrpA4aTSw8lWu 6Rk8sovTbSObo5Wcr2aGGGdwO5rqjn7z/EvL2sgkPhTQ5lTNCY5MgSSamnIhb+OgW6AcSu BRyhBzf+82zmR+Qbw0UV/zruzuRoc7M= Received: from mx-prod-mc-05.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-677-VBKT_YO7Mp2TNuZc4LfykA-1; Thu, 22 Aug 2024 18:07:01 -0400 X-MC-Unique: VBKT_YO7Mp2TNuZc4LfykA-1 Received: from mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.40]) (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-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id AAE351955F45; Thu, 22 Aug 2024 22:06:58 +0000 (UTC) Received: from warthog.procyon.org.uk.com (unknown [10.42.28.30]) by mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 95CA019560A3; Thu, 22 Aug 2024 22:06:53 +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 Subject: [PATCH 0/2] netfs, cifs: DIO read and read-retry fixes Date: Thu, 22 Aug 2024 23:06:47 +0100 Message-ID: <20240822220650.318774-1-dhowells@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.40 X-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 9143A140026 X-Stat-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xYRlMwTyVeJo9LdadK+rGyFX/te1zkIM6dED3auos3nrWp+FJVWTAreDZrovBnH6UCblrO61g459Ic35bd4tsot7Xc/2C48PJP9K4TZJ3D9mqCr8yx1dCPL3dt4hKwnX92v2ooyy1LHvDux5/xWFX6IwNyZgdfrGUb/Jv6BZwOcjItK1P+fjvV65wYcm0CSm6+/e2EYUiIj83Hinizy5Crf2BIn78sUR4qm8xcRtU5p5itqSJpqYZ0naXtljWDPTZboZqUywsZC5MTBsuGLOUvuMugpqlmembO/UjQEr/qxNV7tig== 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: Hi Christian, Steve, Here are a couple of fixes to DIO read handling and the retrying of reads, particularly in relation to cifs. (1) Fix the missing credit renegotiation in cifs on the retrying of reads. The credits we had ended with the original read (or the last retry) and to perform a new read we need more credits otherwise the server can reject our read with EINVAL. (2) Fix the handling of short DIO reads to avoid ENODATA when the read retry tries to access a portion of the file after the EOF. These were both accessible by simply trying to do a DIO read of a remote file where the read was larger than the file. Note that (2) might also apply to other netfslib-using filesystems. The patches can also be found here: https://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs.git/log/?h=netfs-fixes Thanks, David David Howells (2): cifs: Fix lack of credit renegotiation on read retry netfs, cifs: Fix handling of short DIO read fs/netfs/io.c | 19 ++++++++++++------ fs/smb/client/cifsglob.h | 1 + fs/smb/client/file.c | 28 ++++++++++++++++++++++---- fs/smb/client/smb2pdu.c | 43 +++++++++++++++++++++++++++++----------- include/linux/netfs.h | 1 + 5 files changed, 70 insertions(+), 22 deletions(-)