Re: mm: GPF in bdi_put

From: Al Viro
Date: Thu Mar 02 2017 - 07:06:51 EST


On Wed, Mar 01, 2017 at 03:29:09PM +0100, Jan Kara wrote:

> The problem is writeback code (from flusher work or through sync(2) -
> generally inode_to_bdi() users) can be looking at bdev inode independently
> from it being open. So if they start looking while the bdev is open but the
> dereference happens after it is closed and device removed, we oops. We have
> seen oopses due to this for quite a while. And all the stuff that is done
> in __blkdev_put() is not enough to prevent writeback code from having a
> look whether there is not something to write.

Um. What's to prevent the queue/device/module itself from disappearing
from under you? IOW, what are you doing that is safe to do in face of
driver going rmmoded?