[Devel] [vzlin-dev] [PATCH rh7 2/4] ploop: io_direct: check for fsync fop on startup

Dmitry Monakhov dmonakhov at openvz.org
Fri May 20 06:00:16 PDT 2016


Maxim Patlasov <mpatlasov at virtuozzo.com> writes:

> We don't support host file systems without fsync fop. The patch refuses
> to start ploop if fsync is absent.
>
> Signed-off-by: Maxim Patlasov <mpatlasov at virtuozzo.com>
Acked-by:dmonakhov at openvz.org
> ---
>  drivers/block/ploop/io_direct.c |   23 ++++++++++++-----------
>  1 file changed, 12 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/block/ploop/io_direct.c b/drivers/block/ploop/io_direct.c
> index 583b110..a37f296 100644
> --- a/drivers/block/ploop/io_direct.c
> +++ b/drivers/block/ploop/io_direct.c
> @@ -376,7 +376,6 @@ cached_submit(struct ploop_io *io, iblock_t iblk, struct ploop_request * preq,
>  	loff_t new_size;
>  	loff_t used_pos;
>  	bool may_fallocate = io->files.file->f_op->fallocate &&
> -		io->files.file->f_op->fsync &&
>  		io->files.flags & EXT4_EXTENTS_FL;
>  
>  	trace_cached_submit(preq);
> @@ -815,10 +814,8 @@ static int dio_fsync_thread(void * data)
>  		/* filemap_fdatawrite() has been made already */
>  		filemap_fdatawait(io->files.mapping);
>  
> -		err = 0;
> -		if (io->files.file->f_op->fsync)
> -			err = io->files.file->f_op->fsync(io->files.file, 0,
> -							  LLONG_MAX, 0);
> +		err = io->files.file->f_op->fsync(io->files.file, 0,
> +						  LLONG_MAX, 0);
>  
>  		/* Do we need to invalidate page cache? Not really,
>  		 * because we use it only to create full new pages,
> @@ -1386,12 +1383,11 @@ static int dio_alloc_sync(struct ploop_io * io, loff_t pos, loff_t len)
>  	if (err)
>  		goto fail;
>  
> -	if (io->files.file->f_op && io->files.file->f_op->fsync) {
> -		err = io->files.file->f_op->fsync(io->files.file, 0,
> -						  LLONG_MAX, 0);
> -		if (err)
> -			goto fail;
> -	}
> +	err = io->files.file->f_op->fsync(io->files.file, 0,
> +					  LLONG_MAX, 0);
> +	if (err)
> +		goto fail;
> +
>  	err = filemap_fdatawait(io->files.mapping);
>  
>  fail:
> @@ -1878,6 +1874,11 @@ static int dio_autodetect(struct ploop_io * io)
>  		return -1;
>  	}
>  
> +	if (!file->f_op->fsync) {
> +		printk("Cannot run on EXT4(%s): no fsync\n", s_id);
> +		return -1;
> +	}
> +
>  	fs = get_fs();
>  	set_fs(KERNEL_DS);
>  	flags = 0;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 472 bytes
Desc: not available
URL: <http://lists.openvz.org/pipermail/devel/attachments/20160520/b665f076/attachment.sig>


More information about the Devel mailing list