Maxim Patlasov <mpatla...@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 <mpatla...@virtuozzo.com>
Acked-by:dmonak...@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;

Attachment: signature.asc
Description: PGP signature

_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

Reply via email to