1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

Add missing mutex around clvmd lvmcache_drop_metadata library call.

This commit is contained in:
Alasdair Kergon 2008-05-09 15:13:20 +00:00
parent 5e91e174d3
commit 3d6af3e35e
5 changed files with 21 additions and 5 deletions

View File

@ -1,13 +1,14 @@
Version 2.02.38 - Version 2.02.38 -
================================= =================================
Fix uninitialised mutex in clvmd if all daemons are not running at startup.
Make clvmd-cman use a hash rather than an array for node updown info. Make clvmd-cman use a hash rather than an array for node updown info.
Check lv_count in vg_validate. Check lv_count in vg_validate.
Add --prefixes to reporting tools for field name prefix output format. Add --prefixes to reporting tools for field name prefix output format.
Version 2.02.37 - Version 2.02.37 -
================================= =================================
Avoid unnecessary unlock attempts with LCK_CACHE pseudo-locks. Add missing mutex around clvmd lvmcache_drop_metadata library call.
Fix uninitialised mutex in clvmd if all daemons are not running at startup.
Avoid using DLM locks with LCK_CACHE type P_ lock requests.
When asked to drop cached committed VG metadata, invalidate cached PV labels. When asked to drop cached committed VG metadata, invalidate cached PV labels.
Drop metadata cache before writing precommitted metadata instead of after. Drop metadata cache before writing precommitted metadata instead of after.
Don't touch /dev in vgrename if activation is disabled. Don't touch /dev in vgrename if activation is disabled.

View File

@ -122,7 +122,7 @@ int do_command(struct local_client *client, struct clvm_header *msg, int msglen,
if (strcmp(lockname, "P_#global") == 0) if (strcmp(lockname, "P_#global") == 0)
do_refresh_cache(); do_refresh_cache();
else if (strncmp(lockname, "P_", 2) == 0) else if (strncmp(lockname, "P_", 2) == 0)
lvmcache_drop_metadata(lockname + 2); drop_metadata(lockname + 2);
break; break;
@ -253,7 +253,11 @@ int do_pre_command(struct local_client *client)
break; break;
case CLVMD_CMD_LOCK_VG: case CLVMD_CMD_LOCK_VG:
status = lock_vg(client); lockname = &args[2];
/* Do not use lock for cache related commands */
if (!strncmp(lockname, "V_", 2) ||
!strcmp(lockname, "P_#global"))
status = lock_vg(client);
break; break;
case CLVMD_CMD_LOCK_LV: case CLVMD_CMD_LOCK_LV:

View File

@ -499,6 +499,16 @@ static void drop_vg_locks()
DEBUGLOG("vgs fclose failed: %s\n", strerror(errno)); DEBUGLOG("vgs fclose failed: %s\n", strerror(errno));
} }
/*
* Drop lvmcache metadata
*/
void drop_metadata(const char *vgname)
{
pthread_mutex_lock(&lvm_lock);
lvmcache_drop_metadata(vgname);
pthread_mutex_unlock(&lvm_lock);
}
/* /*
* Ideally, clvmd should be started before any LVs are active * Ideally, clvmd should be started before any LVs are active
* but this may not be the case... * but this may not be the case...

View File

@ -33,5 +33,6 @@ extern int hold_unlock(char *resource);
extern int hold_lock(char *resource, int mode, int flags); extern int hold_lock(char *resource, int mode, int flags);
extern void unlock_all(void); extern void unlock_all(void);
extern char *get_last_lvm_error(void); extern char *get_last_lvm_error(void);
extern void drop_metadata(const char *vgname);
#endif #endif

View File

@ -158,7 +158,7 @@ static void _drop_metadata(const char *vgname)
void lvmcache_drop_metadata(const char *vgname) void lvmcache_drop_metadata(const char *vgname)
{ {
/* For VG_ORPHANS, we need to invalidate all labels on orphan PVs. */ /* For VG_ORPHANS, we need to invalidate all labels on orphan PVs. */
if (strcmp(vgname, VG_ORPHANS)) { if (!strcmp(vgname, VG_ORPHANS)) {
_drop_metadata(FMT_TEXT_ORPHAN_VG_NAME); _drop_metadata(FMT_TEXT_ORPHAN_VG_NAME);
_drop_metadata(FMT_LVM1_ORPHAN_VG_NAME); _drop_metadata(FMT_LVM1_ORPHAN_VG_NAME);
_drop_metadata(FMT_POOL_ORPHAN_VG_NAME); _drop_metadata(FMT_POOL_ORPHAN_VG_NAME);