master - metadata: add INTERNAL_ERROR to "Metadata inconsistency" msg
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=6b35c70e8b17b0...
Commit: 6b35c70e8b17b09691d2db6ea2eadba2ee2d095d
Parent: 029b8fbe767e63f1d0a4f6c81a0095af46e9a000
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Thu Oct 10 13:34:43 2013 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Thu Oct 10 13:34:43 2013 +0200
metadata: add INTERNAL_ERROR to "Metadata inconsistency" msg
So we can spot it better if it occurs.
---
lib/format_text/flags.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/format_text/flags.c b/lib/format_text/flags.c
index 6801d6c..a27b791 100644
--- a/lib/format_text/flags.c
+++ b/lib/format_text/flags.c
@@ -145,8 +145,8 @@ int print_flags(uint64_t status, int type, char *buffer, size_t size)
return 0;
if (status)
- log_warn("Metadata inconsistency: Not all flags successfully "
- "exported.");
+ log_warn(INTERNAL_ERROR "Metadata inconsistency: "
+ "Not all flags successfully exported.");
return 1;
}
10 years, 6 months
master - metadata: properly register LV_NOSCAN flag
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=029b8fbe767e63...
Commit: 029b8fbe767e63f1d0a4f6c81a0095af46e9a000
Parent: 304159c99ab59c61543cac747e47a1ff59d2dbb6
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Thu Oct 10 13:24:32 2013 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Thu Oct 10 13:24:32 2013 +0200
metadata: properly register LV_NOSCAN flag
Addendum to commit ce7489e which introduced a new *internal* LV_NOSCAN
flag and so it needs to be marked that way properly otherwise it
ends up unrecognized and improperly handled during metadata export.
---
lib/format_text/flags.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/lib/format_text/flags.c b/lib/format_text/flags.c
index 5077576..6801d6c 100644
--- a/lib/format_text/flags.c
+++ b/lib/format_text/flags.c
@@ -61,6 +61,7 @@ static const struct flag _lv_flags[] = {
{LV_REBUILD, "REBUILD", STATUS_FLAG},
{LV_WRITEMOSTLY, "WRITEMOSTLY", STATUS_FLAG},
{LV_ACTIVATION_SKIP, "ACTIVATION_SKIP", COMPATIBLE_FLAG},
+ {LV_NOSCAN, NULL, 0},
{POOL_METADATA_SPARE, NULL, 0},
{RAID, NULL, 0},
{RAID_META, NULL, 0},
10 years, 6 months
master - cleanup: WHATS_NEW + compiler warning about discarding const
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=304159c99ab59c...
Commit: 304159c99ab59c61543cac747e47a1ff59d2dbb6
Parent: 7d299ecbb3a56f1633f17f746f864c02cd344c85
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Thu Oct 10 09:07:42 2013 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Thu Oct 10 09:09:16 2013 +0200
cleanup: WHATS_NEW + compiler warning about discarding const
---
WHATS_NEW | 3 +++
daemons/lvmetad/lvmetad-core.c | 2 +-
2 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index a87a906..d0ed2ce 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,8 @@
Version 2.02.104
===================================
+ Fix possible race during daemon worker thread creation (lvmetad).
+ Fix possible deadlock while clearing lvmetad cache for full rescan.
+ Fix possible race while creating/destroying memory pools.
Recognise NVM Express devices in filter.
Fix failing metadata repair when lvmetad is used.
Fix incorrect memory handling when reading messages from lvmetad.
diff --git a/daemons/lvmetad/lvmetad-core.c b/daemons/lvmetad/lvmetad-core.c
index 5a841e0..285c8cc 100644
--- a/daemons/lvmetad/lvmetad-core.c
+++ b/daemons/lvmetad/lvmetad-core.c
@@ -796,7 +796,7 @@ static response pv_gone(lvmetad_state *s, request r)
pvmeta = dm_hash_lookup(s->pvid_to_pvmeta, pvid);
pvid_old = dm_hash_lookup_binary(s->device_to_pvid, &device, sizeof(device));
- const char *vgid = dm_hash_lookup(s->pvid_to_vgid, pvid);
+ char *vgid = dm_hash_lookup(s->pvid_to_vgid, pvid);
if (vgid && !(vgid = dm_strdup(vgid))) {
unlock_pvid_to_pvmeta(s);
10 years, 6 months
master - libdaemon: Fix a subtle race in worker thread creation.
by Petr Rockai
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=7d299ecbb3a56f...
Commit: 7d299ecbb3a56f1633f17f746f864c02cd344c85
Parent: cb613d4c101d7e9f51d70d55c1c71a471e6588ab
Author: Petr Rockai <prockai(a)redhat.com>
AuthorDate: Wed Oct 9 22:20:36 2013 +0200
Committer: Petr Rockai <prockai(a)redhat.com>
CommitterDate: Thu Oct 10 00:34:35 2013 +0200
libdaemon: Fix a subtle race in worker thread creation.
---
libdaemon/server/daemon-server.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/libdaemon/server/daemon-server.c b/libdaemon/server/daemon-server.c
index df2c852..b114b9f 100644
--- a/libdaemon/server/daemon-server.c
+++ b/libdaemon/server/daemon-server.c
@@ -381,6 +381,7 @@ static void *client_thread(void *baton)
request req;
response res;
+ b->client.thread_id = pthread_self();
buffer_init(&req.buffer);
while (1) {
@@ -431,6 +432,7 @@ static int handle_connect(daemon_state s)
struct sockaddr_un sockaddr;
client_handle client = { .thread_id = 0 };
socklen_t sl = sizeof(sockaddr);
+ pthread_t tid;
client.socket_fd = accept(s.socket_fd, (struct sockaddr *) &sockaddr, &sl);
if (client.socket_fd < 0)
@@ -446,10 +448,10 @@ static int handle_connect(daemon_state s)
baton->s = s;
baton->client = client;
- if (pthread_create(&baton->client.thread_id, NULL, client_thread, baton))
+ if (pthread_create(&tid, NULL, client_thread, baton))
return 0;
- pthread_detach(baton->client.thread_id);
+ pthread_detach(tid);
return 1;
}
10 years, 6 months
master - lvmetad: Fix a possible deadlock in pv_clear_all.
by Petr Rockai
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=cb613d4c101d7e...
Commit: cb613d4c101d7e9f51d70d55c1c71a471e6588ab
Parent: b5aad86710be57833879ac0e8609021828949682
Author: Petr Rockai <prockai(a)redhat.com>
AuthorDate: Wed Oct 9 22:19:51 2013 +0200
Committer: Petr Rockai <prockai(a)redhat.com>
CommitterDate: Thu Oct 10 00:34:35 2013 +0200
lvmetad: Fix a possible deadlock in pv_clear_all.
---
daemons/lvmetad/lvmetad-core.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/daemons/lvmetad/lvmetad-core.c b/daemons/lvmetad/lvmetad-core.c
index ed44def..5a841e0 100644
--- a/daemons/lvmetad/lvmetad-core.c
+++ b/daemons/lvmetad/lvmetad-core.c
@@ -829,8 +829,8 @@ static response pv_clear_all(lvmetad_state *s, request r)
DEBUGLOG(s, "pv_clear_all");
lock_pvid_to_pvmeta(s);
- lock_vgid_to_metadata(s);
lock_pvid_to_vgid(s);
+ lock_vgid_to_metadata(s);
destroy_metadata_hashes(s);
create_metadata_hashes(s);
10 years, 6 months
master - libdm: Fix a data race in dm_pool_{create, destroy}.
by Petr Rockai
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=b5aad86710be57...
Commit: b5aad86710be57833879ac0e8609021828949682
Parent: 529a13ec8907d5693b64ca7063491db059533820
Author: Petr Rockai <prockai(a)redhat.com>
AuthorDate: Wed Oct 9 22:19:06 2013 +0200
Committer: Petr Rockai <prockai(a)redhat.com>
CommitterDate: Thu Oct 10 00:34:35 2013 +0200
libdm: Fix a data race in dm_pool_{create,destroy}.
---
libdm/mm/pool-fast.c | 4 ++++
libdm/mm/pool.c | 9 +++++++--
2 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/libdm/mm/pool-fast.c b/libdm/mm/pool-fast.c
index 2b494d6..edb31a0 100644
--- a/libdm/mm/pool-fast.c
+++ b/libdm/mm/pool-fast.c
@@ -62,7 +62,9 @@ struct dm_pool *dm_pool_create(const char *name, size_t chunk_hint)
while (new_size < p->chunk_size)
new_size <<= 1;
p->chunk_size = new_size;
+ pthread_mutex_lock(&_dm_pools_mutex);
dm_list_add(&_dm_pools, &p->list);
+ pthread_mutex_unlock(&_dm_pools_mutex);
return p;
}
@@ -77,7 +79,9 @@ void dm_pool_destroy(struct dm_pool *p)
c = pr;
}
+ pthread_mutex_lock(&_dm_pools_mutex);
dm_list_del(&p->list);
+ pthread_mutex_unlock(&_dm_pools_mutex);
dm_free(p);
}
diff --git a/libdm/mm/pool.c b/libdm/mm/pool.c
index fd08307..ef006a4 100644
--- a/libdm/mm/pool.c
+++ b/libdm/mm/pool.c
@@ -15,9 +15,10 @@
#include "dmlib.h"
#include <sys/mman.h>
+#include <pthread.h>
-/* FIXME: thread unsafe */
static DM_LIST_INIT(_dm_pools);
+static pthread_mutex_t _dm_pools_mutex = PTHREAD_MUTEX_INITIALIZER;
void dm_pools_check_leaks(void);
#ifdef DEBUG_ENFORCE_POOL_LOCKING
@@ -81,8 +82,11 @@ void dm_pools_check_leaks(void)
{
struct dm_pool *p;
- if (dm_list_empty(&_dm_pools))
+ pthread_mutex_lock(&_dm_pools_mutex);
+ if (dm_list_empty(&_dm_pools)) {
+ pthread_mutex_unlock(&_dm_pools_mutex);
return;
+ }
log_error("You have a memory leak (not released memory pool):");
dm_list_iterate_items(p, &_dm_pools) {
@@ -94,6 +98,7 @@ void dm_pools_check_leaks(void)
log_error(" [%p] %s", p, p->name);
#endif
}
+ pthread_mutex_unlock(&_dm_pools_mutex);
log_error(INTERNAL_ERROR "Unreleased memory pool(s) found.");
}
10 years, 6 months
master - libdm: Link to libpthread unconditionally.
by Petr Rockai
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=529a13ec8907d5...
Commit: 529a13ec8907d5693b64ca7063491db059533820
Parent: 7bed6d1263c5a65dbdf8e6d6ead021009aa9a59a
Author: Petr Rockai <prockai(a)redhat.com>
AuthorDate: Thu Oct 10 00:27:53 2013 +0200
Committer: Petr Rockai <prockai(a)redhat.com>
CommitterDate: Thu Oct 10 00:34:35 2013 +0200
libdm: Link to libpthread unconditionally.
---
configure.in | 6 ++----
libdm/Makefile.in | 2 +-
2 files changed, 3 insertions(+), 5 deletions(-)
diff --git a/configure.in b/configure.in
index 611ab37..3bd2439 100644
--- a/configure.in
+++ b/configure.in
@@ -1181,10 +1181,8 @@ Features cannot be 'shared' when building statically
fi
################################################################################
-if [[ "$DMEVENTD" = yes -o "$CLVMD" != none ]] ; then
- AC_CHECK_LIB([pthread], [pthread_mutex_lock],
- [PTHREAD_LIBS="-lpthread"], hard_bailout)
-fi
+AC_CHECK_LIB([pthread], [pthread_mutex_lock],
+ [PTHREAD_LIBS="-lpthread"], hard_bailout)
################################################################################
dnl -- Disable selinux
diff --git a/libdm/Makefile.in b/libdm/Makefile.in
index bddb0a0..2aa70d4 100644
--- a/libdm/Makefile.in
+++ b/libdm/Makefile.in
@@ -57,7 +57,7 @@ include $(top_builddir)/make.tmpl
DEFS += -DDM_DEVICE_UID=@DM_DEVICE_UID@ -DDM_DEVICE_GID=@DM_DEVICE_GID@ \
-DDM_DEVICE_MODE=@DM_DEVICE_MODE@
-LIBS += $(SELINUX_LIBS) $(UDEV_LIBS)
+LIBS += $(SELINUX_LIBS) $(UDEV_LIBS) $(PTHREAD_LIBS)
device-mapper: all
10 years, 6 months
master - filters: Add NVM Express (nvme).
by Alasdair Kergon
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=7bed6d1263c5a6...
Commit: 7bed6d1263c5a65dbdf8e6d6ead021009aa9a59a
Parent: 1b91847beb38c3bd522a6ecb62e0a275825c0b5d
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Wed Oct 9 20:08:07 2013 +0100
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Wed Oct 9 20:08:07 2013 +0100
filters: Add NVM Express (nvme).
---
WHATS_NEW | 1 +
lib/device/device-types.h | 1 +
2 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index dd274da..a87a906 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.104
===================================
+ Recognise NVM Express devices in filter.
Fix failing metadata repair when lvmetad is used.
Fix incorrect memory handling when reading messages from lvmetad.
Fix locking in lvmetad when handling the PV which is gone.
diff --git a/lib/device/device-types.h b/lib/device/device-types.h
index d25c2f0..d716878 100644
--- a/lib/device/device-types.h
+++ b/lib/device/device-types.h
@@ -61,5 +61,6 @@ static const dev_known_type_t _dev_known_types[] = {
{"skd", 16, "STEC"},
{"scm", 8, "Storage Class Memory (IBM S/390)"},
{"bcache", 1, "bcache block device cache"},
+ {"nvme", 64, "NVM Express"},
{"", 0, ""}
};
10 years, 6 months
master - WHATS_NEW: commit 0decd75
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=1b91847beb38c3...
Commit: 1b91847beb38c3bd522a6ecb62e0a275825c0b5d
Parent: bcb44281b7c379ed3310b5f9a16ce380d84f31dc
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Wed Oct 9 15:59:19 2013 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Wed Oct 9 15:59:19 2013 +0200
WHATS_NEW: commit 0decd75
---
WHATS_NEW | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 39c5b05..dd274da 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.104
===================================
+ Fix failing metadata repair when lvmetad is used.
Fix incorrect memory handling when reading messages from lvmetad.
Fix locking in lvmetad when handling the PV which is gone.
Recognize new flag to skip udev scanning in udev rules and act appropriately.
10 years, 6 months
master - lvmetad: Do not try to lock a NULL vgid.
by Petr Rockai
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=bcb44281b7c379...
Commit: bcb44281b7c379ed3310b5f9a16ce380d84f31dc
Parent: 17f3b8280b8ade397a6a4a8fd82ba7dd7d0e1d1b
Author: Petr Rockai <prockai(a)redhat.com>
AuthorDate: Wed Oct 9 14:53:58 2013 +0200
Committer: Petr Rockai <prockai(a)redhat.com>
CommitterDate: Wed Oct 9 14:56:06 2013 +0200
lvmetad: Do not try to lock a NULL vgid.
---
daemons/lvmetad/lvmetad-core.c | 15 ++++++++-------
1 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/daemons/lvmetad/lvmetad-core.c b/daemons/lvmetad/lvmetad-core.c
index b7a3023..ed44def 100644
--- a/daemons/lvmetad/lvmetad-core.c
+++ b/daemons/lvmetad/lvmetad-core.c
@@ -796,9 +796,9 @@ static response pv_gone(lvmetad_state *s, request r)
pvmeta = dm_hash_lookup(s->pvid_to_pvmeta, pvid);
pvid_old = dm_hash_lookup_binary(s->device_to_pvid, &device, sizeof(device));
- char *vgid = dm_strdup(dm_hash_lookup(s->pvid_to_vgid, pvid));
+ const char *vgid = dm_hash_lookup(s->pvid_to_vgid, pvid);
- if (!vgid) {
+ if (vgid && !(vgid = dm_strdup(vgid))) {
unlock_pvid_to_pvmeta(s);
return reply_fail("out of memory");
}
@@ -807,11 +807,12 @@ static response pv_gone(lvmetad_state *s, request r)
dm_hash_remove(s->pvid_to_pvmeta, pvid);
unlock_pvid_to_pvmeta(s);
- lock_vg(s, vgid);
- vg_remove_if_missing(s, vgid, 1);
- unlock_vg(s, vgid);
-
- dm_free(vgid);
+ if (vgid) {
+ lock_vg(s, vgid);
+ vg_remove_if_missing(s, vgid, 1);
+ unlock_vg(s, vgid);
+ dm_free(vgid);
+ }
if (pvid_old)
dm_free(pvid_old);
10 years, 6 months