mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-25 07:05:28 +00:00
storage: improve handling of symlinks in gluster
With this patch, dangling and looping symlinks are silently ignored, while links to files and directories are treated the same as the underlying file or directory. This is the same behavior as both 'directory' and 'netfs' pools. * src/storage/storage_backend_gluster.c (virStorageBackendGlusterRefreshVol): Treat symlinks similar to directory and netfs pools. Signed-off-by: Eric Blake <eblake@redhat.com>
This commit is contained in:
parent
13e738cc0a
commit
79eb21f976
@ -166,6 +166,17 @@ virStorageBackendGlusterRefreshVol(virStorageBackendGlusterStatePtr state,
|
|||||||
if (STREQ(name, ".") || STREQ(name, ".."))
|
if (STREQ(name, ".") || STREQ(name, ".."))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
/* Follow symlinks; silently skip broken links and loops. */
|
||||||
|
if (S_ISLNK(st->st_mode) && glfs_stat(state->vol, name, st) < 0) {
|
||||||
|
if (errno == ENOENT || errno == ELOOP) {
|
||||||
|
VIR_WARN("ignoring dangling symlink '%s'", name);
|
||||||
|
ret = 0;
|
||||||
|
} else {
|
||||||
|
virReportSystemError(errno, _("cannot stat '%s'"), name);
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
if (VIR_ALLOC(vol) < 0)
|
if (VIR_ALLOC(vol) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user