Skip to content

Commit eccea80

Browse files
committed
Merge tag 'block-5.16-2021-12-10' of git://git.kernel.dk/linux-block
Pull block fixes from Jens Axboe: "A few block fixes that should go into this release: - NVMe pull request: - set ana_log_size to 0 after freeing ana_log_buf (Hou Tao) - show subsys nqn for duplicate cntlids (Keith Busch) - disable namespace access for unsupported metadata (Keith Busch) - report write pointer for a full zone as zone start + zone len (Niklas Cassel) - fix use after free when disconnecting a reconnecting ctrl (Ruozhu Li) - fix a list corruption in nvmet-tcp (Sagi Grimberg) - Fix for a regression on DIO single bio async IO (Pavel) - ioprio seteuid fix (Davidlohr) - mtd fix that subsequently got reverted as it was broken, will get re-done and submitted for the next round - Two MD fixes via Song (Markus, zhangyue)" * tag 'block-5.16-2021-12-10' of git://git.kernel.dk/linux-block: Revert "mtd_blkdevs: don't scan partitions for plain mtdblock" block: fix ioprio_get(IOPRIO_WHO_PGRP) vs setuid(2) md: fix double free of mddev->private in autorun_array() md: fix update super 1.0 on rdev size change nvmet-tcp: fix possible list corruption for unexpected command failure block: fix single bio async DIO error handling nvme: fix use after free when disconnecting a reconnecting ctrl nvme-multipath: set ana_log_size to 0 after free ana_log_buf mtd_blkdevs: don't scan partitions for plain mtdblock nvme: report write pointer for a full zone as zone start + zone len nvme: disable namespace access for unsupported metadata nvme: show subsys nqn for duplicate cntlids
2 parents f152165 + 5eff363 commit eccea80

File tree

8 files changed

+40
-12
lines changed

8 files changed

+40
-12
lines changed

block/fops.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -341,8 +341,7 @@ static ssize_t __blkdev_direct_IO_async(struct kiocb *iocb,
341341
} else {
342342
ret = bio_iov_iter_get_pages(bio, iter);
343343
if (unlikely(ret)) {
344-
bio->bi_status = BLK_STS_IOERR;
345-
bio_endio(bio);
344+
bio_put(bio);
346345
return ret;
347346
}
348347
}

block/ioprio.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,7 @@ SYSCALL_DEFINE2(ioprio_get, int, which, int, who)
220220
pgrp = task_pgrp(current);
221221
else
222222
pgrp = find_vpid(who);
223+
read_lock(&tasklist_lock);
223224
do_each_pid_thread(pgrp, PIDTYPE_PGID, p) {
224225
tmpio = get_task_ioprio(p);
225226
if (tmpio < 0)
@@ -229,6 +230,8 @@ SYSCALL_DEFINE2(ioprio_get, int, which, int, who)
229230
else
230231
ret = ioprio_best(ret, tmpio);
231232
} while_each_pid_thread(pgrp, PIDTYPE_PGID, p);
233+
read_unlock(&tasklist_lock);
234+
232235
break;
233236
case IOPRIO_WHO_USER:
234237
uid = make_kuid(current_user_ns(), who);

drivers/md/md.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2189,6 +2189,7 @@ super_1_rdev_size_change(struct md_rdev *rdev, sector_t num_sectors)
21892189

21902190
if (!num_sectors || num_sectors > max_sectors)
21912191
num_sectors = max_sectors;
2192+
rdev->sb_start = sb_start;
21922193
}
21932194
sb = page_address(rdev->sb_page);
21942195
sb->data_size = cpu_to_le64(num_sectors);
@@ -6270,7 +6271,8 @@ static void __md_stop(struct mddev *mddev)
62706271
spin_lock(&mddev->lock);
62716272
mddev->pers = NULL;
62726273
spin_unlock(&mddev->lock);
6273-
pers->free(mddev, mddev->private);
6274+
if (mddev->private)
6275+
pers->free(mddev, mddev->private);
62746276
mddev->private = NULL;
62756277
if (pers->sync_request && mddev->to_remove == NULL)
62766278
mddev->to_remove = &md_redundancy_group;

