All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <gregkh@suse.de>
To: linux-kernel@vger.kernel.org, stable@kernel.org
Cc: stable-review@kernel.org, torvalds@linux-foundation.org,
	akpm@linux-foundation.org, alan@lxorguk.ukuu.org.uk,
	Wengang Wang <wen.gang.wang@oracle.com>,
	Srinivas Eeda <srinivas.eeda@oracle.com>,
	Joel Becker <joel.becker@oracle.com>
Subject: [11/59] ocfs2/dlm: avoid incorrect bit set in refmap on recovery master
Date: Tue, 24 Aug 2010 15:24:23 -0700	[thread overview]
Message-ID: <20100824222523.357304306@clark.site> (raw)
In-Reply-To: <20100824224625.GA5449@kroah.com>

2.6.32-stable review patch.  If anyone has any objections, please let us know.

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

From: Wengang Wang <wen.gang.wang@oracle.com>

commit a524812b7eaa7783d7811198921100f079034e61 upstream.

In the following situation, there remains an incorrect bit in refmap on the
recovery master. Finally the recovery master will fail at purging the lockres
due to the incorrect bit in refmap.

1) node A has no interest on lockres A any longer, so it is purging it.
2) the owner of lockres A is node B, so node A is sending de-ref message
to node B.
3) at this time, node B crashed. node C becomes the recovery master. it recovers
lockres A(because the master is the dead node B).
4) node A migrated lockres A to node C with a refbit there.
5) node A failed to send de-ref message to node B because it crashed. The failure
is ignored. no other action is done for lockres A any more.

For mormal, re-send the deref message to it to recovery master can fix it. Well,
ignoring the failure of deref to the original master and not recovering the lockres
to recovery master has the same effect. And the later is simpler.

Signed-off-by: Wengang Wang <wen.gang.wang@oracle.com>
Acked-by: Srinivas Eeda <srinivas.eeda@oracle.com>
Signed-off-by: Joel Becker <joel.becker@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

---
 fs/ocfs2/dlm/dlmrecovery.c |   22 ++++++++++------------
 fs/ocfs2/dlm/dlmthread.c   |   34 +++++++++++++++++++++-------------
 2 files changed, 31 insertions(+), 25 deletions(-)

