All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	stable@vger.kernel.org, Kinglong Mee <kinglongmee@gmail.com>,
	"J. Bruce Fields" <bfields@redhat.com>,
	Sasha Levin <alexander.levin@verizon.com>
Subject: [PATCH 4.4 44/46] nfsd/callback: Cleanup callback cred on shutdown
Date: Thu, 19 Oct 2017 15:49:20 +0200	[thread overview]
Message-ID: <20171019134847.870715707@linuxfoundation.org> (raw)
In-Reply-To: <20171019134845.293630834@linuxfoundation.org>

4.4-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Kinglong Mee <kinglongmee@gmail.com>


[ Upstream commit f7d1ddbe7648af7460d23688c8c131342eb43b3a ]

The rpccred gotten from rpc_lookup_machine_cred() should be put when
state is shutdown.

Signed-off-by: Kinglong Mee <kinglongmee@gmail.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 fs/nfsd/nfs4callback.c |    8 ++++++++
 fs/nfsd/nfs4state.c    |   10 ++++++----
 fs/nfsd/state.h        |    1 +
 3 files changed, 15 insertions(+), 4 deletions(-)

--- a/fs/nfsd/nfs4callback.c
+++ b/fs/nfsd/nfs4callback.c
@@ -696,6 +696,14 @@ int set_callback_cred(void)
 	return 0;
 }
 
