[Devel] [PATCH hci-8.1 v2 1/1] block: let container root set the block size of and flush its device

Pavel Tikhomirov ptikhomirov at virtuozzo.com
Fri Oct 23 13:52:30 MSK 2026


On 10/22/26 04:25, Eva Kurchatova wrote:
>  static int blkdev_flushbuf(struct block_device *bdev, unsigned cmd,
>  		unsigned long arg)
>  {
> -	if (!capable(CAP_SYS_ADMIN))
> +	if (!blkdev_admin_capable(bdev))
>  		return -EACCES;
>  
>  	mutex_lock(&bdev->bd_holder_lock);
> -	if (bdev->bd_holder_ops && bdev->bd_holder_ops->sync)
> +	if (bdev->bd_holder_ops && bdev->bd_holder_ops->sync) {
> +		/* A filesystem on the device is synced by its own mount, not from a container */
> +		if (!ve_is_super(get_exec_env())) {
> +			mutex_unlock(&bdev->bd_holder_lock);
> +			return -EBUSY;
> +		}
>  		bdev->bd_holder_ops->sync(bdev);

This looks a bit overprotective, if we allow writing to this disk directly, why not allow syncing it directly, mounted fs or not.

Not a blocker though, fine either way.

Reviewed-by: Pavel Tikhomirov <ptikhomirov at virtuozzo.com>

-- 
Best regards, Pavel Tikhomirov
Senior Software Developer, Virtuozzo.



More information about the Devel mailing list