All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Teigland <teigland@redhat.com>
To: lvm-devel@redhat.com
Subject: [LVM2 RFCv1 4/5] lib: locking: Parse PV list for IDM locking
Date: Wed, 28 Apr 2021 14:39:27 -0500	[thread overview]
Message-ID: <20210428193927.GE9566@redhat.com> (raw)
In-Reply-To: <20210425022241.5055-5-leo.yan@linaro.org>

On Sun, Apr 25, 2021 at 10:22:40AM +0800, Leo Yan wrote:
> +static void _lockd_retrive_lv_pv_list(struct volume_group *vg,
> +				      const char *lv_name,
> +				      struct lvmlockd_pvs *lock_pvs)
> +{

It looks like this wants a list of PVs (names) used by the LV.  Try
iterating through all PVs in the VG and using the existing lv_is_on_pv()
function to check if the LV is using that PV, e.g.

for each pv in vg->pvs,
	if (lv_is_on_pv(lv, pv))
		copy the pv name;

You could pass the lv struct through to here, or use find_lv(vg, lv_name)
to get it again here.

> @@ -251,7 +485,16 @@ static int _lockd_request(struct cmd_context *cmd,
>  	if (vg_name && lv_name) {
> -		reply = _lockd_send(req_name,
> +		/*
> +		 * For LV operation, the PV list must be passed for idm,
> +		 * otherwise, IDM lock manager has no idea to send locking
> +		 * request to which drives, so return failure.
> +		 */
> +		if (!lock_pvs)
> +			return 1;
> +
> +		reply = _lockd_send_with_pvs(req_name,

Requires other lock managers to include lock_pvs?

> +	/*
> +	 * Create the VG's PV list when start the VG, the PV list
> +	 * is passed to lvmlockd, and the the PVs path will be used
> +	 * to send SCSI commands for idm locking scheme.
> +	 */

if vg->lock_type is IDM before creating pv_list?

> +	_lockd_retrive_vg_pv_list(vg, &lock_pvs);
> +
> +	reply = _lockd_send_with_pvs("start_vg",
> +				&lock_pvs,

and probably NULL instead of &lock_pvs for non-IDM.

Dave



  reply	other threads:[~2021-04-28 19:39 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-25  2:22 [LVM2 RFCv1 0/5] Enable In-Drive-Mutex Locking scheme Leo Yan
2021-04-25  2:22 ` [LVM2 RFCv1 1/5] lvmlockd: idm: Introduce new locking scheme Leo Yan
2021-04-28 19:54   ` David Teigland
2021-04-29  3:26     ` Leo Yan
2021-04-29 15:31       ` David Teigland
2021-04-25  2:22 ` [LVM2 RFCv1 2/5] lvmlockd: idm: Hook Seagate IDM wrapper APIs Leo Yan
2021-04-25  2:22 ` [LVM2 RFCv1 3/5] lib: locking: Add new type "idm" Leo Yan
2021-04-25  2:22 ` [LVM2 RFCv1 4/5] lib: locking: Parse PV list for IDM locking Leo Yan
2021-04-28 19:39   ` David Teigland [this message]
2021-04-29  3:12     ` Leo Yan
2021-04-29  3:36       ` Leo Yan
2021-04-25  2:22 ` [LVM2 RFCv1 5/5] tools: Add support for "idm" lock type Leo Yan
2021-04-27 22:23 ` [LVM2 RFCv1 0/5] Enable In-Drive-Mutex Locking scheme David Teigland
2021-04-28  1:50   ` Leo Yan

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=20210428193927.GE9566@redhat.com \
    --to=teigland@redhat.com \
    --cc=lvm-devel@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.