Message ID | 20231213152350.431591-22-dhowells@redhat.com (mailing list archive) |
---|---|
State | New |
Headers | show
Return-Path: <owner-linux-mm@kvack.org> 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 25616C4332F for <linux-mm@archiver.kernel.org>; Wed, 13 Dec 2023 15:25:35 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B512E8D002D; Wed, 13 Dec 2023 10:25:34 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id AAFE08D0015; Wed, 13 Dec 2023 10:25:34 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 94FEF8D002D; Wed, 13 Dec 2023 10:25:34 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 811678D0015 for <linux-mm@kvack.org>; Wed, 13 Dec 2023 10:25:34 -0500 (EST) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id E7F33A0B77 for <linux-mm@kvack.org>; Wed, 13 Dec 2023 15:25:33 +0000 (UTC) X-FDA: 81562169346.16.9DB3D81 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf22.hostedemail.com (Postfix) with ESMTP id 3A91AC0010 for <linux-mm@kvack.org>; Wed, 13 Dec 2023 15:25:32 +0000 (UTC) Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=T5Iu23sR; spf=pass (imf22.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=1702481132; 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=i1NCs1wijkp9oudHg0v3ZW2pY0xP/Retx1SxWP1fmpE=; b=kq5IlIf7qke0rw7nJhmcFdpcbJDegNnKo6AdlolGFE6iRi5BT0SI8fHosqhX7DQE9ckIGo OZtw3zOleS4++xp8eJOBL/nKqObZJklW5M0WMwYAk0pwhvFHbuKP+vyp2vlXTrCKY/2Fx/ F4Ylcug/IdUgYC19rlv+sxvrnD+WQjI= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1702481132; a=rsa-sha256; cv=none; b=l6h0hAuIAjCXeUF9AIA62nXnouBAGA3FB7S7FDzQNJMq403gYHUzMlGRcsCuTM3kt2MFgc gKerKn2mHKPzAKqL9s2KoMORrsklM4k3R/q8sJBbJO5wnIE1ERjpwXWfMT1B8MgOVuB1H/ 1H7H+QMcBIV0sBcpPXaub1pE9uuowLM= ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=T5Iu23sR; spf=pass (imf22.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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1702481131; 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=i1NCs1wijkp9oudHg0v3ZW2pY0xP/Retx1SxWP1fmpE=; b=T5Iu23sRSw2qw3kT+WEg3WGh8S2q18LNpIO3DRRebp84UlJ7fM9dNK1lAMDTNMkoOxzyou 6DXQ3rNltfwV6NuXZhQGTDBaaurMSJl49WuK/RZCJK9agdQQLzK2RPsKuV+jKYUpfOjYql EyjgE9hUdlNIZ19V/1R+phK+miFupfo= 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-510-SR5-99_mNgesTFIbAUuluQ-1; Wed, 13 Dec 2023 10:25:28 -0500 X-MC-Unique: SR5-99_mNgesTFIbAUuluQ-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 CEA853801F6E; Wed, 13 Dec 2023 15:25:25 +0000 (UTC) Received: from warthog.procyon.org.com (unknown [10.42.28.2]) by smtp.corp.redhat.com (Postfix) with ESMTP id 174293C2F; Wed, 13 Dec 2023 15:25:21 +0000 (UTC) From: David Howells <dhowells@redhat.com> To: Jeff Layton <jlayton@kernel.org>, Steve French <smfrench@gmail.com> Cc: David Howells <dhowells@redhat.com>, Matthew Wilcox <willy@infradead.org>, Marc Dionne <marc.dionne@auristor.com>, Paulo Alcantara <pc@manguebit.com>, Shyam Prasad N <sprasad@microsoft.com>, Tom Talpey <tom@talpey.com>, Dominique Martinet <asmadeus@codewreck.org>, Eric Van Hensbergen <ericvh@kernel.org>, Ilya Dryomov <idryomov@gmail.com>, Christian Brauner <christian@brauner.io>, 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 v4 21/39] netfs: Make netfs_put_request() handle a NULL pointer Date: Wed, 13 Dec 2023 15:23:31 +0000 Message-ID: <20231213152350.431591-22-dhowells@redhat.com> In-Reply-To: <20231213152350.431591-1-dhowells@redhat.com> References: <20231213152350.431591-1-dhowells@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.1 X-Rspamd-Queue-Id: 3A91AC0010 X-Rspam-User: X-Rspamd-Server: rspam11 X-Stat-Signature: epcxjqi3wk67q4rcym8aa95u546a6irm X-HE-Tag: 1702481132-47977 X-HE-Meta: U2FsdGVkX18qWALbjz1ucu7Brvc+kAtMVshLAB1XGj9MJD6YN+lkIztQarGsQrpr/zMntBztr1Oh5SG8E3jVltxQ38bOehnGU/gN3g4rLCP8tkAUkbOZnC1qzaFAMSbEkaaBZ2OKCVOsJEdPB2zKAxYSqH4mqEYRioDDRqDc/p+9qnYDMwU5ncIRuufZBu48j+QnOWbTxwwUyXQ99MsIclI/frcrQnXt+DodjuuZfxa+LuB5Ofdx40jfN/OFFpGFMALITF43jm9Y5krQJOezGdgJDpiH/7AFY9NZEGZThefWoMV+1eAocNPfYNIzFP2go8VqYck3gc+5dO3uVJNHn5ULeDSUYcGCQ7Z4IhKcFJZhe22yeK2xIiyTzG87hi4emTAfUkedY8RPf/3/AciOSx/0s/YVWItYwQUhCZF3vVTo7aSiNbMNI2oesXCVZH2xZwbNsccOlTnc3HmY1lcgJUVwXOvyZRek/WTrDmhi4zG9PZlMhSxcT9myqusqERbFrIm54ez13rHm8VDXjtGCQWjNndu10MpSL+rJse45qRDtNHc0es0FvWboB1Yw37ZTG8mSQt2shx4NyhCpKNMKikQPdTbe8qGaG+G5lR+2TcsI0jGimInxTMHjBLWu09Z0vItRzYN30GpGMzXp5PfNVrkCrAjpGdDQ5aB1IyK0qCGaw2hH3MkXHZVXqQkZzodUalER8+C1aU2GAlYVY7A5ryEH5UEEN5FSTwUqS/0ZNWOpqHZoLYgFqCNdqoTs8ylG137RgK6f50+azYBS8Md2eZgd3XhHl1cphW6Pskmmi1WE9+/bmPpZSdJc2liAzIfMMEQEMUe7iHj3hTIcBSgeLiMtJB0Zg2lb8zbI1jUfAiFFpYQo17iPH25KT0Guoj58a9maAwO6tVH/admOOK+ncsKFr0LesaNaUjCD40dYvshBeNisb/EznKlFcnrqLBa9WAL1NX3JSN6iprE/vuZ NPn7y/7u lUkDKS2LXsmOU6SbOi6KmDq3xQEF3wTLqYtYAKwojcyS//fmspi4LFoxlvze401fdj65bZeme5mOC3bVCICA0W6Jl8S/M0rlObaZDtH88k2noEaOnGLG0Ber5xXaYGhQt4ztkcAMPpl2wuRsXEt4q/aebo7I+Bir+Nwzd2+L2psFFEDsB6x6Irop6Z8HWKH2dPwuwBkp3VViIS0ztE5R7IhTVXkiCdhuPQsNtDY6bKVYLj6MnPggpS0Gezsp2PHXKxNd/3t1deJqCUHjxMjF1axTcLpAGvOrDtrppaoLd02uBgwLaiE4zT+bU0v/iWpvz//qRMFNzzd/lvhX0GbzvKHJ5MQ== 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: <linux-mm.kvack.org> List-Subscribe: <mailto:majordomo@kvack.org> List-Unsubscribe: <mailto:majordomo@kvack.org> |
Series |
netfs, afs, 9p: Delegate high-level I/O to netfslib
|
expand
|
diff --git a/fs/netfs/objects.c b/fs/netfs/objects.c index 7ef804e8915c..3ce6313cc5f9 100644 --- a/fs/netfs/objects.c +++ b/fs/netfs/objects.c @@ -109,19 +109,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); + } } } }
Make netfs_put_request() just return if given a NULL request pointer. Signed-off-by: David Howells <dhowells@redhat.com> cc: Jeff Layton <jlayton@kernel.org> 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(-)