drivers/nvme/host/core.c

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -666,6 +666,7 @@ blk_status_t nvme_fail_nonready_command(struct nvme_ctrl *ctrl,
666666
struct request *rq)
667667
{
668668
if (ctrl->state != NVME_CTRL_DELETING_NOIO &&
669+
ctrl->state != NVME_CTRL_DELETING &&
669670
ctrl->state != NVME_CTRL_DEAD &&
670671
!test_bit(NVME_CTRL_FAILFAST_EXPIRED, &ctrl->flags) &&
671672
!blk_noretry_request(rq) && !(rq->cmd_flags & REQ_NVME_MPATH))
@@ -1749,9 +1750,20 @@ static int nvme_configure_metadata(struct nvme_ns *ns, struct nvme_id_ns *id)
17491750
*/
17501751
if (WARN_ON_ONCE(!(id->flbas & NVME_NS_FLBAS_META_EXT)))
17511752
return -EINVAL;
1752-
if (ctrl->max_integrity_segments)
1753-
ns->features |=
1754-
(NVME_NS_METADATA_SUPPORTED | NVME_NS_EXT_LBAS);
1753+
1754+
ns->features |= NVME_NS_EXT_LBAS;
1755+
1756+
/*
1757+
* The current fabrics transport drivers support namespace
1758+
* metadata formats only if nvme_ns_has_pi() returns true.
1759+
* Suppress support for all other formats so the namespace will
1760+
* have a 0 capacity and not be usable through the block stack.
1761+
*
1762+
* Note, this check will need to be modified if any drivers
1763+
* gain the ability to use other metadata formats.
1764+
*/
1765+
if (ctrl->max_integrity_segments && nvme_ns_has_pi(ns))
1766+
ns->features |= NVME_NS_METADATA_SUPPORTED;
17551767
} else {
17561768
/*
17571769
* For PCIe controllers, we can't easily remap the separate
@@ -2696,8 +2708,9 @@ static bool nvme_validate_cntlid(struct nvme_subsystem *subsys,
26962708

26972709
if (tmp->cntlid == ctrl->cntlid) {
26982710
dev_err(ctrl->device,
2699-
"Duplicate cntlid %u with %s, rejecting\n",
2700-
ctrl->cntlid, dev_name(tmp->device));
2711+
"Duplicate cntlid %u with %s, subsys %s, rejecting\n",
2712+
ctrl->cntlid, dev_name(tmp->device),
2713+
subsys->subnqn);
27012714
return false;
27022715
}
27032716

drivers/nvme/host/multipath.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -866,7 +866,7 @@ int nvme_mpath_init_identify(struct nvme_ctrl *ctrl, struct nvme_id_ctrl *id)
866866
}
867867
if (ana_log_size > ctrl->ana_log_size) {
868868
nvme_mpath_stop(ctrl);
869-
kfree(ctrl->ana_log_buf);
869+
nvme_mpath_uninit(ctrl);
870870
ctrl->ana_log_buf = kmalloc(ana_log_size, GFP_KERNEL);
871871
if (!ctrl->ana_log_buf)
872872
return -ENOMEM;
@@ -886,4 +886,5 @@ void nvme_mpath_uninit(struct nvme_ctrl *ctrl)
886886
{
887887
kfree(ctrl->ana_log_buf);
888888
ctrl->ana_log_buf = NULL;
889+
ctrl->ana_log_size = 0;
889890
}

drivers/nvme/host/nvme.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -709,7 +709,7 @@ static inline bool nvme_check_ready(struct nvme_ctrl *ctrl, struct request *rq,
709709
return true;
710710
if (ctrl->ops->flags & NVME_F_FABRICS &&
711711
ctrl->state == NVME_CTRL_DELETING)
712-
return true;
712+
return queue_live;
713713
return __nvme_check_ready(ctrl, rq, queue_live);
714714
}
715715
int nvme_submit_sync_cmd(struct request_queue *q, struct nvme_command *cmd,

drivers/nvme/host/zns.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,10 @@ static int nvme_zone_parse_entry(struct nvme_ns *ns,
166166
zone.len = ns->zsze;
167167
zone.capacity = nvme_lba_to_sect(ns, le64_to_cpu(entry->zcap));
168168
zone.start = nvme_lba_to_sect(ns, le64_to_cpu(entry->zslba));
169-
zone.wp = nvme_lba_to_sect(ns, le64_to_cpu(entry->wp));
169+
if (zone.cond == BLK_ZONE_COND_FULL)
170+
zone.wp = zone.start + zone.len;
171+
else
172+
zone.wp = nvme_lba_to_sect(ns, le64_to_cpu(entry->wp));
170173

171174
return cb(&zone, idx, data);
172175
}

drivers/nvme/target/tcp.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -922,7 +922,14 @@ static void nvmet_tcp_handle_req_failure(struct nvmet_tcp_queue *queue,
922922
size_t data_len = le32_to_cpu(req->cmd->common.dptr.sgl.length);
923923
int ret;
924924

925-
if (!nvme_is_write(cmd->req.cmd) ||
925+
/*
926+
* This command has not been processed yet, hence we are trying to
927+
* figure out if there is still pending data left to receive. If
928+
* we don't, we can simply prepare for the next pdu and bail out,
929+
* otherwise we will need to prepare a buffer and receive the
930+
* stale data before continuing forward.
931+
*/
932+
if (!nvme_is_write(cmd->req.cmd) || !data_len ||
926933
data_len > cmd->req.port->inline_data_size) {
927934
nvmet_prepare_receive_pdu(queue);
928935
return;

0 commit comments

Comments
 (0)