Distributed Replicated Block Device (DRBD) development
 help / color / mirror / Atom feed
From: Roland Kammerer <roland.kammerer@linbit.com>
To: drbd-dev@lists.linbit.com
Subject: Re: [PATCH v2 2/2] remove lock file after using it
Date: Wed, 28 May 2025 10:11:49 +0200	[thread overview]
Message-ID: <aDbFRcFQpEbhG9E1@arm64> (raw)
In-Reply-To: <20250515024817.25717-3-heming.zhao@suse.com>

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.

  reply	other threads:[~2025-05-28  8:11 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-15  2:48 [PATCH v2 0/2] fix drbd-utils minor issues Heming Zhao
2025-05-15  2:48 ` [PATCH v2 1/2] build: changing SUSE release file Heming Zhao
2025-05-28  8:03   ` Roland Kammerer
2025-05-28 10:08     ` Heming Zhao
2025-05-15  2:48 ` [PATCH v2 2/2] remove lock file after using it Heming Zhao
2025-05-28  8:11   ` Roland Kammerer [this message]
2025-05-29  6:59     ` Heming Zhao
2025-05-29  7:55       ` Heming Zhao
2025-05-29  7:57       ` Heming Zhao

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aDbFRcFQpEbhG9E1@arm64 \
    --to=roland.kammerer@linbit.com \
    --cc=drbd-dev@lists.linbit.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox