Skip to content

Commit 98be58a

Browse files
committed
Merge tag 'block-6.4-2023-05-20' of git://git.kernel.dk/linux
Pull block fixes from Jens Axboe: - NVMe pull request via Keith: - More device quirks (Sagi, Hristo, Adrian, Daniel) - Controller delete race (Maurizo) - Multipath cleanup fix (Christoph) - Deny writeable mmap mapping on a readonly block device (Loic) - Kill unused define that got introduced by accident (Christoph) - Error handling fix for s390 dasd (Stefan) - ublk locking fix (Ming) * tag 'block-6.4-2023-05-20' of git://git.kernel.dk/linux: block: remove NFL4_UFLG_MASK block: Deny writable memory mapping if block is read-only s390/dasd: fix command reject error on ESE devices nvme-pci: Add quirk for Teamgroup MP33 SSD ublk: fix AB-BA lockdep warning nvme: do not let the user delete a ctrl before a complete initialization nvme-multipath: don't call blk_mark_disk_dead in nvme_mpath_remove_disk nvme-pci: clamp max_hw_sectors based on DMA optimized limitation nvme-pci: add quirk for missing secondary temperature thresholds nvme-pci: add NVME_QUIRK_BOGUS_NID for HS-SSD-FUTURE 2048G
2 parents d635f6c + e3afec9 commit 98be58a

File tree

9 files changed

+69
-11
lines changed

9 files changed

+69
-11
lines changed

block/fops.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -678,14 +678,24 @@ static long blkdev_fallocate(struct file *file, int mode, loff_t start,
678678
return error;
679679
}
680680

681+
static int blkdev_mmap(struct file *file, struct vm_area_struct *vma)
682+
{
683+
struct inode *bd_inode = bdev_file_inode(file);
684+
685+
if (bdev_read_only(I_BDEV(bd_inode)))
686+
return generic_file_readonly_mmap(file, vma);
687+
688+
return generic_file_mmap(file, vma);
689+
}
690+
681691
const struct file_operations def_blk_fops = {
682692
.open = blkdev_open,
683693
.release = blkdev_close,
684694
.llseek = blkdev_llseek,
685695
.read_iter = blkdev_read_iter,
686696
.write_iter = blkdev_write_iter,
687697
.iopoll = iocb_bio_iopoll,
688-
.mmap = generic_file_mmap,
698+
.mmap = blkdev_mmap,
689699
.fsync = blkdev_fsync,
690700
.unlocked_ioctl = blkdev_ioctl,
691701
#ifdef CONFIG_COMPAT

drivers/block/ublk_drv.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1120,6 +1120,11 @@ static inline bool ublk_queue_ready(struct ublk_queue *ubq)
11201120
return ubq->nr_io_ready == ubq->q_depth;
11211121
}
11221122

1123+
static void ublk_cmd_cancel_cb(struct io_uring_cmd *cmd, unsigned issue_flags)
1124+
{
1125+
io_uring_cmd_done(cmd, UBLK_IO_RES_ABORT, 0, issue_flags);
1126+
}
1127+
11231128
static void ublk_cancel_queue(struct ublk_queue *ubq)
11241129
{
11251130
int i;
@@ -1131,8 +1136,8 @@ static void ublk_cancel_queue(struct ublk_queue *ubq)
11311136
struct ublk_io *io = &ubq->ios[i];
11321137

11331138
if (io->flags & UBLK_IO_FLAG_ACTIVE)
1134-
io_uring_cmd_done(io->cmd, UBLK_IO_RES_ABORT, 0,
1135-
IO_URING_F_UNLOCKED);
1139+
io_uring_cmd_complete_in_task(io->cmd,
1140+
ublk_cmd_cancel_cb);
11361141
}
11371142

11381143
/* all io commands are canceled */

