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
This commit is contained in:
@@ -277,7 +277,7 @@ static struct bio *__bio_chain_endio(struct bio *bio)
|
||||
{
|
||||
struct bio *parent = bio->bi_private;
|
||||
|
||||
if (!parent->bi_status)
|
||||
if (bio->bi_status && !parent->bi_status)
|
||||
parent->bi_status = bio->bi_status;
|
||||
bio_put(bio);
|
||||
return parent;
|
||||
|
||||
@@ -302,7 +302,6 @@ static const char *const rqf_name[] = {
|
||||
RQF_NAME(QUIET),
|
||||
RQF_NAME(ELVPRIV),
|
||||
RQF_NAME(IO_STAT),
|
||||
RQF_NAME(ALLOCED),
|
||||
RQF_NAME(PM),
|
||||
RQF_NAME(HASHED),
|
||||
RQF_NAME(STATS),
|
||||
|
||||
@@ -1369,10 +1369,13 @@ static blk_status_t null_handle_cmd(struct nullb_cmd *cmd, sector_t sector,
|
||||
}
|
||||
|
||||
if (dev->zoned)
|
||||
cmd->error = null_process_zoned_cmd(cmd, op,
|
||||
sector, nr_sectors);
|
||||
sts = null_process_zoned_cmd(cmd, op, sector, nr_sectors);
|
||||
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:
|
||||
nullb_complete_cmd(cmd);
|
||||
@@ -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)
|
||||
{
|
||||
struct nullb_cmd *cmd = blk_mq_rq_to_pdu(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;
|
||||
}
|
||||
|
||||
@@ -1473,6 +1488,7 @@ static blk_status_t null_queue_rq(struct blk_mq_hw_ctx *hctx,
|
||||
cmd->rq = bd->rq;
|
||||
cmd->error = BLK_STS_OK;
|
||||
cmd->nq = nq;
|
||||
cmd->fake_timeout = should_timeout_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,
|
||||
return BLK_STS_OK;
|
||||
}
|
||||
}
|
||||
if (should_timeout_request(bd->rq))
|
||||
if (cmd->fake_timeout)
|
||||
return BLK_STS_OK;
|
||||
|
||||
return null_handle_cmd(cmd, sector, nr_sectors, req_op(bd->rq));
|
||||
|
||||
@@ -22,6 +22,7 @@ struct nullb_cmd {
|
||||
blk_status_t error;
|
||||
struct nullb_queue *nq;
|
||||
struct hrtimer timer;
|
||||
bool fake_timeout;
|
||||
};
|
||||
|
||||
struct nullb_queue {
|
||||
|
||||
@@ -275,6 +275,8 @@ __blkdev_direct_IO_simple(struct kiocb *iocb, struct iov_iter *iter,
|
||||
bio.bi_opf = dio_bio_write_op(iocb);
|
||||
task_io_account_write(ret);
|
||||
}
|
||||
if (iocb->ki_flags & IOCB_NOWAIT)
|
||||
bio.bi_opf |= REQ_NOWAIT;
|
||||
if (iocb->ki_flags & IOCB_HIPRI)
|
||||
bio_set_polled(&bio, iocb);
|
||||
|
||||
@@ -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);
|
||||
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;
|
||||
pos += bio->bi_iter.bi_size;
|
||||
|
||||
@@ -85,8 +85,6 @@ typedef __u32 __bitwise req_flags_t;
|
||||
#define RQF_ELVPRIV ((__force req_flags_t)(1 << 12))
|
||||
/* account into disk and partition IO statistics */
|
||||
#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 */
|
||||
#define RQF_PM ((__force req_flags_t)(1 << 15))
|
||||
/* on IO scheduler merge hash */
|
||||
|
||||
@@ -2,29 +2,6 @@
|
||||
#ifndef _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/ioctl.h>
|
||||
|
||||
@@ -52,9 +29,8 @@ struct blkpg_partition {
|
||||
long long start; /* starting offset in bytes */
|
||||
long long length; /* length in bytes */
|
||||
int pno; /* partition number */
|
||||
char devname[BLKPG_DEVNAMELTH]; /* partition name, like sda5 or c0d1p2,
|
||||
to be used in kernel messages */
|
||||
char volname[BLKPG_VOLNAMELTH]; /* volume label */
|
||||
char devname[BLKPG_DEVNAMELTH]; /* unused / ignored */
|
||||
char volname[BLKPG_VOLNAMELTH]; /* unused / ignore */
|
||||
};
|
||||
|
||||
#endif /* _UAPI__LINUX_BLKPG_H */
|
||||
|
||||
Reference in New Issue
Block a user