Commit d8ba32c5 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull block fixes from Jens Axboe:

 - ublk selftests for missing coverage

 - two fixes for the block integrity code

 - fix for the newly added newly added PR read keys ioctl, limiting the
   memory that can be allocated

 - work around for a deadlock that can occur with ublk, where partition
   scanning ends up recursing back into file closure, which needs the
   same mutex grabbed. Not the prettiest thing in the world, but an
   acceptable work-around until we can eliminate the reliance on
   disk->open_mutex for this

 - fix for a race between enabling writeback throttling and new IO
   submissions

 - move a bit of bio flag handling code. No changes, but needed for a
   patchset for a future kernel

 - fix for an init time id leak failure in rnbd

 - loop/zloop state check fix

* tag 'block-6.19-20251218' of git://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux:
  block: validate interval_exp integrity limit
  block: validate pi_offset integrity limit
  block: rnbd-clt: Fix leaked ID in init_dev()
  ublk: fix deadlock when reading partition table
  block: add allocation size check in blkdev_pr_read_keys()
  Documentation: admin-guide: blockdev: replace zone_capacity with zone_capacity_mb when creating devices
  zloop: use READ_ONCE() to read lo->lo_state in queue_rq path
  loop: use READ_ONCE() to read lo->lo_state without locking
  block: fix race between wbt_enable_default and IO submission
  selftests: ublk: add user copy test cases
  selftests: ublk: add support for user copy to kublk
  selftests: ublk: forbid multiple data copy modes
  selftests: ublk: don't share backing files between ublk servers
  selftests: ublk: use auto_zc for PER_IO_DAEMON tests in stress_04
  selftests: ublk: fix fio arguments in run_io_and_recover()
  selftests: ublk: remove unused ios map in seq_io.bt
  selftests: ublk: correct last_rw map type in seq_io.bt
  selftests: ublk: fix overflow in ublk_queue_auto_zc_fallback()
  block: move around bio flagging helpers
parents d245b2e5 af65faf3
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -134,7 +134,7 @@ MB and a zone capacity of 63 MB::

        $ modprobe zloop
        $ mkdir -p /var/local/zloop/0
        $ echo "add capacity_mb=2048,zone_size_mb=64,zone_capacity=63MB" > /dev/zloop-control
        $ echo "add capacity_mb=2048,zone_size_mb=64,zone_capacity_mb=63" > /dev/zloop-control

For the device created (/dev/zloop0), the zone backing files are all created
under the default base directory (/var/local/zloop)::
+1 −1
Original line number Diff line number Diff line
@@ -7181,7 +7181,7 @@ static void bfq_exit_queue(struct elevator_queue *e)

	blk_stat_disable_accounting(bfqd->queue);
	blk_queue_flag_clear(QUEUE_FLAG_DISABLE_WBT_DEF, bfqd->queue);
	set_bit(ELEVATOR_FLAG_ENABLE_WBT_ON_EXIT, &e->flags);
	wbt_enable_default(bfqd->queue->disk);

	kfree(bfqd);
}
+9 −5
Original line number Diff line number Diff line
@@ -161,10 +161,9 @@ static int blk_validate_integrity_limits(struct queue_limits *lim)
		return -EINVAL;
	}

	if (bi->pi_tuple_size > bi->metadata_size) {
		pr_warn("pi_tuple_size (%u) exceeds metadata_size (%u)\n",
			 bi->pi_tuple_size,
			 bi->metadata_size);
	if (bi->pi_offset + bi->pi_tuple_size > bi->metadata_size) {
		pr_warn("pi_offset (%u) + pi_tuple_size (%u) exceeds metadata_size (%u)\n",
			bi->pi_offset, bi->pi_tuple_size, bi->metadata_size);
		return -EINVAL;
	}

@@ -194,8 +193,13 @@ static int blk_validate_integrity_limits(struct queue_limits *lim)
		break;
	}

	if (!bi->interval_exp)
	if (!bi->interval_exp) {
		bi->interval_exp = ilog2(lim->logical_block_size);
	} else if (bi->interval_exp < SECTOR_SHIFT ||
		   bi->interval_exp > ilog2(lim->logical_block_size)) {
		pr_warn("invalid interval_exp %u\n", bi->interval_exp);
		return -EINVAL;
	}

	/*
	 * The PI generation / validation helpers do not expect intervals to
+1 −1
Original line number Diff line number Diff line
@@ -932,7 +932,7 @@ int blk_register_queue(struct gendisk *disk)
		elevator_set_default(q);

	blk_queue_flag_set(QUEUE_FLAG_REGISTERED, q);
	wbt_enable_default(disk);
	wbt_init_enable_default(disk);

	/* Now everything is ready and send out KOBJ_ADD uevent */
	kobject_uevent(&disk->queue_kobj, KOBJ_ADD);
+16 −4
Original line number Diff line number Diff line
@@ -699,7 +699,7 @@ static void wbt_requeue(struct rq_qos *rqos, struct request *rq)
/*
 * Enable wbt if defaults are configured that way
 */
void wbt_enable_default(struct gendisk *disk)
static bool __wbt_enable_default(struct gendisk *disk)
{
	struct request_queue *q = disk->queue;
	struct rq_qos *rqos;
@@ -716,19 +716,31 @@ void wbt_enable_default(struct gendisk *disk)
		if (enable && RQWB(rqos)->enable_state == WBT_STATE_OFF_DEFAULT)
			RQWB(rqos)->enable_state = WBT_STATE_ON_DEFAULT;
		mutex_unlock(&disk->rqos_state_mutex);
		return;
		return false;
	}
	mutex_unlock(&disk->rqos_state_mutex);

	/* Queue not registered? Maybe shutting down... */
	if (!blk_queue_registered(q))
		return;
		return false;

	if (queue_is_mq(q) && enable)
		wbt_init(disk);
		return true;
	return false;
}

void wbt_enable_default(struct gendisk *disk)
{
	__wbt_enable_default(disk);
}
EXPORT_SYMBOL_GPL(wbt_enable_default);

void wbt_init_enable_default(struct gendisk *disk)
{
	if (__wbt_enable_default(disk))
		WARN_ON_ONCE(wbt_init(disk));
}

u64 wbt_default_latency_nsec(struct request_queue *q)
{
	/*
Loading