drivers/nvme/host/core.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3585,6 +3585,9 @@ static ssize_t nvme_sysfs_delete(struct device *dev,
35853585
{
35863586
struct nvme_ctrl *ctrl = dev_get_drvdata(dev);
35873587

3588+
if (!test_bit(NVME_CTRL_STARTED_ONCE, &ctrl->flags))
3589+
return -EBUSY;
3590+
35883591
if (device_remove_file_self(dev, attr))
35893592
nvme_delete_ctrl_sync(ctrl);
35903593
return count;
@@ -5045,7 +5048,7 @@ void nvme_start_ctrl(struct nvme_ctrl *ctrl)
50455048
* that were missed. We identify persistent discovery controllers by
50465049
* checking that they started once before, hence are reconnecting back.
50475050
*/
5048-
if (test_and_set_bit(NVME_CTRL_STARTED_ONCE, &ctrl->flags) &&
5051+
if (test_bit(NVME_CTRL_STARTED_ONCE, &ctrl->flags) &&
50495052
nvme_discovery_ctrl(ctrl))
50505053
nvme_change_uevent(ctrl, "NVME_EVENT=rediscover");
50515054

@@ -5056,6 +5059,7 @@ void nvme_start_ctrl(struct nvme_ctrl *ctrl)
50565059
}
50575060

50585061
nvme_change_uevent(ctrl, "NVME_EVENT=connected");
5062+
set_bit(NVME_CTRL_STARTED_ONCE, &ctrl->flags);
50595063
}
50605064
EXPORT_SYMBOL_GPL(nvme_start_ctrl);
50615065

drivers/nvme/host/hwmon.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,9 @@ static umode_t nvme_hwmon_is_visible(const void *_data,
163163
case hwmon_temp_max:
164164
case hwmon_temp_min:
165165
if ((!channel && data->ctrl->wctemp) ||
166-
(channel && data->log->temp_sensor[channel - 1])) {
166+
(channel && data->log->temp_sensor[channel - 1] &&
167+
!(data->ctrl->quirks &
168+
NVME_QUIRK_NO_SECONDARY_TEMP_THRESH))) {
167169
if (data->ctrl->quirks &
168170
NVME_QUIRK_NO_TEMP_THRESH_CHANGE)
169171
return 0444;

drivers/nvme/host/multipath.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -884,7 +884,6 @@ void nvme_mpath_remove_disk(struct nvme_ns_head *head)
884884
{
885885
if (!head->disk)
886886
return;
887-
blk_mark_disk_dead(head->disk);
888887
/* make sure all pending bios are cleaned up */
889888
kblockd_schedule_work(&head->requeue_work);
890889
flush_work(&head->requeue_work);

drivers/nvme/host/nvme.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,11 @@ enum nvme_quirks {
149149
* Reports garbage in the namespace identifiers (eui64, nguid, uuid).
150150
*/
151151
NVME_QUIRK_BOGUS_NID = (1 << 18),
152+
153+
/*
154+
* No temperature thresholds for channels other than 0 (Composite).
155+
*/
156+
NVME_QUIRK_NO_SECONDARY_TEMP_THRESH = (1 << 19),
152157
};
153158

154159
/*

drivers/nvme/host/pci.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2956,7 +2956,7 @@ static struct nvme_dev *nvme_pci_alloc_dev(struct pci_dev *pdev,
29562956
* over a single page.
29572957
*/
29582958
dev->ctrl.max_hw_sectors = min_t(u32,
2959-
NVME_MAX_KB_SZ << 1, dma_max_mapping_size(&pdev->dev) >> 9);
2959+
NVME_MAX_KB_SZ << 1, dma_opt_mapping_size(&pdev->dev) >> 9);
29602960
dev->ctrl.max_segments = NVME_MAX_SEGS;
29612961

29622962
/*
@@ -3402,6 +3402,8 @@ static const struct pci_device_id nvme_id_table[] = {
34023402
.driver_data = NVME_QUIRK_NO_DEEPEST_PS, },
34033403
{ PCI_DEVICE(0x2646, 0x2263), /* KINGSTON A2000 NVMe SSD */
34043404
.driver_data = NVME_QUIRK_NO_DEEPEST_PS, },
3405+
{ PCI_DEVICE(0x2646, 0x5013), /* Kingston KC3000, Kingston FURY Renegade */
3406+
.driver_data = NVME_QUIRK_NO_SECONDARY_TEMP_THRESH, },
34053407
{ PCI_DEVICE(0x2646, 0x5018), /* KINGSTON OM8SFP4xxxxP OS21012 NVMe SSD */
34063408
.driver_data = NVME_QUIRK_DISABLE_WRITE_ZEROES, },
34073409
{ PCI_DEVICE(0x2646, 0x5016), /* KINGSTON OM3PGP4xxxxP OS21011 NVMe SSD */
@@ -3441,6 +3443,10 @@ static const struct pci_device_id nvme_id_table[] = {
34413443
NVME_QUIRK_IGNORE_DEV_SUBNQN, },
34423444
{ PCI_DEVICE(0x10ec, 0x5763), /* TEAMGROUP T-FORCE CARDEA ZERO Z330 SSD */
34433445
.driver_data = NVME_QUIRK_BOGUS_NID, },
3446+
{ PCI_DEVICE(0x1e4b, 0x1602), /* HS-SSD-FUTURE 2048G */
3447+
.driver_data = NVME_QUIRK_BOGUS_NID, },
3448+
{ PCI_DEVICE(0x10ec, 0x5765), /* TEAMGROUP MP33 2TB SSD */
3449+
.driver_data = NVME_QUIRK_BOGUS_NID, },
34443450
{ PCI_DEVICE(PCI_VENDOR_ID_AMAZON, 0x0061),
34453451
.driver_data = NVME_QUIRK_DMA_ADDRESS_BITS_48, },
34463452
{ PCI_DEVICE(PCI_VENDOR_ID_AMAZON, 0x0065),

drivers/s390/block/dasd_eckd.c

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,8 @@ static int prepare_itcw(struct itcw *, unsigned int, unsigned int, int,
127127
struct dasd_device *, struct dasd_device *,
128128
unsigned int, int, unsigned int, unsigned int,
129129
unsigned int, unsigned int);
130+
static int dasd_eckd_query_pprc_status(struct dasd_device *,
131+
struct dasd_pprc_data_sc4 *);
130132

131133
/* initial attempt at a probe function. this can be simplified once
132134
* the other detection code is gone */
@@ -3733,6 +3735,26 @@ static int count_exts(unsigned int from, unsigned int to, int trks_per_ext)
37333735
return count;
37343736
}
37353737

3738+
static int dasd_in_copy_relation(struct dasd_device *device)
3739+
{
3740+
struct dasd_pprc_data_sc4 *temp;
3741+
int rc;
3742+
3743+
if (!dasd_eckd_pprc_enabled(device))
3744+
return 0;
3745+
3746+
temp = kzalloc(sizeof(*temp), GFP_KERNEL);
3747+
if (!temp)
3748+
return -ENOMEM;
3749+
3750+
rc = dasd_eckd_query_pprc_status(device, temp);
3751+
if (!rc)
3752+
rc = temp->dev_info[0].state;
3753+
3754+
kfree(temp);
3755+
return rc;
3756+
}
3757+
37363758
/*
37373759
* Release allocated space for a given range or an entire volume.
37383760
*/
@@ -3749,6 +3771,7 @@ dasd_eckd_dso_ras(struct dasd_device *device, struct dasd_block *block,
37493771
int cur_to_trk, cur_from_trk;
37503772
struct dasd_ccw_req *cqr;
37513773
u32 beg_cyl, end_cyl;
3774+
int copy_relation;
37523775
struct ccw1 *ccw;
37533776
int trks_per_ext;
37543777
size_t ras_size;
@@ -3760,6 +3783,10 @@ dasd_eckd_dso_ras(struct dasd_device *device, struct dasd_block *block,
37603783
if (dasd_eckd_ras_sanity_checks(device, first_trk, last_trk))
37613784
return ERR_PTR(-EINVAL);
37623785

3786+
copy_relation = dasd_in_copy_relation(device);
3787+
if (copy_relation < 0)
3788+
return ERR_PTR(copy_relation);
3789+
37633790
rq = req ? blk_mq_rq_to_pdu(req) : NULL;
37643791

37653792
features = &private->features;
@@ -3788,9 +3815,11 @@ dasd_eckd_dso_ras(struct dasd_device *device, struct dasd_block *block,
37883815
/*
37893816
* This bit guarantees initialisation of tracks within an extent that is
37903817
* not fully specified, but is only supported with a certain feature
3791-
* subset.
3818+
* subset and for devices not in a copy relation.
37923819
*/
3793-
ras_data->op_flags.guarantee_init = !!(features->feature[56] & 0x01);
3820+
if (features->feature[56] & 0x01 && !copy_relation)
3821+
ras_data->op_flags.guarantee_init = 1;
3822+
37943823
ras_data->lss = private->conf.ned->ID;
37953824
ras_data->dev_addr = private->conf.ned->unit_addr;
37963825
ras_data->nr_exts = nr_exts;

include/linux/blkdev.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1376,8 +1376,6 @@ enum blk_unique_id {
13761376
BLK_UID_NAA = 3,
13771377
};
13781378

1379-
#define NFL4_UFLG_MASK 0x0000003F
1380-
13811379
struct block_device_operations {
13821380
void (*submit_bio)(struct bio *bio);
13831381
int (*poll_bio)(struct bio *bio, struct io_comp_batch *iob,

0 commit comments

Comments
 (0)