Skip to content

Commit ed41fd0

Browse files
committed
Merge tag 'block-5.11-2021-01-10' of git://git.kernel.dk/linux-block
Pull block fixes from Jens Axboe: - Missing CRC32 selections (Arnd) - Fix for a merge window regression with bdev inode init (Christoph) - bcache fixes - rnbd fixes - NVMe pull request from Christoph: - fix a race in the nvme-tcp send code (Sagi Grimberg) - fix a list corruption in an nvme-rdma error path (Israel Rukshin) - avoid a possible double fetch in nvme-pci (Lalithambika Krishnakumar) - add the susystem NQN quirk for a Samsung driver (Gopal Tiwari) - fix two compiler warnings in nvme-fcloop (James Smart) - don't call sleeping functions from irq context in nvme-fc (James Smart) - remove an unused argument (Max Gurtovoy) - remove unused exports (Minwoo Im) - Use-after-free fix for partition iteration (Ming) - Missing blk-mq debugfs flag annotation (John) - Bdev freeze regression fix (Satya) - blk-iocost NULL pointer deref fix (Tejun) * tag 'block-5.11-2021-01-10' of git://git.kernel.dk/linux-block: (26 commits) bcache: set bcache device into read-only mode for BCH_FEATURE_INCOMPAT_OBSO_LARGE_BUCKET bcache: introduce BCH_FEATURE_INCOMPAT_LOG_LARGE_BUCKET_SIZE for large bucket bcache: check unsupported feature sets for bcache register bcache: fix typo from SUUP to SUPP in features.h bcache: set pdev_set_uuid before scond loop iteration blk-mq-debugfs: Add decode for BLK_MQ_F_TAG_HCTX_SHARED block/rnbd-clt: avoid module unload race with close confirmation block/rnbd: Adding name to the Contributors List block/rnbd-clt: Fix sg table use after free block/rnbd-srv: Fix use after free in rnbd_srv_sess_dev_force_close block/rnbd: Select SG_POOL for RNBD_CLIENT block: pre-initialize struct block_device in bdev_alloc_inode fs: Fix freeze_bdev()/thaw_bdev() accounting of bd_fsfreeze_sb nvme: remove the unused status argument from nvme_trace_bio_complete nvmet-rdma: Fix list_del corruption on queue establishment failure nvme: unexport functions with no external caller nvme: avoid possible double fetch in handling CQE nvme-tcp: Fix possible race of io_work and direct send nvme-pci: mark Samsung PM1725a as IGNORE_DEV_SUBNQN nvme-fcloop: Fix sscanf type and list_first_entry_or_null warnings ...
2 parents d430adf + 5342fd4 commit ed41fd0

File tree

22 files changed

+172
-59
lines changed

22 files changed

+172
-59
lines changed