+void cleanup_callback_cred(void)
+{
+	if (callback_cred) {
+		put_rpccred(callback_cred);
+		callback_cred = NULL;
+	}
+}
+
 static struct rpc_cred *get_backchannel_cred(struct nfs4_client *clp, struct rpc_clnt *client, struct nfsd4_session *ses)
 {
 	if (clp->cl_minorversion == 0) {
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -6792,23 +6792,24 @@ nfs4_state_start(void)
 
 	ret = set_callback_cred();
 	if (ret)
-		return -ENOMEM;
+		return ret;
+
 	laundry_wq = alloc_workqueue("%s", WQ_UNBOUND, 0, "nfsd4");
 	if (laundry_wq == NULL) {
 		ret = -ENOMEM;
-		goto out_recovery;
+		goto out_cleanup_cred;
 	}
 	ret = nfsd4_create_callback_queue();
 	if (ret)
 		goto out_free_laundry;
 
 	set_max_delegations();
-
 	return 0;
 
 out_free_laundry:
 	destroy_workqueue(laundry_wq);
-out_recovery:
+out_cleanup_cred:
+	cleanup_callback_cred();
 	return ret;
 }
 
@@ -6847,6 +6848,7 @@ nfs4_state_shutdown(void)
 {
 	destroy_workqueue(laundry_wq);
 	nfsd4_destroy_callback_queue();
+	cleanup_callback_cred();
 }
 
 static void
--- a/fs/nfsd/state.h
+++ b/fs/nfsd/state.h
@@ -595,6 +595,7 @@ extern struct nfs4_client_reclaim *nfsd4
 extern __be32 nfs4_check_open_reclaim(clientid_t *clid,
 		struct nfsd4_compound_state *cstate, struct nfsd_net *nn);
 extern int set_callback_cred(void);
+extern void cleanup_callback_cred(void);
 extern void nfsd4_probe_callback(struct nfs4_client *clp);
 extern void nfsd4_probe_callback_sync(struct nfs4_client *clp);
 extern void nfsd4_change_callback(struct nfs4_client *clp, struct nfs4_cb_conn *);

  parent reply	other threads:[~2017-10-19 14:05 UTC|newest]

Thread overview: 56+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-19 13:48 [PATCH 4.4 00/46] 4.4.94-stable review Greg Kroah-Hartman
2017-10-19 13:48 ` [PATCH 4.4 01/46] percpu: make this_cpu_generic_read() atomic w.r.t. interrupts Greg Kroah-Hartman
2017-10-19 13:48 ` [PATCH 4.4 02/46] drm/dp/mst: save vcpi with payloads Greg Kroah-Hartman
2017-10-19 13:48 ` [PATCH 4.4 03/46] MIPS: Fix minimum alignment requirement of IRQ stack Greg Kroah-Hartman
2017-10-19 13:48 ` [PATCH 4.4 04/46] sctp: potential read out of bounds in sctp_ulpevent_type_enabled() Greg Kroah-Hartman
2017-10-19 13:48 ` [PATCH 4.4 05/46] bpf/verifier: reject BPF_ALU64|BPF_END Greg Kroah-Hartman
2017-10-19 13:48 ` [PATCH 4.4 06/46] udpv6: Fix the checksum computation when HW checksum does not apply Greg Kroah-Hartman
2017-10-19 13:48 ` [PATCH 4.4 07/46] ip6_gre: skb_push ipv6hdr before packing the header in ip6gre_header Greg Kroah-Hartman
2017-10-19 13:48 ` [PATCH 4.4 08/46] net: emac: Fix napi poll list corruption Greg Kroah-Hartman
2017-10-19 13:48 ` [PATCH 4.4 09/46] packet: hold bind lock when rebinding to fanout hook Greg Kroah-Hartman
2017-10-19 13:48 ` [PATCH 4.4 10/46] bpf: one perf event close wont free bpf program attached by another perf event Greg Kroah-Hartman
2017-10-19 13:48 ` [PATCH 4.4 11/46] isdn/i4l: fetch the ppp_write buffer in one shot Greg Kroah-Hartman
2017-10-19 13:48 ` [PATCH 4.4 12/46] vti: fix use after free in vti_tunnel_xmit/vti6_tnl_xmit Greg Kroah-Hartman
2017-10-19 13:48 ` [PATCH 4.4 13/46] l2tp: Avoid schedule while atomic in exit_net Greg Kroah-Hartman
2017-10-19 13:48 ` [PATCH 4.4 14/46] l2tp: fix race condition in l2tp_tunnel_delete Greg Kroah-Hartman
2017-10-19 13:48 ` [PATCH 4.4 15/46] tun: bail out from tun_get_user() if the skb is empty Greg Kroah-Hartman
2017-10-19 13:48 ` [PATCH 4.4 16/46] packet: in packet_do_bind, test fanout with bind_lock held Greg Kroah-Hartman
2017-10-19 13:48 ` [PATCH 4.4 17/46] packet: only test po->has_vnet_hdr once in packet_snd Greg Kroah-Hartman
2017-10-19 13:48 ` [PATCH 4.4 18/46] net: Set sk_prot_creator when cloning sockets to the right proto Greg Kroah-Hartman
2017-10-19 13:48 ` [PATCH 4.4 19/46] tipc: use only positive error codes in messages Greg Kroah-Hartman
2017-10-19 13:48 ` [PATCH 4.4 20/46] Revert "bsg-lib: dont free job in bsg_prepare_job" Greg Kroah-Hartman
2017-10-19 13:48 ` [PATCH 4.4 22/46] watchdog: kempld: fix gcc-4.3 build Greg Kroah-Hartman
2017-10-19 13:48 ` [PATCH 4.4 23/46] irqchip/crossbar: Fix incorrect type of local variables Greg Kroah-Hartman
2017-10-19 13:49 ` [PATCH 4.4 24/46] mac80211_hwsim: check HWSIM_ATTR_RADIO_NAME length Greg Kroah-Hartman
2017-10-19 13:49 ` [PATCH 4.4 25/46] mac80211: fix power saving clients handling in iwlwifi Greg Kroah-Hartman
2017-10-19 13:49 ` [PATCH 4.4 26/46] net/mlx4_en: fix overflow in mlx4_en_init_timestamp() Greg Kroah-Hartman
2017-10-19 13:49 ` [PATCH 4.4 27/46] netfilter: nf_ct_expect: Change __nf_ct_expect_check() return value Greg Kroah-Hartman
2017-10-19 13:49 ` [PATCH 4.4 28/46] iio: adc: xilinx: Fix error handling Greg Kroah-Hartman
2017-10-19 13:49 ` [PATCH 4.4 29/46] Btrfs: send, fix failure to rename top level inode due to name collision Greg Kroah-Hartman
2017-10-19 13:49 ` [PATCH 4.4 30/46] f2fs: do not wait for writeback in write_begin Greg Kroah-Hartman
2017-10-19 13:49 ` [PATCH 4.4 31/46] md/linear: shutup lockdep warnning Greg Kroah-Hartman
2017-10-19 13:49 ` [PATCH 4.4 32/46] sparc64: Migrate hvcons irq to panicked cpu Greg Kroah-Hartman
2017-10-19 13:49 ` [PATCH 4.4 33/46] net/mlx4_core: Fix VF overwrite of module param which disables DMFS on new probed PFs Greg Kroah-Hartman
2017-10-19 13:49 ` [PATCH 4.4 34/46] crypto: xts - Add ECB dependency Greg Kroah-Hartman
2017-11-10 20:40   ` Ben Hutchings
2017-11-13 19:04     ` alexander.levin
2017-10-19 13:49 ` [PATCH 4.4 35/46] ocfs2/dlmglue: prepare tracking logic to avoid recursive cluster lock Greg Kroah-Hartman
2017-10-19 13:49 ` [PATCH 4.4 36/46] slub: do not merge cache if slub_debug contains a never-merge flag Greg Kroah-Hartman
2017-10-19 13:49 ` [PATCH 4.4 37/46] scsi: scsi_dh_emc: return success in clariion_std_inquiry() Greg Kroah-Hartman
2017-10-19 13:49 ` [PATCH 4.4 38/46] net: mvpp2: release reference to txq_cpu[] entry after unmapping Greg Kroah-Hartman
2017-10-19 13:49 ` [PATCH 4.4 39/46] i2c: at91: ensure state is restored after suspending Greg Kroah-Hartman
2017-10-19 13:49 ` [PATCH 4.4 40/46] ceph: clean up unsafe d_parent accesses in build_dentry_path Greg Kroah-Hartman
2017-10-19 13:49 ` [PATCH 4.4 41/46] uapi: fix linux/rds.h userspace compilation errors Greg Kroah-Hartman
2017-11-12 18:50   ` Ben Hutchings
2017-11-13 19:03     ` alexander.levin
2017-10-19 13:49 ` [PATCH 4.4 42/46] uapi: fix linux/mroute6.h " Greg Kroah-Hartman
2017-10-19 13:49 ` [PATCH 4.4 43/46] target/iscsi: Fix unsolicited data seq_end_offset calculation Greg Kroah-Hartman
2017-10-19 13:49 ` Greg Kroah-Hartman [this message]
2017-10-19 13:49 ` [PATCH 4.4 45/46] cpufreq: CPPC: add ACPI_PROCESSOR dependency Greg Kroah-Hartman
2017-10-19 13:49 ` [PATCH 4.4 46/46] Revert "tty: goldfish: Fix a parameter of a call to free_irq" Greg Kroah-Hartman
2017-10-19 22:18 ` [PATCH 4.4 00/46] 4.4.94-stable review Tom Gall
2017-10-20  6:26   ` Greg Kroah-Hartman
2017-10-20 16:54     ` Tom Gall
2017-10-21  7:25       ` Greg Kroah-Hartman
2017-10-21 14:37         ` Tom Gall
2017-10-20 13:05 ` Guenter Roeck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171019134847.870715707@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=alexander.levin@verizon.com \
    --cc=bfields@redhat.com \
    --cc=kinglongmee@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.