URL:
https://github.com/SSSD/sssd/pull/5370
Title: #5370: nss: Use posix_fallocate() to alloc memcache file
deastoe commented:
"""
Hmm thinking this over again I guess the reason why the docs do not explicitly refer to
the file being zero'd, or appearing zero'd, is to account for the case where the
operation is performed on an existing file with data. `fallocate(2)` does allude to
this:
Any subregion within the range specified by offset and len that did
not contain data before the call will be initialized to zero
which makes sense, and a quick test program confirms this, a previously empty file appears
zero'd after `posix_fallocate()` while a file previously containing data appears
extended/filled with zeros.
So given we use `O_EXCL` and have a new empty file, it should always appear entirely
zero'd to us.
"""
See the full comment at
https://github.com/SSSD/sssd/pull/5370#issuecomment-709975066