Skip to content

Commit 2383ffc

Browse files
committed
Merge tag 'block-6.5-2023-08-19' of git://git.kernel.dk/linux
Pull block fixes from Jens Axboe: "Main thing here is the fix for the regression in flush handling which caused IO hangs/stalls for a few reporters. Hopefully that should all be sorted out now. Outside of that, just a few minor fixes for issues that were introduced in this cycle" * tag 'block-6.5-2023-08-19' of git://git.kernel.dk/linux: blk-mq: release scheduler resource when request completes blk-crypto: dynamically allocate fallback profile blk-cgroup: hold queue_lock when removing blkg->q_node drivers/rnbd: restore sysfs interface to rnbd-client
2 parents aa9ea98 + e5c0ca1 commit 2383ffc

File tree

5 files changed

+49
-17
lines changed

5 files changed

+49
-17
lines changed

block/blk-cgroup.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,9 @@ static void blkg_free_workfn(struct work_struct *work)
136136
blkcg_policy[i]->pd_free_fn(blkg->pd[i]);
137137
if (blkg->parent)
138138
blkg_put(blkg->parent);
139+
spin_lock_irq(&q->queue_lock);
139140
list_del_init(&blkg->q_node);
141+
spin_unlock_irq(&q->queue_lock);
140142
mutex_unlock(&q->blkcg_mutex);
141143

142144
blk_put_queue(q);

block/blk-crypto-fallback.c

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ static struct blk_crypto_fallback_keyslot {
7878
struct crypto_skcipher *tfms[BLK_ENCRYPTION_MODE_MAX];
7979
} *blk_crypto_keyslots;
8080

