mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ben Hutchings <ben@decadent.org.uk>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: akpm@linux-foundation.org, "Joseph Qi" <joseph.qi@huawei.com>,
	"Mark Fasheh" <mfasheh@suse.de>, "Eric Ren" <zren@suse.com>,
	"Joel Becker" <jlbec@evilplan.org>,
	"Tariq Saeed" <tariq.x.saeed@oracle.com>,
	"Linus Torvalds" <torvalds@linux-foundation.org>,
	"Junxiao Bi" <junxiao.bi@oracle.com>,
	"Santosh Shilimkar" <santosh.shilimkar@oracle.com>,
	"Wengang Wang" <wen.gang.wang@oracle.com>
Subject: [PATCH 3.2 67/87] ocfs2: NFS hangs in __ocfs2_cluster_lock due to race with ocfs2_unblock_lock
Date: Mon, 08 Feb 2016 23:53:51 +0000	[thread overview]
Message-ID: <lsq.1454975631.100806969@decadent.org.uk> (raw)
In-Reply-To: <lsq.1454975630.125133756@decadent.org.uk>

3.2.77-rc1 review patch.  If anyone has any objections, please let me know.

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

From: Tariq Saeed <tariq.x.saeed@oracle.com>

commit b1b1e15ef6b80facf76d6757649dfd7295eda29f upstream.

NFS on a 2 node ocfs2 cluster each node exporting dir.  The lock causing
the hang is the global bit map inode lock.  Node 1 is master, has the
lock granted in PR mode; Node 2 is in the converting list (PR -> EX).
There are no holders of the lock on the master node so it should
downconvert to NL and grant EX to node 2 but that does not happen.
BLOCKED + QUEUED in lock res are set and it is on osb blocked list.
Threads are waiting in __ocfs2_cluster_lock on BLOCKED.  One thread
wants EX, rest want PR.  So it is as though the downconvert thread needs
to be kicked to complete the conv.

The hang is caused by an EX req coming into __ocfs2_cluster_lock on the
heels of a PR req after it sets BUSY (drops l_lock, releasing EX
thread), forcing the incoming EX to wait on BUSY without doing anything.
PR has called ocfs2_dlm_lock, which sets the node 1 lock from NL -> PR,
queues ast.

At this time, upconvert (PR ->EX) arrives from node 2, finds conflict
with node 1 lock in PR, so the lock res is put on dlm thread's dirty
listt.

After ret from ocf2_dlm_lock, PR thread now waits behind EX on BUSY till
awoken by ast.

Now it is dlm_thread that serially runs dlm_shuffle_lists, ast, bast, in
that order.  dlm_shuffle_lists ques a bast on behalf of node 2 (which
will be run by dlm_thread right after the ast).  ast does its part, sets
UPCONVERT_FINISHING, clears BUSY and wakes its waiters.  Next,
dlm_thread runs bast.  It sets BLOCKED and kicks dc thread.  dc thread
runs ocfs2_unblock_lock, but since UPCONVERT_FINISHING set, skips doing
anything and reques.

Inside of __ocfs2_cluster_lock, since EX has been waiting on BUSY ahead
of PR, it wakes up first, finds BLOCKED set and skips doing anything but
clearing UPCONVERT_FINISHING (which was actually "meant" for the PR
thread), and this time waits on BLOCKED.  Next, the PR thread comes out
of wait but since UPCONVERT_FINISHING is not set, it skips updating the
l_ro_holders and goes straight to wait on BLOCKED.  So there, we have a
hang! Threads in __ocfs2_cluster_lock wait on BLOCKED, lock res in osb
blocked list.  Only when dc thread is awoken, it will run
ocfs2_unblock_lock and things will unhang.

One way to fix this is to wake the dc thread on the flag after clearing
UPCONVERT_FINISHING

