If there is a dangling symbol link in filesystem pool, the pool will be failed to start or refresh, this patch is to fix it by ignoring it with a warning log. * src/storage/storage_backend.c * src/storage/storage_backend_fs.c (update the comments) --- src/storage/storage_backend.c | 9 ++++++++- src/storage/storage_backend_fs.c | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/storage/storage_backend.c b/src/storage/storage_backend.c index 10ea33c..9504261 100644 --- a/src/storage/storage_backend.c +++ b/src/storage/storage_backend.c @@ -977,7 +977,8 @@ virStorageBackendForType(int type) { /* * Allows caller to silently ignore files with improper mode * - * Returns -1 on error, -2 if file mode is unexpected. + * Returns -1 on error, -2 if file mode is unexpected or the file + * is symbol link, and it's dangling. */ int virStorageBackendVolOpenCheckMode(const char *path, unsigned int flags) @@ -986,6 +987,12 @@ virStorageBackendVolOpenCheckMode(const char *path, unsigned int flags) struct stat sb; if ((fd = open(path, O_RDONLY|O_NONBLOCK|O_NOCTTY)) < 0) { + if (areadlink(path) != NULL) { + VIR_WARN("cannot open volume '%s': %s", path, + strerror(errno)); + return -2; + } + virReportSystemError(errno, _("cannot open volume '%s'"), path); diff --git a/src/storage/storage_backend_fs.c b/src/storage/storage_backend_fs.c index d916d2d..242508c 100644 --- a/src/storage/storage_backend_fs.c +++ b/src/storage/storage_backend_fs.c @@ -651,7 +651,7 @@ virStorageBackendFileSystemRefresh(virConnectPtr conn ATTRIBUTE_UNUSED, goto cleanup; else { /* Silently ignore non-regular files, - * eg '.' '..', 'lost+found' */ + * eg '.' '..', 'lost+found', dangling symbol link */ virStorageVolDefFree(vol); vol = NULL; continue; -- 1.7.3.2 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list