--- a/fs/ocfs2/dlm/dlmrecovery.c
+++ b/fs/ocfs2/dlm/dlmrecovery.c
@@ -1941,6 +1941,8 @@ void dlm_move_lockres_to_recovery_list(s
 	struct list_head *queue;
 	struct dlm_lock *lock, *next;
 
+	assert_spin_locked(&dlm->spinlock);
+	assert_spin_locked(&res->spinlock);
 	res->state |= DLM_LOCK_RES_RECOVERING;
 	if (!list_empty(&res->recovering)) {
 		mlog(0,
@@ -2265,19 +2267,15 @@ static void dlm_do_local_recovery_cleanu
 			/* zero the lvb if necessary */
 			dlm_revalidate_lvb(dlm, res, dead_node);
 			if (res->owner == dead_node) {
-				if (res->state & DLM_LOCK_RES_DROPPING_REF)
-					mlog(0, "%s:%.*s: owned by "
-					     "dead node %u, this node was "
-					     "dropping its ref when it died. "
-					     "continue, dropping the flag.\n",
-					     dlm->name, res->lockname.len,
-					     res->lockname.name, dead_node);
-
-				/* the wake_up for this will happen when the
-				 * RECOVERING flag is dropped later */
-				res->state &= ~DLM_LOCK_RES_DROPPING_REF;
+				if (res->state & DLM_LOCK_RES_DROPPING_REF) {
+					mlog(ML_NOTICE, "Ignore %.*s for "
+					     "recovery as it is being freed\n",
+					     res->lockname.len,
+					     res->lockname.name);
+				} else
+					dlm_move_lockres_to_recovery_list(dlm,
+									  res);
 
-				dlm_move_lockres_to_recovery_list(dlm, res);
 			} else if (res->owner == dlm->node_num) {
 				dlm_free_dead_locks(dlm, res, dead_node);
 				__dlm_lockres_calc_usage(dlm, res);
--- a/fs/ocfs2/dlm/dlmthread.c
+++ b/fs/ocfs2/dlm/dlmthread.c
@@ -93,19 +93,27 @@ int __dlm_lockres_has_locks(struct dlm_l
  * truly ready to be freed. */
 int __dlm_lockres_unused(struct dlm_lock_resource *res)
 {
-	if (!__dlm_lockres_has_locks(res) &&
-	    (list_empty(&res->dirty) && !(res->state & DLM_LOCK_RES_DIRTY))) {
-		/* try not to scan the bitmap unless the first two
-		 * conditions are already true */
-		int bit = find_next_bit(res->refmap, O2NM_MAX_NODES, 0);
-		if (bit >= O2NM_MAX_NODES) {
-			/* since the bit for dlm->node_num is not
-			 * set, inflight_locks better be zero */
-			BUG_ON(res->inflight_locks != 0);
-			return 1;
-		}
-	}
-	return 0;
+	int bit;
+
+	if (__dlm_lockres_has_locks(res))
+		return 0;
+
+	if (!list_empty(&res->dirty) || res->state & DLM_LOCK_RES_DIRTY)
+		return 0;
+
+	if (res->state & DLM_LOCK_RES_RECOVERING)
+		return 0;
+
+	bit = find_next_bit(res->refmap, O2NM_MAX_NODES, 0);
+	if (bit < O2NM_MAX_NODES)
+		return 0;
+
+	/*
+	 * since the bit for dlm->node_num is not set, inflight_locks better
+	 * be zero
+	 */
+	BUG_ON(res->inflight_locks != 0);
+	return 1;
 }
 
 



  parent reply	other threads:[~2010-08-24 23:47 UTC|newest]

Thread overview: 63+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-24 22:46 [00/59] 2.6.32.21-stable review Greg KH
2010-08-24 22:24 ` [01/59] memstick: fix hangs on unexpected device removal in mspro_blk Greg KH
2010-08-24 22:24 ` [02/59] ASoC: Fix inverted mute controls for WM8580 Greg KH
2010-08-24 22:24 ` [03/59] ASoC: Remove DSP mode support for WM8776 Greg KH
2010-08-24 22:24 ` [04/59] ALSA: riptide - Fix detection / load of firmware files Greg KH
2010-08-24 22:24 ` [05/59] ALSA: emu10k1 - delay the PCM interrupts (add pcm_irq_delay parameter) Greg KH
2010-08-24 22:24 ` [06/59] ALSA: hda - Fix missing stream for second ADC on Realtek ALC260 HDA codec Greg KH
2010-08-24 22:24 ` [07/59] ocfs2: do not overwrite error codes in ocfs2_init_acl Greg KH
2010-08-24 22:24 ` [08/59] ocfs2/dlm: fix a dead lock Greg KH
2010-08-24 22:24 ` [09/59] ocfs2 fix o2dlm dlm run purgelist (rev 3) Greg KH
2010-08-24 22:24 ` [10/59] ocfs2: Count more refcount records in file system fragmentation Greg KH
2010-08-24 22:24 ` Greg KH [this message]
2010-08-24 22:24 ` [12/59] ocfs2/dlm: remove potential deadlock -V3 Greg KH
2010-08-24 22:24 ` [13/59] x86, hotplug: Serialize CPU hotplug to avoid bringup concurrency issues Greg KH
2010-08-24 22:24 ` [14/59] x86, apic: Fix apic=debug boot crash Greg KH
2010-08-24 22:24   ` Greg KH
2010-08-24 22:24 ` [15/59] Fix the nested PR lock calling issue in ACL Greg KH
2010-08-24 22:24 ` [16/59] hwmon: (pc87360) Fix device resource declaration Greg KH
2010-08-24 22:24 ` [17/59] ARM: Tighten check for allowable CPSR values Greg KH
2010-08-24 22:24 ` [18/59] nfs: Add "lookupcache" to displayed mount options Greg KH
2010-08-24 22:24 ` [19/59] ath5k: disable ASPM L0s for all cards Greg KH
2010-08-24 22:24 ` [20/59] pxa3xx: fix ns2cycle equation Greg KH
2010-08-24 22:24 ` [21/59] drm/i915/edp: Flush the write before waiting for PLLs Greg KH
2010-08-24 22:24 ` [22/59] dm mpath: fix NULL pointer dereference when path parameters missing Greg KH
2010-08-24 22:24 ` [23/59] dm ioctl: release _hash_lock between devices in remove_all Greg KH
2010-08-24 22:24 ` [24/59] mm: make the vma list be doubly linked Greg KH
2010-08-24 22:24 ` [25/59] mm: make the mlock() stack guard page checks stricter Greg KH
2010-08-24 22:24 ` [26/59] mm: make stack guard page logic use vm_prev pointer Greg KH
2010-08-24 22:24 ` [27/59] drm/i915: fix hibernation since i915 self-reclaim fixes Greg KH
2010-08-24 22:24 ` [28/59] drm/i915: add reclaimable to i915 self-reclaimable page allocations Greg KH
2010-08-24 22:24 ` [29/59] slab: fix object alignment Greg KH
2010-08-24 22:24 ` [30/59] sunxvr500: Ignore secondary output PCI devices Greg KH
2010-08-24 22:24 ` [31/59] sparc64: Add missing ID to parport probing code Greg KH
2010-08-24 22:24 ` [32/59] sparc64: Fix rwsem constant bug leading to hangs Greg KH
2010-08-24 22:24 ` [33/59] sparc64: Fix atomic64_t routine return values Greg KH
2010-08-24 22:24 ` [34/59] net: Fix a memmove bug in dev_gro_receive() Greg KH
2010-08-24 22:24 ` [35/59] can: add limit for nframes and clean up signed/unsigned variables Greg KH
2010-08-24 22:24 ` [36/59] isdn: fix information leak Greg KH
2010-08-24 22:24 ` [37/59] act_nat: the checksum of ICMP doesnt have pseudo header Greg KH
2010-08-24 22:24 ` [38/59] vmscan: raise the bar to PAGEOUT_IO_SYNC stalls Greg KH
2010-08-24 22:24 ` [39/59] pcmcia: avoid buffer overflow in pcmcia_setup_isa_irq Greg KH
2010-08-24 22:24 ` [40/59] ext4: consolidate in_range() definitions Greg KH
2010-08-24 22:24 ` [41/59] Oprofile: Change CPUIDS from decimal to hex, and add some comments Greg KH
2010-08-24 22:24 ` [42/59] oprofile: add support for Intel processor model 30 Greg KH
2010-08-24 22:24 ` [43/59] fixes for using make 3.82 Greg KH
2010-08-24 22:24 ` [44/59] ALSA: intel8x0: Mute External Amplifier by default for ThinkPad X31 Greg KH
2010-08-24 22:24 ` [45/59] netlink: fix compat recvmsg Greg KH
2010-08-24 22:24 ` [46/59] drm/radeon/kms: fix typo in radeon_compute_pll_gain Greg KH
2010-08-24 22:24 ` [47/59] drm: stop information leak of old kernel stack Greg KH
2010-08-24 22:25 ` [48/59] powerpc: Fix typo in uImage target Greg KH
2010-08-24 22:25 ` [49/59] powerpc: Initialise paca->kstack before early_setup_secondary Greg KH
2010-08-26  7:10   ` Matt Evans
2010-08-26 23:25     ` Greg KH
2010-08-24 22:25 ` [50/59] USB: option: add Celot CT-650 Greg KH
2010-08-24 22:25 ` [51/59] USB: add device IDs for igotu to navman Greg KH
2010-08-24 22:25 ` [52/59] USB: pl2303: New vendor and product id Greg KH
2010-08-24 22:25 ` [53/59] USB: CP210x Fix Break On/Off Greg KH
2010-08-24 22:25 ` [54/59] USB: ftdi_sio: fix endianess of max packet size Greg KH
2010-08-24 22:25 ` [55/59] USB: io_ti: check firmware version before updating Greg KH
2010-08-24 22:25 ` [56/59] USB: xhci: Remove buggy assignment in next_trb() Greg KH
2010-08-24 22:25 ` [57/59] USB: ftdi_sio: Add ID for Ionics PlugComputer Greg KH
2010-08-24 22:25 ` [58/59] USB: ftdi_sio: add product ID for Lenz LI-USB Greg KH
2010-08-24 22:25 ` [59/59] x86, apic: ack all pending irqs when crashed/on kexec Greg KH

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=20100824222523.357304306@clark.site \
    --to=gregkh@suse.de \
    --cc=akpm@linux-foundation.org \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=joel.becker@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=srinivas.eeda@oracle.com \
    --cc=stable-review@kernel.org \
    --cc=stable@kernel.org \
    --cc=torvalds@linux-foundation.org \
    --cc=wen.gang.wang@oracle.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 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.