From: Joe Thornber <thornber@sistina.com>
To: Joe Thornber <thornber@sistina.com>
Cc: Linux Mailing List <linux-kernel@vger.kernel.org>,
Andrew Morton <akpm@zip.com.au>,
Linus Torvalds <torvalds@osdl.org>
Subject: [Patch 5/5] dm: dm_table_event() sleep on spinlock bug
Date: Tue, 25 Nov 2003 16:35:37 +0000 [thread overview]
Message-ID: <20031125163537.GF524@reti> (raw)
In-Reply-To: <20031125162451.GA524@reti>
You can no longer call dm_table_event() from interrupt context.
--- diff/drivers/md/dm-table.c 2003-11-25 15:47:59.000000000 +0000
+++ source/drivers/md/dm-table.c 2003-11-25 15:52:15.000000000 +0000
@@ -12,6 +12,7 @@
#include <linux/namei.h>
#include <linux/ctype.h>
#include <linux/slab.h>
+#include <linux/interrupt.h>
#include <asm/atomic.h>
#define MAX_DEPTH 16
@@ -746,22 +747,28 @@
return r;
}
-static spinlock_t _event_lock = SPIN_LOCK_UNLOCKED;
+static DECLARE_MUTEX(_event_lock);
void dm_table_event_callback(struct dm_table *t,
void (*fn)(void *), void *context)
{
- spin_lock_irq(&_event_lock);
+ down(&_event_lock);
t->event_fn = fn;
t->event_context = context;
- spin_unlock_irq(&_event_lock);
+ up(&_event_lock);
}
void dm_table_event(struct dm_table *t)
{
- spin_lock(&_event_lock);
+ /*
+ * You can no longer call dm_table_event() from interrupt
+ * context, use a bottom half instead.
+ */
+ BUG_ON(in_interrupt());
+
+ down(&_event_lock);
if (t->event_fn)
t->event_fn(t->event_context);
- spin_unlock(&_event_lock);
+ up(&_event_lock);
}
sector_t dm_table_get_size(struct dm_table *t)
prev parent reply other threads:[~2003-11-25 16:36 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-11-25 16:24 2.6.0-t10-dm1 Joe Thornber
2003-11-25 16:30 ` [Patch 1/5] dm: fix block device resizing Joe Thornber
2003-11-25 16:31 ` [Patch 2/5] dm: remove dynamic table resizing Joe Thornber
2003-11-25 16:33 ` [Patch 3/5] dm: make v4 of the ioctl interface the default Joe Thornber
2003-11-25 16:47 ` Kevin P. Fleming
2003-11-25 17:05 ` Joe Thornber
2003-11-25 17:15 ` Kevin P. Fleming
2003-11-25 18:00 ` Joe Thornber
2003-11-25 17:29 ` Wichert Akkerman
2003-11-25 20:18 ` Alasdair G Kergon
2003-11-25 23:45 ` Adrian Bunk
2003-11-26 11:39 ` Joe Thornber
2003-11-25 17:09 ` Kevin Corry
2003-11-25 17:16 ` Kevin P. Fleming
2003-11-25 17:28 ` Kevin Corry
2003-11-25 17:20 ` Christoph Hellwig
2003-11-25 17:59 ` Joe Thornber
2003-11-25 16:34 ` [Patch 4/5] dm: set io restriction defaults Joe Thornber
2003-11-25 16:35 ` Joe Thornber [this message]
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=20031125163537.GF524@reti \
--to=thornber@sistina.com \
--cc=akpm@zip.com.au \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@osdl.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox