]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libblkid: trust in udev symlinks, don't verify
authorKarel Zak <kzak@redhat.com>
Tue, 12 Jun 2012 14:31:39 +0000 (16:31 +0200)
committerKarel Zak <kzak@redhat.com>
Tue, 12 Jun 2012 14:31:39 +0000 (16:31 +0200)
The libblkid always verify that /dev/disk/by-* symlinks match with
on-device LABELs/UUIDs. It means that all requests (e.g. mount -L |
-U) generates extra superblocks scans on the device.

Currently, many users and tools (GNOME, systemd, ...etc) use the
symlink directly and udev maintains the symlinks by inotify (+watch
rule). It seems better for system performance to disable the extra
paranoid mode and trust in udev.

Signed-off-by: Karel Zak <kzak@redhat.com>
libblkid/src/blkidP.h
libblkid/src/evaluate.c

index b6c2bc607fb4b14255d1b48135e9157e77cc3f6f..604de3ddb45acd3bd86dc2406a077a08cefa287c 100644 (file)
 #ifndef _BLKID_BLKIDP_H
 #define _BLKID_BLKIDP_H
 
-
+/* support debug output if LIBBLKID_DEBUG env. variable is set */
 #define CONFIG_BLKID_DEBUG 1
 
+/* Always confirm that /dev/disk-by symlinks match with LABEL/UUID on device */
+/* #define CONFIG_BLKID_VERIFY_UDEV 1 */
+
 #include <sys/types.h>
 #include <dirent.h>
 #include <sys/stat.h>
index fbd8a96fd6b160927007b637bbc3c38ebb82449b..5a84b432580a53b41af3ed804270d1178a3edefb 100644 (file)
@@ -48,6 +48,7 @@
  * API.
  */
 
+#ifdef CONFIG_BLKID_VERIFY_UDEV
 /* returns zero when the device has NAME=value (LABEL/UUID) */
 static int verify_tag(const char *devname, const char *name, const char *value)
 {
@@ -91,6 +92,7 @@ done:
        /* for non-root users we use unverified udev links */
        return errsv == EACCES ? 0 : rc;
 }
+#endif /* CONFIG_BLKID_VERIFY_UDEV*/
 
 /**
  * blkid_send_uevent:
@@ -169,8 +171,10 @@ static char *evaluate_by_udev(const char *token, const char *value, int uevent)
        if (!path)
                return NULL;
 
+#ifdef CONFIG_BLKID_VERIFY_UDEV
        if (verify_tag(path, token, value))
                goto failed;
+#endif
        return path;
 
 failed: