md related oops triggered in bdev_inode_switch_bdi

From: NeilBrown
Date: Wed Aug 31 2011 - 02:22:26 EST



Hi Christoph et. al.,

My testing recently triggered an oops in bdi_lock_two called from
bdev_inode_switch_bdi.
The bdi and the request_queue that contains it had been freed.

This happens with md which can free the md device and request queue
immediately after last close.

It seems that this is caused by your patch f758eeabeb96f8.
Prior to that the 'old' bdi was never dereferenced in
bdev_inode_switch_bdi. Now it is.

I think we can fix that by simply moving the call to bdev_inode_switch_bdi
before the call to ->release as in the patch below.

Do you see any problem with this patch?

Thanks,
NeilBrown