Use fsid from statfs for UUID if blkid can't cope (or not used)
authorDavid Woodhouse <David.Woodhouse@intel.com>
Thu, 28 Aug 2008 15:05:17 +0000 (11:05 -0400)
committerSteve Dickson <steved@redhat.com>
Thu, 28 Aug 2008 15:05:17 +0000 (11:05 -0400)
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Signed-off-by: Steve Dickson <steved@redhat.com>
utils/mountd/cache.c

index 23e2344..fa15472 100644 (file)
@@ -215,8 +215,17 @@ int get_uuid(char *path, char *uuid, int uuidlen, char *u)
 
        if (path) {
                val = get_uuid_blkdev(path);
-               if (!val)
-                       return 0;
+               if (!val) {
+                       struct statfs64 st;
+
+                       if (statfs64(path, &st))
+                               return 0;
+                       if (!st.f_fsid.__val[0] && !st.f_fsid.__val[1])
+                               return 0;
+                       snprintf(fsid_val, 17, "%08x%08x",
+                                st.f_fsid.__val[0], st.f_fsid.__val[1]);
+                       val = fsid_val;
+               }
        } else {
                val = uuid;
        }