On 2018-01-29 06:24, Adam Borowski wrote:
On Mon, Jan 29, 2018 at 09:54:04AM +0100, Tomasz Pala wrote:
it is a btrfs drawback that doesn't provice anything else except for this
IOCTL with it's logic
How can it provide you with something it doesn't yet have? If you want the
information, call mount(). And as others in this thread have mentioned,
what, pray tell, would you want to know "would a mount succeed?" for if you
don't want to mount?
And more importantly, WHY THE HELL DO YOU _WANT_ A TOCTOU RACE CONDITION
INVOLVED?
Seriously, _THERE IS A RACE CONDITION IN SYSTEMD'S CURRENT HANDLING OF
THIS_. It's functionally no different than prefacing an attempt to send
a signal to a process by checking if the process exists, or trying to
see if some other process is using a file that might be locked by
scanning /proc instead of just trying to lock the file yourself, or
scheduling something to check if a RAID array is out of sync before even
trying to start a scrub. No sane programmer would do any of that
(although a lot of rather poorly educated sysadmins do the third),
because _IT'S NOT RELIABLE_. The process you're trying to send a signal
to might disappear after checking for it (or worse, might be a different
process), the file might get locked by something with a low PID while
you're busy scanning /proc, or the array could completely die right
after you check if it's OK.
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html