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.
Showing the changes to include/uapi (1 of 2 files). Show all
Unified · Split
| @@ -62,6 +62,12 @@ struct pr_read_keys { · 61 unmodified lines | |||
| 62 | __u64 keys_ptr; | 62 | __u64 keys_ptr; |
| 63 | }; | 63 | }; |
| 64 | 64 | ||
| 65 | struct pr_read_reservation { | ||
| 66 | __u64 key; | ||
| 67 | __u32 generation; | ||
| 68 | __u32 type; | ||
| 69 | }; | ||
| 70 | |||
| 65 | #define PR_FL_IGNORE_KEY (1 << 0) /* ignore existing key */ | 71 | #define PR_FL_IGNORE_KEY (1 << 0) /* ignore existing key */ |
| 66 | 72 | ||
| 67 | #define IOC_PR_REGISTER _IOW('p', 200, struct pr_registration) | 73 | #define IOC_PR_REGISTER _IOW('p', 200, struct pr_registration) |
| @@ -71,5 +77,6 @@ struct pr_read_keys { · 3 unmodified lines | |||
| 71 | #define IOC_PR_PREEMPT_ABORT _IOW('p', 204, struct pr_preempt) | 77 | #define IOC_PR_PREEMPT_ABORT _IOW('p', 204, struct pr_preempt) |
| 72 | #define IOC_PR_CLEAR _IOW('p', 205, struct pr_clear) | 78 | #define IOC_PR_CLEAR _IOW('p', 205, struct pr_clear) |
| 73 | #define IOC_PR_READ_KEYS _IOWR('p', 206, struct pr_read_keys) | 79 | #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) | ||
| 74 | 81 | ||
| 75 | #endif /* _UAPI_PR_H */ | 82 | #endif /* _UAPI_PR_H */ |