public inbox for lvm2-cvs@sourceware.org help / color / mirror / Atom feed
From: agk@sourceware.org To: lvm-devel@redhat.com, lvm2-cvs@sourceware.org Subject: LVM2 daemons/clvmd/clvmd-command.c daemons/clv ... Date: Fri, 09 May 2008 19:26:00 -0000 [thread overview] Message-ID: <20080509192658.24864.qmail@sourceware.org> (raw) CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: agk@sourceware.org 2008-05-09 19:26:58 Modified files: daemons/clvmd : clvmd-command.c lvm-functions.c lib/locking : file_locking.c locking.h Log message: more cleanup Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/clvmd/clvmd-command.c.diff?cvsroot=lvm2&r1=1.23&r2=1.24 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/clvmd/lvm-functions.c.diff?cvsroot=lvm2&r1=1.41&r2=1.42 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/locking/file_locking.c.diff?cvsroot=lvm2&r1=1.38&r2=1.39 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/locking/locking.h.diff?cvsroot=lvm2&r1=1.40&r2=1.41 --- LVM2/daemons/clvmd/clvmd-command.c 2008/05/09 18:45:14 1.23 +++ LVM2/daemons/clvmd/clvmd-command.c 2008/05/09 19:26:58 1.24 @@ -119,7 +119,7 @@ /* Check to see if the VG is in use by LVM1 */ status = do_check_lvm1(lockname); /* P_#global causes a full cache refresh */ - if (!strcmp(lockname, "P_#global")) + if (!strcmp(lockname, "P_" VG_GLOBAL)) do_refresh_cache(); else drop_metadata(lockname + 2); --- LVM2/daemons/clvmd/lvm-functions.c 2008/05/09 18:45:14 1.41 +++ LVM2/daemons/clvmd/lvm-functions.c 2008/05/09 19:26:58 1.42 @@ -472,8 +472,8 @@ popen ("lvm pvs --config 'log{command_names=0 prefix=\"\"}' --nolocking --noheadings -o vg_name", "r"); - sync_unlock("P_#orphans", LCK_EXCL); - sync_unlock("P_#global", LCK_EXCL); + sync_unlock("P_" VG_ORPHANS, LCK_EXCL); + sync_unlock("P_" VG_GLOBAL, LCK_EXCL); if (!vgs) return; --- LVM2/lib/locking/file_locking.c 2008/05/09 18:45:15 1.38 +++ LVM2/lib/locking/file_locking.c 2008/05/09 19:26:58 1.39 @@ -210,10 +210,14 @@ switch (flags & LCK_SCOPE_MASK) { case LCK_VG: - if (flags & LCK_CACHE) { + /* Skip cache refresh for VG_GLOBAL - the caller handles it */ + if (strcmp(resource, VG_GLOBAL)) lvmcache_drop_metadata(resource); + + /* LCK_CACHE does not require a real lock */ + if (flags & LCK_CACHE) break; - } + if (*resource == '#') dm_snprintf(lockfile, sizeof(lockfile), "%s/P_%s", _lock_dir, resource + 1); --- LVM2/lib/locking/locking.h 2008/04/15 14:46:19 1.40 +++ LVM2/lib/locking/locking.h 2008/05/09 19:26:58 1.41 @@ -27,9 +27,11 @@ /* * LCK_VG: - * Lock/unlock on-disk volume group data - * Use VG_ORPHANS to lock orphan PVs - * char *vol holds volume group name + * Lock/unlock on-disk volume group data. + * Use VG_ORPHANS to lock all orphan PVs. + * Use VG_GLOBAL as a global lock and to wipe the internal cache. + * char *vol holds volume group name. + * Set the LCK_CACHE flag to invalidate 'vol' in the internal cache. * * LCK_LV: * Lock/unlock an individual logical volume @@ -38,6 +40,13 @@ int lock_vol(struct cmd_context *cmd, const char *vol, uint32_t flags); /* + * Internal locking representation. + * LCK_VG: Uses prefix V_ unless the vol begins with # (i.e. #global or #orphans) + * or the LCK_CACHE flag is set when it uses the prefix P_. + * If LCK_CACHE is set, we do not take out a real lock. + */ + +/* * Does the LVM1 driver have this VG active? */ int check_lvm1_vg_inactive(struct cmd_context *cmd, const char *vgname); @@ -69,7 +78,7 @@ #define LCK_HOLD 0x00000020U /* Hold lock when lock_vol returns? */ #define LCK_LOCAL 0x00000040U /* Don't propagate to other nodes */ #define LCK_CLUSTER_VG 0x00000080U /* VG is clustered */ -#define LCK_CACHE 0x00000100U /* Operation on cache using P_ lock */ +#define LCK_CACHE 0x00000100U /* Operation on cache only using P_ lock */ /* * Additional lock bits for cluster communication
next reply other threads:[~2008-05-09 19:26 UTC|newest] Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top 2008-05-09 19:26 agk [this message] -- strict thread matches above, loose matches on Subject: below -- 2012-03-01 21:14 zkabelac 2008-11-04 15:07 agk 2006-12-01 23:10 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=20080509192658.24864.qmail@sourceware.org \ --to=agk@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).