Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'block-5.12-2021-03-05' of git://git.kernel.dk/linux-block

Pull block fixes from Jens Axboe:

- NVMe fixes:
- more device quirks (Julian Einwag, Zoltán Böszörményi, Pascal
Terjan)
- fix a hwmon error return (Daniel Wagner)
- fix the keep alive timeout initialization (Martin George)
- ensure the model_number can't be changed on a used subsystem
(Max Gurtovoy)

- rsxx missing -EFAULT on copy_to_user() failure (Dan)

- rsxx remove unused linux.h include (Tian)

- kill unused RQF_SORTED (Jean)

- updated outdated BFQ comments (Joseph)

- revert work-around commit for bd_size_lock, since we removed the
offending user in this merge window (Damien)

* tag 'block-5.12-2021-03-05' of git://git.kernel.dk/linux-block:
nvmet: model_number must be immutable once set
nvme-fabrics: fix kato initialization
nvme-hwmon: Return error code when registration fails
nvme-pci: add quirks for Lexar 256GB SSD
nvme-pci: mark Kingston SKC2000 as not supporting the deepest power state
nvme-pci: mark Seagate Nytro XM1440 as QUIRK_NO_NS_DESC_LIST.
rsxx: Return -EFAULT if copy_to_user() fails
block/bfq: update comments and default value in docs for fifo_expire
rsxx: remove unused including <linux/version.h>
block: Drop leftover references to RQF_SORTED
block: revert "block: fix bd_size_lock use"

