[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: bug#20826: SEEK_HOLE not supported for ext4 for kernel < 3.1
From: |
Eric Blake |
Subject: |
Re: bug#20826: SEEK_HOLE not supported for ext4 for kernel < 3.1 |
Date: |
Tue, 16 Jun 2015 06:47:40 -0600 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 |
[adding bug-gnulib]
On 06/16/2015 06:28 AM, Johannes Meixner wrote:
>
>> From one of our (SUSE) kernel developers
> I even got a proposal for a workaround in grep:
>
> --- a/src/grep.c
> +++ b/src/grep.c
> @@ -575,6 +575,17 @@ file_textbin (char *buf, size_t size, in
> off_t hole_start = lseek (fd, cur, SEEK_HOLE);
> if (0 <= hole_start)
> {
> + /* if hole_start is identical with cur, it's more likely a
> buggy
> + * lseek(SEEK_HOLE) implementation in kernel filesystem;
> + * check whether it really reads a null byte.
> + */
> + if (hole_start == cur)
> + {
> + char c;
> + if (read (fd, &c, 1) != 1 || c != 0)
> + hole_start = st->st_size; /* no hole */
> + }
> +
Sounds like we need to update the gnulib lseek module to work around
bugs like this in the wild.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
- Re: bug#20826: SEEK_HOLE not supported for ext4 for kernel < 3.1,
Eric Blake <=