master - udev: keep DM_ACTIVATION and DM_UDEV_PRIMARY_SOURCE_FLAG meaning as before commit 8d1d835
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=6940e24aeeff3d...
Commit: 6940e24aeeff3d6c5c8da259b74afd908b4716f2
Parent: 4d544004863b3d443fbeca11d264a324275958bd
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Thu Sep 12 13:46:20 2013 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Thu Sep 12 13:49:02 2013 +0200
udev: keep DM_ACTIVATION and DM_UDEV_PRIMARY_SOURCE_FLAG meaning as before commit 8d1d835
The DM_ACTIVATION and DM_UDEV_PRIMARY_SOURCE_FLAG needs to be kept the
way it was for backward compatibility (e.g. the old rules are still
in initramfs). This way the check in whether the device should be
scanned in 69-dm-lvmetad.rules is even easier.
---
udev/10-dm.rules.in | 18 ++++++++++--------
udev/69-dm-lvm-metad.rules.in | 3 +--
2 files changed, 11 insertions(+), 10 deletions(-)
diff --git a/udev/10-dm.rules.in b/udev/10-dm.rules.in
index f495103..bc9681f 100644
--- a/udev/10-dm.rules.in
+++ b/udev/10-dm.rules.in
@@ -45,13 +45,14 @@ ENV{DISK_RO}=="1", GOTO="dm_disable"
# in libdevmapper so we need to detect this and try to behave correctly.
# For such spurious events, regenerate all flags from current udev database content
# (this information would normally be inaccessible for spurious ADD and CHANGE events).
-ENV{DM_UDEV_PRIMARY_SOURCE_FLAG}=="1", ENV{DM_ACTIVATED}="1", GOTO="dm_flags_done"
+ENV{DM_UDEV_PRIMARY_SOURCE_FLAG}=="1", ENV{DM_ACTIVATION}="1", GOTO="dm_flags_done"
IMPORT{db}="DM_UDEV_DISABLE_DM_RULES_FLAG"
IMPORT{db}="DM_UDEV_DISABLE_SUBSYSTEM_RULES_FLAG"
IMPORT{db}="DM_UDEV_DISABLE_DISK_RULES_FLAG"
IMPORT{db}="DM_UDEV_DISABLE_OTHER_RULES_FLAG"
IMPORT{db}="DM_UDEV_LOW_PRIORITY_FLAG"
IMPORT{db}="DM_UDEV_DISABLE_LIBRARY_FALLBACK_FLAG"
+IMPORT{db}="DM_UDEV_PRIMARY_SOURCE_FLAG"
IMPORT{db}="DM_UDEV_FLAG7"
IMPORT{db}="DM_SUBSYSTEM_UDEV_FLAG0"
IMPORT{db}="DM_SUBSYSTEM_UDEV_FLAG1"
@@ -62,7 +63,6 @@ IMPORT{db}="DM_SUBSYSTEM_UDEV_FLAG5"
IMPORT{db}="DM_SUBSYSTEM_UDEV_FLAG6"
IMPORT{db}="DM_SUBSYSTEM_UDEV_FLAG7"
IMPORT{db}="DM_UDEV_RULES_VSN"
-IMPORT{db}="DM_ACTIVATED"
LABEL="dm_flags_done"
# Normally, we operate on "change" events. But when coldplugging, there's an
@@ -77,24 +77,26 @@ LABEL="dm_flags_done"
# before (e.g. in initrd). If udev is used in initrd, we require the udev init
# script to not remove the existing udev database so we can reuse the information
# stored at the time of device activation in the initrd.
-# The DM_ACTIVATED variable indicates that the device has already been activated.
-ACTION=="add", ENV{DM_UDEV_RULES_VSN}!="1", ENV{DM_ACTIVATED}!="1", GOTO="dm_disable"
+ACTION!="add", GOTO="dm_no_coldplug"
+ENV{DM_UDEV_RULES_VSN}!="1", ENV{DM_UDEV_PRIMARY_SOURCE_FLAG}!="1", GOTO="dm_disable"
+ENV{DM_ACTIVATION}="1"
+LABEL="dm_no_coldplug"
# Putting it together, following table is used to recognize genuine and spurious events.
# N.B. Spurious events are generated based on use of the WATCH udev
# rule or by triggering an event manually by "udevadm trigger" call
# or by "echo <event_name> > /sys/block/dm-X/uevent".
#
-# EVENT DM_UDEV_PRIMARY_SOURCE_FLAG DM_ACTIVATED
-# ====================================================================
+# EVENT DM_UDEV_PRIMARY_SOURCE_FLAG DM_ACTIVATION
+# ======================================================================
# add event (genuine) 0 0
# change event (genuine) 1 1
# add event (spurious)
# |_ dev still not active 0 0
-# \_ dev already active 0 1
+# \_ dev already active 1 1
# change event (spurious)
# |_ dev still not active 0 0
-# \_ dev already active 0 1
+# \_ dev already active 1 0
# "dm" sysfs subdirectory is available in newer versions of DM
# only (kernels >= 2.6.29). We have to check for its existence
diff --git a/udev/69-dm-lvm-metad.rules.in b/udev/69-dm-lvm-metad.rules.in
index f2d2f1b..6363a79 100644
--- a/udev/69-dm-lvm-metad.rules.in
+++ b/udev/69-dm-lvm-metad.rules.in
@@ -39,8 +39,7 @@ ACTION=="remove", GOTO="lvm_scan"
# DM device:
KERNEL!="dm-[0-9]*", GOTO="next"
-ACTION=="add", ENV{DM_ACTIVATED}=="1", GOTO="lvm_scan"
-ACTION=="change", ENV{DM_UDEV_PRIMARY_SOURCE_FLAG}=="1", GOTO="lvm_scan"
+ENV{DM_UDEV_PRIMARY_SOURCE_FLAG}=="1", ENV{DM_ACTIVATION}=="1", GOTO="lvm_scan"
GOTO="lvm_end"
# MD device:
10 years, 7 months
master - tests: extend harness with output of /var/log/messages
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=4d544004863b3d...
Commit: 4d544004863b3d443fbeca11d264a324275958bd
Parent: 4dc16684679fb4bb9e8dbc2424e3760055788da2
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Sep 12 13:30:12 2013 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu Sep 12 13:30:12 2013 +0200
tests: extend harness with output of /var/log/messages
Add a very simple hack for embeding /var/log/messages into
the tests output - it's not ideal since it sometimes breaks lines,
but still gives valuable info.
---
test/lib/harness.c | 24 ++++++++++++++++++++----
1 files changed, 20 insertions(+), 4 deletions(-)
diff --git a/test/lib/harness.c b/test/lib/harness.c
index 415093d..0036502 100644
--- a/test/lib/harness.c
+++ b/test/lib/harness.c
@@ -219,7 +219,8 @@ static const char *_append_with_stamp(const char *buf, int stamp)
return bb;
}
-static void drain(void) {
+static void drain(int fd)
+{
char buf[4096];
const char *bp;
int stamp = 0;
@@ -228,7 +229,7 @@ static void drain(void) {
static int stdout_last = -1, stdout_counter = 0;
static int outfile_last = -1, outfile_counter = 0;
- while ((sz = read(fds[1], buf, sizeof(buf) - 1)) > 0) {
+ while ((sz = read(fd, buf, sizeof(buf) - 1)) > 0) {
if (fullbuffer)
continue;
buf[sz] = '\0';
@@ -368,6 +369,8 @@ static void run(int i, char *f) {
fd_set set;
int runaway = 0;
int no_write = 0;
+ FILE *varlogmsg;
+ int fd_vlm = -1;
snprintf(buf, sizeof(buf), "%s ...", f);
printf("Running %-60s ", buf);
@@ -378,6 +381,13 @@ static void run(int i, char *f) {
if (!(outfile = fopen(outpath, "w")))
perror("fopen");
+ /* Mix in kernel log message */
+ if (!(varlogmsg = fopen("/var/log/messages", "r")))
+ perror("fopen");
+ else if (((fd_vlm = fileno(varlogmsg)) >= 0) &&
+ fseek(varlogmsg, 0L, SEEK_END))
+ perror("fseek");
+
while ((w = wait4(pid, &st, WNOHANG, &usage)) == 0) {
if ((fullbuffer && fullbuffer++ == 8000) ||
(no_write > 180 * 2)) /* a 3 minute timeout */
@@ -401,14 +411,18 @@ static void run(int i, char *f) {
no_write++;
continue;
}
- drain();
+ drain(fds[1]);
no_write = 0;
+ if (fd_vlm >= 0)
+ drain(fd_vlm);
}
if (w != pid) {
perror("waitpid");
exit(206);
}
- drain();
+ drain(fds[1]);
+ if (fd_vlm >= 0)
+ drain(fd_vlm);
if (die == 2)
interrupted(i, f);
else if (runaway) {
@@ -423,6 +437,8 @@ static void run(int i, char *f) {
} else
failed(i, f, st);
+ if (varlogmsg)
+ fclose(varlogmsg);
if (outfile)
fclose(outfile);
if (fullbuffer)
10 years, 7 months
master - tests: singlenode cleanup for prev commit
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=4dc16684679fb4...
Commit: 4dc16684679fb4bb9e8dbc2424e3760055788da2
Parent: 2a6abcb80a0b29334484325318aa643fd024fde8
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Sep 12 11:29:18 2013 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu Sep 12 11:29:18 2013 +0200
tests: singlenode cleanup for prev commit
Add few more comments and cleanup some warnings.
---
daemons/clvmd/clvmd-singlenode.c | 12 ++++++++----
1 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/daemons/clvmd/clvmd-singlenode.c b/daemons/clvmd/clvmd-singlenode.c
index 8103dcc..cad9acb 100644
--- a/daemons/clvmd/clvmd-singlenode.c
+++ b/daemons/clvmd/clvmd-singlenode.c
@@ -195,7 +195,7 @@ static int _lock_resource(const char *resource, int mode, int flags, int *lockid
/* EX */ { 1, 0, 0, 0, 0, 0}
};
- struct lock *lck, *lckt;
+ struct lock *lck = NULL, *lckt;
struct dm_list *head;
DEBUGLOG("Locking resource %s, flags=0x%02x (%s%s%s), mode=%s (%d)\n",
@@ -213,6 +213,11 @@ retry:
pthread_cond_broadcast(&_lock_cond); /* to wakeup waiters */
if (!(head = dm_hash_lookup(_locks, resource))) {
+ if (flags & LCKF_CONVERT) {
+ /* In real DLM, lock is identified only by lockid, resource is not used */
+ DEBUGLOG("Unlocked resource %s cannot be converted\n", resource);
+ goto_bad;
+ }
/* Add new locked resource */
if (!(head = dm_malloc(sizeof(struct dm_list))) ||
!dm_hash_insert(_locks, resource, head)) {
@@ -223,14 +228,13 @@ retry:
dm_list_init(head);
} else /* Update/convert locked resource */
dm_list_iterate_items(lck, head) {
- /* FIXME Unsure what is LCKF_CONVERT about....*/
+ /* Check is all locks are compatible with requested lock */
if (flags & LCKF_CONVERT) {
if (lck->lockid != *lockid)
continue;
DEBUGLOG("Converting resource %s lockid=%d mode:%s -> %s...\n",
resource, lck->lockid, _get_mode(lck->mode), _get_mode(mode));
- /* Check if converted lock is compatible with locks we already have */
dm_list_iterate_items(lckt, head) {
if ((lckt->lockid != *lockid) &&
!_dlm_table[mode][lckt->mode]) {
@@ -297,7 +301,7 @@ static int _unlock_resource(const char *resource, int lockid)
if (!(head = dm_hash_lookup(_locks, resource))) {
pthread_mutex_unlock(&_lock_mutex);
- DEBUGLOG("Resource %s is not locked.\n", resource, lockid);
+ DEBUGLOG("Resource %s is not locked.\n", resource);
return 1;
}
10 years, 7 months
master - tests: singlenode updates
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=2a6abcb80a0b29...
Commit: 2a6abcb80a0b29334484325318aa643fd024fde8
Parent: 7b5f2e7f34e3236382f4ca8351a12de73956117d
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed Sep 11 23:46:20 2013 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu Sep 12 10:40:39 2013 +0200
tests: singlenode updates
Add more 'realistic' simulation of dlm locking.
Previous version was not capable to maintain multiple locks.
Current version doesn't handle multiqueues for locks,
so the ordering is different.
---
WHATS_NEW | 1 +
daemons/clvmd/clvmd-singlenode.c | 178 ++++++++++++++++++++++++++------------
2 files changed, 122 insertions(+), 57 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 2245d56..c61070e 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.101 -
===================================
+ Improve of clvmd singlenode locking simulation.
Disallow thinpools on mirror logical volumes.
Direct udev to use 3min timeout for LVM devices. Recent udev has default 30s.
Do not scan multipath or RAID components and avoid incorrect autoactivation.
diff --git a/daemons/clvmd/clvmd-singlenode.c b/daemons/clvmd/clvmd-singlenode.c
index 756c589..8103dcc 100644
--- a/daemons/clvmd/clvmd-singlenode.c
+++ b/daemons/clvmd/clvmd-singlenode.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2009 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2009-2013 Red Hat, Inc. All rights reserved.
*
* This file is part of LVM2.
*
@@ -32,10 +32,14 @@ static int listen_fd = -1;
static struct dm_hash_table *_locks;
static int _lockid;
+static pthread_mutex_t _lock_mutex = PTHREAD_MUTEX_INITIALIZER;
+/* Using one common condition for all locks for simplicity */
+static pthread_cond_t _lock_cond = PTHREAD_COND_INITIALIZER;
+
struct lock {
+ struct dm_list list;
int lockid;
int mode;
- int excl;
};
static void close_comms(void)
@@ -118,9 +122,13 @@ static void _cluster_closedown(void)
DEBUGLOG("cluster_closedown\n");
destroy_lvhash();
+ /* If there is any awaited resource, kill it softly */
+ pthread_mutex_lock(&_lock_mutex);
dm_hash_destroy(_locks);
_locks = NULL;
_lockid = 0;
+ pthread_cond_broadcast(&_lock_cond); /* wakeup waiters */
+ pthread_mutex_unlock(&_lock_mutex);
}
static void _get_our_csid(char *csid)
@@ -160,63 +168,110 @@ static int _cluster_do_node_callback(struct local_client *master_client,
int _lock_file(const char *file, uint32_t flags);
-static pthread_mutex_t _lock_mutex = PTHREAD_MUTEX_INITIALIZER;
-/* Using one common condition for all locks for simplicity */
-static pthread_cond_t _lock_cond = PTHREAD_COND_INITIALIZER;
+static const char *_get_mode(int mode)
+{
+ switch (mode) {
+ case LCK_NULL: return "NULL";
+ case LCK_READ: return "READ";
+ case LCK_PREAD: return "PREAD";
+ case LCK_WRITE: return "WRITE";
+ case LCK_EXCL: return "EXCLUSIVE";
+ case LCK_UNLOCK: return "UNLOCK";
+ default: return "????";
+ }
+}
/* Real locking */
static int _lock_resource(const char *resource, int mode, int flags, int *lockid)
{
- struct lock *lck;
-
- DEBUGLOG("Locking resource %s, flags=%d, mode=%d\n",
- resource, flags, mode);
+ /* DLM table of allowed transition states */
+ static const int _dlm_table[6][6] = {
+ /* Mode NL CR CW PR PW EX */
+ /* NL */ { 1, 1, 1, 1, 1, 1},
+ /* CR */ { 1, 1, 1, 1, 1, 0},
+ /* CW */ { 1, 1, 1, 0, 0, 0},
+ /* PR */ { 1, 1, 0, 1, 0, 0},
+ /* PW */ { 1, 1, 0, 0, 0, 0},
+ /* EX */ { 1, 0, 0, 0, 0, 0}
+ };
+
+ struct lock *lck, *lckt;
+ struct dm_list *head;
+
+ DEBUGLOG("Locking resource %s, flags=0x%02x (%s%s%s), mode=%s (%d)\n",
+ resource, flags,
+ (flags & LCKF_NOQUEUE) ? "NOQUEUE" : "",
+ ((flags & (LCKF_NOQUEUE | LCKF_CONVERT)) ==
+ (LCKF_NOQUEUE | LCKF_CONVERT)) ? "|" : "",
+ (flags & LCKF_CONVERT) ? "CONVERT" : "",
+ _get_mode(mode), mode);
mode &= LCK_TYPE_MASK;
pthread_mutex_lock(&_lock_mutex);
-retry:
- if (!(lck = dm_hash_lookup(_locks, resource))) {
- /* Add new locked resource */
- if (!(lck = dm_zalloc(sizeof(struct lock))) ||
- !dm_hash_insert(_locks, resource, lck))
- goto bad;
- lck->lockid = ++_lockid;
- goto out;
- }
+retry:
+ pthread_cond_broadcast(&_lock_cond); /* to wakeup waiters */
- /* Update/convert lock */
- if (flags == LCKF_CONVERT) {
- if (lck->excl)
- mode = LCK_EXCL;
- } else if ((lck->mode == LCK_WRITE) || (lck->mode == LCK_EXCL)) {
- DEBUGLOG("Resource %s already %s locked (%d)...\n", resource,
- (lck->mode == LCK_WRITE) ? "write" : "exclusively", lck->lockid);
- goto maybe_retry;
- } else if (lck->mode > mode) {
- DEBUGLOG("Resource %s already locked and %s lock requested...\n",
- resource,
- (mode == LCK_READ) ? "READ" :
- (mode == LCK_WRITE) ? "WRITE" : "EXCLUSIVE");
- goto maybe_retry;
+ if (!(head = dm_hash_lookup(_locks, resource))) {
+ /* Add new locked resource */
+ if (!(head = dm_malloc(sizeof(struct dm_list))) ||
+ !dm_hash_insert(_locks, resource, head)) {
+ dm_free(head);
+ goto_bad;
+ }
+
+ dm_list_init(head);
+ } else /* Update/convert locked resource */
+ dm_list_iterate_items(lck, head) {
+ /* FIXME Unsure what is LCKF_CONVERT about....*/
+ if (flags & LCKF_CONVERT) {
+ if (lck->lockid != *lockid)
+ continue;
+
+ DEBUGLOG("Converting resource %s lockid=%d mode:%s -> %s...\n",
+ resource, lck->lockid, _get_mode(lck->mode), _get_mode(mode));
+ /* Check if converted lock is compatible with locks we already have */
+ dm_list_iterate_items(lckt, head) {
+ if ((lckt->lockid != *lockid) &&
+ !_dlm_table[mode][lckt->mode]) {
+ if (!(flags & LCKF_NOQUEUE) &&
+ /* TODO: Real dlm uses here conversion queues */
+ !pthread_cond_wait(&_lock_cond, &_lock_mutex) &&
+ _locks) /* End of the game? */
+ goto retry;
+ goto bad;
+ }
+ }
+ lck->mode = mode; /* Lock is now converted */
+ goto out;
+ } else if (!_dlm_table[mode][lck->mode]) {
+ DEBUGLOG("Resource %s already locked lockid=%d, mode:%s\n",
+ resource, lck->lockid, _get_mode(lck->mode));
+ if (!(flags & LCKF_NOQUEUE) &&
+ !pthread_cond_wait(&_lock_cond, &_lock_mutex) &&
+ _locks) { /* End of the game? */
+ DEBUGLOG("Resource %s retrying lock in mode:%s...\n",
+ resource, _get_mode(mode));
+ goto retry;
+ }
+ goto bad;
+ }
+ }
+
+ if (!(flags & LCKF_CONVERT)) {
+ if (!(lck = dm_malloc(sizeof(struct lock))))
+ goto_bad;
+
+ *lockid = lck->lockid = ++_lockid;
+ lck->mode = mode;
+ dm_list_add(head, &lck->list);
}
-
out:
- *lockid = lck->lockid;
- lck->mode = mode;
- lck->excl |= (mode == LCK_EXCL);
- DEBUGLOG("Locked resource %s, lockid=%d, mode=%d\n", resource, lck->lockid, mode);
- pthread_cond_broadcast(&_lock_cond); /* wakeup waiters */
pthread_mutex_unlock(&_lock_mutex);
+ DEBUGLOG("Locked resource %s, lockid=%d, mode=%s\n",
+ resource, lck->lockid, _get_mode(lck->mode));
return 0;
-
-maybe_retry:
- if (!(flags & LCK_NONBLOCK)) {
- pthread_cond_wait(&_lock_cond, &_lock_mutex);
- DEBUGLOG("Resource %s RETRYING lock...\n", resource);
- goto retry;
- }
bad:
pthread_mutex_unlock(&_lock_mutex);
DEBUGLOG("Failed to lock resource %s\n", resource);
@@ -227,35 +282,44 @@ bad:
static int _unlock_resource(const char *resource, int lockid)
{
struct lock *lck;
+ struct dm_list *head;
+ int r = 1;
if (lockid < 0) {
DEBUGLOG("Not tracking unlock of lockid -1: %s, lockid=%d\n",
resource, lockid);
- return 0;
+ return 1;
}
DEBUGLOG("Unlocking resource %s, lockid=%d\n", resource, lockid);
pthread_mutex_lock(&_lock_mutex);
+ pthread_cond_broadcast(&_lock_cond); /* wakeup waiters */
- if (!(lck = dm_hash_lookup(_locks, resource))) {
+ if (!(head = dm_hash_lookup(_locks, resource))) {
pthread_mutex_unlock(&_lock_mutex);
- DEBUGLOG("Resource %s, lockid=%d is not locked.\n", resource, lockid);
+ DEBUGLOG("Resource %s is not locked.\n", resource, lockid);
return 1;
}
- if (lck->lockid != lockid) {
- pthread_mutex_unlock(&_lock_mutex);
- DEBUGLOG("Resource %s has wrong lockid %d, expected %d.\n",
- resource, lck->lockid, lockid);
- return 1;
+ dm_list_iterate_items(lck, head)
+ if (lck->lockid == lockid) {
+ dm_list_del(&lck->list);
+ dm_free(lck);
+ r = 0;
+ goto out;
+ }
+
+ DEBUGLOG("Resource %s has wrong lockid %d.\n", resource, lockid);
+out:
+ if (dm_list_empty(head)) {
+ //DEBUGLOG("Resource %s is no longer hashed (lockid=%d).\n", resource, lockid);
+ dm_hash_remove(_locks, resource);
+ dm_free(head);
}
- dm_hash_remove(_locks, resource);
- pthread_cond_broadcast(&_lock_cond); /* wakeup waiters */
pthread_mutex_unlock(&_lock_mutex);
- dm_free(lck);
- return 0;
+ return r;
}
static int _is_quorate(void)
10 years, 7 months
master - clvmd: add missing debug newline
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=7b5f2e7f34e323...
Commit: 7b5f2e7f34e3236382f4ca8351a12de73956117d
Parent: b8ea27ac97ef94837f6ee3fce86fd65dcb294d65
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Sep 12 10:33:51 2013 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu Sep 12 10:38:49 2013 +0200
clvmd: add missing debug newline
Just missing new line.
---
daemons/clvmd/lvm-functions.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/daemons/clvmd/lvm-functions.c b/daemons/clvmd/lvm-functions.c
index 5f1658d..da7d335 100644
--- a/daemons/clvmd/lvm-functions.c
+++ b/daemons/clvmd/lvm-functions.c
@@ -256,7 +256,7 @@ static int hold_lock(char *resource, int mode, int flags)
}
if ((lvi->lock_mode == LCK_EXCL) && (mode == LCK_WRITE)) {
DEBUGLOG("hold_lock, lock already held LCK_EXCL, "
- "ignoring LCK_WRITE request");
+ "ignoring LCK_WRITE request\n");
return 0;
}
}
10 years, 7 months
master - cleanup: hide gcc warning
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=b8ea27ac97ef94...
Commit: b8ea27ac97ef94837f6ee3fce86fd65dcb294d65
Parent: 82228acfc95fa4dbe9acca2d3bfc5a89087fd5e4
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Sep 9 13:06:05 2013 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Sep 11 23:40:45 2013 +0200
cleanup: hide gcc warning
Older gcc is giving misleading warning:
metadata/lv_manip.c:4018: warning: ‘seg’ may be used uninitialized in
this function
But warning free compilation is better.
---
lib/metadata/lv_manip.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index d12b34e..a145c41 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -4016,7 +4016,7 @@ static struct logical_volume *_lvresize_volume(struct cmd_context *cmd,
{
struct volume_group *vg = lv->vg;
struct logical_volume *lock_lv = NULL;
- struct lv_segment *seg;
+ struct lv_segment *seg = NULL;
int status;
alloc_policy_t alloc;
10 years, 7 months
master - Mirror/Thin: Disallow thinpools on mirror logical volumes
by Jonathan Brassow
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=82228acfc95fa4...
Commit: 82228acfc95fa4dbe9acca2d3bfc5a89087fd5e4
Parent: 1f4bc637b4b71ed7a66ea4e7836c51b529bef92a
Author: Jonathan Brassow <jbrassow(a)redhat.com>
AuthorDate: Wed Sep 11 15:58:44 2013 -0500
Committer: Jonathan Brassow <jbrassow(a)redhat.com>
CommitterDate: Wed Sep 11 15:58:44 2013 -0500
Mirror/Thin: Disallow thinpools on mirror logical volumes
The same corner cases that exist for snapshots on mirrors exist for
any logical volume layered on top of mirror. (One example is when
a mirror image fails and a non-repair LVM command is the first to
detect it via label reading. In this case, the LVM command will hang
and prevent the necessary LVM repair command from running.) When
a better alternative exists, it makes no sense to allow a new target
to stack on mirrors as a new feature. Since, RAID is now capable of
running EX in a cluster and thin is not active-active aware, it makes
sense to pair these two rather than mirror+thinpool.
As further background, here are some additional comments that I made
when addressing a bug related to mirror+thinpool:
(https://bugzilla.redhat.com/show_bug.cgi?id=919604#c9)
I am going to disallow thin* on top of mirror logical volumes.
Users will have to use the "raid1" segment type if they want this.
This bug has come down to a choice between:
1) Disallowing thin-LVs from being used as PVs.
2) Disallowing thinpools on top of mirrors.
The problem is that the code in dev_manager.c:device_is_usable() is unable
to tell whether there is a mirror device lower in the stack from the device
being checked. Pretty much anything layered on top of a mirror will suffer
from this problem. (Snapshots are a good example of this; and option #1
above has been chosen to deal with them. This can also be seen in
dev_manager.c:device_is_usable().) When a mirror failure occurs, the
kernel blocks all I/O to it. If there is an LVM command that comes along
to do the repair (or a different operation that requires label reading), it
would normally avoid the mirror when it sees that it is blocked. However,
if there is a snapshot or a thin-LV that is on a mirror, the above code
will not detect the mirror underneath and will issue label reading I/O.
This causes the command to hang.
Choosing #1 would mean that thin-LVs could never be used as PVs - even if
they are stacked on something other than mirrors.
Choosing #2 means that thinpools can never be placed on mirrors. This is
probably better than we think, since it is preferred that people use the
"raid1" segment type in the first place. However, RAID* cannot currently
be used in a cluster volume group - even in EX-only mode. Thus, a complete
solution for option #2 must include the ability to activate RAID logical
volumes (and perform RAID operations) in a cluster volume group. I've
already begun working on this.
---
WHATS_NEW | 1 +
test/shell/lvchange-raid.sh | 7 +++++++
test/shell/lvconvert-thin.sh | 20 +++++++++++++++-----
tools/lvconvert.c | 19 +++++++++++++++++++
4 files changed, 42 insertions(+), 5 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 927419a..2245d56 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.101 -
===================================
+ Disallow thinpools on mirror logical volumes.
Direct udev to use 3min timeout for LVM devices. Recent udev has default 30s.
Do not scan multipath or RAID components and avoid incorrect autoactivation.
Fix MD/loop udev handling to fire autoactivation after setup or coldplug only.
diff --git a/test/shell/lvchange-raid.sh b/test/shell/lvchange-raid.sh
index babe726..f1b8d72 100644
--- a/test/shell/lvchange-raid.sh
+++ b/test/shell/lvchange-raid.sh
@@ -285,6 +285,12 @@ run_checks() {
run_recovery_rate_check $1 $2
elif [ 'thinpool_data' == $3 ]; then
aux target_at_least dm-thin-pool 1 8 0 || return 0
+
+ # RAID works EX in cluster
+ # thinpool works EX in cluster
+ # but they don't work together in a cluster yet
+ # (nor does thinpool+mirror work in a cluster yet)
+ test -e LOCAL_CLVMD && return 0
printf "#\n#\n# run_checks: RAID as thinpool data\n#\n#\n"
# Hey, specifying devices for thin allocation doesn't work
@@ -300,6 +306,7 @@ run_checks() {
run_recovery_rate_check $1 $2
elif [ 'thinpool_meta' == $3 ]; then
aux target_at_least dm-thin-pool 1 8 0 || return 0
+ test -e LOCAL_CLVMD && return 0
printf "#\n#\n# run_checks: RAID as thinpool metadata\n#\n#\n"
lvrename $1/$2 ${2}_meta
diff --git a/test/shell/lvconvert-thin.sh b/test/shell/lvconvert-thin.sh
index f1e2176..0081e45 100644
--- a/test/shell/lvconvert-thin.sh
+++ b/test/shell/lvconvert-thin.sh
@@ -36,13 +36,22 @@ vgcreate $vg -s 64K $(cut -d ' ' -f 4 DEVICES) "$DM_DEV_DIR/$vg1/$lv"
# create mirrored LVs for data and metadata volumes
lvcreate -aey -L10M --type mirror -m1 --mirrorlog core -n $lv1 $vg
-lvcreate -aey -L8M --type mirror -m1 --mirrorlog core -n $lv2 $vg
+lvcreate -aey -L10M -n $lv2 $vg
lvchange -an $vg/$lv1
+# conversion fails for mirror segment type
+not lvconvert --thinpool $vg/$lv1
+not lvconvert --thinpool $vg/$lv2 --poolmetadata $vg/$lv2
+lvremove -f $vg
+
+# create RAID LVs for data and metadata volumes
+lvcreate -aey -L10M --type raid1 -m1 -n $lv1 $vg
+lvcreate -aey -L10M --type raid1 -m1 -n $lv2 $vg
+lvchange -an $vg/$lv1
# conversion fails for internal volumes
-not lvconvert --thinpool $vg/${lv1}_mimage_0
-not lvconvert --thinpool $vg/$lv1 --poolmetadata $vg/${lv2}_mimage_0
+not lvconvert --thinpool $vg/${lv1}_rimage_0
+not lvconvert --thinpool $vg/$lv1 --poolmetadata $vg/${lv2}_rimage_0
# can't use --readahead with --poolmetadata
not lvconvert --thinpool $vg/$lv1 --poolmetadata $vg/$lv2 --readahead 512
@@ -95,7 +104,8 @@ grep "WARNING: Chunk size is too small" err
#lvs -a -o+chunk_size,stripe_size,seg_pe_ranges
-# Convertions of pool to mirror is unsupported
-not lvconvert -m1 $vg/$lv1
+# Convertions of pool to mirror or RAID is unsupported
+not lvconvert --type mirror -m1 $vg/$lv1
+not lvconvert --type raid1 -m1 $vg/$lv1
vgremove -ff $vg
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
index 13002e3..2a3c827 100644
--- a/tools/lvconvert.c
+++ b/tools/lvconvert.c
@@ -1605,6 +1605,13 @@ static int _lvconvert_mirrors(struct cmd_context *cmd,
if (!_lvconvert_validate_thin(lv, lp))
return_0;
+ if (lv_is_thin_type(lv)) {
+ log_error("Mirror segment type cannot be used for thinpool%s.\n"
+ "Try \"raid1\" segment type instead.",
+ lv_is_thin_pool_data(lv) ? "s" : " metadata");
+ return 0;
+ }
+
/* Adjust mimage and/or log count */
if (!_lvconvert_mirrors_parse_params(cmd, lv, lp,
&old_mimage_count, &old_log_count,
@@ -2270,6 +2277,12 @@ static int _lvconvert_thinpool(struct cmd_context *cmd,
return 0;
}
+ if (lv_is_mirrored(pool_lv) && !lv_is_raid_type(pool_lv)) {
+ log_error("Mirror logical volumes cannot be used as thinpools.\n"
+ "Try \"raid1\" segment type instead.");
+ return 0;
+ }
+
if (lp->thin) {
external_lv = pool_lv;
if (!(pool_lv = find_lv(external_lv->vg, lp->pool_data_lv_name))) {
@@ -2338,6 +2351,12 @@ static int _lvconvert_thinpool(struct cmd_context *cmd,
metadata_lv->vg->name, metadata_lv->name);
return 0;
}
+ if (lv_is_mirrored(pool_lv) && !lv_is_raid_type(pool_lv)) {
+ log_error("Mirror logical volumes cannot be used"
+ " for thinpool metadata.\n"
+ "Try \"raid1\" segment type instead.");
+ return 0;
+ }
if (metadata_lv->status & LOCKED) {
log_error("Can't convert locked LV %s/%s.",
metadata_lv->vg->name, metadata_lv->name);
10 years, 7 months
master - WHATS_NEW: one more for commit 8d1d835
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=1f4bc637b4b71e...
Commit: 1f4bc637b4b71ed7a66ea4e7836c51b529bef92a
Parent: fe227d14a5947357a784661e32e74690b9eb226f
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Wed Sep 11 13:15:53 2013 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Wed Sep 11 13:16:36 2013 +0200
WHATS_NEW: one more for commit 8d1d835
---
WHATS_NEW | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 61a66a2..927419a 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,6 +1,7 @@
Version 2.02.101 -
===================================
Direct udev to use 3min timeout for LVM devices. Recent udev has default 30s.
+ Do not scan multipath or RAID components and avoid incorrect autoactivation.
Fix MD/loop udev handling to fire autoactivation after setup or coldplug only.
Make RAID capable of single-machine exclusive operations in a cluster.
Drop calculation of read ahead for deactivated volume.
10 years, 7 months
master - WHATS_NEW: for commit 8d1d8350 and 72a9d4f
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=fe227d14a59473...
Commit: fe227d14a5947357a784661e32e74690b9eb226f
Parent: 72a9d4f879751d58e531efbffaef1f7d325092c7
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Wed Sep 11 12:58:43 2013 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Wed Sep 11 13:01:01 2013 +0200
WHATS_NEW: for commit 8d1d8350 and 72a9d4f
---
WHATS_NEW | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index b14daf5..61a66a2 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,7 @@
Version 2.02.101 -
===================================
+ Direct udev to use 3min timeout for LVM devices. Recent udev has default 30s.
+ Fix MD/loop udev handling to fire autoactivation after setup or coldplug only.
Make RAID capable of single-machine exclusive operations in a cluster.
Drop calculation of read ahead for deactivated volume.
Check for exactly one lv segment in validation of thin pools and volumes.
10 years, 7 months
master - udev: override new udev default timeout of 30s to original 3min
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=72a9d4f879751d...
Commit: 72a9d4f879751d58e531efbffaef1f7d325092c7
Parent: 2691f1d764182722195cda80be1f511e968480aa
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Wed Sep 11 12:42:29 2013 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Wed Sep 11 12:47:38 2013 +0200
udev: override new udev default timeout of 30s to original 3min
New versions of udev changed the default event timeout to 30s
from original 3min. This causes problems with LVM processes that
starve because of the IO load caused by some LVM actions (e.g.
mirror/raid synchronization).
Reinstate the 3min udev timeout for now until we optimize this
in a way that even the 30s timeout is sufficient.
---
udev/11-dm-lvm.rules.in | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/udev/11-dm-lvm.rules.in b/udev/11-dm-lvm.rules.in
index 58ef210..90804f3 100644
--- a/udev/11-dm-lvm.rules.in
+++ b/udev/11-dm-lvm.rules.in
@@ -29,6 +29,8 @@ ENV{DM_LV_LAYER}=="?*", GOTO="lvm_disable"
# Create symlinks for top-level devices only.
ENV{DM_VG_NAME}=="?*", ENV{DM_LV_NAME}=="?*", SYMLINK+="$env{DM_VG_NAME}/$env{DM_LV_NAME}", GOTO="lvm_end"
+OPTIONS+="event_timeout=180"
+
LABEL="lvm_disable"
ENV{DM_UDEV_DISABLE_DISK_RULES_FLAG}="1"
ENV{DM_UDEV_DISABLE_OTHER_RULES_FLAG}="1"
10 years, 7 months