From patchwork Wed Jan 3 14:59:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 13510165 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 9741DC3DA6E for ; Wed, 3 Jan 2024 15:00:30 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 279B76B039C; Wed, 3 Jan 2024 10:00:30 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 202BC6B039D; Wed, 3 Jan 2024 10:00:30 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 02DA16B039E; Wed, 3 Jan 2024 10:00:29 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id DF5856B039C for ; Wed, 3 Jan 2024 10:00:29 -0500 (EST) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 9E48F140925 for ; Wed, 3 Jan 2024 15:00:29 +0000 (UTC) X-FDA: 81638310978.08.67A1698 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf11.hostedemail.com (Postfix) with ESMTP id 862FB40015 for ; Wed, 3 Jan 2024 15:00:23 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=WlvIIMQY; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf11.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=1704294023; a=rsa-sha256; cv=none; b=elAQqiV5G+NfU2HwHFht/xXcN7Fg3hx32LKcwXkatPRSKv74R2krYp4WeX3E6hf19XhupA g16L9VlvAtcNNJdyJeONH0W/a9UWhRuZo2QLSYYM5s+uVQp0vBnY8Gk6bWSkvY7ycInnrK 05nNYPTpfkUZeOljlBRnvC9T5di07/0= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=WlvIIMQY; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf11.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=1704294023; 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=7QMJZ+3lHeykV3WPSbajID2T4bzMyvXitF+gI+XPTjU=; b=LaP9x0jT40p/0QSJ7VOep6ujCMsuaAXQvNLOWCmBT9+1R5K2TyT983pJ6auv0VtIUo733q yPoPaa9DJi2OencKBu/bEztQYCTkW5ClU10McRRdKRxMjcB5S+EfyOzhtm3RlFnyAFZbP8 T1zmPZB3pcpsoXoA23vJGM5spo+JF04= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1704294016; 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=7QMJZ+3lHeykV3WPSbajID2T4bzMyvXitF+gI+XPTjU=; b=WlvIIMQY0Jc70EjRsDm3sWLi9Edks09+k12WzFYdIz6MkmSMAgYdFppVcZRRiyAzDO98EQ L/V8725gWJnJeFp2y9pu1q9Mb9X/v9G5vy5rOvpLAQJGWVr2OK9lknruEOsifKbioInJZI Yr3skH16iF4m2ohBfQZVaZE0keA3Hxw= 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-590-aceTF6bhNCidJMmyrfkt8A-1; Wed, 03 Jan 2024 10:00:12 -0500 X-MC-Unique: aceTF6bhNCidJMmyrfkt8A-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 4AA321E441CA; Wed, 3 Jan 2024 15:00:10 +0000 (UTC) Received: from warthog.procyon.org.com (unknown [10.42.28.68]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1A2D21121306; Wed, 3 Jan 2024 15:00:06 +0000 (UTC) From: David Howells To: Christian Brauner , Jeff Layton , Gao Xiang , Dominique Martinet Cc: David Howells , Steve French , Matthew Wilcox , Marc Dionne , Paulo Alcantara , Shyam Prasad N , Tom Talpey , Eric Van Hensbergen , Ilya Dryomov , 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-erofs@lists.ozlabs.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Latchesar Ionkov , Christian Schoenebeck Subject: [PATCH 5/5] 9p: Use length of data written to the server in preference to error Date: Wed, 3 Jan 2024 14:59:29 +0000 Message-ID: <20240103145935.384404-6-dhowells@redhat.com> In-Reply-To: <20240103145935.384404-1-dhowells@redhat.com> References: <20240103145935.384404-1-dhowells@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.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nS3K2k4ZYYAeTRSh+Ambz/SNwvCA vO3+gg6f dzYFlOzHB0B+R3AjSpzTbvcsbWPfwKZle74rQflArju5rfwHPkaXD8Z0+uuiUfeI5Z4VGbF8LIbzjqXb1Fitwtq07S7wyq/nT6IwJtqFE492MEczcuZ4da1McPCB6VrBrUKOxOYBc8RnehQYD8OXQ1aMFES9+TuJtUhjv9aQeY1Ll6r6Yj6CD88LePt1O2PcIpqUcjPfDh+zrTy/ZsFKFK73agq/eBx1Sic966uvz4EbgS6NH16C9wwL1NvlHO/Y2OdRihOocNtvZ1BT04SVGDfmrT3ZjxANkMPfA11Ow9enn9wmhKOct5uinzPPmXFkmlANvexo8zeaR83rHIY7kzWY0Z7Kftkum33HdLyP1vY7wHxjGcxXjF688+YJCDjbtptPLdZgmsgkHDwDp6Lmz7D9G9NhxCgbIPtFPe6uxxKiJ/3zk6IxoM3ijXA== 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: In v9fs_upload_to_server(), we pass the error to netfslib to terminate the subreq rather than the amount of data written - even if we did actually write something. Further, we assume that the write is always entirely done if successful - but it might have been partially complete - as returned by p9_client_write(), but we ignore that. Fix this by indicating the amount written by preference and only returning the error if we didn't write anything. (We might want to return both in future if both are available as this might be useful as to whether we retry or not.) Suggested-by: Dominique Martinet Link: https://lore.kernel.org/r/ZZULNQAZ0n0WQv7p@codewreck.org/ Signed-off-by: David Howells cc: Eric Van Hensbergen cc: Latchesar Ionkov cc: Christian Schoenebeck cc: v9fs@lists.linux.dev cc: linux-cachefs@redhat.com cc: linux-fsdevel@vger.kernel.org Acked-by: Dominique Martinet --- fs/9p/vfs_addr.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/fs/9p/vfs_addr.c b/fs/9p/vfs_addr.c index f7f83eec3bcc..047855033d32 100644 --- a/fs/9p/vfs_addr.c +++ b/fs/9p/vfs_addr.c @@ -29,12 +29,11 @@ static void v9fs_upload_to_server(struct netfs_io_subrequest *subreq) { struct p9_fid *fid = subreq->rreq->netfs_priv; - int err; + int err, len; trace_netfs_sreq(subreq, netfs_sreq_trace_submit); - p9_client_write(fid, subreq->start, &subreq->io_iter, &err); - netfs_write_subrequest_terminated(subreq, err < 0 ? err : subreq->len, - false); + len = p9_client_write(fid, subreq->start, &subreq->io_iter, &err); + netfs_write_subrequest_terminated(subreq, len ?: err, false); } static void v9fs_upload_to_server_worker(struct work_struct *work)