From: mbroz@sourceware.org <mbroz@sourceware.org>
To: lvm-devel@redhat.com
Subject: LVM2 ./WHATS_NEW daemons/clvmd/clvmd-command.c ...
Date: 15 Apr 2008 14:46:20 -0000 [thread overview]
Message-ID: <20080415144620.20263.qmail@sourceware.org> (raw)
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: mbroz at sourceware.org 2008-04-15 14:46:19
Modified files:
. : WHATS_NEW
daemons/clvmd : clvmd-command.c
lib/cache : lvmcache.c lvmcache.h
lib/locking : cluster_locking.c file_locking.c locking.c
locking.h
lib/metadata : metadata.c
Log message:
Drop cached VG metadata before and after committing changes to it.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.850&r2=1.851
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/clvmd/clvmd-command.c.diff?cvsroot=lvm2&r1=1.20&r2=1.21
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/cache/lvmcache.c.diff?cvsroot=lvm2&r1=1.44&r2=1.45
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/cache/lvmcache.h.diff?cvsroot=lvm2&r1=1.21&r2=1.22
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/locking/cluster_locking.c.diff?cvsroot=lvm2&r1=1.27&r2=1.28
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/locking/file_locking.c.diff?cvsroot=lvm2&r1=1.36&r2=1.37
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/locking/locking.c.diff?cvsroot=lvm2&r1=1.46&r2=1.47
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/locking/locking.h.diff?cvsroot=lvm2&r1=1.39&r2=1.40
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata.c.diff?cvsroot=lvm2&r1=1.170&r2=1.171
--- LVM2/WHATS_NEW 2008/04/15 11:36:46 1.850
+++ LVM2/WHATS_NEW 2008/04/15 14:46:18 1.851
@@ -1,5 +1,6 @@
Version 2.02.35 -
=================================
+ Drop cached VG metadata before and after committing changes to it.
Rename P_global to P_#global.
Don't attempt remote metadata backups of non-clustered VGs. (2.02.29)
Don't store fid in VG metadata cache to avoid clvmd segfault. (2.02.34)
--- LVM2/daemons/clvmd/clvmd-command.c 2008/04/15 11:36:46 1.20
+++ LVM2/daemons/clvmd/clvmd-command.c 2008/04/15 14:46:18 1.21
@@ -121,6 +121,8 @@
/* P_#global causes a cache refresh */
if (strcmp(lockname, "P_#global") == 0)
do_refresh_cache();
+ else if (strncmp(lockname, "P_", 2) == 0)
+ lvmcache_drop_metadata(lockname + 2);
break;
--- LVM2/lib/cache/lvmcache.c 2008/04/14 19:24:15 1.44
+++ LVM2/lib/cache/lvmcache.c 2008/04/15 14:46:18 1.45
@@ -130,6 +130,16 @@
_update_cache_vginfo_lock_state(vginfo, locked);
}
+void lvmcache_drop_metadata(const char *vgname)
+{
+ struct lvmcache_vginfo *vginfo;
+
+ if (!(vginfo = vginfo_from_vgname(vgname, NULL)))
+ return;
+
+ _free_cached_vgmetadata(vginfo);
+}
+
void lvmcache_lock_vgname(const char *vgname, int read_only __attribute((unused)))
{
if (!_lock_hash && !lvmcache_init()) {
--- LVM2/lib/cache/lvmcache.h 2008/04/14 19:24:16 1.21
+++ LVM2/lib/cache/lvmcache.h 2008/04/15 14:46:18 1.22
@@ -111,5 +111,6 @@
/* Returns cached volume group metadata. */
struct volume_group *lvmcache_get_vg(const char *vgid, unsigned precommitted);
+void lvmcache_drop_metadata(const char *vgname);
#endif
--- LVM2/lib/locking/cluster_locking.c 2008/04/15 11:36:46 1.27
+++ LVM2/lib/locking/cluster_locking.c 2008/04/15 14:46:19 1.28
@@ -389,7 +389,7 @@
/* If the VG name is empty then lock the unused PVs */
if (!*resource) /* FIXME Deprecated */
dm_snprintf(lockname, sizeof(lockname), "P_orphans");
- else if (*resource == '#')
+ else if (*resource == '#' || (flags & LCK_CACHE))
dm_snprintf(lockname, sizeof(lockname), "P_%s", resource);
else
dm_snprintf(lockname, sizeof(lockname), "V_%s",
--- LVM2/lib/locking/file_locking.c 2008/04/07 19:17:29 1.36
+++ LVM2/lib/locking/file_locking.c 2008/04/15 14:46:19 1.37
@@ -21,6 +21,7 @@
#include "defaults.h"
#include "lvm-file.h"
#include "lvm-string.h"
+#include "lvmcache.h"
#include <limits.h>
#include <unistd.h>
@@ -209,6 +210,10 @@
switch (flags & LCK_SCOPE_MASK) {
case LCK_VG:
+ if (flags & LCK_CACHE) {
+ lvmcache_drop_metadata(resource);
+ break;
+ }
if (!*resource) /* FIXME Deprecated */
dm_snprintf(lockfile, sizeof(lockfile),
"%s/P_orphans", _lock_dir);
--- LVM2/lib/locking/locking.c 2008/04/09 12:56:34 1.46
+++ LVM2/lib/locking/locking.c 2008/04/15 14:46:19 1.47
@@ -324,7 +324,8 @@
assert(resource);
if ((ret = _locking.lock_resource(cmd, resource, flags))) {
- if ((flags & LCK_SCOPE_MASK) == LCK_VG) {
+ if ((flags & LCK_SCOPE_MASK) == LCK_VG &&
+ !(flags & LCK_CACHE)) {
if ((flags & LCK_TYPE_MASK) == LCK_UNLOCK)
lvmcache_unlock_vgname(resource);
else
--- LVM2/lib/locking/locking.h 2008/04/10 17:09:31 1.39
+++ LVM2/lib/locking/locking.h 2008/04/15 14:46:19 1.40
@@ -69,6 +69,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 */
/*
* Additional lock bits for cluster communication
@@ -91,6 +92,7 @@
#define LCK_VG_READ (LCK_VG | LCK_READ | LCK_HOLD)
#define LCK_VG_WRITE (LCK_VG | LCK_WRITE | LCK_HOLD)
#define LCK_VG_UNLOCK (LCK_VG | LCK_UNLOCK)
+#define LCK_VG_DROP_CACHE (LCK_VG | LCK_WRITE | LCK_CACHE)
#define LCK_LV_EXCLUSIVE (LCK_LV | LCK_EXCL | LCK_NONBLOCK)
#define LCK_LV_SUSPEND (LCK_LV | LCK_WRITE | LCK_NONBLOCK)
@@ -116,6 +118,8 @@
lock_lv_vol(cmd, lv, LCK_LV_ACTIVATE | LCK_HOLD | LCK_LOCAL)
#define deactivate_lv_local(cmd, lv) \
lock_lv_vol(cmd, lv, LCK_LV_DEACTIVATE | LCK_LOCAL)
+#define drop_cached_metadata(vg) \
+ lock_vol((vg)->cmd, (vg)->name, LCK_VG_DROP_CACHE)
/* Process list of LVs */
int suspend_lvs(struct cmd_context *cmd, struct list *lvs);
--- LVM2/lib/metadata/metadata.c 2008/04/10 19:59:42 1.170
+++ LVM2/lib/metadata/metadata.c 2008/04/15 14:46:19 1.171
@@ -1333,6 +1333,11 @@
return cache_updated;
}
+ if (!drop_cached_metadata(vg)) {
+ log_error("Unable to drop cached metadata for VG %s.", vg->name);
+ return 0;
+ }
+
/* Commit to each copy of the metadata area */
list_iterate_items(mda, &vg->fid->metadata_areas) {
failed = 0;
@@ -1348,6 +1353,10 @@
}
}
+ if (!drop_cached_metadata(vg))
+ log_error("Attempt to drop cached metadata failed "
+ "after commit for VG %s.", vg->name);
+
/* If at least one mda commit succeeded, it was committed */
return cache_updated;
}
next reply other threads:[~2008-04-15 14:46 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-04-15 14:46 mbroz [this message]
-- strict thread matches above, loose matches on Subject: below --
2011-09-26 7:51 LVM2 ./WHATS_NEW daemons/clvmd/clvmd-command.c zkabelac
2011-06-01 21:16 agk
2011-04-08 14:40 zkabelac
2011-02-18 16:17 zkabelac
2011-02-04 19:18 zkabelac
2011-01-31 19:52 zkabelac
2011-01-17 23:13 mbroz
2011-01-10 14:02 zkabelac
2010-06-17 12:48 mbroz
2010-06-04 12:59 mbroz
2010-01-05 16:07 mbroz
2010-01-05 16:05 mbroz
2009-12-09 18:42 mbroz
2009-04-22 9:39 mbroz
2008-05-09 18:45 agk
2008-05-09 15:13 agk
2008-04-15 11:36 agk
2006-12-11 14:00 pcaulfield
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=20080415144620.20263.qmail@sourceware.org \
--to=mbroz@sourceware.org \
--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.