Orabug: 20933419
Signed-off-by: Tariq Saeed <tariq.x.saeed@oracle.com>
Signed-off-by: Santosh Shilimkar <santosh.shilimkar@oracle.com>
Reviewed-by: Wengang Wang <wen.gang.wang@oracle.com>
Reviewed-by: Mark Fasheh <mfasheh@suse.de>
Cc: Joel Becker <jlbec@evilplan.org>
Cc: Junxiao Bi <junxiao.bi@oracle.com>
Reviewed-by: Joseph Qi <joseph.qi@huawei.com>
Cc: Eric Ren <zren@suse.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
[bwh: Backported to 3.2: adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 fs/ocfs2/dlmglue.c | 6 ++++++
 1 file changed, 6 insertions(+)

--- a/fs/ocfs2/dlmglue.c
+++ b/fs/ocfs2/dlmglue.c
@@ -1373,6 +1373,7 @@ static int __ocfs2_cluster_lock(struct o
 	unsigned long flags;
 	unsigned int gen;
 	int noqueue_attempted = 0;
+	int kick_dc = 0;
 
 	ocfs2_init_mask_waiter(&mw);
 
@@ -1501,7 +1502,12 @@ update_holders:
 unlock:
 	lockres_clear_flags(lockres, OCFS2_LOCK_UPCONVERT_FINISHING);
 
+	/* ocfs2_unblock_lock reques on seeing OCFS2_LOCK_UPCONVERT_FINISHING */
+	kick_dc = (lockres->l_flags & OCFS2_LOCK_BLOCKED);
+
 	spin_unlock_irqrestore(&lockres->l_lock, flags);
+	if (kick_dc)
+		ocfs2_wake_downconvert_thread(osb);
 out:
 	/*
 	 * This is helping work around a lock inversion between the page lock

  parent reply	other threads:[~2016-02-09  0:01 UTC|newest]

Thread overview: 91+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-08 23:53 [PATCH 3.2 00/87] 3.2.77-rc1 review Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 07/87] ath9k_htc: check for underflow in ath9k_htc_rx_msg() Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 27/87] rtlwifi: rtl8192ce: Fix handling of module parameters Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 12/87] wlcore: SPI - fix spi transfer_list Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 46/87] x86/mm: Improve switch_mm() barrier comments Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 30/87] Input: i8042 - add Fujitsu Lifebook U745 to the nomux list Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 69/87] crypto: af_alg - Disallow bind/setkey/... after accept(2) Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 83/87] sctp: Prevent soft lockup when sctp_accept() is called during a timeout event Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 08/87] mtd: nand: fix ONFI parameter page layout Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 33/87] udf: Check output buffer length when converting name to CS0 Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 53/87] m32r: fix m32104ut_defconfig build fail Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 57/87] ALSA: timer: Harden slave timer list handling Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 43/87] ALSA: seq: Fix missing NULL check at remove_events ioctl Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 79/87] crypto: af_alg - Forbid bind(2) when nokey child sockets are present Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 37/87] uml: fix hostfs mknod() Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 31/87] x86/xen: don't reset vcpu_info on a cancelled suspend Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 84/87] [media] usbvision-video: fix memory leak of alt_max_pkt_size Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 51/87] cifs: fix race between call_async() and reconnect() Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 02/87] [media] media: dvb-core: Don't force CAN_INVERSION_AUTO in oneshot mode Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 04/87] SCSI: initio: remove duplicate module device table Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 87/87] [media] usbvision: fix crash on detecting device with invalid configuration Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 65/87] IB/qib: fix mcast detach when qp not attached Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 82/87] crypto: algif_skcipher - Load TX SG list after waiting Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 14/87] EDAC: Robustify workqueues destruction Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 66/87] IB/mlx4: Initialize hop_limit when creating address handle Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 61/87] ALSA: hrtimer: Fix stall by hrtimer_cancel() Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 76/87] crypto: af_alg - Allow af_af_alg_release_parent to be called on nokey path Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 64/87] ALSA: control: Avoid kernel warnings from tlv ioctl with numid 0 Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 73/87] crypto: algif_hash - Require setkey before accept(2) Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 39/87] ipv6: tcp: add rcu locking in tcp_v6_send_synack() Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 41/87] x86/boot: Double BOOT_HEAP_SIZE to 64KB Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 35/87] locks: fix unlock when fcntl_setlk races with a close Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 70/87] crypto: af_alg - Add nokey compatibility path Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 22/87] USB: cp210x: add ID for ELV Marble Sound Board 1 Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 55/87] scripts/bloat-o-meter: fix python3 syntax error Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 36/87] dm snapshot: fix hung bios when copy error occurs Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 23/87] posix-clock: Fix return code on the poll method's error path Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 19/87] ALSA: fm801: propagate TUNER_ONLY bit when autodetected Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 62/87] ALSA: pcm: Fix snd_pcm_hw_params struct copy in compat mode Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 85/87] [media] usbvision: fix leak of usb_dev on failure paths in usbvision_probe() Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 59/87] printk: help pr_debug and pr_devel to optimize out arguments Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 44/87] ALSA: seq: Fix race at timer setup and close Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 49/87] sparc64: fix incorrect sign extension in sys_sparc64_personality Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 71/87] crypto: algif_skcipher - Add nokey compatibility path Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 54/87] dma-debug: switch check from _text to _stext Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 20/87] drm/radeon: clean up fujitsu quirks Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 03/87] [media] rc: allow rc modules to be loaded if rc-main is not a module Ben Hutchings
2016-02-08 23:53 ` Ben Hutchings [this message]
2016-02-08 23:53 ` [PATCH 3.2 81/87] crypto: algif_skcipher - Fix race condition in skcipher_check_key Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 21/87] udf: limit the maximum number of indirect extents in a row Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 63/87] ALSA: seq: Fix snd_seq_call_port_info_ioctl in compat mode Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 58/87] memcg: only free spare array when readers are done Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 45/87] parisc: Fix __ARCH_SI_PREAMBLE_SIZE Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 05/87] KVM: x86: expose MSR_TSC_AUX to userspace Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 09/87] drm/radeon: call hpd_irq_event on resume Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 25/87] rtlwifi: rtl8192de: Fix incorrect module parameter descriptions Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 13/87] wlcore/wl12xx: spi: fix oops on firmware load Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 50/87] cifs: Ratelimit kernel log messages Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 32/87] udf: Prevent buffer overrun with multi-byte characters Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 52/87] cifs_dbg() outputs an uninitialized buffer in cifs_readdir() Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 56/87] ocfs2/dlm: ignore cleaning the migration mle that is inuse Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 26/87] rtlwifi: rtl8192se: Fix module parameter initialization Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 17/87] asix: silence log message from oversize packet Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 16/87] powerpc: Make {cmp}xchg* and their atomic_ versions fully ordered Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 86/87] [media] usbvision fix overflow of interfaces array Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 34/87] power: test_power: correctly handle empty writes Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 74/87] crypto: skcipher - Add crypto_skcipher_has_setkey Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 01/87] [media] gspca: ov534/topro: prevent a division by 0 Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 72/87] crypto: hash - Add crypto_ahash_has_setkey Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 60/87] crypto: af_alg - Fix socket double-free when accept fails Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 78/87] crypto: algif_skcipher - Remove custom release parent function Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 48/87] ALSA: timer: Fix race among timer ioctls Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 24/87] x86/LDT: Print the real LDT base address Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 77/87] crypto: algif_hash - Remove custom release parent function Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 47/87] ALSA: timer: Fix double unlink of active_list Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 40/87] x86/mm: Add barriers and document switch_mm()-vs-flush synchronization Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 18/87] futex: Drop refcount if requeue_pi() acquired the rtmutex Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 38/87] uml: flush stdout before forking Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 11/87] rtlwifi: fix memory leak for USB device Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 80/87] crypto: algif_hash - Fix race condition in hash_check_key Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 06/87] KVM: x86: correctly print #AC in traces Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 10/87] xhci: refuse loading if nousb is used Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 29/87] NFS: Fix attribute cache revalidation Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 68/87] crypto: algif_skcipher - Require setkey before accept(2) Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 15/87] powerpc: Make value-returning atomics fully ordered Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 42/87] x86/reboot/quirks: Add iMac10,1 to pci_reboot_dmi_table[] Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 75/87] crypto: algif_skcipher - Add key check exception for cipher_null Ben Hutchings
2016-02-08 23:53 ` [PATCH 3.2 28/87] rtlwifi: rtl8192cu: Add missing parameter setup Ben Hutchings
2016-02-09  0:21 ` [PATCH 3.2 00/87] 3.2.77-rc1 review Ben Hutchings
2016-02-09  3:58 ` Guenter Roeck
2016-02-10  1:00   ` Ben Hutchings

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=lsq.1454975631.100806969@decadent.org.uk \
    --to=ben@decadent.org.uk \
    --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=santosh.shilimkar@oracle.com \
    --cc=stable@vger.kernel.org \
    --cc=tariq.x.saeed@oracle.com \
    --cc=torvalds@linux-foundation.org \
    --cc=wen.gang.wang@oracle.com \
    --cc=zren@suse.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

Powered by JetHome