Re: 2.6.19-rc6-mm2

Jiri Kosina
2006-12-08T12:36:12Z

On Fri, 8 Dec 2006, Neil Brown wrote:

> > OK, so more details follow (I am not sure how valuable they are, though).
> They do help a bit..
> I've found a possible race that could possibly be related to this BUG.
> Can you try this patch and see if it helps?
> Signed-off-by: Neil Brown <neilb@suse.de>
>
> ### Diffstat output
> ./drivers/md/md.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff .prev/drivers/md/md.c ./drivers/md/md.c
> --- .prev/drivers/md/md.c 2006-12-06 14:49:20.000000000 +1100
> +++ ./drivers/md/md.c 2006-12-07 10:29:40.000000000 +1100
> @@ -222,10 +222,14 @@ static inline mddev_t *mddev_get(mddev_t
> return mddev;
> }
>
> +static DEFINE_MUTEX(disks_mutex);
> static void mddev_put(mddev_t *mddev)
> {
> - if (!atomic_dec_and_lock(&mddev->active, &all_mddevs_lock))
> + mutex_lock(&disks_mutex);
> + if (!atomic_dec_and_lock(&mddev->active, &all_mddevs_lock)) {
> + mutex_unlock(&disks_mutex);
> return;
> + }
> list_del(&mddev->all_mddevs);
> spin_unlock(&all_mddevs_lock);
>
> @@ -234,6 +238,7 @@ static void mddev_put(mddev_t *mddev)
> blk_cleanup_queue(mddev->queue);
> mddev->queue = NULL;
> kobject_unregister(&mddev->kobj);
> + mutex_unlock(&disks_mutex);
> }
>
> static mddev_t * mddev_find(dev_t unit)
> @@ -2948,7 +2953,6 @@ int mdp_major = 0;
>
> static struct kobject *md_probe(dev_t dev, int *part, void *data)
> {
> - static DEFINE_MUTEX(disks_mutex);
> mddev_t *mddev = mddev_find(dev);
> struct gendisk *disk;
> int partitioned = (MAJOR(dev) != MD_MAJOR);

Hi Neil,

sorry, but the BUG is still there after applying this patch.

--
Jiri Kosina