+75 -69
+2 -2
Documentation/block/bfq-iosched.rst
··· 430 430 ----------------- 431 431 432 432 This parameter is used to set the timeout of asynchronous requests. Default 433 - value of this is 248ms. 433 + value of this is 250ms. 434 434 435 435 fifo_expire_sync 436 436 ---------------- 437 437 438 438 This parameter is used to set the timeout of synchronous requests. Default 439 - value of this is 124ms. In case to favor synchronous requests over asynchronous 439 + value of this is 125ms. In case to favor synchronous requests over asynchronous 440 440 one, this value should be decreased relative to fifo_expire_async. 441 441 442 442 low_latency
+1 -1
block/bfq-iosched.c
··· 162 162 BFQ_BFQQ_FNS(softrt_update); 163 163 #undef BFQ_BFQQ_FNS \ 164 164 165 - /* Expiration time of sync (0) and async (1) requests, in ns. */ 165 + /* Expiration time of async (0) and sync (1) requests, in ns. */ 166 166 static const u64 bfq_fifo_expire[2] = { NSEC_PER_SEC / 4, NSEC_PER_SEC / 8 }; 167 167 168 168 /* Maximum backwards seek (magic number lifted from CFQ), in KiB. */
-1
block/blk-mq-debugfs.c
··· 292 292 293 293 #define RQF_NAME(name) [ilog2((__force u32)RQF_##name)] = #name 294 294 static const char *const rqf_name[] = { 295 - RQF_NAME(SORTED), 296 295 RQF_NAME(STARTED), 297 296 RQF_NAME(SOFTBARRIER), 298 297 RQF_NAME(FLUSH_SEQ),
+1 -5
block/blk-mq-sched.c
··· 385 385 EXPORT_SYMBOL_GPL(blk_mq_sched_try_insert_merge); 386 386 387 387 static bool blk_mq_sched_bypass_insert(struct blk_mq_hw_ctx *hctx, 388 - bool has_sched, 389 388 struct request *rq) 390 389 { 391 390 /* ··· 401 402 if ((rq->rq_flags & RQF_FLUSH_SEQ) || blk_rq_is_passthrough(rq)) 402 403 return true; 403 404 404 - if (has_sched) 405 - rq->rq_flags |= RQF_SORTED; 406 - 407 405 return false; 408 406 } 409 407 ··· 414 418 415 419 WARN_ON(e && (rq->tag != BLK_MQ_NO_TAG)); 416 420 417 - if (blk_mq_sched_bypass_insert(hctx, !!e, rq)) { 421 + if (blk_mq_sched_bypass_insert(hctx, rq)) { 418 422 /* 419 423 * Firstly normal IO request is inserted to scheduler queue or 420 424 * sw queue, meantime we add flush request to dispatch queue(
+2 -3
block/genhd.c
··· 45 45 void set_capacity(struct gendisk *disk, sector_t sectors) 46 46 { 47 47 struct block_device *bdev = disk->part0; 48 - unsigned long flags; 49 48 50 - spin_lock_irqsave(&bdev->bd_size_lock, flags); 49 + spin_lock(&bdev->bd_size_lock); 51 50 i_size_write(bdev->bd_inode, (loff_t)sectors << SECTOR_SHIFT); 52 - spin_unlock_irqrestore(&bdev->bd_size_lock, flags); 51 + spin_unlock(&bdev->bd_size_lock); 53 52 } 54 53 EXPORT_SYMBOL(set_capacity); 55 54
+2 -4
block/partitions/core.c
··· 88 88 89 89 static void bdev_set_nr_sectors(struct block_device *bdev, sector_t sectors) 90 90 { 91 - unsigned long flags; 92 - 93 - spin_lock_irqsave(&bdev->bd_size_lock, flags); 91 + spin_lock(&bdev->bd_size_lock); 94 92 i_size_write(bdev->bd_inode, (loff_t)sectors << SECTOR_SHIFT); 95 - spin_unlock_irqrestore(&bdev->bd_size_lock, flags); 93 + spin_unlock(&bdev->bd_size_lock); 96 94 } 97 95 98 96 static struct parsed_partitions *allocate_partitions(struct gendisk *hd)
+5 -3
drivers/block/rsxx/core.c
··· 165 165 { 166 166 struct rsxx_cardinfo *card = file_inode(fp)->i_private; 167 167 char *buf; 168 - ssize_t st; 168 + int st; 169 169 170 170 buf = kzalloc(cnt, GFP_KERNEL); 171 171 if (!buf) 172 172 return -ENOMEM; 173 173 174 174 st = rsxx_creg_read(card, CREG_ADD_CRAM + (u32)*ppos, cnt, buf, 1); 175 - if (!st) 176 - st = copy_to_user(ubuf, buf, cnt); 175 + if (!st) { 176 + if (copy_to_user(ubuf, buf, cnt)) 177 + st = -EFAULT; 178 + } 177 179 kfree(buf); 178 180 if (st) 179 181 return st;
-1
drivers/block/rsxx/rsxx_priv.h
··· 11 11 #ifndef __RSXX_PRIV_H__ 12 12 #define __RSXX_PRIV_H__ 13 13 14 - #include <linux/version.h> 15 14 #include <linux/semaphore.h> 16 15 17 16 #include <linux/fs.h>
+4 -1
drivers/nvme/host/fabrics.c
··· 630 630 opts->queue_size = NVMF_DEF_QUEUE_SIZE; 631 631 opts->nr_io_queues = num_online_cpus(); 632 632 opts->reconnect_delay = NVMF_DEF_RECONNECT_DELAY; 633 - opts->kato = NVME_DEFAULT_KATO; 633 + opts->kato = 0; 634 634 opts->duplicate_connect = false; 635 635 opts->fast_io_fail_tmo = NVMF_DEF_FAIL_FAST_TMO; 636 636 opts->hdr_digest = false; ··· 893 893 opts->nr_write_queues = 0; 894 894 opts->nr_poll_queues = 0; 895 895 opts->duplicate_connect = true; 896 + } else { 897 + if (!opts->kato) 898 + opts->kato = NVME_DEFAULT_KATO; 896 899 } 897 900 if (ctrl_loss_tmo < 0) { 898 901 opts->max_reconnects = -1;
+1
drivers/nvme/host/hwmon.c
··· 248 248 if (IS_ERR(hwmon)) { 249 249 dev_warn(dev, "Failed to instantiate hwmon device\n"); 250 250 kfree(data); 251 + return PTR_ERR(hwmon); 251 252 } 252 253 ctrl->hwmon_device = hwmon; 253 254 return 0;
+7 -1
drivers/nvme/host/pci.c
··· 3234 3234 { PCI_DEVICE(0x126f, 0x2263), /* Silicon Motion unidentified */ 3235 3235 .driver_data = NVME_QUIRK_NO_NS_DESC_LIST, }, 3236 3236 { PCI_DEVICE(0x1bb1, 0x0100), /* Seagate Nytro Flash Storage */ 3237 - .driver_data = NVME_QUIRK_DELAY_BEFORE_CHK_RDY, }, 3237 + .driver_data = NVME_QUIRK_DELAY_BEFORE_CHK_RDY | 3238 + NVME_QUIRK_NO_NS_DESC_LIST, }, 3238 3239 { PCI_DEVICE(0x1c58, 0x0003), /* HGST adapter */ 3239 3240 .driver_data = NVME_QUIRK_DELAY_BEFORE_CHK_RDY, }, 3240 3241 { PCI_DEVICE(0x1c58, 0x0023), /* WDC SN200 adapter */ ··· 3249 3248 NVME_QUIRK_IGNORE_DEV_SUBNQN, }, 3250 3249 { PCI_DEVICE(0x1987, 0x5016), /* Phison E16 */ 3251 3250 .driver_data = NVME_QUIRK_IGNORE_DEV_SUBNQN, }, 3251 + { PCI_DEVICE(0x1b4b, 0x1092), /* Lexar 256 GB SSD */ 3252 + .driver_data = NVME_QUIRK_NO_NS_DESC_LIST | 3253 + NVME_QUIRK_IGNORE_DEV_SUBNQN, }, 3252 3254 { PCI_DEVICE(0x1d1d, 0x1f1f), /* LighNVM qemu device */ 3253 3255 .driver_data = NVME_QUIRK_LIGHTNVM, }, 3254 3256 { PCI_DEVICE(0x1d1d, 0x2807), /* CNEX WL */ ··· 3269 3265 .driver_data = NVME_QUIRK_DISABLE_WRITE_ZEROES, }, 3270 3266 { PCI_DEVICE(0x1d97, 0x2263), /* SPCC */ 3271 3267 .driver_data = NVME_QUIRK_DISABLE_WRITE_ZEROES, }, 3268 + { PCI_DEVICE(0x2646, 0x2262), /* KINGSTON SKC2000 NVMe SSD */ 3269 + .driver_data = NVME_QUIRK_NO_DEEPEST_PS, }, 3272 3270 { PCI_DEVICE(0x2646, 0x2263), /* KINGSTON A2000 NVMe SSD */ 3273 3271 .driver_data = NVME_QUIRK_NO_DEEPEST_PS, }, 3274 3272 { PCI_DEVICE(PCI_VENDOR_ID_AMAZON, 0x0061),
+25 -11
drivers/nvme/target/admin-cmd.c
··· 313 313 nvmet_req_complete(req, NVME_SC_INVALID_FIELD | NVME_SC_DNR); 314 314 } 315 315 316 - static void nvmet_id_set_model_number(struct nvme_id_ctrl *id, 317 - struct nvmet_subsys *subsys) 316 + static u16 nvmet_set_model_number(struct nvmet_subsys *subsys) 318 317 { 319 - const char *model = NVMET_DEFAULT_CTRL_MODEL; 320 - struct nvmet_subsys_model *subsys_model; 318 + u16 status = 0; 321 319 322 - rcu_read_lock(); 323 - subsys_model = rcu_dereference(subsys->model); 324 - if (subsys_model) 325 - model = subsys_model->number; 326 - memcpy_and_pad(id->mn, sizeof(id->mn), model, strlen(model), ' '); 327 - rcu_read_unlock(); 320 + mutex_lock(&subsys->lock); 321 + if (!subsys->model_number) { 322 + subsys->model_number = 323 + kstrdup(NVMET_DEFAULT_CTRL_MODEL, GFP_KERNEL); 324 + if (!subsys->model_number) 325 + status = NVME_SC_INTERNAL; 326 + } 327 + mutex_unlock(&subsys->lock); 328 + 329 + return status; 328 330 } 329 331 330 332 static void nvmet_execute_identify_ctrl(struct nvmet_req *req) 331 333 { 332 334 struct nvmet_ctrl *ctrl = req->sq->ctrl; 335 + struct nvmet_subsys *subsys = ctrl->subsys; 333 336 struct nvme_id_ctrl *id; 334 337 u32 cmd_capsule_size; 335 338 u16 status = 0; 339 + 340 + /* 341 + * If there is no model number yet, set it now. It will then remain 342 + * stable for the life time of the subsystem. 343 + */ 344 + if (!subsys->model_number) { 345 + status = nvmet_set_model_number(subsys); 346 + if (status) 347 + goto out; 348 + } 336 349 337 350 id = kzalloc(sizeof(*id), GFP_KERNEL); 338 351 if (!id) { ··· 360 347 memset(id->sn, ' ', sizeof(id->sn)); 361 348 bin2hex(id->sn, &ctrl->subsys->serial, 362 349 min(sizeof(ctrl->subsys->serial), sizeof(id->sn) / 2)); 363 - nvmet_id_set_model_number(id, ctrl->subsys); 350 + memcpy_and_pad(id->mn, sizeof(id->mn), subsys->model_number, 351 + strlen(subsys->model_number), ' '); 364 352 memcpy_and_pad(id->fr, sizeof(id->fr), 365 353 UTS_RELEASE, strlen(UTS_RELEASE), ' '); 366 354
+23 -27
drivers/nvme/target/configfs.c
··· 1118 1118 char *page) 1119 1119 { 1120 1120 struct nvmet_subsys *subsys = to_subsys(item); 1121 - struct nvmet_subsys_model *subsys_model; 1122 - char *model = NVMET_DEFAULT_CTRL_MODEL; 1123 1121 int ret; 1124 1122 1125 - rcu_read_lock(); 1126 - subsys_model = rcu_dereference(subsys->model); 1127 - if (subsys_model) 1128 - model = subsys_model->number; 1129 - ret = snprintf(page, PAGE_SIZE, "%s\n", model); 1130 - rcu_read_unlock(); 1123 + mutex_lock(&subsys->lock); 1124 + ret = snprintf(page, PAGE_SIZE, "%s\n", subsys->model_number ? 1125 + subsys->model_number : NVMET_DEFAULT_CTRL_MODEL); 1126 + mutex_unlock(&subsys->lock); 1131 1127 1132 1128 return ret; 1133 1129 } ··· 1134 1138 return c >= 0x20 && c <= 0x7e; 1135 1139 } 1136 1140 1137 - static ssize_t nvmet_subsys_attr_model_store(struct config_item *item, 1138 - const char *page, size_t count) 1141 + static ssize_t nvmet_subsys_attr_model_store_locked(struct nvmet_subsys *subsys, 1142 + const char *page, size_t count) 1139 1143 { 1140 - struct nvmet_subsys *subsys = to_subsys(item); 1141 - struct nvmet_subsys_model *new_model; 1142 - char *new_model_number; 1143 1144 int pos = 0, len; 1145 + 1146 + if (subsys->model_number) { 1147 + pr_err("Can't set model number. %s is already assigned\n", 1148 + subsys->model_number); 1149 + return -EINVAL; 1150 + } 1144 1151 1145 1152 len = strcspn(page, "\n"); 1146 1153 if (!len) ··· 1154 1155 return -EINVAL; 1155 1156 } 1156 1157 1157 - new_model_number = kmemdup_nul(page, len, GFP_KERNEL); 1158 - if (!new_model_number) 1158 + subsys->model_number = kmemdup_nul(page, len, GFP_KERNEL); 1159 + if (!subsys->model_number) 1159 1160 return -ENOMEM; 1161 + return count; 1162 + } 1160 1163 1161 - new_model = kzalloc(sizeof(*new_model) + len + 1, GFP_KERNEL); 1162 - if (!new_model) { 1163 - kfree(new_model_number); 1164 - return -ENOMEM; 1165 - } 1166 - memcpy(new_model->number, new_model_number, len); 1164 + static ssize_t nvmet_subsys_attr_model_store(struct config_item *item, 1165 + const char *page, size_t count) 1166 + { 1167 + struct nvmet_subsys *subsys = to_subsys(item); 1168 + ssize_t ret; 1167 1169 1168 1170 down_write(&nvmet_config_sem); 1169 1171 mutex_lock(&subsys->lock); 1170 - new_model = rcu_replace_pointer(subsys->model, new_model, 1171 - mutex_is_locked(&subsys->lock)); 1172 + ret = nvmet_subsys_attr_model_store_locked(subsys, page, count); 1172 1173 mutex_unlock(&subsys->lock); 1173 1174 up_write(&nvmet_config_sem); 1174 1175 1175 - kfree_rcu(new_model, rcuhead); 1176 - kfree(new_model_number); 1177 - 1178 - return count; 1176 + return ret; 1179 1177 } 1180 1178 CONFIGFS_ATTR(nvmet_subsys_, attr_model); 1181 1179
+1 -1
drivers/nvme/target/core.c
··· 1532 1532 nvmet_passthru_subsys_free(subsys); 1533 1533 1534 1534 kfree(subsys->subsysnqn); 1535 - kfree_rcu(subsys->model, rcuhead); 1535 + kfree(subsys->model_number); 1536 1536 kfree(subsys); 1537 1537 } 1538 1538
+1 -6
drivers/nvme/target/nvmet.h
··· 208 208 bool pi_support; 209 209 }; 210 210 211 - struct nvmet_subsys_model { 212 - struct rcu_head rcuhead; 213 - char number[]; 214 - }; 215 - 216 211 struct nvmet_subsys { 217 212 enum nvme_subsys_type type; 218 213 ··· 237 242 struct config_group namespaces_group; 238 243 struct config_group allowed_hosts_group; 239 244 240 - struct nvmet_subsys_model __rcu *model; 245 + char *model_number; 241 246 242 247 #ifdef CONFIG_NVME_TARGET_PASSTHRU 243 248 struct nvme_ctrl *passthru_ctrl;
-2
include/linux/blkdev.h
··· 65 65 * request flags */ 66 66 typedef __u32 __bitwise req_flags_t; 67 67 68 - /* elevator knows about this request */ 69 - #define RQF_SORTED ((__force req_flags_t)(1 << 0)) 70 68 /* drive already may have started this one */ 71 69 #define RQF_STARTED ((__force req_flags_t)(1 << 1)) 72 70 /* may not be passed by ioscheduler */