[PATCH v2 2/2] remove lock file after using it
Roland Kammerer
roland.kammerer at linbit.com
Wed May 28 10:11:49 CEST 2025
On Thu, May 15, 2025 at 10:48:15AM +0800, Heming Zhao wrote:
> In a SELinux env, if a user runs as root to set up a DRBD device,
> it will leave a lock file in "/var/run/drbd/lock/". Then HA pacemaker
> will fail to set up DRBD because of a permission issue.
Sorry, but that needs more explanation. I wonder why it works for
everybody else including our SuSE customers but would require changes
for you? What exactly (sles versions, pacemaker versions,...) do I need
to reproduce this?
> /* ignore errors */
> -void dt_unlock_drbd(int lock_fd)
> +void dt_unlock_drbd(int lock_fd, int minor)
> {
> + int ret;
> + char *lfname;
> +
> if (lock_fd >= 0)
> unlock_fd(lock_fd);
> +
> + lfname = get_lock_filename(minor, 0);
> + ret = unlink(lfname);
> + free(lfname);
> + if (ret < 0) {
> + perror("unlink");
> + }
> }
As I don't understand why you would need these changes in the first
place I did not look into the patch too closely, but: You first unlock
and then unlink? Shouldn't that be the other way round? As is you would
create a race I guess. But first things first: why do you need that at
all?
Regards, rck
P.S.: it is fine to send user land patches here, but the main focus is
on kernel level coordination, feel free to send patches via github.
More information about the drbd-dev
mailing list