Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp149978rdb; Thu, 21 Dec 2023 05:35:32 -0800 (PST) X-Google-Smtp-Source: AGHT+IFjk5cXZZ7mkq3XeHuyFY8E4rdA9089LT8pSCnAnnHAgGYHAdLL2hBx907rmESQE13bMQjU X-Received: by 2002:ad4:5aad:0:b0:67f:820d:9bea with SMTP id u13-20020ad45aad000000b0067f820d9beamr1307259qvg.45.1703165732215; Thu, 21 Dec 2023 05:35:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703165732; cv=none; d=google.com; s=arc-20160816; b=EKn0FRS6b5l3fLK0H/YlNB8HwSyas7pTna8ApKZ8Zm38aZO/qIDeNQrZB/1OEuQwsT wxTkF03oV1mdc4HWowb2aVGDVJUkXLcUP2UHYLgT4zy/in+/pPJzfanrbjsDkxkJcRAd mG/D9A4GloY0Ne6BE5Q3nEs5u4e+D5wPfJjrg2EEx1j9X7TR7SgRJBu/xLPHPc+ufJLf D0/PqFoZ9mTwZ7JqiIgQIkmjDLhj+8mhyhwSvegsxC6L7Cx2yD7BPOrSQBr8pyA1N5H1 BEmnjQJaA4PkjyT/wpRgVbsMEjTqiXTKVd62jEInRY5TjBytzdugbnBFAnF6mIGZ4tdg F+MA== 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=U/y+xm2N9V1erDz4QIGlE5zRDPNtyRW7a99pDjZCrtc=; fh=ib4gl95HfLmZdfX9QIMf3rTepWCH9JlNymcDKJTPhJg=; b=nRGfqX5pEazTUHbPkxUbi28X3VAG4XpSNXK014OtkhjVg2GSiG3KHz/4Wr5m2MmkGD r78AEyE5lI6RIkOM/pBenssnVJWrzEemdnIyb2AKwFQrp/yVpMlYulZLKwCzq55L2MIs vUl3CexGUfhYQ4+9StGD5A1B7iX7z5VxpSoTwYmMMz+mh4K+t29kjxN3pP9KeFE8gRzg /Gcf23q3OlzSS6WGD61nVEY0FaXYn8gALHw2QAyOz0GftgfHbGuX5ClvWFX8fY8ylbTV znksknZdsZcC9SGlzrkRKPQnqlPCVRljGcCn0MDVOdbLBFSYq3bQbAu5u24/t3wMDTGz RJeg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=QzQ54kLQ; spf=pass (google.com: domain of linux-nfs+bounces-746-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-nfs+bounces-746-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 r16-20020a0cb290000000b0067f27bdede5si2052932qve.87.2023.12.21.05.35.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Dec 2023 05:35:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-nfs+bounces-746-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=QzQ54kLQ; spf=pass (google.com: domain of linux-nfs+bounces-746-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-nfs+bounces-746-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 003B51C215F5 for ; Thu, 21 Dec 2023 13:35:32 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 371D2745DA; Thu, 21 Dec 2023 13:25:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="QzQ54kLQ" X-Original-To: linux-nfs@vger.kernel.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.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 DCC34768FA for ; Thu, 21 Dec 2023 13:25:31 +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=1703165131; 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=U/y+xm2N9V1erDz4QIGlE5zRDPNtyRW7a99pDjZCrtc=; b=QzQ54kLQtdTEXkZNA9HXyQ3LXtJG0/JbTEv9R/YXP1S+kuKlXYvIsMZkE0EoTjMAKsspFD TDj0dBlzMJTmeyP0D6/QkLsTgcw3dRZgR666Rj60g7kdL2UjHp56AWhYx6HWxZf5kLNHEb 7O4Ysu6FmzcKCherTm6Cwd+cn0g9nII= 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-417-9pjKgx18P2eV28IFZ7u4ow-1; Thu, 21 Dec 2023 08:25:27 -0500 X-MC-Unique: 9pjKgx18P2eV28IFZ7u4ow-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (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 4A30185A58B; Thu, 21 Dec 2023 13:25:26 +0000 (UTC) Received: from warthog.procyon.org.com (unknown [10.39.195.169]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6425F51D5; Thu, 21 Dec 2023 13:25:23 +0000 (UTC) From: David Howells To: Jeff Layton , Steve French Cc: David Howells , Matthew Wilcox , Marc Dionne , Paulo Alcantara , Shyam Prasad N , Tom Talpey , Dominique Martinet , Eric Van Hensbergen , Ilya Dryomov , Christian Brauner , 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-fsdevel@vger.kernel.org, linux-mm@kvack.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v5 21/40] netfs: Make netfs_put_request() handle a NULL pointer Date: Thu, 21 Dec 2023 13:23:16 +0000 Message-ID: <20231221132400.1601991-22-dhowells@redhat.com> In-Reply-To: <20231221132400.1601991-1-dhowells@redhat.com> References: <20231221132400.1601991-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.5 Make netfs_put_request() just return if given a NULL request pointer. Signed-off-by: David Howells Reviewed-by: Jeff Layton cc: linux-cachefs@redhat.com cc: linux-fsdevel@vger.kernel.org cc: linux-mm@kvack.org --- fs/netfs/objects.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/fs/netfs/objects.c b/fs/netfs/objects.c index 65a17dd4ab49..3aa0bfbc04ec 100644 --- a/fs/netfs/objects.c +++ b/fs/netfs/objects.c @@ -106,19 +106,22 @@ static void netfs_free_request(struct work_struct *work) void netfs_put_request(struct netfs_io_request *rreq, bool was_async, enum netfs_rreq_ref_trace what) { - unsigned int debug_id = rreq->debug_id; + unsigned int debug_id; bool dead; int r; - dead = __refcount_dec_and_test(&rreq->ref, &r); - trace_netfs_rreq_ref(debug_id, r - 1, what); - if (dead) { - if (was_async) { - rreq->work.func = netfs_free_request; - if (!queue_work(system_unbound_wq, &rreq->work)) - BUG(); - } else { - netfs_free_request(&rreq->work); + if (rreq) { + debug_id = rreq->debug_id; + dead = __refcount_dec_and_test(&rreq->ref, &r); + trace_netfs_rreq_ref(debug_id, r - 1, what); + if (dead) { + if (was_async) { + rreq->work.func = netfs_free_request; + if (!queue_work(system_unbound_wq, &rreq->work)) + BUG(); + } else { + netfs_free_request(&rreq->work); + } } } }