Re: [PATCH] mdadm: autodetect being run in an initramfs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 27 September 2012 23:11, Dave Reisner <d@xxxxxxxxxxxxxx> wrote:
>
> On Sep 27, 2012 6:08 PM, "Dmitrijs Ledkovs" <dmitrij.ledkov@xxxxxxxxxxxx>
> wrote:
>>
>> On 27 September 2012 15:41, Dave Reisner <dreisner@xxxxxxxxxxxxx> wrote:
>> > Key off of the existance of /etc/initrd-release as an indicator that
>> > mdadm is running in early userspace and set the __offroot flag. This
>> > allows the same udev-based assembly rules to be valid both off and on
>> > root and, moreover, will propagate to mdmon, should it need to be
>> > started.
>> >
>>
>> And what shall non-systemd systems do?
>
> Add the file, of course!
>
>>
>> I don't have /etc/initrd-release in my initramfs-tools generated
>> initrd, and so far didn't have a usecase for it.
>> Should it be an empty file?
>>
>
> Yep, just an empty file. It only serves to be a marker since there really
> isn't any other heuristic for detecting early userspace.
>

This is a bit backwards. As far as I understand the systemd & udev
merge now means that udev rules cannot spawn long running processes
and instead should have a proper systemd units instead. And since
systemd is running all of the initramfs surely it can set up an
environment without adding pointless files, e.g. an environment
variable?

Please correct me, if I am wrong, cause I really don't understand
either this patch or systemd or both.


>>
>> > Signed-off-by: Dave Reisner <dreisner@xxxxxxxxxxxxx>
>> > ---
>> >  mdadm.c | 5 +++++
>> >  1 file changed, 5 insertions(+)
>> >
>> > diff --git a/mdadm.c b/mdadm.c
>> > index 4c7c5ea..557e00b 100644
>> > --- a/mdadm.c
>> > +++ b/mdadm.c
>> > @@ -1106,6 +1106,11 @@ int main(int argc, char *argv[])
>> >                 exit(0);
>> >         }
>> >
>> > +       /* auto-detect being on an initramfs
>> > +        *
>> > http://www.freedesktop.org/wiki/Software/systemd/InitrdInterface */
>> > +       if (access("/etc/initrd-release", F_OK) == 0)
>> > +               __offroot = 1;
>> > +
>> >         if (!mode && devs_found) {
>> >                 mode = MISC;
>> >                 devmode = 'Q';
>> > --
>> > 1.7.12.1
>> >
>> > --
>> > To unsubscribe from this list: send the line "unsubscribe linux-raid" in
>> > the body of a message to majordomo@xxxxxxxxxxxxxxx
>> > More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux RAID Wiki]     [ATA RAID]     [Linux SCSI Target Infrastructure]     [Linux Block]     [Linux IDE]     [Linux SCSI]     [Linux Hams]     [Device Mapper]     [Device Mapper Cryptographics]     [Kernel]     [Linux Admin]     [Linux Net]     [GFS]     [RPM]     [git]     [Yosemite Forum]


  Powered by Linux