From: VMware, Inc <> Date: Thu, 22 Dec 2011 00:26:34 +0000 (-0800) Subject: Ignore EBUSY when freezing filesystems. X-Git-Tag: 2011.12.20-562307~31 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8831583a51484ebffcf0bf57fbd2f62c5ae9e7c9;p=thirdparty%2Fopen-vm-tools.git Ignore EBUSY when freezing filesystems. Thanks to bind mounts (and apparently some other changes in Fedora 15), we may try to freeze the same superblock more than once. Ignore the EBUSY errors the kernel returns in these cases. Log some more information and fix a memory leak in the process. Signed-off-by: Marcelo Vanzin --- diff --git a/open-vm-tools/lib/syncDriver/syncDriverLinux.c b/open-vm-tools/lib/syncDriver/syncDriverLinux.c index af785795d..81d16e80c 100644 --- a/open-vm-tools/lib/syncDriver/syncDriverLinux.c +++ b/open-vm-tools/lib/syncDriver/syncDriverLinux.c @@ -192,15 +192,27 @@ LinuxDriver_Freeze(const char *paths, * supported on the device, we get EOPNOTSUPP. Ignore the latter, * since freezing does not make sense for all fs types, and some * Linux fs drivers may not have been hooked up in the running kernel. + * + * Also ignore EBUSY since we may try to freeze the same superblock + * more than once depending on the OS configuration (e.g., usage of + * bind mounts). */ close(fd); - if (ioctlerr != EOPNOTSUPP) { - Debug(LGPFX "ioctl failed: %d (%s)\n", ioctlerr, strerror(ioctlerr)); - err = first ? SD_UNAVAILABLE : SD_ERROR; + if (ioctlerr != EBUSY && ioctlerr != EOPNOTSUPP) { + Debug(LGPFX "failed to freeze '%s': %d (%s)\n", + path, ioctlerr, strerror(ioctlerr)); + err = first && ioctlerr == ENOTTY ? SD_UNAVAILABLE : SD_ERROR; + free(path); break; } } else { + Debug(LGPFX "successfully froze '%s'.\n", path); if (!DynBuf_Append(&fds, &fd, sizeof fd)) { + if (ioctl(fd, FITHAW) == -1) { + Warning(LGPFX "failed to thaw '%s': %d (%s)\n", + path, errno, strerror(errno)); + } + free(path); close(fd); err = SD_ERROR; break; @@ -208,6 +220,7 @@ LinuxDriver_Freeze(const char *paths, count++; } + free(path); first = FALSE; }