public inbox for lvm2-cvs@sourceware.org help / color / mirror / Atom feed
From: wysochanski@sourceware.org To: lvm-devel@redhat.com, lvm2-cvs@sourceware.org Subject: LVM2/lib/activate activate.c activate.h Date: Thu, 10 Apr 2008 21:34:00 -0000 [thread overview] Message-ID: <20080410213419.14041.qmail@sourceware.org> (raw) CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: wysochanski@sourceware.org 2008-04-10 21:34:18 Modified files: lib/activate : activate.c activate.h Log message: Add lv_is_active() to determine whether an lv is active. Handles non-clustered as well as clustered. For clustered, the best we can do is try exclusive local activation. If this succeeds, we know it is not active elsewhere in the cluster. Otherwise, we assume it is active elsewhere. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/activate/activate.c.diff?cvsroot=lvm2&r1=1.134&r2=1.135 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/activate/activate.h.diff?cvsroot=lvm2&r1=1.60&r2=1.61 --- LVM2/lib/activate/activate.c 2008/04/07 10:23:46 1.134 +++ LVM2/lib/activate/activate.c 2008/04/10 21:34:18 1.135 @@ -674,6 +674,38 @@ } /* + * Determine whether an LV is active locally or in a cluster. + * Assumes vg lock held. + * Returns: + * 0 - not active locally or on any node in cluster + * 1 - active either locally or some node in the cluster + */ +int lv_is_active(struct logical_volume *lv) +{ + if (_lv_active(lv->vg->cmd, lv, 0)) + return 1; + + if (!vg_is_clustered(lv->vg)) + return 0; + + /* + * FIXME: Cluster does not report per-node LV activation status. + * Currently the best we can do is try exclusive local activation. + * If that succeeds, we know the LV is not active elsewhere in the + * cluster. + */ + if (activate_lv_excl(lv->vg->cmd, lv)) { + deactivate_lv(lv->vg->cmd, lv); + return 0; + } + + /* + * Exclusive local activation failed so assume it is active elsewhere. + */ + return 1; +} + +/* * Returns 0 if an attempt to (un)monitor the device failed. * Returns 1 otherwise. */ --- LVM2/lib/activate/activate.h 2008/04/07 10:23:46 1.60 +++ LVM2/lib/activate/activate.h 2008/04/10 21:34:18 1.61 @@ -91,6 +91,7 @@ int lvs_in_vg_activated_by_uuid_only(struct volume_group *vg); int lvs_in_vg_opened(const struct volume_group *vg); +int lv_is_active(struct logical_volume *lv); int monitor_dev_for_events(struct cmd_context *cmd, struct logical_volume *lv, int do_reg);
next reply other threads:[~2008-04-10 21:34 UTC|newest] Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top 2008-04-10 21:34 wysochanski [this message] -- strict thread matches above, loose matches on Subject: below -- 2011-12-21 13:10 zkabelac 2011-11-11 15:14 mbroz 2004-03-26 19:52 agk 2004-03-26 15:35 agk 2004-03-08 18:54 agk
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=20080410213419.14041.qmail@sourceware.org \ --to=wysochanski@sourceware.org \ --cc=lvm-devel@redhat.com \ --cc=lvm2-cvs@sourceware.org \ /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: linkBe 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; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).