linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrei Borzenkov <arvidjaar@gmail.com>
To: Chris Murphy <lists@colorremedies.com>,
	David Sterba <dsterba@suse.cz>,
	Btrfs BTRFS <linux-btrfs@vger.kernel.org>,
	Austin S Hemmelgarn <ahferroin7@gmail.com>
Subject: Re: btrfs device ready purpose
Date: Sat, 22 Jul 2017 08:55:23 +0300	[thread overview]
Message-ID: <9a16f6d5-90cd-bd04-a0ea-63e88cc3faf4@gmail.com> (raw)
In-Reply-To: <CAJCQCtTjKRZxN+MxyM0=DJmqF94WBrV3Uoz7kw5SGq_xQ1fzrg@mail.gmail.com>

21.07.2017 17:36, Chris Murphy пишет:
>>
>> The command is just a simple wrapper around the DEVICES_READY ioctl, but
>> now that systemd has it's own wrapper tool, there are probably no users
>> of that subcommand in 'btrfs' tool itself. We can enhance the
>> documentation to state the expected purpose and that normal users can
>> ignore it.
> 
> What is the expected purpose? It flat out does not seem to work at
> all. It doesn't wait when devices are missing, as the man description
> says.

That's man page that is misleading. The intent was to let caller of
"btrfs device ready" to know when it has to wait.

> And echo ? returns a 0 instead of 1. I'd expect the exit code is
> 0 to mean "yes all devices are ready", and exit code 1 "some devices
> not ready". But right now, I get the same result no matter what.
> 

That's not what I observe.

linux-gtrk:~ # btrfs device ready /dev/sdb
linux-gtrk:~ # echo $?
1
linux-gtrk:~ # btrfs-debug-tree /dev/sdb
btrfs-progs v4.5.3+20160729
warning, device 2 is missing
...

But if you call "btrfs device ready" AFTER kernel has already seen (or
decided about) all devices, then it returns 0. Basically, this is not
"filesystem ready" but "does kernel know about all devices for this
filesystem".

> So it seems to me it needs to be fixed in user space or it just needs
> to be removed.
> 
> Where this stems from, is this 'help wanted' issue
> https://github.com/storaged-project/libblockdev/issues/244
> 
> The gist is that libblockdev needs to know whether a device can be
> mounted successfully without -o degraded, and that's basically what
> BTRFS_IOC_DEVICES_READY does. But at least in startup, the udev usage
> of this ioctl causes a hang. Literally systemd just sits there and
> will not try to mount such a volume, and it waits indefinitely, which
> is itself suboptimal.

Please do not confuse independent things. "btrfs device ready" simply
tells caller whether all devices have been seen by kernel. This is poor
man's solution for "can I mount it". What caller does with this
information is outside of scope of btrfs.

> I think it'd be better to return a code.
> 0: is complete, degraded not required
> 1: is incomplete, degraded should mount it
> 2: is incomplete, degraded won't mount it
> 

There is no way systemd can make use of this information using current
static unit dependencies. Really, this topic came up more than once
(including by you as well). systemd does not have adequate ways to
represent multi-device objects (this goes beyond btrfs, Linux MD is good
example). Sometimes it is possible to workaround it (Linux MD again).
But at the end, systemd needs to offer framework where btrfs et al can
plug in by providing status. Until this happens, discussion on this list
is pointless.

  reply	other threads:[~2017-07-22  5:55 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-07 16:42 btrfs device ready purpose Chris Murphy
2017-07-07 16:59 ` Andrei Borzenkov
2017-07-07 17:40   ` Chris Murphy
2017-07-10 12:33     ` Austin S. Hemmelgarn
2017-07-17 15:54     ` David Sterba
2017-07-21 14:36       ` Chris Murphy
2017-07-22  5:55         ` Andrei Borzenkov [this message]
2017-07-22 17:49           ` Chris Murphy
2017-07-22 18:06             ` Chris Murphy
2017-07-22 18:15               ` Hugo Mills
2017-07-22 19:58                 ` Adam Borowski
2017-07-22 20:35                   ` Chris Murphy
2017-07-24  6:05                     ` Duncan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9a16f6d5-90cd-bd04-a0ea-63e88cc3faf4@gmail.com \
    --to=arvidjaar@gmail.com \
    --cc=ahferroin7@gmail.com \
    --cc=dsterba@suse.cz \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=lists@colorremedies.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).