History

nbd: add a flag to destroy an nbd device on disconnect

For ease of management it would be nice for users to specify that the device node for a nbd device is destroyed once it is disconnected and there are no more users. Add a client flag and enable this operation to happen.

Josef Bacik committed 9 years ago

Commit a2c97901 parent c6a47592 files · +35 −1Browse files

Showing the changes to include/uapi/linux (1 of 2 files). Show all

Unified · Split

include/uapi/linux/nbd.h+5−1
@@ -37,7 +37,7 @@ enum { · 36 unmodified lines
3737 NBD_CMD_TRIM = 4
3838 };
3939
40−/* values for flags field */
40+/* values for flags field, these are server interaction specific. */
4141 #define NBD_FLAG_HAS_FLAGS (1 << 0) /* nbd-server supports flags */
4242 #define NBD_FLAG_READ_ONLY (1 << 1) /* device is read-only */
4343 #define NBD_FLAG_SEND_FLUSH (1 << 2) /* can flush writeback cache */
@@ -45,6 +45,10 @@ enum { · 1 unmodified line
4545 #define NBD_FLAG_SEND_TRIM (1 << 5) /* send trim/discard */
4646 #define NBD_FLAG_CAN_MULTI_CONN (1 << 8) /* Server supports multiple connections per export. */
4747
48+/* These are client behavior specific flags. */
49+#define NBD_CFLAG_DESTROY_ON_DISCONNECT (1 << 0) /* delete the nbd device on
50+ disconnect. */
51+
4852 /* userspace doesn't need the nbd_device structure */
4953
5054 /* These are sent over the network in the request/reply magic fields */