Commit 5fc6b075 authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge tag 'block-5.10-2020-10-30' of git://git.kernel.dk/linux-block

Pull block fixes from Jens Axboe:

 - null_blk zone fixes (Damien, Kanchan)

 - NVMe pull request from Christoph:
       - improve zone revalidation (Keith Busch)
       - gracefully handle zero length messages in nvme-rdma (zhenwei pi)
       - nvme-fc error handling fixes (James Smart)
       - nvmet tracing NULL pointer dereference fix (Chaitanya Kulkarni)"

 - xsysace platform fixes (Andy)

 - scatterlist type cleanup (David)

 - blk-cgroup memory fixes (Gabriel)

 - nbd block size update fix (Ming)

 - Flush completion state fix (Ming)

 - bio_add_hw_page() iteration fix (Naohiro)

* tag 'block-5.10-2020-10-30' of git://git.kernel.dk/linux-block:
  blk-mq: mark flush request as IDLE in flush_end_io()
  lib/scatterlist: use consistent sg_copy_buffer() return type
  xsysace: use platform_get_resource() and platform_get_irq_optional()
  null_blk: Fix locking in zoned mode
  null_blk: Fix zone reset all tracing
  nbd: don't update block size after device is started
  block: advance iov_iter on bio_add_hw_page failure
  null_blk: synchronization fix for zoned device
  nvmet: fix a NULL pointer dereference when tracing the flush command
  nvme-fc: remove nvme_fc_terminate_io()
  nvme-fc: eliminate terminate_io use by nvme_fc_error_recovery
  nvme-fc: remove err_work work item
  nvme-fc: track error_recovery while connecting
  nvme-rdma: handle unexpected nvme completion data length
  nvme: ignore zone validate errors on subsequent scans
  blk-cgroup: Pre-allocate tree node on blkg_conf_prep
  blk-cgroup: Fix memleak on error path
parents cf9446cc 65ff5cd0
Loading
Loading
Loading
Loading
+7 −4
Original line number Diff line number Diff line
@@ -1044,6 +1044,7 @@ static int __bio_iov_append_get_pages(struct bio *bio, struct iov_iter *iter)
	ssize_t size, left;
	unsigned len, i;
	size_t offset;
	int ret = 0;

	if (WARN_ON_ONCE(!max_append_sectors))
		return 0;
@@ -1066,15 +1067,17 @@ static int __bio_iov_append_get_pages(struct bio *bio, struct iov_iter *iter)

		len = min_t(size_t, PAGE_SIZE - offset, left);
		if (bio_add_hw_page(q, bio, page, len, offset,
				max_append_sectors, &same_page) != len)
			return -EINVAL;
				max_append_sectors, &same_page) != len) {
			ret = -EINVAL;
			break;
		}
		if (same_page)
			put_page(page);
		offset = 0;
	}

	iov_iter_advance(iter, size);
	return 0;
	iov_iter_advance(iter, size - left);
	return ret;
}

/**
+13 −2
Original line number Diff line number Diff line
@@ -657,13 +657,20 @@ int blkg_conf_prep(struct blkcg *blkcg, const struct blkcg_policy *pol,
			goto fail;
		}

		if (radix_tree_preload(GFP_KERNEL)) {
			blkg_free(new_blkg);
			ret = -ENOMEM;
			goto fail;
		}

		rcu_read_lock();
		spin_lock_irq(&q->queue_lock);

		blkg = blkg_lookup_check(pos, pol, q);
		if (IS_ERR(blkg)) {
			ret = PTR_ERR(blkg);
			goto fail_unlock;
			blkg_free(new_blkg);
			goto fail_preloaded;
		}

		if (blkg) {
@@ -672,10 +679,12 @@ int blkg_conf_prep(struct blkcg *blkcg, const struct blkcg_policy *pol,
			blkg = blkg_create(pos, q, new_blkg);
			if (IS_ERR(blkg)) {
				ret = PTR_ERR(blkg);
				goto fail_unlock;
				goto fail_preloaded;
			}
		}

		radix_tree_preload_end();

		if (pos == blkcg)
			goto success;
	}
@@ -685,6 +694,8 @@ success:
	ctx->body = input;
	return 0;

fail_preloaded:
	radix_tree_preload_end();
fail_unlock:
	spin_unlock_irq(&q->queue_lock);
	rcu_read_unlock();
+1 −0
Original line number Diff line number Diff line
@@ -225,6 +225,7 @@ static void flush_end_io(struct request *flush_rq, blk_status_t error)
	/* release the tag's ownership to the req cloned from */
	spin_lock_irqsave(&fq->mq_flush_lock, flags);

	WRITE_ONCE(flush_rq->state, MQ_RQ_IDLE);
	if (!refcount_dec_and_test(&flush_rq->ref)) {
		fq->rq_status = error;
		spin_unlock_irqrestore(&fq->mq_flush_lock, flags);
+5 −4
Original line number Diff line number Diff line
@@ -296,7 +296,7 @@ static void nbd_size_clear(struct nbd_device *nbd)
	}
}

static void nbd_size_update(struct nbd_device *nbd)
static void nbd_size_update(struct nbd_device *nbd, bool start)
{
	struct nbd_config *config = nbd->config;
	struct block_device *bdev = bdget_disk(nbd->disk, 0);
@@ -313,6 +313,7 @@ static void nbd_size_update(struct nbd_device *nbd)
	if (bdev) {
		if (bdev->bd_disk) {
			bd_set_nr_sectors(bdev, nr_sectors);
			if (start)
				set_blocksize(bdev, config->blksize);
		} else
			set_bit(GD_NEED_PART_SCAN, &nbd->disk->state);
@@ -328,7 +329,7 @@ static void nbd_size_set(struct nbd_device *nbd, loff_t blocksize,
	config->blksize = blocksize;
	config->bytesize = blocksize * nr_blocks;
	if (nbd->task_recv != NULL)
		nbd_size_update(nbd);
		nbd_size_update(nbd, false);
}

static void nbd_complete_rq(struct request *req)
@@ -1308,7 +1309,7 @@ static int nbd_start_device(struct nbd_device *nbd)
		args->index = i;
		queue_work(nbd->recv_workq, &args->work);
	}
	nbd_size_update(nbd);
	nbd_size_update(nbd, true);
	return error;
}

+2 −0
Original line number Diff line number Diff line
@@ -47,6 +47,8 @@ struct nullb_device {
	unsigned int nr_zones_closed;
	struct blk_zone *zones;
	sector_t zone_size_sects;
	spinlock_t zone_dev_lock;
	unsigned long *zone_locks;

	unsigned long size; /* device size in MB */
	unsigned long completion_nsec; /* time in ns to complete a request */
Loading