block: mount_device: skip extroot earlier
authorYousong Zhou <yszhou4tech@gmail.com>
Tue, 29 Oct 2019 12:39:49 +0000 (12:39 +0000)
committerJohn Crispin <john@phrozen.org>
Sat, 2 Nov 2019 18:23:06 +0000 (19:23 +0100)
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
block.c

diff --git a/block.c b/block.c
index 15caaba..084e7fc 100644 (file)
--- a/block.c
+++ b/block.c
@@ -1087,6 +1087,10 @@ static int mount_device(struct device *dev, int type)
                return 0;
        }
 
+       m = dev->m;
+       if (m && m->extroot)
+               return -1;
+
        mp = find_mount_point(pr->dev);
        if (mp && (type != TYPE_HOTPLUG)) {
                ULOG_ERR("%s is already mounted on %s\n", pr->dev, mp);
@@ -1094,10 +1098,6 @@ static int mount_device(struct device *dev, int type)
                return -1;
        }
 
-       m = dev->m;
-       if (m && m->extroot)
-               return -1;
-
        if (type == TYPE_HOTPLUG)
                blockd_notify(device, m, pr);