[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Bug-tar] stat() on btrfs reports the st_blocks with delay (data los
From: |
Joerg Schilling |
Subject: |
Re: [Bug-tar] stat() on btrfs reports the st_blocks with delay (data loss in archivers) |
Date: |
Wed, 6 Jul 2016 13:49:37 +0200 |
User-agent: |
Heirloom mailx 12.5 7/5/10 |
"Austin S. Hemmelgarn" <address@hidden> wrote:
> > A broken filesystem is a broken filesystem.
> >
> > If you try to change gtar to work around a specific problem, it may fail in
> > other situations.
> The problem with this is that tar is assuming things that are not
> guaranteed to be true. There is absolutely nothing that says that
> st_blocks has to be non-zero if there's data in the file. In fact, the
This is not true: POSIX requires st_blocks to be != 0 in case that the file
contains data.
> behavior that BTRFS used to have of reporting st_blocks to be 0 for
> files entirely inlined in the metadata is absolutely correct given the
> description of the field by POSIX, because there _are_ no blocks
> allocated to the file (because the metadata block is technically
> equivalent to the inode, which isn't counted by st_blocks). This is yet
> another example of an old interface (in this case, sparse file
> detection) being short-sighted (read in this case as non-existent).
The internal state of a file system is irrelevant. The only thing that counts
is the user space view and if a file contains data (read succeeds in user
space), it needs to report st_blocks != 0.
> The proper fix for this is that tar (and anything else that handles
> sparse files differently) should be parsing the file regardless. It has
> to anyway for a normal sparse file to figure out where the sparse
> regions are, and optimizing for a file that's completely sparse (and
> therefore probably pre-allocated with fallocate) is not all that
> reasonable considering that this is going to be a very rare case in
> normal usage.
This does not help.
Even on a decent OS (e.g. Solaris since Summer 2005) and a decent tar
implementation (star) that supports SEEK_HOLE since Summer 2005, this method
will not work for all filesystems as there may be old filesystem
implementations and as there may be NFS...
For this reason, star still checks st_blocks in case that SEEK_HOLE did not
work.
Jörg
--
EMail:address@hidden (home) Jörg Schilling D-13353 Berlin
address@hidden (work) Blog: http://schily.blogspot.com/
URL: http://cdrecord.org/private/
http://sourceforge.net/projects/schilytools/files/'
- [Bug-tar] stat() on btrfs reports the st_blocks with delay (data loss in archivers), Pavel Raiskup, 2016/07/02
- Re: [Bug-tar] stat() on btrfs reports the st_blocks with delay (data loss in archivers), Andreas Dilger, 2016/07/04
- Re: [Bug-tar] stat() on btrfs reports the st_blocks with delay (data loss in archivers), Joerg Schilling, 2016/07/05
- Re: [Bug-tar] stat() on btrfs reports the st_blocks with delay (data loss in archivers), Austin S. Hemmelgarn, 2016/07/06
- Re: [Bug-tar] stat() on btrfs reports the st_blocks with delay (data loss in archivers),
Joerg Schilling <=
- Re: [Bug-tar] stat() on btrfs reports the st_blocks with delay (data loss in archivers), Antonio Diaz Diaz, 2016/07/06
- Re: [Bug-tar] stat() on btrfs reports the st_blocks with delay (data loss in archivers), Joerg Schilling, 2016/07/06
- Re: [Bug-tar] stat() on btrfs reports the st_blocks with delay (data loss in archivers), Paul Eggert, 2016/07/06
- Re: [Bug-tar] stat() on btrfs reports the st_blocks with delay (data loss in archivers), Joerg Schilling, 2016/07/06
- Re: [Bug-tar] stat() on btrfs reports the st_blocks with delay (data loss in archivers), Paul Eggert, 2016/07/06
- Re: [Bug-tar] stat() on btrfs reports the st_blocks with delay (data loss in archivers), Austin S. Hemmelgarn, 2016/07/06
- Re: [Bug-tar] stat() on btrfs reports the st_blocks with delay (data loss in archivers), Joerg Schilling, 2016/07/06
- Re: [Bug-tar] stat() on btrfs reports the st_blocks with delay (data loss in archivers), Austin S. Hemmelgarn, 2016/07/06
- Re: [Bug-tar] stat() on btrfs reports the st_blocks with delay (data loss in archivers), Austin S. Hemmelgarn, 2016/07/06
- Re: [Bug-tar] stat() on btrfs reports the st_blocks with delay (data loss in archivers), Joerg Schilling, 2016/07/06