提交 1dc14195 编写于 作者: C Christoph Hellwig 提交者: Zheng Zengkai

nbd: remove the call to set_blocksize

mainline inclusion
from mainline-v5.11-rc1
commit ee4bf648
category: bugfix
bugzilla: 187706,https://gitee.com/openeuler/kernel/issues/I5XEBX
CVE: NA

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=ee4bf648635055d2b76afadaf34236c8b2d852a7

----------------------------------------

Block driver have no business setting the file system concept of a
block size.
Signed-off-by: NChristoph Hellwig <hch@lst.de>
Reviewed-by: NJosef Bacik <josef@toxicpanda.com>
Signed-off-by: NJens Axboe <axboe@kernel.dk>

conflicts:
	drivers/block/nbd.c
Signed-off-by: NZhong Jinghua <zhongjinghua@huawei.com>
Reviewed-by: NJason Yan <yanaijie@huawei.com>
Reviewed-by: NYu Kuai <yukuai3@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 df1635a4
......@@ -301,7 +301,7 @@ static void nbd_size_clear(struct nbd_device *nbd)
}
}
static void nbd_size_update(struct nbd_device *nbd, bool start)
static void nbd_size_update(struct nbd_device *nbd)
{
struct nbd_config *config = nbd->config;
struct block_device *bdev = bdget_disk(nbd->disk, 0);
......@@ -316,11 +316,9 @@ static void nbd_size_update(struct nbd_device *nbd, bool start)
blk_queue_physical_block_size(nbd->disk->queue, config->blksize);
set_capacity(nbd->disk, nr_sectors);
if (bdev) {
if (bdev->bd_disk) {
if (bdev->bd_disk)
bd_set_nr_sectors(bdev, nr_sectors);
if (start)
set_blocksize(bdev, config->blksize);
} else
else
set_bit(GD_NEED_PART_SCAN, &nbd->disk->state);
bdput(bdev);
}
......@@ -334,7 +332,7 @@ static void nbd_size_set(struct nbd_device *nbd, loff_t blocksize,
config->blksize = blocksize;
config->bytesize = blocksize * nr_blocks;
if (nbd->pid)
nbd_size_update(nbd, false);
nbd_size_update(nbd);
}
static void nbd_complete_rq(struct request *req)
......@@ -1393,7 +1391,7 @@ static int nbd_start_device(struct nbd_device *nbd)
args->index = i;
queue_work(nbd->recv_workq, &args->work);
}
nbd_size_update(nbd, true);
nbd_size_update(nbd);
return error;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册