Merge ~sil2100/cloud-initramfs-tools:growroot-do-not-waitroot into cloud-initramfs-tools:master

Proposed by Łukasz Zemczak
Status: Needs review
Proposed branch: ~sil2100/cloud-initramfs-tools:growroot-do-not-waitroot
Merge into: cloud-initramfs-tools:master
Diff against target: 21 lines (+4/-4)
1 file modified
growroot/scripts/local-bottom/growroot (+4/-4)
Reviewer Review Type Date Requested Status
cloud-initramfs-tools Pending
Review via email: mp+411155@code.launchpad.net

Commit message

When performing growroot, we don't need to perform a wait-for-root call as we already waited for the whole of udev to settle before that.

Description of the change

When performing growroot, we don't need to perform a wait-for-root call as we already waited for the whole of udev to settle before that.

The reason I'm proposing this change is actually as a workaround to a weird problem I have encountered with growpart and udev (might be kernel related?). Basically the problem there is that after growpart the rootfs block device loses all the ID_* udev properties, and wait-for-root basically loops until timeout looking for ID_FS_TYPE. Yes, this is a real bug that we need to chase down, but I think that's a separate thing.

I don't think there is *any* merit in doing a `wait-for-root` here as it was. In the regular local initrd setup, wait-for-root is (if I understand correctly) used to wait for the root device to be fully available without having to wait for the whole of udev to settle (per the comment in scripts/local's local_device_setup() ). In case of growroot, we already do an `udevadm settle` right before the wait-for-root, so there's not much more we can do actually - the call is pointless. Sure, we fetch the FSTYPE as well, but it's not needed (and supported to be optional), as for all of our initrd we anyway use get_fstype() for that (which uses blkid) - and if no filesystem type is given to mount, mount defaults to using blkid for the FS identification.

So even though this is a workaround to get growroot working in this weird broken usecase, I think either way this call is redundant and doesn't make any sense to be there. Looks like it got copied over just-in-case anyway. Though, maybe I'm missing context and it's needed? If yes, please comment!

To post a comment you must log in.
Revision history for this message
Scott Moser (smoser) wrote :

well, lots of things have changed since this code was written and it probably did take a safe approach even then. Generally speaking, one 'settle' or (wait-for-root) immediately after another is going to happen "real fast", so its not really wasteful.

In theory, we've worked out all the bugs in growpart at cloud-utils version 0.32, and there is no longer any need for *any* settle as growpart should not return until everything has been done. (see 6b98f49ffb2c7, 957ba4cff0, d99b2d7664d5).

that might be something to consider.

I won't approve or deny this, simply because I don't really have the time to think it all the way through. I'll let someone else do that.

Unmerged commits

c02d734... by Łukasz Zemczak

When performing growroot, we don't need to perform a wait-for-root call as we already waited for the whole of udev to settle before that.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
diff --git a/growroot/scripts/local-bottom/growroot b/growroot/scripts/local-bottom/growroot
index b4efa24..4c27d66 100644
--- a/growroot/scripts/local-bottom/growroot
+++ b/growroot/scripts/local-bottom/growroot
@@ -98,12 +98,12 @@ fi
98# so that the root partition is available when we try and mount it.98# so that the root partition is available when we try and mount it.
99udevadm settle --timeout ${ROOTDELAY:-30}99udevadm settle --timeout ${ROOTDELAY:-30}
100100
101# this is taken from 'mountroot' function101# We don't need to do a call of wait-for-root here as we already waited for
102# see /usr/share/initramfs-tools/scripts/local102# the whole of udev to settle, nor do we need to know the FSTYPE - mount will
103FSTYPE=$(wait-for-root "${ROOT}" ${ROOTDELAY:-30})103# use blkid to guess it anyway.
104roflag="-r"104roflag="-r"
105[ "${readonly}" = "y" ] || roflag="-w"105[ "${readonly}" = "y" ] || roflag="-w"
106mount ${roflag} ${FSTYPE:+-t ${FSTYPE} }${ROOTFLAGS} ${ROOT} ${rootmnt} ||106mount ${roflag} ${ROOTFLAGS} ${ROOT} ${rootmnt} ||
107 fail "failed to re-mount ${ROOT}. this is bad!"107 fail "failed to re-mount ${ROOT}. this is bad!"
108108
109# write to /etc/grownroot-grown. most likely this wont work (readonly)109# write to /etc/grownroot-grown. most likely this wont work (readonly)

Subscribers

People subscribed via source and target branches