public inbox for linux-kernel@vger.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, Jiufei Xue <xuejiufei@huawei.com>,
	Joseph Qi <joseph.qi@huawei.com>, Mark Fasheh <mfasheh@suse.de>,
	Joel Becker <jlbec@evilplan.org>,
	Junxiao Bi <junxiao.bi@oracle.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Linus Torvalds <torvalds@linux-foundation.org>
Subject: [PATCH 4.4 009/117] ocfs2/dlm: ignore cleaning the migration mle that is inuse
Date: Sun, 14 Feb 2016 14:20:46 -0800	[thread overview]
Message-ID: <20160214222141.679195420@linuxfoundation.org> (raw)
In-Reply-To: <20160214222141.393531627@linuxfoundation.org>

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

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

From: xuejiufei <xuejiufei@huawei.com>

commit bef5502de074b6f6fa647b94b73155d675694420 upstream.

We have found that migration source will trigger a BUG that the refcount
of mle is already zero before put when the target is down during
migration.  The situation is as follows:

dlm_migrate_lockres
  dlm_add_migration_mle
  dlm_mark_lockres_migrating
  dlm_get_mle_inuse
  <<<<<< Now the refcount of the mle is 2.
  dlm_send_one_lockres and wait for the target to become the
  new master.
  <<<<<< o2hb detect the target down and clean the migration
  mle. Now the refcount is 1.

dlm_migrate_lockres woken, and put the mle twice when found the target
goes down which trigger the BUG with the following message:

  "ERROR: bad mle: ".

Signed-off-by: Jiufei Xue <xuejiufei@huawei.com>
Reviewed-by: Joseph Qi <joseph.qi@huawei.com>
Cc: Mark Fasheh <mfasheh@suse.de>
Cc: Joel Becker <jlbec@evilplan.org>
Cc: Junxiao Bi <junxiao.bi@oracle.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 fs/ocfs2/dlm/dlmmaster.c |   26 +++++++++++++++-----------
 1 file changed, 15 insertions(+), 11 deletions(-)

