Hi,
Thank you for the patch! Perhaps something to improve.
1) backported patch(es) should use the original author, you can use git am --amend --author="Ming Lei ming.lei@redhat.com" and use format-patch re-generate this patch.
or just insert "From: Ming Lei ming.lei@redhat.com" to the first line.
2) if bugzilla is out of openEuler, you can directly paste the full url here.
3) all patches should be first sent to kernel-4.19 (the develop branch), and tell the maintainer cherry-pick to the right maintenance branch(es). for this patch, you can sent to kernel-4.19 branch, and add backport tags.
mainline inclusion from mainline-v5.10-rc2 commit b40813ddcd6b category: bugfix bugzilla: 1891363 CVE: NA backport: openEuler-20.09 ^^^^^^^^^^^^^^^^^^^^^^^^^
4) additional, if you have test case for this patch, please provide the url.
--- Xie XiuQi, openEuler Kernel SIG
On 2020/11/17 14:40, lining wrote:
mainline inclusion from mainline-v5.10-rc2 commit b40813ddcd6b category: bugfix bugzilla: 1891363 CVE: NA
Mounted NBD device can be resized, one use case is rbd-nbd.
Fix the issue by setting up default block size, then not touch it in nbd_size_update() any more. This kind of usage is aligned with loop which has same use case too.
Cc: stable@vger.kernel.org Fixes: c8a83a6b54d0 ("nbd: Use set_blocksize() to set device blocksize") Reported-by: lining lining2020x@163.com Signed-off-by: Ming Lei ming.lei@redhat.com Cc: Josef Bacik josef@toxicpanda.com Cc: Jan Kara jack@suse.cz Tested-by: lining lining2020x@163.com Signed-off-by: Jens Axboe axboe@kernel.dk Signed-off-by: lining lining_yewu@cmss.chinamobile.com
drivers/block/nbd.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c index 816188aa841f..a913153d0b6b 100644 --- a/drivers/block/nbd.c +++ b/drivers/block/nbd.c @@ -293,7 +293,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); @@ -309,7 +309,8 @@ static void nbd_size_update(struct nbd_device *nbd) if (bdev) { if (bdev->bd_disk) { bd_set_size(bdev, config->bytesize);
set_blocksize(bdev, config->blksize);
if (start)
set_blocksize(bdev, config->blksize); } else bdev->bd_invalidated = 1; bdput(bdev);
@@ -324,7 +325,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) @@ -1263,7 +1264,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.25.1
Kernel mailing list -- kernel@openeuler.org To unsubscribe send an email to kernel-leave@openeuler.org