how stop sync on last close of removable medium?

From: Peter T. Breuer
Date: Fri Sep 29 2006 - 23:37:34 EST

blkdev_close calls blkdev_put, which does a sync if we were the last
opener of the device and are now closing:

if (!--bdev->bd_openers) {

This is bad news for nbd-like devices which use a client daemon
to transfer data out of the device. If there are requests pending
when the daemon is killed off (hey, we may want to shut down!)
then the sync in the daemon's close of its device creates a deadlock.
The sync will not complete until the daemon sends pending
requests which it will not do since it is closing due to death.

Is there a mechanism to prevent this sync occuring? Say for
removable devices?

(I don't see it, due to blindness and mental density ... I could change
blkdev_close in inode->i_fops, I suppose, but that is attached to an
inode, presumably of our special device node in the fs above, and by the
time I get to it we have already opened the device node and it seems
that changing the release method then doesn't actually do anything.

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at