--- a/fs/ocfs2/dlm/dlmmaster.c
+++ b/fs/ocfs2/dlm/dlmmaster.c
@@ -2519,6 +2519,11 @@ static int dlm_migrate_lockres(struct dl
 	spin_lock(&dlm->master_lock);
 	ret = dlm_add_migration_mle(dlm, res, mle, &oldmle, name,
 				    namelen, target, dlm->node_num);
+	/* get an extra reference on the mle.
+	 * otherwise the assert_master from the new
+	 * master will destroy this.
+	 */
+	dlm_get_mle_inuse(mle);
 	spin_unlock(&dlm->master_lock);
 	spin_unlock(&dlm->spinlock);
 
@@ -2554,6 +2559,7 @@ fail:
 		if (mle_added) {
 			dlm_mle_detach_hb_events(dlm, mle);
 			dlm_put_mle(mle);
+			dlm_put_mle_inuse(mle);
 		} else if (mle) {
 			kmem_cache_free(dlm_mle_cache, mle);
 			mle = NULL;
@@ -2571,17 +2577,6 @@ fail:
 	 * ensure that all assert_master work is flushed. */
 	flush_workqueue(dlm->dlm_worker);
 
-	/* get an extra reference on the mle.
-	 * otherwise the assert_master from the new
-	 * master will destroy this.
-	 * also, make sure that all callers of dlm_get_mle
-	 * take both dlm->spinlock and dlm->master_lock */
-	spin_lock(&dlm->spinlock);
-	spin_lock(&dlm->master_lock);
-	dlm_get_mle_inuse(mle);
-	spin_unlock(&dlm->master_lock);
-	spin_unlock(&dlm->spinlock);
-
 	/* notify new node and send all lock state */
 	/* call send_one_lockres with migration flag.
 	 * this serves as notice to the target node that a
@@ -3312,6 +3307,15 @@ top:
 			    mle->new_master != dead_node)
 				continue;
 
+			if (mle->new_master == dead_node && mle->inuse) {
+				mlog(ML_NOTICE, "%s: target %u died during "
+						"migration from %u, the MLE is "
+						"still keep used, ignore it!\n",
+						dlm->name, dead_node,
+						mle->master);
+				continue;
+			}
+
 			/* If we have reached this point, this mle needs to be
 			 * removed from the list and freed. */
 			dlm_clean_migration_mle(dlm, mle);

  parent reply	other threads:[~2016-02-14 22:25 UTC|newest]

Thread overview: 122+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-14 22:20 [PATCH 4.4 000/117] 4.4.2-stable review Greg Kroah-Hartman
2016-02-14 22:20 ` [PATCH 4.4 001/117] crypto: sun4i-ss - add missing statesize Greg Kroah-Hartman
2016-02-14 22:20 ` [PATCH 4.4 002/117] NFSv4.1/pnfs: Fixup an lo->plh_block_lgets imbalance in layoutreturn Greg Kroah-Hartman
2016-02-14 22:20 ` [PATCH 4.4 003/117] block: split bios to max possible length Greg Kroah-Hartman
2016-02-14 22:20 ` [PATCH 4.4 004/117] ocfs2: NFS hangs in __ocfs2_cluster_lock due to race with ocfs2_unblock_lock Greg Kroah-Hartman
2016-02-14 22:20 ` [PATCH 4.4 005/117] HID: usbhid: fix recursive deadlock Greg Kroah-Hartman
2016-02-14 22:20 ` [PATCH 4.4 006/117] base/platform: Fix platform drivers with no probe callback Greg Kroah-Hartman
2016-02-14 22:20 ` [PATCH 4.4 007/117] block: fix bio splitting on max sectors Greg Kroah-Hartman
2016-02-14 22:20 ` [PATCH 4.4 008/117] ALSA: hda - Implement loopback control switch for Realtek and other codecs Greg Kroah-Hartman
2016-02-14 22:20 ` Greg Kroah-Hartman [this message]
2016-02-14 22:20 ` [PATCH 4.4 010/117] ocfs2/dlm: clear refmap bit of recovery lock while doing local recovery cleanup Greg Kroah-Hartman
2016-02-14 22:20 ` [PATCH 4.4 011/117] wlcore/wl12xx: spi: fix oops on firmware load Greg Kroah-Hartman
2016-02-14 22:20 ` [PATCH 4.4 012/117] wlcore/wl12xx: spi: fix NULL pointer dereference (Oops) Greg Kroah-Hartman
2016-02-14 22:20 ` [PATCH 4.4 013/117] mtd: nand: assign reasonable default name for NAND drivers Greg Kroah-Hartman
2016-02-14 22:20 ` [PATCH 4.4 015/117] PCI: Fix minimum allocation address overwrite Greg Kroah-Hartman
2016-02-14 22:20 ` [PATCH 4.4 016/117] tracing: Fix stacktrace skip depth in trace_buffer_unlock_commit_regs() Greg Kroah-Hartman
2016-02-14 22:20 ` [PATCH 4.4 017/117] tracing/stacktrace: Show entire trace if passed in function not found Greg Kroah-Hartman
2016-02-14 22:20 ` [PATCH 4.4 018/117] printk: do cond_resched() between lines while outputting to consoles Greg Kroah-Hartman
2016-02-14 22:20 ` [PATCH 4.4 019/117] parisc: Protect huge page pte changes with spinlocks Greg Kroah-Hartman
2016-02-14 22:20 ` [PATCH 4.4 020/117] parisc: Fix __ARCH_SI_PREAMBLE_SIZE Greg Kroah-Hartman
2016-02-14 22:20 ` [PATCH 4.4 021/117] [media] media: i2c: Dont export ir-kbd-i2c module alias Greg Kroah-Hartman
2016-02-14 22:20 ` [PATCH 4.4 022/117] md/raid: only permit hot-add of compatible integrity profiles Greg Kroah-Hartman
2016-02-14 22:21 ` [PATCH 4.4 023/117] hrtimer: Handle remaining time proper for TIME_LOW_RES Greg Kroah-Hartman
2016-02-14 22:21 ` [PATCH 4.4 024/117] ALSA: usb-audio: Fix TEAC UD-501/UD-503/NT-503 usb delay Greg Kroah-Hartman
2016-02-14 22:21 ` [PATCH 4.4 025/117] ALSA: usb-audio: Add quirk for Microsoft LifeCam HD-6000 Greg Kroah-Hartman
2016-02-14 22:21 ` [PATCH 4.4 026/117] ALSA: usb-audio: Fix OPPO HA-1 vendor ID Greg Kroah-Hartman
2016-02-14 22:21 ` [PATCH 4.4 027/117] ALSA: usb-audio: Add native DSD support for PS Audio NuWave DAC Greg Kroah-Hartman
2016-02-14 22:21 ` [PATCH 4.4 028/117] ALSA: usb-audio: avoid freeing umidi object twice Greg Kroah-Hartman
2016-02-14 22:21 ` [PATCH 4.4 029/117] ALSA: bebob: Use a signed return type for get_formation_index Greg Kroah-Hartman
2016-02-14 22:21 ` [PATCH 4.4 030/117] ALSA: Add missing dependency on CONFIG_SND_TIMER Greg Kroah-Hartman
2016-02-14 22:21 ` [PATCH 4.4 031/117] ALSA: hda - disable dynamic clock gating on Broxton before reset Greg Kroah-Hartman
2016-02-14 22:21 ` [PATCH 4.4 032/117] ALSA: compress: Disable GET_CODEC_CAPS ioctl for some architectures Greg Kroah-Hartman
2016-02-14 22:21 ` [PATCH 4.4 033/117] ALSA: dummy: Disable switching timer backend via sysfs Greg Kroah-Hartman
2016-02-14 22:21 ` [PATCH 4.4 034/117] ALSA: seq: Fix incorrect sanity check at snd_seq_oss_synth_cleanup() Greg Kroah-Hartman
2016-02-14 22:21 ` [PATCH 4.4 035/117] ALSA: seq: Degrade the error message for too many opens Greg Kroah-Hartman
2016-02-14 22:21 ` [PATCH 4.4 036/117] ALSA: rawmidi: Make snd_rawmidi_transmit() race-free Greg Kroah-Hartman
2016-02-14 22:21 ` [PATCH 4.4 037/117] ALSA: rawmidi: Remove kernel WARNING for NULL user-space buffer check Greg Kroah-Hartman
2016-02-14 22:21 ` [PATCH 4.4 038/117] ALSA: rawmidi: Fix race at copying & updating the position Greg Kroah-Hartman
2016-02-14 22:21 ` [PATCH 4.4 039/117] ALSA: hda/realtek - New codec support of ALC225 Greg Kroah-Hartman
2016-02-14 22:21 ` [PATCH 4.4 040/117] ALSA: hda/realtek - Support headset mode for ALC225 Greg Kroah-Hartman
2016-02-14 22:21 ` [PATCH 4.4 041/117] ALSA: hda/realtek - Support Dell " Greg Kroah-Hartman
2016-02-14 22:21 ` [PATCH 4.4 042/117] ALSA: pcm: Fix potential deadlock in OSS emulation Greg Kroah-Hartman
2016-02-14 22:21 ` [PATCH 4.4 043/117] ASoC: dpcm: fix the BE state on hw_free Greg Kroah-Hartman
2016-02-14 22:21 ` [PATCH 4.4 044/117] ALSA: seq: Fix yet another races among ALSA timer accesses Greg Kroah-Hartman
2016-02-14 22:21 ` [PATCH 4.4 045/117] ALSA: seq: Fix race at closing in virmidi driver Greg Kroah-Hartman
2016-02-14 22:21 ` [PATCH 4.4 046/117] ALSA: seq: Fix lockdep warnings due to double mutex locks Greg Kroah-Hartman
2016-02-14 22:21 ` [PATCH 4.4 047/117] ALSA: timer: Code cleanup Greg Kroah-Hartman
2016-02-14 22:21 ` [PATCH 4.4 048/117] ALSA: timer: Fix leftover link at closing Greg Kroah-Hartman
2016-02-14 22:21 ` [PATCH 4.4 049/117] ALSA: timer: Fix link corruption due to double start or stop Greg Kroah-Hartman
2016-02-14 22:21 ` [PATCH 4.4 050/117] ALSA: timer: Fix race at concurrent reads Greg Kroah-Hartman
2016-02-14 22:21 ` [PATCH 4.4 051/117] ALSA: timer: Fix wrong instance passed to slave callbacks Greg Kroah-Hartman
2016-02-14 22:21 ` [PATCH 4.4 052/117] ALSA: timer: Fix race between stop and interrupt Greg Kroah-Hartman
2016-02-14 22:21 ` [PATCH 4.4 053/117] ALSA: hda - Add fixup for Mac Mini 7,1 model Greg Kroah-Hartman
2016-02-14 22:21 ` [PATCH 4.4 054/117] ALSA: hda - Fix static checker warning in patch_hdmi.c Greg Kroah-Hartman
2016-02-14 22:21 ` [PATCH 4.4 055/117] Revert "ALSA: hda - Fix noise on Gigabyte Z170X mobo" Greg Kroah-Hartman
2016-02-14 22:21 ` [PATCH 4.4 056/117] ALSA: hda - Fix speaker output from VAIO AiO machines Greg Kroah-Hartman
2016-02-14 22:21 ` [PATCH 4.4 057/117] ALSA: hda - Fix bad dereference of jack object Greg Kroah-Hartman
2016-02-14 22:21 ` [PATCH 4.4 058/117] ALSA: dummy: Implement timer backend switching more safely Greg Kroah-Hartman
2016-02-14 22:21 ` [PATCH 4.4 059/117] [media] saa7134-alsa: Only frees registered sound cards Greg Kroah-Hartman
2016-02-14 22:21 ` [PATCH 4.4 060/117] ASoC: rt5645: fix the shift bit of IN1 boost Greg Kroah-Hartman
2016-02-14 22:21 ` [PATCH 4.4 061/117] USB: serial: visor: fix crash on detecting device without write_urbs Greg Kroah-Hartman
2016-02-14 22:21 ` [PATCH 4.4 062/117] USB: visor: fix null-deref at probe Greg Kroah-Hartman
2016-02-14 22:21 ` [PATCH 4.4 063/117] usb: hub: do not clear BOS field during reset device Greg Kroah-Hartman
2016-02-14 22:21 ` [PATCH 4.4 064/117] USB: serial: ftdi_sio: add support for Yaesu SCU-18 cable Greg Kroah-Hartman
2016-02-14 22:21 ` [PATCH 4.4 065/117] USB: cp210x: add ID for IAI USB to RS485 adaptor Greg Kroah-Hartman
2016-02-14 22:21 ` [PATCH 4.4 066/117] USB: serial: option: Adding support for Telit LE922 Greg Kroah-Hartman
2016-02-14 22:21 ` [PATCH 4.4 067/117] USB: option: fix Cinterion AHxx enumeration Greg Kroah-Hartman
2016-02-14 22:21 ` [PATCH 4.4 068/117] usb: cdc-acm: handle unlinked urb in acm read callback Greg Kroah-Hartman
2016-02-14 22:21 ` [PATCH 4.4 069/117] usb: cdc-acm: send zero packet for intel 7260 modem Greg Kroah-Hartman
2016-02-14 22:21 ` [PATCH 4.4 070/117] usb: phy: msm: fix error handling in probe Greg Kroah-Hartman
2016-02-14 22:21 ` [PATCH 4.4 071/117] usb: xhci: handle both SSIC ports in PME stuck quirk Greg Kroah-Hartman
2016-02-14 22:21 ` [PATCH 4.4 072/117] usb: xhci: apply XHCI_PME_STUCK_QUIRK to Intel Broxton-M platforms Greg Kroah-Hartman
2016-02-14 22:21 ` [PATCH 4.4 073/117] n_tty: Fix unsafe reference to "other" ldisc Greg Kroah-Hartman
2016-02-14 22:21 ` [PATCH 4.4 074/117] tty: Wait interruptibly for tty lock on reopen Greg Kroah-Hartman
2016-02-14 22:21 ` [PATCH 4.4 075/117] tty: Retry failed reopen if tty teardown in-progress Greg Kroah-Hartman
2016-02-14 22:21 ` [PATCH 4.4 076/117] tty: Fix unsafe ldisc reference via ioctl(TIOCGETD) Greg Kroah-Hartman
2016-02-14 22:21 ` [PATCH 4.4 077/117] iommu/io-pgtable-arm: Ensure we free the final level on teardown Greg Kroah-Hartman
2016-02-14 22:21 ` [PATCH 4.4 078/117] ext4 crypto: add missing locking for keyring_key access Greg Kroah-Hartman
2016-02-14 22:21 ` [PATCH 4.4 079/117] sched: Fix crash in sched_init_numa() Greg Kroah-Hartman
2016-02-14 22:21 ` [PATCH 4.4 080/117] crypto: algif_skcipher - Require setkey before accept(2) Greg Kroah-Hartman
2016-02-14 22:21 ` [PATCH 4.4 081/117] crypto: af_alg - Disallow bind/setkey/... after accept(2) Greg Kroah-Hartman
2016-02-14 22:21 ` [PATCH 4.4 082/117] crypto: af_alg - Fix socket double-free when accept fails Greg Kroah-Hartman
2016-02-14 22:22 ` [PATCH 4.4 083/117] crypto: af_alg - Add nokey compatibility path Greg Kroah-Hartman
2016-02-14 22:22 ` [PATCH 4.4 084/117] crypto: algif_skcipher " Greg Kroah-Hartman
2016-02-14 22:22 ` [PATCH 4.4 085/117] crypto: hash - Add crypto_ahash_has_setkey Greg Kroah-Hartman
2016-02-14 22:22 ` [PATCH 4.4 086/117] crypto: algif_hash - Require setkey before accept(2) Greg Kroah-Hartman
2016-02-14 22:22 ` [PATCH 4.4 087/117] crypto: skcipher - Add crypto_skcipher_has_setkey Greg Kroah-Hartman
2016-02-14 22:22 ` [PATCH 4.4 088/117] crypto: algif_skcipher - Add key check exception for cipher_null Greg Kroah-Hartman
2016-02-14 22:22 ` [PATCH 4.4 089/117] libata: disable forced PORTS_IMPL for >= AHCI 1.3 Greg Kroah-Hartman
2016-02-14 22:22 ` [PATCH 4.4 090/117] ahci: Intel DNV device IDs SATA Greg Kroah-Hartman
2016-02-14 22:22 ` [PATCH 4.4 091/117] crypto: af_alg - Allow af_af_alg_release_parent to be called on nokey path Greg Kroah-Hartman
2016-02-14 22:22 ` [PATCH 4.4 092/117] crypto: algif_hash - Remove custom release parent function Greg Kroah-Hartman
2016-02-14 22:22 ` [PATCH 4.4 093/117] crypto: algif_skcipher " Greg Kroah-Hartman
2016-02-14 22:22 ` [PATCH 4.4 094/117] crypto: af_alg - Forbid bind(2) when nokey child sockets are present Greg Kroah-Hartman
2016-02-14 22:22 ` [PATCH 4.4 095/117] crypto: algif_hash - Fix race condition in hash_check_key Greg Kroah-Hartman
2016-02-14 22:22 ` [PATCH 4.4 096/117] crypto: algif_skcipher - Fix race condition in skcipher_check_key Greg Kroah-Hartman
2016-02-14 22:22 ` [PATCH 4.4 097/117] crypto: crc32c - Fix crc32c soft dependency Greg Kroah-Hartman
2016-02-14 22:22 ` [PATCH 4.4 098/117] crypto: algif_skcipher - Load TX SG list after waiting Greg Kroah-Hartman
2016-02-14 22:22 ` [PATCH 4.4 099/117] crypto: algif_skcipher - sendmsg SG marking is off by one Greg Kroah-Hartman
2016-02-14 22:22 ` [PATCH 4.4 100/117] crypto: caam - make write transactions bufferable on PPC platforms Greg Kroah-Hartman
2016-02-14 22:22 ` [PATCH 4.4 101/117] crypto: chacha20-ssse3 - Align stack pointer to 64 bytes Greg Kroah-Hartman
2016-02-14 22:22 ` [PATCH 4.4 102/117] crypto: shash - Fix has_key setting Greg Kroah-Hartman
2016-02-14 22:22 ` [PATCH 4.4 103/117] crypto: algif_hash - wait for crypto_ahash_init() to complete Greg Kroah-Hartman
2016-02-14 22:22 ` [PATCH 4.4 104/117] EVM: Use crypto_memneq() for digest comparisons Greg Kroah-Hartman
2016-02-14 22:22 ` [PATCH 4.4 105/117] crypto: user - lock crypto_alg_list on alg dump Greg Kroah-Hartman
2016-02-14 22:22 ` [PATCH 4.4 106/117] crypto: algif_skcipher - Do not assume that req is unchanged Greg Kroah-Hartman
2016-02-14 22:22 ` [PATCH 4.4 107/117] crypto: algif_skcipher - Do not dereference ctx without socket lock Greg Kroah-Hartman
2016-02-14 22:22 ` [PATCH 4.4 108/117] crypto: algif_skcipher - Do not set MAY_BACKLOG on the async path Greg Kroah-Hartman
2016-02-14 22:22 ` [PATCH 4.4 109/117] crypto: atmel-sha - fix atmel_sha_remove() Greg Kroah-Hartman
2016-02-14 22:22 ` [PATCH 4.4 110/117] crypto: atmel-sha - remove calls of clk_prepare() from atomic contexts Greg Kroah-Hartman
2016-02-14 22:22 ` [PATCH 4.4 111/117] crypto: marvell/cesa - fix test in mv_cesa_dev_dma_init() Greg Kroah-Hartman
2016-02-14 22:22 ` [PATCH 4.4 112/117] rtlwifi: rtl8821ae: Fix errors in parameter initialization Greg Kroah-Hartman
2016-02-16 18:46   ` Ben Hutchings
2016-02-16 20:21     ` Luis Henriques
2016-02-18  2:31       ` Larry Finger
2016-02-14 22:22 ` [PATCH 4.4 113/117] rtlwifi: rtl8821ae: Fix 5G failure when EEPROM is incorrectly encoded Greg Kroah-Hartman
2016-02-14 22:22 ` [PATCH 4.4 114/117] zram/zcomp: use GFP_NOIO to allocate streams Greg Kroah-Hartman
2016-02-14 22:22 ` [PATCH 4.4 115/117] zram: try vmalloc() after kmalloc() Greg Kroah-Hartman
2016-02-14 22:22 ` [PATCH 4.4 116/117] zram: dont call idr_remove() from zram_remove() Greg Kroah-Hartman
2016-02-14 22:22 ` [PATCH 4.4 117/117] zsmalloc: fix migrate_zspage-zs_free race condition Greg Kroah-Hartman
2016-02-15 15:50 ` [PATCH 4.4 000/117] 4.4.2-stable review Guenter Roeck
2016-02-15 17:08 ` Shuah Khan

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=20160214222141.679195420@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=akpm@linux-foundation.org \
    --cc=jlbec@evilplan.org \
    --cc=joseph.qi@huawei.com \
    --cc=junxiao.bi@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mfasheh@suse.de \
    --cc=stable@vger.kernel.org \
    --cc=torvalds@linux-foundation.org \
    --cc=xuejiufei@huawei.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox