mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
sanlock: Chown lease files as well
Since sanlock doesn't run under root:root, we have chown()'ed the __LIBVIRT__DISKS__ lease file to the user:group defined in the sanlock config. However, when writing the patch I've forgot about lease files for each disk (this is the /var/lib/libvirt/sanlock/<md5>) file.
This commit is contained in:
parent
e2d7e7c61a
commit
ce753ec5d6
@ -679,6 +679,17 @@ static int virLockManagerSanlockCreateLease(struct sanlk_resource *res)
|
|||||||
}
|
}
|
||||||
VIR_DEBUG("Someone else just created lockspace %s", res->disks[0].path);
|
VIR_DEBUG("Someone else just created lockspace %s", res->disks[0].path);
|
||||||
} else {
|
} else {
|
||||||
|
/* chown() the path to make sure sanlock can access it */
|
||||||
|
if ((driver->user != -1 || driver->group != -1) &&
|
||||||
|
(fchown(fd, driver->user, driver->group) < 0)) {
|
||||||
|
virReportSystemError(errno,
|
||||||
|
_("cannot chown '%s' to (%u, %u)"),
|
||||||
|
res->disks[0].path,
|
||||||
|
(unsigned int) driver->user,
|
||||||
|
(unsigned int) driver->group);
|
||||||
|
goto error_unlink;
|
||||||
|
}
|
||||||
|
|
||||||
if ((rv = sanlock_align(&res->disks[0])) < 0) {
|
if ((rv = sanlock_align(&res->disks[0])) < 0) {
|
||||||
if (rv <= -200)
|
if (rv <= -200)
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user