rpms/kernel/F-12 linux-2.6-raidlockdep.patch, NONE, 1.1 kernel.spec, 1.1803, 1.1804

Hans de Goede jwrdegoede at fedoraproject.org
Wed Sep 16 12:47:28 UTC 2009


Author: jwrdegoede

Update of /cvs/extras/rpms/kernel/F-12
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv22595

Modified Files:
	kernel.spec 
Added Files:
	linux-2.6-raidlockdep.patch 
Log Message:
* Wed Sep 18 2009 Hans de Goede <hdegoede at redhat.com>
- Fix lockdep warning (and potential real deadlock) in mdraid10 code,
  requested for -stable, rh#515471


linux-2.6-raidlockdep.patch:
 file.c |   15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

--- NEW FILE linux-2.6-raidlockdep.patch ---
Subject:
Re: 2.6.31rc5 RAID10 lockdep report - sysfs_nofity_dirent locking issue
From:
Dan Williams <dan.j.williams at intel.com>
Date:
Tue, 15 Sep 2009 16:05:51 -0700
To:
Greg KH <gregkh at suse.de>
CC:
Neil Brown <neilb at suse.de>, Dave Jones <davej at redhat.com>, Linux Kernel <linux-kernel at vger.kernel.org>, Hans de Goede <hdegoede at redhat.com>

>From 1ee8b5bfeb2de765d3b2acbaf5357c4c0eb65dbe Mon Sep 17 00:00:00 2001
From: NeilBrown <neilb at suse.de>
Date: Thu, 6 Aug 2009 15:42:08 +1000
Subject: [PATCH] Allow sysfs_notify_dirent to be called from interrupt context.

sysfs_notify_dirent is a simple atomic operation that can be used to
alert user-space that new data can be read from a sysfs attribute.

Unfortunately it cannot currently be called from non-process context
because of its use of spin_lock which is sometimes taken with
interrupts enabled.

So change all lockers of sysfs_open_dirent_lock to disable interrupts,
thus making sysfs_notify_dirent safe to be called from non-process
context (as drivers/md does in md_safemode_timeout).

sysfs_get_open_dirent is (documented as being) only called from
process context, so it uses spin_lock_irq.  Other places
use spin_lock_irqsave.

The usage for sysfs_notify_dirent in md_safemode_timeout was
introduced in 2.6.28, so this patch is suitable for that and more
recent kernels.

Cc: <stable at kernel.org>
Reported-by: Joel Andres Granados <jgranado at redhat.com>
Signed-off-by: NeilBrown <neilb at suse.de>
Signed-off-by: Dan Williams <dan.j.williams at intel.com>
---
>> > > Greg?
>> > > 
>> > > Looks like this never made it upstream, and now Hans is hitting this
>> > > in his tests.
> > 
> > Ok, I don't have this in my queue, so someone needs to resubmit it and
> > tell me what kernel trees it should be applicable for.

As mentioned in the commit log should be applicable back to 2.6.28.

Thanks,
Dan


 fs/sysfs/file.c |   14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/fs/sysfs/file.c b/fs/sysfs/file.c
index 561a9c0..f5ea468 100644
--- a/fs/sysfs/file.c
+++ b/fs/sysfs/file.c
@@ -268,7 +268,7 @@ static int sysfs_get_open_dirent(struct sysfs_dirent *sd,
 	struct sysfs_open_dirent *od, *new_od = NULL;
 
  retry:
-	spin_lock(&sysfs_open_dirent_lock);
+	spin_lock_irq(&sysfs_open_dirent_lock);
 
 	if (!sd->s_attr.open && new_od) {
 		sd->s_attr.open = new_od;
@@ -281,7 +281,7 @@ static int sysfs_get_open_dirent(struct sysfs_dirent *sd,
 		list_add_tail(&buffer->list, &od->buffers);
 	}
 
-	spin_unlock(&sysfs_open_dirent_lock);
+	spin_unlock_irq(&sysfs_open_dirent_lock);
 
 	if (od) {
 		kfree(new_od);
@@ -315,8 +315,9 @@ static void sysfs_put_open_dirent(struct sysfs_dirent *sd,
 				  struct sysfs_buffer *buffer)
 {
 	struct sysfs_open_dirent *od = sd->s_attr.open;
+	unsigned long flags;
 
-	spin_lock(&sysfs_open_dirent_lock);
+	spin_lock_irqsave(&sysfs_open_dirent_lock, flags);
 
 	list_del(&buffer->list);
 	if (atomic_dec_and_test(&od->refcnt))
@@ -324,7 +325,7 @@ static void sysfs_put_open_dirent(struct sysfs_dirent *sd,
 	else
 		od = NULL;
 
-	spin_unlock(&sysfs_open_dirent_lock);
+	spin_unlock_irqrestore(&sysfs_open_dirent_lock, flags);
 
 	kfree(od);
 }
@@ -456,8 +457,9 @@ static unsigned int sysfs_poll(struct file *filp, poll_table *wait)
 void sysfs_notify_dirent(struct sysfs_dirent *sd)
 {
 	struct sysfs_open_dirent *od;
+	unsigned long flags;
 
-	spin_lock(&sysfs_open_dirent_lock);
+	spin_lock_irqsave(&sysfs_open_dirent_lock, flags);
 
 	od = sd->s_attr.open;
 	if (od) {
@@ -465,7 +467,7 @@ void sysfs_notify_dirent(struct sysfs_dirent *sd)
 		wake_up_interruptible(&od->poll);
 	}
 
-	spin_unlock(&sysfs_open_dirent_lock);
+	spin_unlock_irqrestore(&sysfs_open_dirent_lock, flags);
 }
 EXPORT_SYMBOL_GPL(sysfs_notify_dirent);
 
-- 1.6.0.6 

Index: kernel.spec
===================================================================
RCS file: /cvs/extras/rpms/kernel/F-12/kernel.spec,v
retrieving revision 1.1803
retrieving revision 1.1804
diff -u -p -r1.1803 -r1.1804
--- kernel.spec	16 Sep 2009 04:41:25 -0000	1.1803
+++ kernel.spec	16 Sep 2009 12:47:26 -0000	1.1804
@@ -741,6 +741,8 @@ Patch12013: linux-2.6-rfkill-all.patch
 # scsi oops fixes
 Patch14000: linux-2.6-scsi-sd-fix-oops-during-scanning.patch
 Patch14001: linux-2.6-scsi-sg-fix-oops-in-error-path.patch
+# Raid10 lockdep fix
+Patch14002: linux-2.6-raidlockdep.patch
 
 %endif
 
@@ -1383,6 +1385,8 @@ ApplyPatch linux-2.6-rfkill-all.patch
 # scsi oops fixes
 ApplyPatch linux-2.6-scsi-sd-fix-oops-during-scanning.patch
 ApplyPatch linux-2.6-scsi-sg-fix-oops-in-error-path.patch
+# Raid10 lockdep fix
+ApplyPatch linux-2.6-raidlockdep.patch
 
 # END OF PATCH APPLICATIONS
 
@@ -2040,6 +2044,10 @@ fi
 # and build.
 
 %changelog
+* Wed Sep 18 2009 Hans de Goede <hdegoede at redhat.com>
+- Fix lockdep warning (and potential real deadlock) in mdraid10 code,
+  requested for -stable, rh#515471
+
 * Wed Sep 16 2009 Ben Skeggs <bskeggs at redhat.com> 2.6.31-17
 - nouveau: potential fix for rh#522649 + misc other fixes
 




More information about the fedora-extras-commits mailing list