[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20110415090118.GA3315@mtj.dyndns.org>
Date: Fri, 15 Apr 2011 18:01:18 +0900
From: Tejun Heo <tj@...nel.org>
To: Sitsofe Wheeler <sitsofe@...oo.com>
Cc: Jens Axboe <axboe@...nel.dk>, linux-kernel@...r.kernel.org
Subject: Re: WARNING: at block/genhd.c:1556 disk_clear_events+0xdc/0xf0()
On Thu, Apr 14, 2011 at 05:00:00AM +0900, Tejun Heo wrote:
> Thanks a lot for finding out the test case. I'll see whether I can
> reproduce the problem in qemu.
Hmm... can't reproduce the problem with qemu. Can you please apply
the following patch and see which warning messages trigger?
Thanks.
diff --git a/block/genhd.c b/block/genhd.c
index b364bd0..f061975 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -1377,6 +1377,8 @@ struct disk_events {
long poll_msecs; /* interval, -1 for default */
struct delayed_work dwork;
+ struct mutex mutex;
+ atomic_t cnt;
};
static const char *disk_events_strs[] = {
@@ -1572,6 +1574,9 @@ static void disk_events_workfn(struct work_struct *work)
unsigned long intv;
int nr_events = 0, i;
+ WARN_ON_ONCE(atomic_add_return(1, &ev->cnt) != 1);
+ mutex_lock(&ev->mutex);
+
/* check events */
events = disk->fops->check_events(disk, clearing);
@@ -1595,6 +1600,9 @@ static void disk_events_workfn(struct work_struct *work)
if (nr_events)
kobject_uevent_env(&disk_to_dev(disk)->kobj, KOBJ_CHANGE, envp);
+
+ mutex_unlock(&ev->mutex);
+ WARN_ON_ONCE(atomic_add_return(-1, &ev->cnt) != 0);
}
/*
@@ -1749,6 +1757,8 @@ static void disk_add_events(struct gendisk *disk)
ev->block = 1;
ev->poll_msecs = -1;
INIT_DELAYED_WORK(&ev->dwork, disk_events_workfn);
+ mutex_init(&ev->mutex);
+ atomic_set(&ev->cnt, 0);
mutex_lock(&disk_events_mutex);
list_add_tail(&ev->node, &disk_events);
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists