[LEDE-DEV] [PATCH mountd 2/2] mount: add mount with ignore=1 for unsupported filesystems

Rafał Miłecki zajec5 at gmail.com
Fri Nov 3 02:02:40 PDT 2017


From: Rafał Miłecki <rafal at milecki.pl>

So far a check for unsupported filesystem was in the mount_add_list
which was simply stopping mount from being added to the global list.

This resulted in mount_dev_add continuously not being able to find a
mount for the given block device and trying to add it over and over.
That was non-optimal becuse with unsupported filesystem present the
code was checking all its parameters every second.

Fix this by:
1) Moving check out of the mount_add_list to keep all logic in the
   caller function.
2) Adding mount with ignore=1 for unsupported filesystem instead of
   ignoring it.

Signed-off-by: Rafał Miłecki <rafal at milecki.pl>
---
 mount.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/mount.c b/mount.c
index 6d95de9..caf9d9d 100644
--- a/mount.c
+++ b/mount.c
@@ -139,8 +139,7 @@ static void mount_add_list(char *name, char *dev, char *serial,
 {
 	struct mount *mount;
 	char tmp[64], tmp2[64];
-	if(fs <= MBR || fs > LASTFS)
-		return;
+
 	mount  = malloc(sizeof(struct mount));
 	INIT_LIST_HEAD(&mount->list);
 	strncpy(mount->vendor, vendor, 64);
@@ -451,6 +450,7 @@ static void mount_dev_add(char *dev)
 		char sector_size[64];
 		FILE *fp;
 		int offset = 3;
+		int fs;
 
 		strcpy(name, dev);
 		if (!strncmp(name, "mmcblk", 6))
@@ -556,7 +556,11 @@ static void mount_dev_add(char *dev)
 			fclose(fp);
 		}
 		snprintf(tmp, 64, "/dev/%s", dev);
-		mount_add_list(node, dev, s, vendor, model, rev, ignore, size, sector_size, detect_fs(tmp));
+		fs = detect_fs(tmp);
+		if (fs <= MBR || fs > LASTFS) {
+			ignore = 1;
+		}
+		mount_add_list(node, dev, s, vendor, model, rev, ignore, size, sector_size, fs);
 		mount_dump_uci_state();
 	}
 }
-- 
2.11.0




More information about the Lede-dev mailing list