Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

block: Add error codes for common PR failures

If a PR operation fails we can return a device-specific error which is
impossible to handle in some cases because we could have a mix of devices
when DM is used, or future users like LIO only knows it's interacting with
a block device so it doesn't know the type.

This patch adds a new pr_status enum so drivers can convert errors to a
common type which can be handled by the caller.

Signed-off-by: Mike Christie <michael.christie@oracle.com>
Link: https://lore.kernel.org/r/20221122032603.32766-2-michael.christie@oracle.com
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

authored by

Mike Christie and committed by
Martin K. Petersen
255c4f4a 9f5436f4

+17
+17
include/uapi/linux/pr.h
··· 4 4 5 5 #include <linux/types.h> 6 6 7 + enum pr_status { 8 + PR_STS_SUCCESS = 0x0, 9 + /* 10 + * The following error codes are based on SCSI, because the interface 11 + * was originally created for it and has existing users. 12 + */ 13 + /* Generic device failure. */ 14 + PR_STS_IOERR = 0x2, 15 + PR_STS_RESERVATION_CONFLICT = 0x18, 16 + /* Temporary path failure that can be retried. */ 17 + PR_STS_RETRY_PATH_FAILURE = 0xe0000, 18 + /* The request was failed due to a fast failure timer. */ 19 + PR_STS_PATH_FAST_FAILED = 0xf0000, 20 + /* The path cannot be reached and has been marked as failed. */ 21 + PR_STS_PATH_FAILED = 0x10000, 22 + }; 23 + 7 24 enum pr_type { 8 25 PR_WRITE_EXCLUSIVE = 1, 9 26 PR_EXCLUSIVE_ACCESS = 2,