Re: [NBD] Use per-device semaphore instead of BKL

From: Paul Clements
Date: Sun Nov 20 2005 - 16:42:14 EST

Herbert Xu wrote:
On Sun, Nov 20, 2005 at 12:19:17PM -0500, Paul Clements wrote:

The dropping of the lock in nbd_do_it is actually critical to the way nbd functions. nbd_do_it runs for the lifetime of the nbd device, so if nbd_do_it were holding some lock (BKL or otherwise), we'd have big problems.

Why would you want to issue an ioctl from a different process while
nbd-client is still running?

nbd-client -d (disconnect) is the main reason -- this functionality would be broken if we didn't allow ioctls anymore

Allow ioctl's while nbd_do_it is in progress is a *serious* bug. For a

Certain ioctls, yes. There's no harm in NBD_DISCONNECT, though.

start, if someone else clears the socket then nbd_read_stat will crash.

I agree, NBD_CLEAR_SOCK from another process while nbd_do_it is running would cause problems. But, if the user-level tools are coded properly, this is not an issue.

Perhaps your ioctl lock scheme, with an exemption for NBD_DISCONNECT would work?

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