From patchwork Wed Jan 3 14:59:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 13510164 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 7D56FC47077 for ; Wed, 3 Jan 2024 15:00:23 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0CC536B0399; Wed, 3 Jan 2024 10:00:23 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 0550F6B039A; Wed, 3 Jan 2024 10:00:22 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E10846B039B; Wed, 3 Jan 2024 10:00:22 -0500 (EST) 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 C75D46B0399 for ; Wed, 3 Jan 2024 10:00:22 -0500 (EST) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 74A1C1A08B9 for ; Wed, 3 Jan 2024 15:00:10 +0000 (UTC) X-FDA: 81638310180.25.1DF3218 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf15.hostedemail.com (Postfix) with ESMTP id 965BDA0017 for ; Wed, 3 Jan 2024 15:00:08 +0000 (UTC) Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=ZcosswAf; spf=pass (imf15.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=1704294008; a=rsa-sha256; cv=none; b=KHN+BjOEKwy5aVFAj0KOt6XWD5izvzZdA2V1XkdRBAKOnwncVFPbh5I46ytuFt2ysYKcmW BZXNitK2RRvzKX0DoaCXM+ywzMCQzIY9jvxgCe9/EisQGPXiJIh+d/o6NICF42+QgzGw0L 7VmjOYWEv/HpNRBeMsEo5iJPlL4y4l4= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=ZcosswAf; spf=pass (imf15.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=1704294008; 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=ZUPriBHgZCe048XAouZ6FVZlUrGVgRcZGkDmJ6vhI+o=; b=VrnSwjB4m5wxDxQ7kLAkLHH0+c5+DRDzW8YRhSW39tmy1b1HmPuvDZ4T+n4IsKpIN2MY55 kvRxOnxnkLpVvzg8ywByG2QRNlBg5mx1ZpLRl5TvArE1yzQXlGZKoy11BVgtF4tmOf5Hic o01urj4cWINJle5XBubujcwdbkRz+1c= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1704294007; 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=ZUPriBHgZCe048XAouZ6FVZlUrGVgRcZGkDmJ6vhI+o=; b=ZcosswAfmwuQQDPOw/u+XeeOx1T9QEmw5bQsPu+2eaHVWQghGX+4v0Ohw65WDkCa1vRvrH WBQc9uwCEP52J6hMbCRYzfFoksEbM1i1J4wbGGV9ik3D+xYqkH9Xo9DaWiw8ChX5jK+UoW kFuiqPUeTPM4z3mQbRkheUySAX6hhdI= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-194-mFIdXobHMneufCW3dOaAMw-1; Wed, 03 Jan 2024 10:00:04 -0500 X-MC-Unique: mFIdXobHMneufCW3dOaAMw-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (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 7FA74185A780; Wed, 3 Jan 2024 15:00:02 +0000 (UTC) Received: from warthog.procyon.org.com (unknown [10.42.28.68]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0074C3C30; Wed, 3 Jan 2024 14:59:58 +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 3/5] 9p: Do a couple of cleanups Date: Wed, 3 Jan 2024 14:59:27 +0000 Message-ID: <20240103145935.384404-4-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: MIME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s8/AhSGMn7Z3JltdyAuOxhmTdHPLMcpL74C3wTnB aOCw/oRN amzva9UiNvXdlH0JmcPI6q3Ds5s9SERmcJfxvJNYJNeSFk1DLq8Yhjs2VObKpBY6jpir/Se5Pa0tiw9xWQWkFNUhv+0cA9O8S/mkGtCHpBe6LkCufHBQMcIamDT/E/tpi6PVaKH2vB7im2tR9mF0Knj9u0M0xtc4+ouiicvVuhpih53KGt9Gx3w1h/OeBEptZcgjJwHbWPrT2K4CnUQeIi85f2T2Ww/MzE/olZK9EI43kn9VWzYpv3TCW4O69M/m1Ik5CZhK+yRde6hpdXolGtf1w7JzaW37VWV1RtmxE+3ksezYHe14afFG7cO21+P68678QpufswVzZ7Yl7UXBqCskrMq/zf+UMmmWw/0L1Decs+TmYzzVciZFBxUuEgbTWxlqYO/1lNJ0VOR17t37yHhpAhGgo8AworC6h 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: Do a couple of cleanups to 9p: (1) Remove a couple of unused variables. (2) Turn a BUG_ON() into a warning, consolidate with another warning and make the warning message include the inode number rather than whatever's in i_private (which will get hashed anyway). 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 | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/fs/9p/vfs_addr.c b/fs/9p/vfs_addr.c index d8fb407189a0..f7f83eec3bcc 100644 --- a/fs/9p/vfs_addr.c +++ b/fs/9p/vfs_addr.c @@ -28,8 +28,6 @@ static void v9fs_upload_to_server(struct netfs_io_subrequest *subreq) { - struct inode *inode = subreq->rreq->inode; - struct v9fs_inode __maybe_unused *v9inode = V9FS_I(inode); struct p9_fid *fid = subreq->rreq->netfs_priv; int err; @@ -98,15 +96,13 @@ static int v9fs_init_request(struct netfs_io_request *rreq, struct file *file) if (file) { fid = file->private_data; - BUG_ON(!fid); + if (!fid) + goto no_fid; p9_fid_get(fid); } else { fid = v9fs_fid_find_inode(rreq->inode, writing, INVALID_UID, true); - if (!fid) { - WARN_ONCE(1, "folio expected an open fid inode->i_private=%p\n", - rreq->inode->i_private); - return -EINVAL; - } + if (!fid) + goto no_fid; } /* we might need to read from a fid that was opened write-only @@ -115,6 +111,11 @@ static int v9fs_init_request(struct netfs_io_request *rreq, struct file *file) WARN_ON(rreq->origin == NETFS_READ_FOR_WRITE && !(fid->mode & P9_ORDWR)); rreq->netfs_priv = fid; return 0; + +no_fid: + WARN_ONCE(1, "folio expected an open fid inode->i_ino=%lx\n", + rreq->inode->i_ino); + return -EINVAL; } /**