Commit d93a0d43 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'block-5.12-2021-04-02' of git://git.kernel.dk/linux-block

Pull block fixes from Jens Axboe:

 - Remove comment that never came to fruition in 22 years of development
   (Christoph)

 - Remove unused request flag (Christoph)

 - Fix for null_blk fake timeout handling (Damien)

 - Fix for IOCB_NOWAIT being ignored for O_DIRECT on raw bdevs (Pavel)

 - Error propagation fix for multiple split bios (Yufen)

* tag 'block-5.12-2021-04-02' of git://git.kernel.dk/linux-block:
  block: remove the unused RQF_ALLOCED flag
  block: update a few comments in uapi/linux/blkpg.h
  block: don't ignore REQ_NOWAIT for direct IO
  null_blk: fix command timeout completion handling
  block: only update parent bi_status when bio fail
parents 1faccb63 f06c6096
...@@ -277,7 +277,7 @@ static struct bio *__bio_chain_endio(struct bio *bio) ...@@ -277,7 +277,7 @@ static struct bio *__bio_chain_endio(struct bio *bio)
{ {
struct bio *parent = bio->bi_private; struct bio *parent = bio->bi_private;
if (!parent->bi_status) if (bio->bi_status && !parent->bi_status)
parent->bi_status = bio->bi_status; parent->bi_status = bio->bi_status;
bio_put(bio); bio_put(bio);
return parent; return parent;
......
...@@ -302,7 +302,6 @@ static const char *const rqf_name[] = { ...@@ -302,7 +302,6 @@ static const char *const rqf_name[] = {
RQF_NAME(QUIET), RQF_NAME(QUIET),
RQF_NAME(ELVPRIV), RQF_NAME(ELVPRIV),
RQF_NAME(IO_STAT), RQF_NAME(IO_STAT),
RQF_NAME(ALLOCED),
RQF_NAME(PM), RQF_NAME(PM),
RQF_NAME(HASHED), RQF_NAME(HASHED),
RQF_NAME(STATS), RQF_NAME(STATS),
......
...@@ -1369,10 +1369,13 @@ static blk_status_t null_handle_cmd(struct nullb_cmd *cmd, sector_t sector, ...@@ -1369,10 +1369,13 @@ static blk_status_t null_handle_cmd(struct nullb_cmd *cmd, sector_t sector,
} }
if (dev->zoned) if (dev->zoned)
cmd->error = null_process_zoned_cmd(cmd, op, sts = null_process_zoned_cmd(cmd, op, sector, nr_sectors);
sector, nr_sectors);
else else
cmd->error = null_process_cmd(cmd, op, sector, nr_sectors); sts = null_process_cmd(cmd, op, sector, nr_sectors);
/* Do not overwrite errors (e.g. timeout errors) */
if (cmd->error == BLK_STS_OK)
cmd->error = sts;
out: out:
nullb_complete_cmd(cmd); nullb_complete_cmd(cmd);
...@@ -1451,8 +1454,20 @@ static bool should_requeue_request(struct request *rq) ...@@ -1451,8 +1454,20 @@ static bool should_requeue_request(struct request *rq)
static enum blk_eh_timer_return null_timeout_rq(struct request *rq, bool res) static enum blk_eh_timer_return null_timeout_rq(struct request *rq, bool res)
{ {
struct nullb_cmd *cmd = blk_mq_rq_to_pdu(rq);
pr_info("rq %p timed out\n", rq); pr_info("rq %p timed out\n", rq);
blk_mq_complete_request(rq);
/*
* If the device is marked as blocking (i.e. memory backed or zoned
* device), the submission path may be blocked waiting for resources
* and cause real timeouts. For these real timeouts, the submission
* path will complete the request using blk_mq_complete_request().
* Only fake timeouts need to execute blk_mq_complete_request() here.
*/
cmd->error = BLK_STS_TIMEOUT;
if (cmd->fake_timeout)
blk_mq_complete_request(rq);
return BLK_EH_DONE; return BLK_EH_DONE;
} }
...@@ -1473,6 +1488,7 @@ static blk_status_t null_queue_rq(struct blk_mq_hw_ctx *hctx, ...@@ -1473,6 +1488,7 @@ static blk_status_t null_queue_rq(struct blk_mq_hw_ctx *hctx,
cmd->rq = bd->rq; cmd->rq = bd->rq;
cmd->error = BLK_STS_OK; cmd->error = BLK_STS_OK;
cmd->nq = nq; cmd->nq = nq;
cmd->fake_timeout = should_timeout_request(bd->rq);
blk_mq_start_request(bd->rq); blk_mq_start_request(bd->rq);
...@@ -1489,7 +1505,7 @@ static blk_status_t null_queue_rq(struct blk_mq_hw_ctx *hctx, ...@@ -1489,7 +1505,7 @@ static blk_status_t null_queue_rq(struct blk_mq_hw_ctx *hctx,
return BLK_STS_OK; return BLK_STS_OK;
} }
} }
if (should_timeout_request(bd->rq)) if (cmd->fake_timeout)
return BLK_STS_OK; return BLK_STS_OK;
return null_handle_cmd(cmd, sector, nr_sectors, req_op(bd->rq)); return null_handle_cmd(cmd, sector, nr_sectors, req_op(bd->rq));
......
...@@ -22,6 +22,7 @@ struct nullb_cmd { ...@@ -22,6 +22,7 @@ struct nullb_cmd {
blk_status_t error; blk_status_t error;
struct nullb_queue *nq; struct nullb_queue *nq;
struct hrtimer timer; struct hrtimer timer;
bool fake_timeout;
}; };
struct nullb_queue { struct nullb_queue {
......
...@@ -275,6 +275,8 @@ __blkdev_direct_IO_simple(struct kiocb *iocb, struct iov_iter *iter, ...@@ -275,6 +275,8 @@ __blkdev_direct_IO_simple(struct kiocb *iocb, struct iov_iter *iter,
bio.bi_opf = dio_bio_write_op(iocb); bio.bi_opf = dio_bio_write_op(iocb);
task_io_account_write(ret); task_io_account_write(ret);
} }
if (iocb->ki_flags & IOCB_NOWAIT)
bio.bi_opf |= REQ_NOWAIT;
if (iocb->ki_flags & IOCB_HIPRI) if (iocb->ki_flags & IOCB_HIPRI)
bio_set_polled(&bio, iocb); bio_set_polled(&bio, iocb);
...@@ -428,6 +430,8 @@ static ssize_t __blkdev_direct_IO(struct kiocb *iocb, struct iov_iter *iter, ...@@ -428,6 +430,8 @@ static ssize_t __blkdev_direct_IO(struct kiocb *iocb, struct iov_iter *iter,
bio->bi_opf = dio_bio_write_op(iocb); bio->bi_opf = dio_bio_write_op(iocb);
task_io_account_write(bio->bi_iter.bi_size); task_io_account_write(bio->bi_iter.bi_size);
} }
if (iocb->ki_flags & IOCB_NOWAIT)
bio->bi_opf |= REQ_NOWAIT;
dio->size += bio->bi_iter.bi_size; dio->size += bio->bi_iter.bi_size;
pos += bio->bi_iter.bi_size; pos += bio->bi_iter.bi_size;
......
...@@ -85,8 +85,6 @@ typedef __u32 __bitwise req_flags_t; ...@@ -85,8 +85,6 @@ typedef __u32 __bitwise req_flags_t;
#define RQF_ELVPRIV ((__force req_flags_t)(1 << 12)) #define RQF_ELVPRIV ((__force req_flags_t)(1 << 12))
/* account into disk and partition IO statistics */ /* account into disk and partition IO statistics */
#define RQF_IO_STAT ((__force req_flags_t)(1 << 13)) #define RQF_IO_STAT ((__force req_flags_t)(1 << 13))
/* request came from our alloc pool */
#define RQF_ALLOCED ((__force req_flags_t)(1 << 14))
/* runtime pm request */ /* runtime pm request */
#define RQF_PM ((__force req_flags_t)(1 << 15)) #define RQF_PM ((__force req_flags_t)(1 << 15))
/* on IO scheduler merge hash */ /* on IO scheduler merge hash */
......
...@@ -2,29 +2,6 @@ ...@@ -2,29 +2,6 @@
#ifndef _UAPI__LINUX_BLKPG_H #ifndef _UAPI__LINUX_BLKPG_H
#define _UAPI__LINUX_BLKPG_H #define _UAPI__LINUX_BLKPG_H
/*
* Partition table and disk geometry handling
*
* A single ioctl with lots of subfunctions:
*
* Device number stuff:
* get_whole_disk() (given the device number of a partition,
* find the device number of the encompassing disk)
* get_all_partitions() (given the device number of a disk, return the
* device numbers of all its known partitions)
*
* Partition stuff:
* add_partition()
* delete_partition()
* test_partition_in_use() (also for test_disk_in_use)
*
* Geometry stuff:
* get_geometry()
* set_geometry()
* get_bios_drivedata()
*
* For today, only the partition stuff - aeb, 990515
*/
#include <linux/compiler.h> #include <linux/compiler.h>
#include <linux/ioctl.h> #include <linux/ioctl.h>
...@@ -52,9 +29,8 @@ struct blkpg_partition { ...@@ -52,9 +29,8 @@ struct blkpg_partition {
long long start; /* starting offset in bytes */ long long start; /* starting offset in bytes */
long long length; /* length in bytes */ long long length; /* length in bytes */
int pno; /* partition number */ int pno; /* partition number */
char devname[BLKPG_DEVNAMELTH]; /* partition name, like sda5 or c0d1p2, char devname[BLKPG_DEVNAMELTH]; /* unused / ignored */
to be used in kernel messages */ char volname[BLKPG_VOLNAMELTH]; /* unused / ignore */
char volname[BLKPG_VOLNAMELTH]; /* volume label */
}; };
#endif /* _UAPI__LINUX_BLKPG_H */ #endif /* _UAPI__LINUX_BLKPG_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment