[PATCH kvmtool] init: fix sysfs mount arguments

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

 



From: Dmitry Monakhov <dmtrmonakhov@xxxxxxxxxxxxxx>

It is not good idea to pass empty 'source' argument to  mount(2) because libmount complains about
incorrect /proc/self/mountinfo structure. This affect many applications such as findmnt, umount and etc.
Let's add fake source argument to sysfs mount command as we do with all other filesystems.

#TESTCASE_BEGIN:
## findmount will complain like this 'findmnt: /proc/self/mountinfo: parse error at line 4 -- ignored'
echo "/bin/findmnt" > ./test.sh
./lkvm setup init-mount-test
./lkvm run -d init-mount-test --sandbox test.sh
rm -rf ~/.lkvm/init-mount-test
#TESTCASE_END
---
 guest/init.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/guest/init.c b/guest/init.c
index 46e3fa4..22fe765 100644
--- a/guest/init.c
+++ b/guest/init.c
@@ -32,8 +32,8 @@ static void do_mounts(void)
 {
 #ifndef CONFIG_GUEST_PRE_INIT
 	mount("hostfs", "/host", "9p", MS_RDONLY, "trans=virtio,version=9p2000.L");
-#endif
-	mount("", "/sys", "sysfs", 0, NULL);
+#endif	
+	mount("sysfs", "/sys", "sysfs", 0, NULL);
 	mount("proc", "/proc", "proc", 0, NULL);
 	mount("devtmpfs", "/dev", "devtmpfs", 0, NULL);
 	mkdir("/dev/pts", 0755);
-- 
2.17.1




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux