/etc/init.d/target doesn't work if configfs module is already loaded

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


in this file, check_configfs_mount() checks for the existence of
/sys/kernel/config (which is created when configfs module is loaded).
If this does not exist, it modprobes configfs and mounts
/sys/kernel/config.  The problem is that if the system already has
configfs loaded for one reason or another then this script fails to
mount the configfs filesystem and nothing works.

I'm including a patch that seems to fix the issue for me, it simply
decouples the modprobe of configfs from the mounting of configfs.
diff --git a/scripts/rc.target b/scripts/rc.target
index 22c0350..f313bc3 100644
--- a/scripts/rc.target
+++ b/scripts/rc.target
@@ -228,15 +228,19 @@ function load_scsi_disk() {
 }
 
 function check_configfs_mount() {
-	if [ ! -d /sys/kernel/config ]; then
-		modprobe configfs
-		mount -t configfs configfs /sys/kernel/config
-		RET=$?
-		if [ $RET != 0 ]; then
-			echo "ERROR: Unable to mount configfs on /sys/kernel/config"
-			return 1
-		fi
-	fi
+        if [ ! -d /sys/kernel/config ]; then
+        modprobe configfs
+        fi
+        if ! grep -q /sys/kernel/config /proc/mounts
+        then
+                mount -t configfs configfs /sys/kernel/config
+               RET=$?
+                if [ $RET != 0 ]; then
+                        echo "ERROR: Unable to mount configfs on /sys/kernel/config"
+                        return 1
+                fi
+        fi
+
 }
 
 function unload_lio_mode() {

[Linux SCSI]     [Kernel Newbies]     [Linux SCSI Target Infrastructure]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Photos]     [Yosemite]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

Add to Google Powered by Linux