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
37 NBD_CMD_TRIM = 437 NBD_CMD_TRIM = 4
38};38};
39 39
40/* values for flags field */40/* values for flags field, these are server interaction specific. */
41#define NBD_FLAG_HAS_FLAGS (1 << 0) /* nbd-server supports flags */41#define NBD_FLAG_HAS_FLAGS (1 << 0) /* nbd-server supports flags */
42#define NBD_FLAG_READ_ONLY (1 << 1) /* device is read-only */42#define NBD_FLAG_READ_ONLY (1 << 1) /* device is read-only */
43#define NBD_FLAG_SEND_FLUSH (1 << 2) /* can flush writeback cache */43#define NBD_FLAG_SEND_FLUSH (1 << 2) /* can flush writeback cache */
@@ -45,6 +45,10 @@ enum { · 1 unmodified line
45#define NBD_FLAG_SEND_TRIM (1 << 5) /* send trim/discard */45#define NBD_FLAG_SEND_TRIM (1 << 5) /* send trim/discard */
46#define NBD_FLAG_CAN_MULTI_CONN (1 << 8) /* Server supports multiple connections per export. */46#define NBD_FLAG_CAN_MULTI_CONN (1 << 8) /* Server supports multiple connections per export. */
47 47
48/* These are client behavior specific flags. */
49#define NBD_CFLAG_DESTROY_ON_DISCONNECT (1 << 0) /* delete the nbd device on
50 disconnect. */
51
48/* userspace doesn't need the nbd_device structure */52/* userspace doesn't need the nbd_device structure */
49 53
50/* These are sent over the network in the request/reply magic fields */54/* These are sent over the network in the request/reply magic fields */