Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp7172144rdb; Wed, 3 Jan 2024 07:01:07 -0800 (PST) X-Google-Smtp-Source: AGHT+IGgJCiNXbSZhu7Te0q2/qV1QqnPXbzgeahfEtX064cJhUBoxDpI7G3LwikjleHgY6SvYsYC X-Received: by 2002:ac8:5a43:0:b0:428:3206:cb6 with SMTP id o3-20020ac85a43000000b0042832060cb6mr2880010qta.134.1704294065860; Wed, 03 Jan 2024 07:01:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704294065; cv=none; d=google.com; s=arc-20160816; b=tlx9K/7cTVRlppdVz4cH5ieJBFmrJYYK2K5EcZG/0WB5Vs3yLmFQ/l6IMhSXst+k3h rsOU/vMhJxdchWQddFPU1p8LdmUQtrQUFS0Cae1UZr1iEzIOjrct4KfwZra7IsQ4w+Ya hQ7sG0byyQR28YP05HGEcx8nsWAfEAcKYT15oGBjii23VVT94V2nDkh1tYW5T1phzXjJ KhOBu5dRvXtYisbrK8xSMhoRvwJADeRcUGQ9+aFB6ASgAWkZlhG43xVxlvaKRjTBp1Wl yrA1ewBWSNg4t27ZGD1fpkll4dA+DiLKMOfmxzqU7PfwxFn3NN7r0GUPggU2mWYtIMhh 58yA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=ZUPriBHgZCe048XAouZ6FVZlUrGVgRcZGkDmJ6vhI+o=; fh=z2lFNIQm1BYTiGQWz0rp4lP3BVSA1n5g+uZ/88gyKRg=; b=T4wF9Va9hwES+UKUKxtf++qnkf0eESoFF8uB4ETgd6va/pr7iWhg1IMtvIjMDZhYvL v/oijjMLSpiGWZVCCjugaWvL6FrtmEv/0GA5ym2LBz6IW0FQJ/UBgsI+wWOCvrr5QDgF 3TNHULq0d1TH/7v46Zgcc6aABACCZVFILP9IBYCXFW9PRX1jB+j0eyB8K0z1W12nka74 NmVc+LPoPsNt+q2glWsgytIYGWIlwoQwashWowF+wTmCusK7vSIJBbUpDQ5olPlFNV51 Cmm6Co8eO1VOwRRYcPGptVk5Eywy4CO42WPwq24Yza173JLvhsD4ShLWfnSj5LBkVE8D kGGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="WbIVdre/"; spf=pass (google.com: domain of linux-nfs+bounces-882-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-nfs+bounces-882-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id r5-20020ac85c85000000b004283ab4f730si804976qta.798.2024.01.03.07.01.04 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jan 2024 07:01:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-nfs+bounces-882-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="WbIVdre/"; spf=pass (google.com: domain of linux-nfs+bounces-882-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-nfs+bounces-882-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 6C0EE1C22361 for ; Wed, 3 Jan 2024 15:01:04 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0538C1A731; Wed, 3 Jan 2024 15:00:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="WbIVdre/" X-Original-To: linux-nfs@vger.kernel.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 917B51C287 for ; Wed, 3 Jan 2024 15:00:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1704294006; 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=WbIVdre/77BYAs7VnmULYmFKFJtIZgm28xhi+FQbOnzkgc+eDT1o0psUmkZusvQm2uqw+J TUAjVHJg2k54XZ0Nzo7IbsEyS68AJR7ls2rSU1wKWFGMVQpKIr1q+g643FhQewC9MzFAEw ZRciCyrgsWf4PBK4IAeW0SbHsvLtaXU= 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> Precedence: bulk X-Mailing-List: linux-nfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.1 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 --- 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; } /**