public inbox for linux-block@vger.kernel.org
 help / color / mirror / Atom feed
From: Mike Christie <michael.christie@oracle.com>
To: chaitanyak@nvidia.com, kbusch@kernel.org, axboe@fb.com,
	hch@lst.de, sagi@grimberg.me, martin.petersen@oracle.com,
	jejb@linux.ibm.com, linux-scsi@vger.kernel.org,
	linux-nvme@lists.infradead.org, linux-block@vger.kernel.org
Cc: Mike Christie <michael.christie@oracle.com>,
	Chaitanya Kulkarni <kch@nvidia.com>
Subject: [PATCH v3 1/4] block: Add error codes for common PR failures
Date: Mon, 21 Nov 2022 21:26:00 -0600	[thread overview]
Message-ID: <20221122032603.32766-2-michael.christie@oracle.com> (raw)
In-Reply-To: <20221122032603.32766-1-michael.christie@oracle.com>

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 know 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>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>
---
 include/uapi/linux/pr.h | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/include/uapi/linux/pr.h b/include/uapi/linux/pr.h
index ccc78cbf1221..d8126415966f 100644
--- a/include/uapi/linux/pr.h
+++ b/include/uapi/linux/pr.h
@@ -4,6 +4,23 @@
 
 #include <linux/types.h>
 
+enum pr_status {
+	PR_STS_SUCCESS			= 0x0,
+	/*
+	 * The following error codes are based on SCSI, because the interface
+	 * was originally created for it and has existing users.
+	 */
+	/* Generic device failure. */
+	PR_STS_IOERR			= 0x2,
+	PR_STS_RESERVATION_CONFLICT	= 0x18,
+	/* Temporary path failure that can be retried. */
+	PR_STS_RETRY_PATH_FAILURE	= 0xe0000,
+	/* The request was failed due to a fast failure timer. */
+	PR_STS_PATH_FAST_FAILED		= 0xf0000,
+	/* The path cannot be reached and has been marked as failed. */
+	PR_STS_PATH_FAILED		= 0x10000,
+};
+
 enum pr_type {
 	PR_WRITE_EXCLUSIVE		= 1,
 	PR_EXCLUSIVE_ACCESS		= 2,
-- 
2.25.1


  reply	other threads:[~2022-11-22  3:29 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-22  3:25 [PATCH v3 0/4] block/scsi/nvme: Add error codes for PR ops Mike Christie
2022-11-22  3:26 ` Mike Christie [this message]
2022-11-22  3:26 ` [PATCH v3 2/4] scsi: Rename status_byte to sg_status_byte Mike Christie
2022-11-22  3:26 ` [PATCH v3 3/4] scsi: Convert SCSI errors to PR errors Mike Christie
2022-11-22  3:26 ` [PATCH v3 4/4] nvme: Convert NVMe " Mike Christie
2022-11-26  2:48 ` [PATCH v3 0/4] block/scsi/nvme: Add error codes for PR ops Martin K. Petersen
2022-11-29  4:18   ` Chaitanya Kulkarni
2022-11-29 13:28     ` hch
2022-11-29 14:00       ` Jens Axboe
2022-11-29 21:31         ` Mike Christie
2022-12-01  3:28           ` Martin K. Petersen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221122032603.32766-2-michael.christie@oracle.com \
    --to=michael.christie@oracle.com \
    --cc=axboe@fb.com \
    --cc=chaitanyak@nvidia.com \
    --cc=hch@lst.de \
    --cc=jejb@linux.ibm.com \
    --cc=kbusch@kernel.org \
    --cc=kch@nvidia.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=sagi@grimberg.me \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox