diff --git a/src/locking/lock_driver_sanlock.c b/src/locking/lock_driver_sanlock.c index 75ced845c2612d1f254bb4307ae38464be972ac8..c955003072e78ea37658dc2041bd393fdfb80549 100644 --- a/src/locking/lock_driver_sanlock.c +++ b/src/locking/lock_driver_sanlock.c @@ -679,6 +679,17 @@ static int virLockManagerSanlockCreateLease(struct sanlk_resource *res) } VIR_DEBUG("Someone else just created lockspace %s", res->disks[0].path); } 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 <= -200) virReportError(VIR_ERR_INTERNAL_ERROR,