81-
static struct blk_crypto_profile blk_crypto_fallback_profile;
81+
static struct blk_crypto_profile *blk_crypto_fallback_profile;
8282
static struct workqueue_struct *blk_crypto_wq;
8383
static mempool_t *blk_crypto_bounce_page_pool;
8484
static struct bio_set crypto_bio_split;
@@ -292,7 +292,7 @@ static bool blk_crypto_fallback_encrypt_bio(struct bio **bio_ptr)
292292
* Get a blk-crypto-fallback keyslot that contains a crypto_skcipher for
293293
* this bio's algorithm and key.
294294
*/
295-
blk_st = blk_crypto_get_keyslot(&blk_crypto_fallback_profile,
295+
blk_st = blk_crypto_get_keyslot(blk_crypto_fallback_profile,
296296
bc->bc_key, &slot);
297297
if (blk_st != BLK_STS_OK) {
298298
src_bio->bi_status = blk_st;
@@ -395,7 +395,7 @@ static void blk_crypto_fallback_decrypt_bio(struct work_struct *work)
395395
* Get a blk-crypto-fallback keyslot that contains a crypto_skcipher for
396396
* this bio's algorithm and key.
397397
*/
398-
blk_st = blk_crypto_get_keyslot(&blk_crypto_fallback_profile,
398+
blk_st = blk_crypto_get_keyslot(blk_crypto_fallback_profile,
399399
bc->bc_key, &slot);
400400
if (blk_st != BLK_STS_OK) {
401401
bio->bi_status = blk_st;
@@ -499,7 +499,7 @@ bool blk_crypto_fallback_bio_prep(struct bio **bio_ptr)
499499
return false;
500500
}
501501

502-
if (!__blk_crypto_cfg_supported(&blk_crypto_fallback_profile,
502+
if (!__blk_crypto_cfg_supported(blk_crypto_fallback_profile,
503503
&bc->bc_key->crypto_cfg)) {
504504
bio->bi_status = BLK_STS_NOTSUPP;
505505
return false;
@@ -526,15 +526,14 @@ bool blk_crypto_fallback_bio_prep(struct bio **bio_ptr)
526526

527527
int blk_crypto_fallback_evict_key(const struct blk_crypto_key *key)
528528
{
529-
return __blk_crypto_evict_key(&blk_crypto_fallback_profile, key);
529+
return __blk_crypto_evict_key(blk_crypto_fallback_profile, key);
530530
}
531531

532532
static bool blk_crypto_fallback_inited;
533533
static int blk_crypto_fallback_init(void)
534534
{
535535
int i;
536536
int err;
537-
struct blk_crypto_profile *profile = &blk_crypto_fallback_profile;
538537

539538
if (blk_crypto_fallback_inited)
540539
return 0;
@@ -545,18 +544,27 @@ static int blk_crypto_fallback_init(void)
545544
if (err)
546545
goto out;
547546

548-
err = blk_crypto_profile_init(profile, blk_crypto_num_keyslots);
549-
if (err)
547+
/* Dynamic allocation is needed because of lockdep_register_key(). */
548+
blk_crypto_fallback_profile =
549+
kzalloc(sizeof(*blk_crypto_fallback_profile), GFP_KERNEL);
550+
if (!blk_crypto_fallback_profile) {
551+
err = -ENOMEM;
550552
goto fail_free_bioset;
553+
}
554+
555+
err = blk_crypto_profile_init(blk_crypto_fallback_profile,
556+
blk_crypto_num_keyslots);
557+
if (err)
558+
goto fail_free_profile;
551559
err = -ENOMEM;
552560

553-
profile->ll_ops = blk_crypto_fallback_ll_ops;
554-
profile->max_dun_bytes_supported = BLK_CRYPTO_MAX_IV_SIZE;
561+
blk_crypto_fallback_profile->ll_ops = blk_crypto_fallback_ll_ops;
562+
blk_crypto_fallback_profile->max_dun_bytes_supported = BLK_CRYPTO_MAX_IV_SIZE;
555563

556564
/* All blk-crypto modes have a crypto API fallback. */
557565
for (i = 0; i < BLK_ENCRYPTION_MODE_MAX; i++)
558-
profile->modes_supported[i] = 0xFFFFFFFF;
559-
profile->modes_supported[BLK_ENCRYPTION_MODE_INVALID] = 0;
566+
blk_crypto_fallback_profile->modes_supported[i] = 0xFFFFFFFF;
567+
blk_crypto_fallback_profile->modes_supported[BLK_ENCRYPTION_MODE_INVALID] = 0;
560568

561569
blk_crypto_wq = alloc_workqueue("blk_crypto_wq",
562570
WQ_UNBOUND | WQ_HIGHPRI |
@@ -597,7 +605,9 @@ static int blk_crypto_fallback_init(void)
597605
fail_free_wq:
598606
destroy_workqueue(blk_crypto_wq);
599607
fail_destroy_profile:
600-
blk_crypto_profile_destroy(profile);
608+
blk_crypto_profile_destroy(blk_crypto_fallback_profile);
609+
fail_free_profile:
610+
kfree(blk_crypto_fallback_profile);
601611
fail_free_bioset:
602612
bioset_exit(&crypto_bio_split);
603613
out:

block/blk-mq.c

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -681,6 +681,21 @@ struct request *blk_mq_alloc_request_hctx(struct request_queue *q,
681681
}
682682
EXPORT_SYMBOL_GPL(blk_mq_alloc_request_hctx);
683683

684+
static void blk_mq_finish_request(struct request *rq)
685+
{
686+
struct request_queue *q = rq->q;
687+
688+
if (rq->rq_flags & RQF_USE_SCHED) {
689+
q->elevator->type->ops.finish_request(rq);
690+
/*
691+
* For postflush request that may need to be
692+
* completed twice, we should clear this flag
693+
* to avoid double finish_request() on the rq.
694+
*/
695+
rq->rq_flags &= ~RQF_USE_SCHED;
696+
}
697+
}
698+
684699
static void __blk_mq_free_request(struct request *rq)
685700
{
686701
struct request_queue *q = rq->q;
@@ -707,9 +722,7 @@ void blk_mq_free_request(struct request *rq)
707722
{
708723
struct request_queue *q = rq->q;
709724

710-
if ((rq->rq_flags & RQF_USE_SCHED) &&
711-
q->elevator->type->ops.finish_request)
712-
q->elevator->type->ops.finish_request(rq);
725+
blk_mq_finish_request(rq);
713726

714727
if (unlikely(laptop_mode && !blk_rq_is_passthrough(rq)))
715728
laptop_io_completion(q->disk->bdi);
@@ -1020,6 +1033,8 @@ inline void __blk_mq_end_request(struct request *rq, blk_status_t error)
10201033
if (blk_mq_need_time_stamp(rq))
10211034
__blk_mq_end_request_acct(rq, ktime_get_ns());
10221035

1036+
blk_mq_finish_request(rq);
1037+
10231038
if (rq->end_io) {
10241039
rq_qos_done(rq->q, rq);
10251040
if (rq->end_io(rq, error) == RQ_END_IO_FREE)
@@ -1074,6 +1089,8 @@ void blk_mq_end_request_batch(struct io_comp_batch *iob)
10741089
if (iob->need_ts)
10751090
__blk_mq_end_request_acct(rq, now);
10761091

1092+
blk_mq_finish_request(rq);
1093+
10771094
rq_qos_done(rq->q, rq);
10781095

10791096
/*

block/elevator.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -499,6 +499,9 @@ void elv_unregister_queue(struct request_queue *q)
499499

500500
int elv_register(struct elevator_type *e)
501501
{
502+
/* finish request is mandatory */
503+
if (WARN_ON_ONCE(!e->ops.finish_request))
504+
return -EINVAL;
502505
/* insert_requests and dispatch_request are mandatory */
503506
if (WARN_ON_ONCE(!e->ops.insert_requests || !e->ops.dispatch_request))
504507
return -EINVAL;

drivers/block/rnbd/rnbd-clt-sysfs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525

2626
static struct device *rnbd_dev;
2727
static const struct class rnbd_dev_class = {
28-
.name = "rnbd_client",
28+
.name = "rnbd-client",
2929
};
3030
static struct kobject *rnbd_devs_kobj;
3131

0 commit comments

Comments
 (0)