block/bfq-iosched.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6332,13 +6332,13 @@ static unsigned int bfq_update_depths(struct bfq_data *bfqd,
63326332
* limit 'something'.
63336333
*/
63346334
/* no more than 50% of tags for async I/O */
6335-
bfqd->word_depths[0][0] = max((1U << bt->sb.shift) >> 1, 1U);
6335+
bfqd->word_depths[0][0] = max(bt->sb.depth >> 1, 1U);
63366336
/*
63376337
* no more than 75% of tags for sync writes (25% extra tags
63386338
* w.r.t. async I/O, to prevent async I/O from starving sync
63396339
* writes)
63406340
*/
6341-
bfqd->word_depths[0][1] = max(((1U << bt->sb.shift) * 3) >> 2, 1U);
6341+
bfqd->word_depths[0][1] = max((bt->sb.depth * 3) >> 2, 1U);
63426342

63436343
/*
63446344
* In-word depths in case some bfq_queue is being weight-
@@ -6348,9 +6348,9 @@ static unsigned int bfq_update_depths(struct bfq_data *bfqd,
63486348
* shortage.
63496349
*/
63506350
/* no more than ~18% of tags for async I/O */
6351-
bfqd->word_depths[1][0] = max(((1U << bt->sb.shift) * 3) >> 4, 1U);
6351+
bfqd->word_depths[1][0] = max((bt->sb.depth * 3) >> 4, 1U);
63526352
/* no more than ~37% of tags for sync writes (~20% extra tags) */
6353-
bfqd->word_depths[1][1] = max(((1U << bt->sb.shift) * 6) >> 4, 1U);
6353+
bfqd->word_depths[1][1] = max((bt->sb.depth * 6) >> 4, 1U);
63546354

63556355
for (i = 0; i < 2; i++)
63566356
for (j = 0; j < 2; j++)

block/blk-iocost.c

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2551,8 +2551,8 @@ static void ioc_rqos_throttle(struct rq_qos *rqos, struct bio *bio)
25512551
bool use_debt, ioc_locked;
25522552
unsigned long flags;
25532553

2554-
/* bypass IOs if disabled or for root cgroup */
2555-
if (!ioc->enabled || !iocg->level)
2554+
/* bypass IOs if disabled, still initializing, or for root cgroup */
2555+
if (!ioc->enabled || !iocg || !iocg->level)
25562556
return;
25572557

25582558
/* calculate the absolute vtime cost */
@@ -2679,14 +2679,14 @@ static void ioc_rqos_merge(struct rq_qos *rqos, struct request *rq,
26792679
struct bio *bio)
26802680
{
26812681
struct ioc_gq *iocg = blkg_to_iocg(bio->bi_blkg);
2682-
struct ioc *ioc = iocg->ioc;
2682+
struct ioc *ioc = rqos_to_ioc(rqos);
26832683
sector_t bio_end = bio_end_sector(bio);
26842684
struct ioc_now now;
26852685
u64 vtime, abs_cost, cost;
26862686
unsigned long flags;
26872687

2688-
/* bypass if disabled or for root cgroup */
2689-
if (!ioc->enabled || !iocg->level)
2688+
/* bypass if disabled, still initializing, or for root cgroup */
2689+
if (!ioc->enabled || !iocg || !iocg->level)
26902690
return;
26912691

26922692
abs_cost = calc_vtime_cost(bio, iocg, true);
@@ -2863,6 +2863,12 @@ static int blk_iocost_init(struct request_queue *q)
28632863
ioc_refresh_params(ioc, true);
28642864
spin_unlock_irq(&ioc->lock);
28652865

2866+
/*
2867+
* rqos must be added before activation to allow iocg_pd_init() to
2868+
* lookup the ioc from q. This means that the rqos methods may get
2869+
* called before policy activation completion, can't assume that the
2870+
* target bio has an iocg associated and need to test for NULL iocg.
2871+
*/
28662872
rq_qos_add(q, rqos);
28672873
ret = blkcg_activate_policy(q, &blkcg_policy_iocost);
28682874
if (ret) {

block/blk-mq-debugfs.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,7 @@ static const char *const hctx_flag_name[] = {
246246
HCTX_FLAG_NAME(BLOCKING),
247247
HCTX_FLAG_NAME(NO_SCHED),
248248
HCTX_FLAG_NAME(STACKING),
249+
HCTX_FLAG_NAME(TAG_HCTX_SHARED),
249250
};
250251
#undef HCTX_FLAG_NAME
251252

block/genhd.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -246,15 +246,18 @@ struct block_device *disk_part_iter_next(struct disk_part_iter *piter)
246246
part = rcu_dereference(ptbl->part[piter->idx]);
247247
if (!part)
248248
continue;
249+
piter->part = bdgrab(part);
250+
if (!piter->part)
251+
continue;
249252
if (!bdev_nr_sectors(part) &&
250253
!(piter->flags & DISK_PITER_INCL_EMPTY) &&
251254
!(piter->flags & DISK_PITER_INCL_EMPTY_PART0 &&
252-
piter->idx == 0))
255+
piter->idx == 0)) {
256+
bdput(piter->part);
257+
piter->part = NULL;
253258
continue;
259+
}
254260

255-
piter->part = bdgrab(part);
256-
if (!piter->part)
257-
continue;
258261
piter->idx += inc;
259262
break;
260263
}

drivers/block/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -445,6 +445,7 @@ config BLK_DEV_RBD
445445
config BLK_DEV_RSXX
446446
tristate "IBM Flash Adapter 900GB Full Height PCIe Device Driver"
447447
depends on PCI
448+
select CRC32
448449
help
449450
Device driver for IBM's high speed PCIe SSD
450451
storage device: Flash Adapter 900GB Full Height.

drivers/block/rnbd/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ config BLK_DEV_RNBD_CLIENT
77
tristate "RDMA Network Block Device driver client"
88
depends on INFINIBAND_RTRS_CLIENT
99
select BLK_DEV_RNBD
10+
select SG_POOL
1011
help
1112
RNBD client is a network block device driver using rdma transport.
1213

drivers/block/rnbd/README

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,3 +90,4 @@ Kleber Souza <[email protected]>
9090
Lutz Pogrell <[email protected]>
9191
Milind Dumbare <[email protected]>
9292
Roman Penyaev <[email protected]>
93+
Swapnil Ingle <[email protected]>

