...
> > +#ifdef CONFIG_FALLOCATE_PUNCH_HOLE
> > + ret = do_fallocate(s->fd, FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE,
> > + aiocb->aio_offset, aiocb->aio_nbytes);
> > + if (ret != -ENOTSUP) {
> >
>
> This fails with ENODEV on RHEL 7.5 when fd is a block device.
>
> The manual says:
>
> ENODEV fd does not refer to a regular file or a directory. (If fd
> is a pipe or FIFO, a different error results.)
do_fallocate() is a wrapper around fallocate() that handles EINTR and
translates a few errno values (including ENODEV) into a -ENOTSUP return
code.
I missed that, so this looks correct.
Nir