The commit is pushed to "branch-rh7-3.10.0-123.1.2-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git after rh7-3.10.0-123.1.2.vz7.5.1 ------> commit 8854414d2d97abd7ab86d4c9d1c74d9b2fc04c3c Author: Andrey Smetanin <asmeta...@virtuozzo.com> Date: Tue May 19 08:26:56 2015 +0400
ploop: prevent dangerous ploop-umount Umounting ploop device if inner fs is still mounted on it leads to numerous complains in kernel logs like: VFS: Busy inodes after unmount. sb = ffff880108987000, fs type = ext4, sb count = 2, sb->s_root = / and is not what user expected. The patch adds some protection from dummy userspace mistakes: do not allow to stop ploop device (this is the first step of ploop-umount) if user uses /dev/ploopNp1 for ioctl, or if someone (inner fs) is still using the device. https://jira.sw.ru/browse/PSBM-21474 Signed-off-by: Maxim Patlasov <mpatla...@parallels.com> --- drivers/block/ploop/dev.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/drivers/block/ploop/dev.c b/drivers/block/ploop/dev.c index 5a3a5ec..2f4928d 100644 --- a/drivers/block/ploop/dev.c +++ b/drivers/block/ploop/dev.c @@ -3548,6 +3548,20 @@ static int ploop_stop(struct ploop_device * plo, struct block_device *bdev) struct ploop_delta * delta; int cnt; + if (bdev != bdev->bd_contains) { + if (printk_ratelimit()) + printk(KERN_INFO "stop ploop%d failed (wrong bdev)\n", + plo->index); + return -ENODEV; + } + + if (bdev->bd_contains->bd_holders) { + if (printk_ratelimit()) + printk(KERN_INFO "stop ploop%d failed (holders=%d)\n", + plo->index, bdev->bd_contains->bd_holders); + return -EBUSY; + } + if (!test_bit(PLOOP_S_RUNNING, &plo->state)) return -EINVAL; _______________________________________________ Devel mailing list Devel@openvz.org https://lists.openvz.org/mailman/listinfo/devel