History

block: add IOC_PR_READ_RESERVATION ioctl

Add a Persistent Reservations ioctl to read the current reservation. This calls the pr_ops->read_reservation() function that was previously added in commit c787f1baa503 ("block: Add PR callouts for read keys and reservation") but was only used by the in-kernel SCSI target so far. The IOC_PR_READ_RESERVATION ioctl is necessary so that userspace applications that rely on Persistent Reservations ioctls have a way of inspecting the current state. Cluster managers and validation tests need this functionality.

Stefan Hajnoczi committed 11 months ago

Commit 3e2cb9e1 parent 22a1ffe2 files · +35 −0Browse files

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

Unified · Split

include/uapi/linux/pr.h+7−0
@@ -62,6 +62,12 @@ struct pr_read_keys { · 61 unmodified lines
6262 __u64 keys_ptr;
6363 };
6464
65+struct pr_read_reservation {
66+ __u64 key;
67+ __u32 generation;
68+ __u32 type;
69+};
70+
6571 #define PR_FL_IGNORE_KEY (1 << 0) /* ignore existing key */
6672
6773 #define IOC_PR_REGISTER _IOW('p', 200, struct pr_registration)
@@ -71,5 +77,6 @@ struct pr_read_keys { · 3 unmodified lines
7177 #define IOC_PR_PREEMPT_ABORT _IOW('p', 204, struct pr_preempt)
7278 #define IOC_PR_CLEAR _IOW('p', 205, struct pr_clear)
7379 #define IOC_PR_READ_KEYS _IOWR('p', 206, struct pr_read_keys)
80+#define IOC_PR_READ_RESERVATION _IOR('p', 207, struct pr_read_reservation)
7481
7582 #endif /* _UAPI_PR_H */