Hey Michael, thanks for dealing with this!
Michael Biebl [2015-01-06 1:34 +0100]: > +static bool is_mounted(const char *dev_path) { > + _cleanup_endmntent_ FILE *mtab = NULL; > + struct mntent *me = NULL; > + > + mtab = setmntent("/etc/mtab", "r"); Can we rely on /etc/mtab at this point? Should we rather look at /proc/mounts here? Also, I think there is a simpler way to check if a dir is a mountpoint: s1 = stat(dir), s2 = stat(parent(dir)) (i. e. dir + "/.."), and check is_mount = (st.st_dev != st2.st_dev) || (st.st_dev == st2.st_dev && st.st_ino == st2.st_ino); That's the approach that /bin/mountpoint uses, and it avoids relying on having /etc/mtab, /proc mounted, and doing the iteration. The first check is obvious; I think the second check is only needed for bind mounts, which we could probably even ignore here (but then again it doesn't hurt to keep it). > @@ -83,6 +103,11 @@ int main(int argc, char *argv[]) { > !path_equal(me->mnt_dir, "/usr")) > continue; > > + /* Don't remount /usr if it hasn't been mounted by the > initrd */ > + if (path_equal(me->mnt_dir, "/usr") && > + !is_mounted("/usr")) > + continue; > + That looks like a good approach to me indeed. Thanks, Martin -- Martin Pitt | http://www.piware.de Ubuntu Developer (www.ubuntu.com) | Debian Developer (www.debian.org)
signature.asc
Description: Digital signature
_______________________________________________ Pkg-systemd-maintainers mailing list Pkg-systemd-maintainers@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-systemd-maintainers