Commit 0471c6fe authored by Ming Lei's avatar Ming Lei Committed by Yang Yingliang
Browse files

nbd: don't update block size after device is started

mainline inclusion
from mainline-v5.10-rc2
commit b40813dd
category: bugfix
bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1891363


CVE: NA
backport: openEuler-20.09

Here is the testcase:
1. rbd create --size 2G rbdpool/foo
2. rbd-nbd map rbdpool/foo
3. mkfs.ext4 /dev/nbd0
4. mount /dev/nbd0 /mnt
5. rbd resize --size 4G rbdpool/foo
6. ls /mnt
ls will stuck here forever.

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

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: c8a83a6b ("nbd: Use set_blocksize() to set device blocksize")
Reported-by: default avatarlining <lining2020x@163.com>
Signed-off-by: default avatarMing Lei <ming.lei@redhat.com>
Cc: Josef Bacik <josef@toxicpanda.com>
Cc: Jan Kara <jack@suse.cz>
Tested-by: default avatarlining <lining2020x@163.com>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
Signed-off-by: default avatarlining <lining_yewu@cmss.chinamobile.com>
Reviewed-by: default avatarXie XiuQi <xiexiuqi@huawei.com>
Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
parent 700a6373
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment