lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 15 Jan 2020 15:48:39 +0100
From:   Christoph Hellwig <hch@....de>
To:     David Howells <dhowells@...hat.com>
Cc:     Christoph Hellwig <hch@....de>, Qu Wenruo <quwenruo.btrfs@....com>,
        Andreas Dilger <adilger@...ger.ca>,
        linux-fsdevel <linux-fsdevel@...r.kernel.org>,
        Al Viro <viro@...iv.linux.org.uk>,
        "Theodore Y. Ts'o" <tytso@....edu>,
        "Darrick J. Wong" <darrick.wong@...cle.com>,
        Chris Mason <clm@...com>, Josef Bacik <josef@...icpanda.com>,
        David Sterba <dsterba@...e.com>,
        linux-ext4 <linux-ext4@...r.kernel.org>,
        linux-xfs <linux-xfs@...r.kernel.org>,
        linux-btrfs <linux-btrfs@...r.kernel.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: Problems with determining data presence by examining extents?

On Wed, Jan 15, 2020 at 02:35:22PM +0000, David Howells wrote:
> > If we can't get that easily it can be emulated using lseek SEEK_DATA /
> > SEEK_HOLE assuming no other thread could be writing to the file, or the
> > raciness doesn't matter.
> 
> Another thread could be writing to the file, and the raciness matters if I
> want to cache the result of calling SEEK_HOLE - though it might be possible
> just to mask it off.

Well, if you have other threads changing the file (writing, punching holes,
truncating, etc) you have lost with any interface that isn't an atomic
give me that data or tell me its a hole.  And even if that if you allow
threads that aren't part of your fscache implementation to do the
modifications you have lost.  If on the other hand they are part of
fscache you should be able to synchronize your threads somehow.

> One problem I have with SEEK_HOLE is that there's no upper bound on it.  Say
> I have a 1GiB cachefile that's completely populated and I want to find out if
> the first byte is present or not.  I call:
> 
> 	end = vfs_llseek(file, SEEK_HOLE, 0);
> 
> It will have to scan the metadata of the entire 1GiB file and will then
> presumably return the EOF position.  Now this might only be a mild irritation
> as I can cache this information for later use, but it does put potentially put
> a performance hiccough in the case of someone only reading the first page or
> so of the file (say the file program).  On the other hand, probably most of
> the files in the cache are likely to be complete - in which case, it's
> probably quite cheap.

At least for XFS all the metadata is read from disk at once anyway,
so you only spend a few more cycles walking through a pretty efficient
in-memory data structure.

> However, SEEK_HOLE doesn't help with the issue of the filesystem 'altering'
> the content of the file by adding or removing blocks of zeros.

As does any other method.  If you need that fine grained control you
need to track the information yourself.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