From: Ritika Srivastava <ritika.srivastava@oracle.com>
To: linux-block@vger.kernel.org
Cc: axboe@kernel.dk, ritika.srivastava@oracle.com
Subject: [PATCH 1/1] block: return BLK_STS_NOTSUPP if operation is not supported
Date: Fri, 24 Jul 2020 09:33:22 -0700 [thread overview]
Message-ID: <1595608402-16457-1-git-send-email-ritika.srivastava@oracle.com> (raw)
If WRITE_ZERO/WRITE_SAME operation is not supported by the storage,
blk_cloned_rq_check_limits() will return -EIO which will cause
device-mapper to fail the paths.
Instead, if the queue limit is set to 0, return BLK_STS_NOTSUPP.
BLK_STS_NOTSUPP will be ignored by device-mapper and will not fail the
paths.
Suggested-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Ritika Srivastava <ritika.srivastava@oracle.com>
---
block/blk-core.c | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
diff --git a/block/blk-core.c b/block/blk-core.c
index 9bfaee0..173bb04 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -1223,10 +1223,13 @@ blk_qc_t submit_bio(struct bio *bio)
static int blk_cloned_rq_check_limits(struct request_queue *q,
struct request *rq)
{
- if (blk_rq_sectors(rq) > blk_queue_get_max_sectors(q, req_op(rq))) {
+ unsigned int queue_max_sector = blk_queue_get_max_sectors(q, req_op(rq));
+
+ if (blk_rq_sectors(rq) > queue_max_sector) {
printk(KERN_ERR "%s: over max size limit. (%u > %u)\n",
- __func__, blk_rq_sectors(rq),
- blk_queue_get_max_sectors(q, req_op(rq)));
+ __func__, blk_rq_sectors(rq), queue_max_sector);
+ if (queue_max_sector == 0)
+ return -EOPNOTSUPP;
return -EIO;
}
@@ -1253,7 +1256,11 @@ static int blk_cloned_rq_check_limits(struct request_queue *q,
*/
blk_status_t blk_insert_cloned_request(struct request_queue *q, struct request *rq)
{
- if (blk_cloned_rq_check_limits(q, rq))
+ int cloned_limit_check = blk_cloned_rq_check_limits(q, rq);
+
+ if (cloned_limit_check == -EOPNOTSUPP)
+ return BLK_STS_NOTSUPP;
+ else if (cloned_limit_check)
return BLK_STS_IOERR;
if (rq->rq_disk &&
--
1.8.3.1
next reply other threads:[~2020-07-24 16:48 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-24 16:33 Ritika Srivastava [this message]
2020-07-26 15:10 ` [PATCH 1/1] block: return BLK_STS_NOTSUPP if operation is not supported Christoph Hellwig
2020-07-27 19:11 ` Ritika Srivastava
2020-07-28 7:28 ` Christoph Hellwig
2020-07-28 17:18 ` Ritika Srivastava
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=1595608402-16457-1-git-send-email-ritika.srivastava@oracle.com \
--to=ritika.srivastava@oracle.com \
--cc=axboe@kernel.dk \
--cc=linux-block@vger.kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).