summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--utils/mountd/cache.c38
1 files changed, 35 insertions, 3 deletions
diff --git a/utils/mountd/cache.c b/utils/mountd/cache.c
index e04b86e..ca35de2 100644
--- a/utils/mountd/cache.c
+++ b/utils/mountd/cache.c
@@ -266,6 +266,27 @@ static int get_uuid(const char *val, size_t uuidlen, char *u)
return 1;
}
+
+/*
+ * Don't ask libblkid for these filesystems. Note that BTRF is ignored, because
+ * we generate the identifier from statfs->f_fsid. The rest are network or
+ * pseudo filesystems. (See <linux/magic.h> for the basic IDs.)
+ */
+static const long int nonblkid_filesystems[] = {
+ 0x2fc12fc1, /* ZFS_SUPER_MAGIC */
+ 0x9123683E, /* BTRFS_SUPER_MAGIC */
+ 0xFF534D42, /* CIFS_MAGIC_NUMBER */
+ 0x1373, /* DEVFS_SUPER_MAGIC */
+ 0x73757245, /* CODA_SUPER_MAGIC */
+ 0x564C, /* NCP_SUPER_MAGIC */
+ 0x6969, /* NFS_SUPER_MAGIC */
+ 0x9FA0, /* PROC_SUPER_MAGIC */
+ 0x62656572, /* SYSFS_MAGIC */
+ 0x517B, /* SMB_SUPER_MAGIC */
+ 0x01021994, /* TMPFS_SUPER_MAGIC */
+ 0 /* last */
+};
+
static int uuid_by_path(char *path, int type, size_t uuidlen, char *uuid)
{
/* get a uuid for the filesystem found at 'path'.
@@ -297,12 +318,23 @@ static int uuid_by_path(char *path, int type, size_t uuidlen, char *uuid)
*/
struct statfs64 st;
char fsid_val[17];
- const char *blkid_val;
+ const char *blkid_val = NULL;
const char *val;
+ int rc;
- blkid_val = get_uuid_blkdev(path);
+ rc = statfs64(path, &st);
+
+ if (type == 0 && rc == 0) {
+ const long int *bad;
+ for (bad = nonblkid_filesystems; *bad; bad++) {
+ if (*bad == st.f_type)
+ break;
+ }
+ if (*bad == 0)
+ blkid_val = get_uuid_blkdev(path);
+ }
- if (statfs64(path, &st) == 0 &&
+ if (rc == 0 &&
(st.f_fsid.__val[0] || st.f_fsid.__val[1]))
snprintf(fsid_val, 17, "%08x%08x",
st.f_fsid.__val[0], st.f_fsid.__val[1]);