diff options
| author | Jens Axboe <axboe@kernel.dk> | 2026-05-26 11:02:17 -0600 |
|---|---|---|
| committer | Jens Axboe <axboe@kernel.dk> | 2026-05-26 11:02:17 -0600 |
| commit | f1cad4de61239d9a0d43652de6eefe79679444ca (patch) | |
| tree | 15802ee5f7afa772c193ada027e5110052dce1e6 /block | |
| parent | a8920e95adb1fde467a47b45335362996758db55 (diff) | |
| parent | ee9895ae5a1868b13effc28174e4bb7f1084ded6 (diff) | |
| download | linux-next-history-f1cad4de61239d9a0d43652de6eefe79679444ca.tar.gz | |
Merge branch 'for-7.2/block' into for-next
* for-7.2/block:
block: remove blkdev_write_begin() and blkdev_write_end()
mtip32xx: fix use-after-free on service thread failure
block: don't set BIO_QUIET for BLK_STS_AGAIN
direct-io: remove IOCB_NOWAIT support
block: Avoid mounting the bdev pseudo-filesystem in userspace
block: switch numa_node to int in blk_mq_hw_ctx and init_request
block: skip sync_blockdev() on surprise removal in bdev_mark_dead()
blk-mq: add tracepoint block_rq_tag_wait
block: partitions: fix of_node refcount leak in of_partition()
Diffstat (limited to 'block')
| -rw-r--r-- | block/bdev.c | 13 | ||||
| -rw-r--r-- | block/blk-mq-tag.c | 6 | ||||
| -rw-r--r-- | block/bsg-lib.c | 2 | ||||
| -rw-r--r-- | block/fops.c | 24 | ||||
| -rw-r--r-- | block/partitions/of.c | 5 |
5 files changed, 18 insertions, 32 deletions
diff --git a/block/bdev.c b/block/bdev.c index bb0ffa3bb4dfb..85ce57bd2ae4f 100644 --- a/block/bdev.c +++ b/block/bdev.c @@ -446,15 +446,10 @@ EXPORT_SYMBOL_GPL(blockdev_superblock); void __init bdev_cache_init(void) { - int err; - bdev_cachep = kmem_cache_create("bdev_cache", sizeof(struct bdev_inode), 0, (SLAB_HWCACHE_ALIGN|SLAB_RECLAIM_ACCOUNT| SLAB_ACCOUNT|SLAB_PANIC), init_once); - err = register_filesystem(&bd_type); - if (err) - panic("Cannot register bdev pseudo-fs"); blockdev_mnt = kern_mount(&bd_type); if (IS_ERR(blockdev_mnt)) panic("Cannot create bdev pseudo-fs"); @@ -1250,7 +1245,13 @@ void bdev_mark_dead(struct block_device *bdev, bool surprise) bdev->bd_holder_ops->mark_dead(bdev, surprise); else { mutex_unlock(&bdev->bd_holder_lock); - sync_blockdev(bdev); + /* + * On surprise removal the device is already gone; syncing is + * futile and can hang forever waiting on I/O that will never + * complete. Match fs_bdev_mark_dead(), which also skips it. + */ + if (!surprise) + sync_blockdev(bdev); } invalidate_bdev(bdev); diff --git a/block/blk-mq-tag.c b/block/blk-mq-tag.c index 33946cdb57164..35deee5bbc739 100644 --- a/block/blk-mq-tag.c +++ b/block/blk-mq-tag.c @@ -13,6 +13,7 @@ #include <linux/kmemleak.h> #include <linux/delay.h> +#include <trace/events/block.h> #include "blk.h" #include "blk-mq.h" #include "blk-mq-sched.h" @@ -181,6 +182,11 @@ unsigned int blk_mq_get_tag(struct blk_mq_alloc_data *data) if (tag != BLK_MQ_NO_TAG) break; + /* Log the starvation event before altering task state */ + trace_block_rq_tag_wait(data->q, data->hctx, + data->rq_flags & RQF_SCHED_TAGS, + data->flags); + sbitmap_prepare_to_wait(bt, ws, &wait, TASK_UNINTERRUPTIBLE); tag = __blk_mq_get_tag(data, bt); diff --git a/block/bsg-lib.c b/block/bsg-lib.c index fdb4b290ca689..895db30a7033d 100644 --- a/block/bsg-lib.c +++ b/block/bsg-lib.c @@ -299,7 +299,7 @@ out: /* called right after the request is allocated for the request_queue */ static int bsg_init_rq(struct blk_mq_tag_set *set, struct request *req, - unsigned int hctx_idx, unsigned int numa_node) + unsigned int hctx_idx, int numa_node) { struct bsg_job *job = blk_mq_rq_to_pdu(req); diff --git a/block/fops.c b/block/fops.c index bb6642b45937c..ffe7b2042f4e2 100644 --- a/block/fops.c +++ b/block/fops.c @@ -499,36 +499,12 @@ static void blkdev_readahead(struct readahead_control *rac) mpage_readahead(rac, blkdev_get_block); } -static int blkdev_write_begin(const struct kiocb *iocb, - struct address_space *mapping, loff_t pos, - unsigned len, struct folio **foliop, - void **fsdata) -{ - return block_write_begin(mapping, pos, len, foliop, blkdev_get_block); -} - -static int blkdev_write_end(const struct kiocb *iocb, - struct address_space *mapping, - loff_t pos, unsigned len, unsigned copied, - struct folio *folio, void *fsdata) -{ - int ret; - ret = block_write_end(pos, len, copied, folio); - - folio_unlock(folio); - folio_put(folio); - - return ret; -} - const struct address_space_operations def_blk_aops = { .dirty_folio = block_dirty_folio, .invalidate_folio = block_invalidate_folio, .read_folio = blkdev_read_folio, .readahead = blkdev_readahead, .writepages = blkdev_writepages, - .write_begin = blkdev_write_begin, - .write_end = blkdev_write_end, .migrate_folio = buffer_migrate_folio_norefs, .is_dirty_writeback = buffer_check_dirty_writeback, }; diff --git a/block/partitions/of.c b/block/partitions/of.c index c22b606610981..53664ea06b654 100644 --- a/block/partitions/of.c +++ b/block/partitions/of.c @@ -74,8 +74,10 @@ int of_partition(struct parsed_partitions *state) struct device_node *partitions_np = of_node_get(ddev->of_node); if (!partitions_np || - !of_device_is_compatible(partitions_np, "fixed-partitions")) + !of_device_is_compatible(partitions_np, "fixed-partitions")) { + of_node_put(partitions_np); return 0; + } slot = 1; /* Validate parition offset and size */ @@ -104,5 +106,6 @@ int of_partition(struct parsed_partitions *state) seq_buf_puts(&state->pp_buf, "\n"); + of_node_put(partitions_np); return 1; } |
