From: Oliver Kurth Date: Fri, 17 Feb 2017 21:26:23 +0000 (-0800) Subject: Exclude non-directory and non-existing paths during quiescing. X-Git-Tag: stable-10.1.5~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6ffbf9d187613a911a3811f56667ba288c714e1f;p=thirdparty%2Fopen-vm-tools.git Exclude non-directory and non-existing paths during quiescing. --- diff --git a/open-vm-tools/lib/syncDriver/syncDriverLinux.c b/open-vm-tools/lib/syncDriver/syncDriverLinux.c index f1fff29bc..da0a8cb6e 100644 --- a/open-vm-tools/lib/syncDriver/syncDriverLinux.c +++ b/open-vm-tools/lib/syncDriver/syncDriverLinux.c @@ -30,6 +30,8 @@ #include #include #include +#include +#include #include "debug.h" #include "dynbuf.h" #include "syncDriverInt.h" @@ -170,12 +172,21 @@ LinuxDriver_Freeze(const GSList *paths, */ while (paths != NULL) { int fd; + struct stat sbuf; const char *path = paths->data; Debug(LGPFX "opening path '%s'.\n", path); paths = g_slist_next(paths); fd = open(path, O_RDONLY); if (fd == -1) { switch (errno) { + case ENOENT: + /* + * We sometimes get stale mountpoints or special mountpoints + * created by the docker engine. + */ + Debug(LGPFX "cannot find the directory '%s'.\n", path); + continue; + case EACCES: /* * We sometimes get access errors to virtual filesystems mounted @@ -201,6 +212,20 @@ LinuxDriver_Freeze(const GSList *paths, } } + if (fstat(fd, &sbuf) == -1) { + close(fd); + Debug(LGPFX "failed to stat '%s': %d (%s)\n", + path, errno, strerror(errno)); + err = SD_ERROR; + goto exit; + } + + if (!S_ISDIR(sbuf.st_mode)) { + close(fd); + Debug(LGPFX "Skipping a non-directory path '%s'.\n", path); + continue; + } + Debug(LGPFX "freezing path '%s' (fd=%d).\n", path, fd); if (ioctl(fd, FIFREEZE) == -1) { int ioctlerr = errno;