drivers/block/rnbd/rnbd-clt.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -375,12 +375,19 @@ static struct rnbd_iu *rnbd_get_iu(struct rnbd_clt_session *sess,
375375
init_waitqueue_head(&iu->comp.wait);
376376
iu->comp.errno = INT_MAX;
377377

378+
if (sg_alloc_table(&iu->sgt, 1, GFP_KERNEL)) {
379+
rnbd_put_permit(sess, permit);
380+
kfree(iu);
381+
return NULL;
382+
}
383+
378384
return iu;
379385
}
380386

381387
static void rnbd_put_iu(struct rnbd_clt_session *sess, struct rnbd_iu *iu)
382388
{
383389
if (atomic_dec_and_test(&iu->refcount)) {
390+
sg_free_table(&iu->sgt);
384391
rnbd_put_permit(sess, iu->permit);
385392
kfree(iu);
386393
}
@@ -487,8 +494,6 @@ static int send_msg_close(struct rnbd_clt_dev *dev, u32 device_id, bool wait)
487494
iu->buf = NULL;
488495
iu->dev = dev;
489496

490-
sg_alloc_table(&iu->sgt, 1, GFP_KERNEL);
491-
492497
msg.hdr.type = cpu_to_le16(RNBD_MSG_CLOSE);
493498
msg.device_id = cpu_to_le32(device_id);
494499

@@ -502,7 +507,6 @@ static int send_msg_close(struct rnbd_clt_dev *dev, u32 device_id, bool wait)
502507
err = errno;
503508
}
504509

505-
sg_free_table(&iu->sgt);
506510
rnbd_put_iu(sess, iu);
507511
return err;
508512
}
@@ -575,7 +579,6 @@ static int send_msg_open(struct rnbd_clt_dev *dev, bool wait)
575579
iu->buf = rsp;
576580
iu->dev = dev;
577581

578-
sg_alloc_table(&iu->sgt, 1, GFP_KERNEL);
579582
sg_init_one(iu->sgt.sgl, rsp, sizeof(*rsp));
580583

581584
msg.hdr.type = cpu_to_le16(RNBD_MSG_OPEN);
@@ -594,7 +597,6 @@ static int send_msg_open(struct rnbd_clt_dev *dev, bool wait)
594597
err = errno;
595598
}
596599

597-
sg_free_table(&iu->sgt);
598600
rnbd_put_iu(sess, iu);
599601
return err;
600602
}
@@ -622,8 +624,6 @@ static int send_msg_sess_info(struct rnbd_clt_session *sess, bool wait)
622624

623625
iu->buf = rsp;
624626
iu->sess = sess;
625-
626-
sg_alloc_table(&iu->sgt, 1, GFP_KERNEL);
627627
sg_init_one(iu->sgt.sgl, rsp, sizeof(*rsp));
628628

629629
msg.hdr.type = cpu_to_le16(RNBD_MSG_SESS_INFO);
@@ -650,7 +650,6 @@ static int send_msg_sess_info(struct rnbd_clt_session *sess, bool wait)
650650
} else {
651651
err = errno;
652652
}
653-
sg_free_table(&iu->sgt);
654653
rnbd_put_iu(sess, iu);
655654
return err;
656655
}
@@ -1698,7 +1697,8 @@ static void rnbd_destroy_sessions(void)
16981697
*/
16991698

17001699
list_for_each_entry_safe(sess, sn, &sess_list, list) {
1701-
WARN_ON(!rnbd_clt_get_sess(sess));
1700+
if (!rnbd_clt_get_sess(sess))
1701+
continue;
17021702
close_rtrs(sess);
17031703
list_for_each_entry_safe(dev, tn, &sess->devs_list, list) {
17041704
/*

drivers/block/rnbd/rnbd-srv.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -338,10 +338,12 @@ static int rnbd_srv_link_ev(struct rtrs_srv *rtrs,
338338

339339
void rnbd_srv_sess_dev_force_close(struct rnbd_srv_sess_dev *sess_dev)
340340
{
341-
mutex_lock(&sess_dev->sess->lock);
342-
rnbd_srv_destroy_dev_session_sysfs(sess_dev);
343-
mutex_unlock(&sess_dev->sess->lock);
341+
struct rnbd_srv_session *sess = sess_dev->sess;
342+
344343
sess_dev->keep_id = true;
344+
mutex_lock(&sess->lock);
345+
rnbd_srv_destroy_dev_session_sysfs(sess_dev);
346+
mutex_unlock(&sess->lock);
345347
}
346348

347349
static int process_msg_close(struct rtrs_srv *rtrs,

drivers/lightnvm/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ if NVM
1919

2020
config NVM_PBLK
2121
tristate "Physical Block Device Open-Channel SSD target"
22+
select CRC32
2223
help
2324
Allows an open-channel SSD to be exposed as a block device to the
2425
host. The target assumes the device exposes raw flash and must be

0 commit comments

Comments
 (0)