]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
Skip davfs mount points during quiescing
authorOliver Kurth <okurth@vmware.com>
Mon, 26 Feb 2018 20:35:36 +0000 (12:35 -0800)
committerOliver Kurth <okurth@vmware.com>
Mon, 26 Feb 2018 20:35:36 +0000 (12:35 -0800)
The davfs2 is a Linux filesystem that allows mounting a Web Distributed
Authoring and Versioning (WebDAV) network resource as a local filesystem.
On some Linux releases, the FREEZE ioctl() is rejected and quiescing
these filesystems is not attempted.  On others, however, the FREEZE is
not rejected and there exists the potential of a quiescing deadlock
if the davfs2 attempts to write to its cache in /var which has already
been quiesced.

This fix is to avoid a potential deadlock by excluding davfs2 mounts
as the networking filesystem they are.  Since davfs2 may be implemented
on the Linux fuse (default) or coda filesystem kernel module,
the detection of these network mounts must be based upon detection
of the URL prefix of the mounted device name.

The static function SyncDriverIsRemoteFSType() is being updated to
not only exclude remote filesystems based on filesystem type but also
to exclude davfs2 remote filesystems by the "http://" or "https://"
URL prefix on the device name.  The function name is being changed
to SyncDriverIsRemoteFS().

open-vm-tools/lib/syncDriver/syncDriverPosix.c

index 51979b298847cbe74100cece8bc25f11c9ed4ac8..f66ca8026c88e23c56693f60e87946d1450bd984 100644 (file)
@@ -1,5 +1,5 @@
 /*********************************************************
- * Copyright (C) 2005-2017 VMware, Inc. All rights reserved.
+ * Copyright (C) 2005-2018 VMware, Inc. All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms of the GNU Lesser General Public License as published
@@ -50,16 +50,31 @@ static const char *gRemoteFSTypes[] = {
    "vmhgfs"
 };
 
+typedef struct {
+   const char *prefix;
+   size_t len;
+} RemoteDevPrefix;
+
+#define DEF_DEV_PREFIX(a) {(a), sizeof((a)) - 1}
+
+static RemoteDevPrefix gRemoteDevPrefixes[] = {
+   DEF_DEV_PREFIX("https://"),
+   DEF_DEV_PREFIX("http://")
+};
+
+#undef DEF_DEV_PREFIX
+
 
 /*
  *-----------------------------------------------------------------------------
  *
- * SyncDriverIsRemoteFSType  --
+ * SyncDriverIsRemoteFS  --
  *
  *    Checks whether a filesystem is remote or not
  *
  * Results:
- *    Returns TRUE for remote filesystem types, otherwise FALSE.
+ *    Returns TRUE for remote filesystem types or device names,
+ *    otherwise FALSE.
  *
  * Side effects:
  *    None
@@ -68,12 +83,20 @@ static const char *gRemoteFSTypes[] = {
  */
 
 static Bool
-SyncDriverIsRemoteFSType(const char *fsType)
+SyncDriverIsRemoteFS(const MNTINFO *mntinfo)
 {
    size_t i;
 
    for (i = 0; i < ARRAYSIZE(gRemoteFSTypes); i++) {
-      if (Str_Strcmp(gRemoteFSTypes[i], fsType) == 0) {
+      if (Str_Strcmp(gRemoteFSTypes[i], MNTINFO_FSTYPE(mntinfo)) == 0) {
+         return TRUE;
+      }
+   }
+
+   for (i = 0; i < ARRAYSIZE(gRemoteDevPrefixes); i++) {
+      if (Str_Strncasecmp(gRemoteDevPrefixes[i].prefix,
+                          MNTINFO_NAME(mntinfo),
+                          gRemoteDevPrefixes[i].len) == 0) {
          return TRUE;
       }
    }
@@ -125,7 +148,7 @@ SyncDriverLocalMounts(void)
        * Skip remote mounts because they are not freezable and opening them
        * could lead to hangs. See PR 1196785.
        */
-      if (SyncDriverIsRemoteFSType(MNTINFO_FSTYPE(mntinfo))) {
+      if (SyncDriverIsRemoteFS(mntinfo)) {
          Debug(LGPFX "Skipping remote filesystem, name=%s, mntpt=%s.\n",
                MNTINFO_NAME(mntinfo), MNTINFO_MNTPT(mntinfo));
          continue;