OBS User unknown 2009-05-15 20:00:20 +00:00 committed by Git OBS Bridge
parent 7a5efa9688
commit c114ca9b11
36 changed files with 2353 additions and 460 deletions

View File

@ -9,6 +9,8 @@ ENV{ID_FS_TYPE}!="LVM2_member", GOTO="lvm_end"
ENV{ID_FS_UUID_ENC}=="?*", SYMLINK+="disk/by-id/lvm2-pvuuid-$env{ID_FS_UUID_ENC}"
ENV{DMDEPS}=="0", GOTO="lvm_end"
IMPORT{PROGRAM}="collect_lvm $tempnode"
ENV{VGUUID}!="?*", GOTO="lvm_end"

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:4eeb6a82b496be4ebbad5b6350698469c7de4fcc5d1372edd16d856dc49fac8c
size 455011

3
LVM2.2.02.45.tar.bz2 Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:a6c93a4f1a0cfa1abe41e7a3f3e7bfb8c7b77e8c6983c99fc030ccdc1841c7bc
size 592703

1
baselibs.conf Normal file
View File

@ -0,0 +1 @@
device-mapper

41
boot.device-mapper Normal file
View File

@ -0,0 +1,41 @@
#! /bin/sh
#
# Copyright (c) 2001 SuSE GmbH Nuernberg, Germany. All rights reserved.
#
# /etc/init.d/boot.device-mapper
#
### BEGIN INIT INFO
# Provides: boot.device-mapper
# Required-Start: boot.udev boot.rootfsck
# Required-Stop: boot.udev
# Default-Start: B
# Default-Stop:
# Description: activate device mapper
### END INIT INFO
. /etc/rc.status
rc_reset
case "$1" in
start)
echo "Activating device mapper..."
lsmod | grep "^dm[-_]mod[ ]" >/dev/null 2>&1 || modprobe dm-mod
rc_status -v -r
;;
stop)
# module unloading seems to be uneliable in kernel 2.6
# rmmod dm-mod
# rc_status -v
;;
status)
rc_failed 4
rc_status -v
;;
*)
echo "Usage: $0 {start|stop|status}"
exit 1
;;
esac
rc_exit

View File

@ -0,0 +1,22 @@
Index: LVM2.2.02.39/daemons/clvmd/clvmd-openais.c
===================================================================
--- LVM2.2.02.39.orig/daemons/clvmd/clvmd-openais.c
+++ LVM2.2.02.39/daemons/clvmd/clvmd-openais.c
@@ -368,7 +368,16 @@ static void _cluster_closedown(void)
DEBUGLOG("cluster_closedown\n");
unlock_all();
- dlm_release_lockspace(LOCKSPACE_NAME, lockspace, 0);
+ int r;
+ r = dlm_release_lockspace(LOCKSPACE_NAME, lockspace, 0);
+ if (r == -1) {
+ if (errno == EBUSY) {
+ syslog(LOG_ERR, "Some locks still active, close by force\n");
+ dlm_release_lockspace(LOCKSPACE_NAME, lockspace, 1);
+ } else {
+ syslog(LOG_ERR, "dlm_release_lockspace failed\n");
+ }
+ }
cpg_finalize(cpg_handle);
}

View File

@ -0,0 +1,44 @@
Index: LVM2.2.02.39/daemons/clvmd/clvmd-openais.c
===================================================================
--- LVM2.2.02.39.orig/daemons/clvmd/clvmd-openais.c 2009-04-01 20:12:52.000000000 +0800
+++ LVM2.2.02.39/daemons/clvmd/clvmd-openais.c 2009-04-01 20:13:23.000000000 +0800
@@ -342,7 +342,7 @@
err = cpg_join(cpg_handle, &cpg_group_name);
if (err != SA_AIS_OK) {
cpg_finalize(cpg_handle);
- dlm_release_lockspace(LOCKSPACE_NAME, lockspace, 0);
+ dlm_release_lockspace(LOCKSPACE_NAME, lockspace, 1);
syslog(LOG_ERR, "Cannot join clvmd process group");
DEBUGLOG("Cannot join clvmd process group: %d\n", err);
return ais_to_errno(err);
@@ -351,8 +351,9 @@
err = cpg_local_get(cpg_handle,
&our_nodeid);
if (err != SA_AIS_OK) {
+ cpg_leave(cpg_handle, &cpg_group_name);
cpg_finalize(cpg_handle);
- dlm_release_lockspace(LOCKSPACE_NAME, lockspace, 0);
+ dlm_release_lockspace(LOCKSPACE_NAME, lockspace, 1);
syslog(LOG_ERR, "Cannot get local node id\n");
return ais_to_errno(err);
}
@@ -369,15 +370,11 @@
unlock_all();
int r;
- r = dlm_release_lockspace(LOCKSPACE_NAME, lockspace, 0);
- if (r == -1) {
- if (errno == EBUSY) {
- syslog(LOG_ERR, "Some locks still active, close by force\n");
- dlm_release_lockspace(LOCKSPACE_NAME, lockspace, 1);
- } else {
- syslog(LOG_ERR, "dlm_release_lockspace failed\n");
- }
+ r = dlm_release_lockspace(LOCKSPACE_NAME, lockspace, 1);
+ if (r != 0) {
+ syslog(LOG_ERR, "dlm_release_lockspace failed: %d\n", errno);
}
+ cpg_leave(cpg_handle, &cpg_group_name);
cpg_finalize(cpg_handle);
}

View File

@ -1,7 +1,7 @@
Index: LVM2.2.02.39/daemons/clvmd/clvmd-openais.c
===================================================================
--- LVM2.2.02.39.orig/daemons/clvmd/clvmd-openais.c 2008-06-20 20:46:21.000000000 +0800
+++ LVM2.2.02.39/daemons/clvmd/clvmd-openais.c 2009-01-22 12:36:41.000000000 +0800
+++ LVM2.2.02.39/daemons/clvmd/clvmd-openais.c 2009-02-25 22:13:32.000000000 +0800
@@ -34,9 +34,9 @@
#include <syslog.h>
#include <assert.h>
@ -22,7 +22,17 @@ Index: LVM2.2.02.39/daemons/clvmd/clvmd-openais.c
static void cpg_deliver_callback (cpg_handle_t handle,
struct cpg_name *groupName,
uint32_t nodeid,
@@ -77,9 +79,15 @@
@@ -66,9 +68,6 @@
/* Hash list of nodes in the cluster */
static struct dm_hash_table *node_hash;
-/* For associating lock IDs & resource handles */
-static struct dm_hash_table *lock_hash;
-
/* Number of active nodes */
static int num_nodes;
static unsigned int our_nodeid;
@@ -77,9 +76,15 @@
/* OpenAIS handles */
static cpg_handle_t cpg_handle;
@ -39,7 +49,7 @@ Index: LVM2.2.02.39/daemons/clvmd/clvmd-openais.c
/* Openais callback structs */
cpg_callbacks_t cpg_callbacks = {
@@ -93,13 +101,6 @@
@@ -93,13 +98,6 @@
int nodeid;
};
@ -53,7 +63,7 @@ Index: LVM2.2.02.39/daemons/clvmd/clvmd-openais.c
/* Set errno to something approximating the right value and return 0 or -1 */
static int ais_to_errno(SaAisErrorT err)
{
@@ -309,19 +310,9 @@
@@ -309,22 +307,11 @@
num_nodes = member_list_entries;
}
@ -72,8 +82,11 @@ Index: LVM2.2.02.39/daemons/clvmd/clvmd-openais.c
- int select_fd;
node_hash = dm_hash_create(100);
lock_hash = dm_hash_create(10);
@@ -335,16 +326,14 @@
- lock_hash = dm_hash_create(10);
err = cpg_initialize(&cpg_handle,
&cpg_callbacks);
@@ -335,16 +322,19 @@
return ais_to_errno(err);
}
@ -89,29 +102,34 @@ Index: LVM2.2.02.39/daemons/clvmd/clvmd-openais.c
+ /* Create a lockspace for LV & VG locks to live in */
+ lockspace = dlm_create_lockspace(LOCKSPACE_NAME, 0600);
+ if (!lockspace) {
+ syslog(LOG_ERR, "Unable to create lockspace for CLVM: %m");
+ return -1;
+ if (errno == EEXIST) {
+ lockspace = dlm_open_lockspace(LOCKSPACE_NAME);
+ }
+ if (!lockspace) {
+ syslog(LOG_ERR, "Unable to create lockspace for CLVM: %m");
+ return -1;
+ }
}
+ dlm_ls_pthread_init(lockspace);
+ DEBUGLOG("DLM initialisation complete\n");
/* Connect to the clvmd group */
strcpy((char *)cpg_group_name.value, "clvmd");
@@ -352,7 +341,7 @@
@@ -352,7 +342,7 @@
err = cpg_join(cpg_handle, &cpg_group_name);
if (err != SA_AIS_OK) {
cpg_finalize(cpg_handle);
- saLckFinalize(lck_handle);
+ dlm_release_lockspace(LOCKSPACE_NAME, lockspace, 1);
+ dlm_release_lockspace(LOCKSPACE_NAME, lockspace, 0);
syslog(LOG_ERR, "Cannot join clvmd process group");
DEBUGLOG("Cannot join clvmd process group: %d\n", err);
return ais_to_errno(err);
@@ -362,15 +351,12 @@
@@ -362,15 +352,12 @@
&our_nodeid);
if (err != SA_AIS_OK) {
cpg_finalize(cpg_handle);
- saLckFinalize(lck_handle);
+ dlm_release_lockspace(LOCKSPACE_NAME, lockspace, 1);
+ dlm_release_lockspace(LOCKSPACE_NAME, lockspace, 0);
syslog(LOG_ERR, "Cannot get local node id\n");
return ais_to_errno(err);
}
@ -123,51 +141,40 @@ Index: LVM2.2.02.39/daemons/clvmd/clvmd-openais.c
DEBUGLOG("Connected to OpenAIS\n");
return 0;
@@ -381,7 +367,7 @@
@@ -381,7 +368,7 @@
DEBUGLOG("cluster_closedown\n");
unlock_all();
- saLckFinalize(lck_handle);
+ dlm_release_lockspace(LOCKSPACE_NAME, lockspace, 1);
+ dlm_release_lockspace(LOCKSPACE_NAME, lockspace, 0);
cpg_finalize(cpg_handle);
}
@@ -472,156 +458,82 @@
@@ -472,156 +459,69 @@
return somedown;
}
-/* Real locking */
-static int _lock_resource(char *resource, int mode, int flags, int *lockid)
-{
+static int _sync_lock(const char *resource, int mode, int flags, int *lockid)
{
- struct lock_info *linfo;
- SaLckResourceHandleT res_handle;
- SaAisErrorT err;
- SaLckLockIdT lock_id;
- SaLckLockStatusT lockStatus;
+static void sync_ast_routine(void *arg)
+{
+ struct lock_wait *lwait = arg;
+
+ pthread_mutex_lock(&lwait->mutex);
+ pthread_cond_signal(&lwait->cond);
+ pthread_mutex_unlock(&lwait->mutex);
+}
-
- /* This needs to be converted from DLM/LVM2 value for OpenAIS LCK */
- if (flags & LCK_NONBLOCK) flags = SA_LCK_LOCK_NO_QUEUE;
+static int _sync_lock(const char *resource, int mode, int flags, int *lockid)
+{
+ int status;
+ struct lock_wait lwait;
-
- linfo = malloc(sizeof(struct lock_info));
- if (!linfo)
+ if (!lockid) {
+ errno = EINVAL;
return -1;
-
- DEBUGLOG("lock_resource '%s', flags=%d, mode=%d\n", resource, flags, mode);
-
- return -1;
+ struct dlm_lksb lksb;
+ int err;
DEBUGLOG("lock_resource '%s', flags=%d, mode=%d\n", resource, flags, mode);
- linfo->lock_name.length = strlen(resource)+1;
- strcpy((char *)linfo->lock_name.value, resource);
-
@ -178,79 +185,85 @@ Index: LVM2.2.02.39/daemons/clvmd/clvmd-openais.c
- DEBUGLOG("ResourceOpen returned %d\n", err);
- free(linfo);
- return ais_to_errno(err);
}
- }
+ if (flags & LKF_CONVERT)
+ lksb.sb_lkid = *lockid;
- err = saLckResourceLock(
- res_handle,
- &lock_id,
+ DEBUGLOG("sync_lock: '%s' mode:%d flags=%d\n", resource,mode,flags);
+ /* Conversions need the lockid in the LKSB */
+ if (flags & LKF_CONVERT)
+ lwait.lksb.sb_lkid = *lockid;
+
+ pthread_cond_init(&lwait.cond, NULL);
+ pthread_mutex_init(&lwait.mutex, NULL);
+ pthread_mutex_lock(&lwait.mutex);
+
+ status = dlm_ls_lock(lockspace,
+ err = dlm_ls_lock_wait(lockspace,
mode,
+ &lwait.lksb,
+ &lksb,
flags,
- 0,
+ resource,
+ strlen(resource),
0,
- SA_TIME_END,
- &lockStatus);
- if (err != SA_AIS_OK && lockStatus != SA_LCK_LOCK_GRANTED)
- {
+ NULL, NULL, NULL);
+
+ if (err != 0)
{
- free(linfo);
- saLckResourceClose(res_handle);
- return ais_to_errno(err);
- }
+ DEBUGLOG("dlm_ls_lock returned %d\n", errno);
+ return err;
+ }
+ errno = lksb.sb_status;
+ if (lksb.sb_status != 0)
+ {
+ DEBUGLOG("dlm_ls_lock returns lksb.sb_status %d\n", lksb.sb_status);
+ return -1;
}
-
- /* Wait for it to complete */
+ resource,
+ strlen(resource),
+ 0, sync_ast_routine, &lwait, NULL, NULL);
+ if (status)
+ return status;
-
- DEBUGLOG("lock_resource returning %d, lock_id=%llx\n", err,
- lock_id);
-
- linfo->lock_id = lock_id;
- linfo->res_handle = res_handle;
-
+ DEBUGLOG("lock_resource returning %d, lock_id=%x\n", err, lksb.sb_lkid);
- dm_hash_insert(lock_hash, resource, linfo);
-
+ *lockid = lksb.sb_lkid;
- return ais_to_errno(err);
-}
+ /* Wait for it to complete */
+ pthread_cond_wait(&lwait.cond, &lwait.mutex);
+ pthread_mutex_unlock(&lwait.mutex);
+ *lockid = lwait.lksb.sb_lkid;
+ return 0;
}
-
-static int _unlock_resource(char *resource, int lockid)
-{
+static int _sync_unlock(const char *resource, int lockid)
{
- SaAisErrorT err;
- struct lock_info *linfo;
-
+ struct dlm_lksb lksb;
+ int err;
- DEBUGLOG("unlock_resource %s\n", resource);
- linfo = dm_hash_lookup(lock_hash, resource);
- if (!linfo)
+ errno = lwait.lksb.sb_status;
+ DEBUGLOG("sync_lock: returning lkid %x\n", *lockid);
+ if (lwait.lksb.sb_status)
+ return -1;
+ else
return 0;
-
- return 0;
+ DEBUGLOG("unlock_resource: %s lockid: %x\n", resource, lockid);
+ lksb.sb_lkid = lockid;
- DEBUGLOG("unlock_resource: lockid: %llx\n", linfo->lock_id);
- err = saLckResourceUnlock(linfo->lock_id, SA_TIME_END);
- if (err != SA_AIS_OK)
- {
- DEBUGLOG("Unlock returned %d\n", err);
+ err = dlm_ls_unlock_wait(lockspace,
+ lockid,
+ 0,
+ &lksb);
+ if (err != 0)
{
DEBUGLOG("Unlock returned %d\n", err);
- return ais_to_errno(err);
- }
+ return err;
}
-
- /* Release the resource */
- dm_hash_remove(lock_hash, resource);
@ -270,7 +283,9 @@ Index: LVM2.2.02.39/daemons/clvmd/clvmd-openais.c
- snprintf(lock2, sizeof(lock2), "%s-2", resource);
-
- switch (mode)
- {
+ errno = lksb.sb_status;
+ if (lksb.sb_status != EUNLOCK)
{
- case LCK_EXCL:
- status = _lock_resource(lock1, SA_LCK_EX_LOCK_MODE, flags, lockid);
- if (status)
@ -306,50 +321,35 @@ Index: LVM2.2.02.39/daemons/clvmd/clvmd-openais.c
- status = -1;
- errno = EINVAL;
- break;
- }
+ DEBUGLOG("dlm_ls_unlock_wait returns lksb.sb_status: %x\n", lksb.sb_status);
+ return -1;
}
-out:
- *lockid = mode;
- return status;
}
static int _sync_unlock(const char *resource, int lockid)
{
int status = 0;
-}
-
-static int _sync_unlock(const char *resource, int lockid)
-{
- int status = 0;
- char lock1[strlen(resource)+3];
- char lock2[strlen(resource)+3];
+ struct lock_wait lwait;
-
- snprintf(lock1, sizeof(lock1), "%s-1", resource);
- snprintf(lock2, sizeof(lock2), "%s-2", resource);
+ DEBUGLOG("sync_unlock: '%s' lkid:%x\n", resource, lockid);
-
- _unlock_resource(lock1, lockid);
- _unlock_resource(lock2, lockid);
+ pthread_cond_init(&lwait.cond, NULL);
+ pthread_mutex_init(&lwait.mutex, NULL);
+ pthread_mutex_lock(&lwait.mutex);
+ return 0;
- return status;
+ status = dlm_ls_unlock(lockspace, lockid, 0, &lwait.lksb, &lwait);
+
+ if (status)
+ return status;
+ /* Wait for it to complete */
+ pthread_cond_wait(&lwait.cond, &lwait.mutex);
+ pthread_mutex_unlock(&lwait.mutex);
+
+ errno = lwait.lksb.sb_status;
+ if (lwait.lksb.sb_status != EUNLOCK)
+ return -1;
+ else
+ return 0;
}
/* We are always quorate ! */
Index: LVM2.2.02.39/daemons/clvmd/Makefile.in
===================================================================
--- LVM2.2.02.39.orig/daemons/clvmd/Makefile.in 2009-01-22 12:26:13.000000000 +0800
+++ LVM2.2.02.39/daemons/clvmd/Makefile.in 2009-01-22 12:27:34.000000000 +0800
--- LVM2.2.02.39.orig/daemons/clvmd/Makefile.in 2009-02-25 18:52:32.000000000 +0800
+++ LVM2.2.02.39/daemons/clvmd/Makefile.in 2009-02-25 18:52:32.000000000 +0800
@@ -59,7 +59,7 @@
ifeq ("$(OPENAIS)", "yes")
@ -361,8 +361,8 @@ Index: LVM2.2.02.39/daemons/clvmd/Makefile.in
Index: LVM2.2.02.39/daemons/clvmd/clvm.h
===================================================================
--- LVM2.2.02.39.orig/daemons/clvmd/clvm.h 2009-01-22 12:26:13.000000000 +0800
+++ LVM2.2.02.39/daemons/clvmd/clvm.h 2009-01-22 12:35:08.000000000 +0800
--- LVM2.2.02.39.orig/daemons/clvmd/clvm.h 2009-02-25 18:52:32.000000000 +0800
+++ LVM2.2.02.39/daemons/clvmd/clvm.h 2009-02-25 18:52:32.000000000 +0800
@@ -79,6 +79,7 @@
/* Locking flags - these match the ones
* in dlm.h

View File

@ -28,7 +28,8 @@
# Parameter defaults
: ${OCF_RESKEY_CRM_meta_gloablly_unique:="false"}
: ${OCF_RESKEY_daemon_timeout:="10"}
: ${OCF_RESKEY_daemon_timeout:="80"}
: ${OCF_RESKEY_daemon_options:="-d0"}
# Common variables
DAEMON="/usr/sbin/clvmd"
@ -49,7 +50,7 @@ bringup_daemon()
return $OCF_ERR_INSTALLED
fi
start_daemon "$DAEMON"; rc=$?
start_daemon "$DAEMON" "$OCF_RESKEY_daemon_options"; rc=$?
if [ $rc != 0 ]; then
ocf_log err "Could not start $DAEMON"
return $OCF_ERR_GENERIC
@ -80,7 +81,7 @@ kill_daemon()
fi
ocf_log info "Stopping `basename "$DAEMON"`"
killproc "$DAEMON"
killproc -INT "$DAEMON"
sleep 1
status_daemon; rc=$?
@ -89,12 +90,18 @@ kill_daemon()
while [ $rc = $OCF_SUCCESS ]; do
COUNT=`expr $COUNT + 1`
if [ $COUNT -gt $OCF_RESKEY_daemon_timeout ]; then
ocf_log err "`basename $DAEMON` shutdown emergency"
ocf_log err "`basename $DAEMON` shutdown emergency"
killproc -9 "$DAEMON"
return $OCF_SUCCESS
status_daemon; rc=$?
if [ $rc = $OCF_NOT_RUNNING ]; then
return $OCF_SUCCESS
else
return $OCF_ERR_GENERIC
fi
fi
status_daemon; rc=$?
killproc -INT "$DAEMON"
sleep 1
status_daemon; rc=$?
done
return $OCF_SUCCESS
@ -155,21 +162,30 @@ meta_data() {
<!DOCTYPE resource-agent SYSTEM "ra-api-1.dtd">
<resource-agent name="clvmd">
<version>1.0</version>
<shortdesc lang="en">clvmd resource agent</shortdesc>
<longdesc lang="en">
This is a clvmd Resource Agent.
It starts clvmd as anonymous clones.
</longdesc>
<shortdesc lang="en">clvmd resource agent</shortdesc>
<parameters>
<parameter name="daemon_timeout" unique="0">
<longdesc lang="en">
Number of seconds to allow the control daemon to come up
Number of seconds to allow the control daemon to come up and down
</longdesc>
<shortdesc lang="en">Daemon Timeout</shortdesc>
<content type="string" default="10"/>
<content type="string" default="80"/>
</parameter>
<parameter name="daemon_options" unique="0">
<longdesc lang="en">
Options to clvmd. Refer to clvmd.8 for detailed descriptions.
</longdesc>
<shortdesc lang="en">Daemon Options</shortdesc>
<content type="string" default="-d0"/>
</parameter>
</parameters>
<actions>
<action name="start" timeout="90" />

View File

@ -9,6 +9,19 @@ PVNAME=$1
exit 1
fi
lvlist=$(/sbin/lvm lvs --config "devices {filter = [ \"a|$PVNAME|\", \"r/.*/\" ]}" --partial -o lv_name,lv_attr --ignorelockingfailure --noheadings $vgname 2>/dev/null | while read lvname lvattr; do
if [[ $lvattr =~ mode. ]] ; then
continue
fi
if [[ $lvattr =~ ....-. ]]; then
echo -n $lvname
fi
done)
if [ -z "$lvlist" ] ; then
exit 1
fi
pvlist=$(/sbin/lvm vgdisplay --config "devices {filter = [ \"a|$PVNAME|\", \"r/.*/\" ]}" --partial -v $vgname 2>/dev/null | while read str1 str2 val; do
if [[ $str1 =~ PV && $str2 =~ UUID ]]; then
echo $val
@ -21,13 +34,16 @@ PVNAME=$1
collected=0
for pv in $pvlist; do
if [[ x$pv = x$pvuuid ]]; then
continue
fi
if [[ ! -h /dev/disk/by-id/lvm2-pvuuid-$pv ]]; then
echo COLLECT=1
collected=1
break
fi
done
if [[ $collected == 0 ]]; then
if [[ $collected = 0 ]]; then
echo COLLECT=0
fi

View File

@ -0,0 +1,35 @@
Index: LVM2.2.02.45/tools/dmsetup.c
===================================================================
--- LVM2.2.02.45.orig/tools/dmsetup.c 2009-04-27 17:46:16.000000000 +0800
+++ LVM2.2.02.45/tools/dmsetup.c 2009-04-27 17:58:50.000000000 +0800
@@ -1087,6 +1087,7 @@
const char *name = NULL;
const char *uuid = NULL;
struct dm_info info;
+ struct dm_deps *deps;
if (data)
name = names->name;
@@ -1156,6 +1157,22 @@
printf("\n");
}
+ dm_task_destroy(dmt);
+
+ if (!(dmt = dm_task_create(DM_DEVICE_DEPS)))
+ goto out;
+
+ if (!_set_task_device(dmt, name, 0))
+ goto out;
+
+ if (!dm_task_run(dmt))
+ goto out;
+
+ if (!(deps = dm_task_get_deps(dmt)))
+ goto out;
+
+ printf("DM_DEPS=%d\n", deps->count);
+
r = 1;
out:
if (dmt)

View File

@ -0,0 +1,132 @@
Index: LVM2.2.02.45/tools/dmsetup.c
===================================================================
--- LVM2.2.02.45.orig/tools/dmsetup.c 2008-10-31 01:52:06.000000000 +0800
+++ LVM2.2.02.45/tools/dmsetup.c 2009-04-27 17:46:16.000000000 +0800
@@ -1075,6 +1075,94 @@
return r;
}
+static int _export(int argc, char **argv, void *data)
+{
+ int r = 0;
+ struct dm_task *dmt = NULL;
+ void *next = NULL;
+ uint64_t start, length;
+ char *target_type = NULL;
+ char *params;
+ struct dm_names *names = (struct dm_names *) data;
+ const char *name = NULL;
+ const char *uuid = NULL;
+ struct dm_info info;
+
+ if (data)
+ name = names->name;
+ else if (argc == 2)
+ name = argv[1];
+
+ if (!(dmt = dm_task_create(DM_DEVICE_STATUS)))
+ goto out;
+
+ if (!_set_task_device(dmt, name, 0))
+ goto out;
+
+ if (!dm_task_run(dmt))
+ goto out;
+
+ if (!dm_task_get_info(dmt, &info) || !info.exists)
+ goto out;
+
+ if (!name)
+ name = dm_task_get_name(dmt);
+
+ uuid = dm_task_get_uuid(dmt);
+ printf("DM_NAME=%s\n", name);
+
+ if ((uuid = dm_task_get_uuid(dmt)) && *uuid)
+ printf("DM_UUID=%s\n", uuid);
+
+ if (!info.exists) {
+ printf("DM_STATE=NOTPRESENT\n");
+ goto out;
+ }
+
+ printf("DM_STATE=%s\n",
+ info.suspended ? "SUSPENDED" :
+ (info.read_only ? "READONLY" : "ACTIVE"));
+
+ if (!info.live_table && !info.inactive_table)
+ printf("DM_TABLE_STATE=NONE\n");
+ else
+ printf("DM_TABLE_STATE=%s%s%s\n",
+ info.live_table ? "LIVE" : "",
+ info.live_table && info.inactive_table ? "/" : "",
+ info.inactive_table ? "INACTIVE" : "");
+
+ if (info.open_count != -1)
+ printf("DM_OPENCOUNT=%d\n", info.open_count);
+
+ printf("DM_LAST_EVENT_NR=%" PRIu32 "\n", info.event_nr);
+
+ printf("DM_MAJOR=%d\n", info.major);
+ printf("DM_MINOR=%d\n", info.minor);
+
+ if (info.target_count != -1)
+ printf("DM_TARGET_COUNT=%d\n", info.target_count);
+
+ /* export all table types */
+ next = dm_get_next_target(dmt, next, &start, &length,
+ &target_type, &params);
+ if (target_type) {
+ printf("DM_TARGET_TYPES=%s", target_type);
+ while (next) {
+ next = dm_get_next_target(dmt, next, &start, &length,
+ &target_type, &params);
+ if (target_type)
+ printf(",%s", target_type);
+ }
+ printf("\n");
+ }
+
+ r = 1;
+ out:
+ if (dmt)
+ dm_task_destroy(dmt);
+ return r;
+}
+
/* Show target names and their version numbers */
static int _targets(int argc __attribute((unused)), char **argv __attribute((unused)), void *data __attribute((unused)))
{
@@ -2115,6 +2203,7 @@
{"info", "[<device>]", 0, 1, _info},
{"deps", "[<device>]", 0, 1, _deps},
{"status", "[<device>] [--target <target_type>]", 0, 1, _status},
+ {"export", "[<device>]", 0, 1, _export},
{"table", "[<device>] [--target <target_type>] [--showkeys]", 0, 1, _status},
{"wait", "<device> [<event_nr>]", 0, 2, _wait},
{"mknodes", "[<device>]", 0, 1, _mknodes},
Index: LVM2.2.02.45/man/dmsetup.8.in
===================================================================
--- LVM2.2.02.45.orig/man/dmsetup.8.in 2007-12-28 23:13:38.000000000 +0800
+++ LVM2.2.02.45/man/dmsetup.8.in 2009-04-27 17:48:53.000000000 +0800
@@ -46,6 +46,9 @@
.I [--noheadings] [--separator separator] [-o fields] [-O|--sort sort_fields]
.I [device_name]
.br
+.B dmsetup export
+.I [device_name]
+.br
.B dmsetup deps
.I [device_name]
.br
@@ -146,6 +149,10 @@
If successful a device will appear as
/dev/device-mapper/<device-name>.
See below for information on the table format.
+.IP \fBexport
+.I [device_name]
+.br
+Outputs information in key/value format to be imported by other programs.
.IP \fBdeps
.I [device_name]
.br

View File

@ -0,0 +1,45 @@
Index: LVM2.2.02.45/libdm/datastruct/hash.c
===================================================================
--- LVM2.2.02.45.orig/libdm/datastruct/hash.c 2008-11-04 02:59:59.000000000 +0800
+++ LVM2.2.02.45/libdm/datastruct/hash.c 2009-04-27 17:52:05.000000000 +0800
@@ -19,7 +19,7 @@
struct dm_hash_node *next;
void *data;
unsigned keylen;
- char key[0];
+ unsigned char key[0];
};
struct dm_hash_table {
@@ -140,7 +140,7 @@
static struct dm_hash_node **_find(struct dm_hash_table *t, const char *key,
uint32_t len)
{
- unsigned h = _hash(key, len) & (t->num_slots - 1);
+ unsigned h = _hash((unsigned char*)key, len) & (t->num_slots - 1);
struct dm_hash_node **c;
for (c = &t->slots[h]; *c; c = &((*c)->next))
@@ -235,7 +235,7 @@
char *dm_hash_get_key(struct dm_hash_table *t __attribute((unused)),
struct dm_hash_node *n)
{
- return n->key;
+ return (char*)n->key;
}
void *dm_hash_get_data(struct dm_hash_table *t __attribute((unused)),
Index: LVM2.2.02.45/libdm/ioctl/libdm-iface.c
===================================================================
--- LVM2.2.02.45.orig/libdm/ioctl/libdm-iface.c 2009-02-13 04:42:07.000000000 +0800
+++ LVM2.2.02.45/libdm/ioctl/libdm-iface.c 2009-04-27 17:53:30.000000000 +0800
@@ -1668,7 +1668,8 @@
dmt->no_open_count ? 'N' : 'O',
dmt->no_flush ? 'N' : 'F',
dmt->skip_lockfs ? "S " : "",
- dmt->sector, dmt->message ? dmt->message : "",
+ (unsigned long long int)dmt->sector,
+ dmt->message ? dmt->message : "",
dmi->data_size);
#ifdef DM_IOCTLS
if (ioctl(_control_fd, command, dmi) < 0) {

21
device-mapper-static.diff Normal file
View File

@ -0,0 +1,21 @@
Index: LVM2.2.02.45/libdm/Makefile.in
===================================================================
--- LVM2.2.02.45.orig/libdm/Makefile.in 2009-04-27 17:41:57.000000000 +0800
+++ LVM2.2.02.45/libdm/Makefile.in 2009-04-27 17:56:06.000000000 +0800
@@ -78,7 +78,6 @@
$(libdir)/libdevmapper.$(LIB_SUFFIX)
install_static: install_@interface@_static
- $(LN_S) -f libdevmapper.a.$(LIB_VERSION_DM) $(libdir)/libdevmapper.a
install_ioctl: ioctl/libdevmapper.$(LIB_SUFFIX)
$(INSTALL) -D -m 555 $(STRIP) $< \
@@ -90,7 +89,7 @@
install_ioctl_static: ioctl/libdevmapper.a
$(INSTALL) -D -m 555 $(STRIP) $< \
- $(libdir)/libdevmapper.a.$(LIB_VERSION_DM)
+ $(libdir)/libdevmapper.a
$(VERSIONED_SHLIB): %.$(LIB_SUFFIX).$(LIB_VERSION_DM): $(interface)/%.$(LIB_SUFFIX)
rm -f $@

View File

@ -0,0 +1,132 @@
Index: LVM2.2.02.45/libdm/ioctl/libdm-iface.c
===================================================================
--- LVM2.2.02.45.orig/libdm/ioctl/libdm-iface.c 2009-04-27 17:53:30.000000000 +0800
+++ LVM2.2.02.45/libdm/ioctl/libdm-iface.c 2009-04-27 17:57:54.000000000 +0800
@@ -129,6 +129,67 @@
# define DM_EXISTS_FLAG 0x00000004
#endif
+static unsigned long long get_seq()
+{
+ struct stat s;
+ int r;
+ unsigned long long seq = 0;
+ FILE* fp;
+ r = stat("/sys/kernel/uevent_seqnum", &s);
+ if (r) { return seq; }
+ if (!S_ISREG(s.st_mode)) { return seq; }
+ fp = fopen("/sys/kernel/uevent_seqnum", "r");
+ if (fp == NULL) { return seq; }
+ fscanf(fp, "%llu\n", &seq);
+ fclose(fp);
+ return seq;
+}
+
+static int wait_4_udev(unsigned long long start_seq, unsigned long long end_seq)
+{
+ FILE* fp;
+ struct stat s;
+ int r;
+ int ite=30; /* Iterate 30 times. Otherwise, it's considered timed out */
+ unsigned long long seq;
+ /*
+ * len("/dev/.udev/queue/") + len(str(0xffffffffffffffff)) = 38
+ */
+ #define PATH_SIZE 40
+ char filename[PATH_SIZE];
+ #undef PATH_SIZE
+
+ if (start_seq > end_seq || end_seq == 0) return 1;
+
+ /* Wait until end_seq is enqueued into udev */
+ r = stat("/dev/.udev/uevent_seqnum", &s);
+ if (r) { return 1; }
+ if (!S_ISREG(s.st_mode)) { return 1; }
+ while (ite-- > 0) {
+ fp = fopen("/dev/.udev/uevent_seqnum", "r");
+ if (fp == NULL) { return 1; }
+ fscanf(fp, "%llu\n", &seq);
+ fclose(fp);
+ if (seq >= end_seq) { break; }
+ usleep(200000);
+ }
+ if (ite <=0 ) return 1;
+
+ /* Loop to make sure all $seq are unlinked in /dev/.udev/queue then */
+ for (seq = start_seq; seq <= end_seq; seq++) {
+ ite = 30;
+ while (ite-- > 0) {
+ snprintf(filename, sizeof(filename), "/dev/.udev/queue/%llu", seq);
+ r = open(filename, O_RDONLY);
+ if (r == -1 && errno == ENOENT) break;
+ if (r >= 0) close(r);
+ usleep(200000);
+ }
+ if (ite <=0 ) return 1;
+ }
+ return 0;
+}
+
static void *_align(void *ptr, unsigned int a)
{
register unsigned long agn = --a;
@@ -679,6 +740,7 @@
{
struct dm_ioctl_v1 *dmi;
unsigned int command;
+ unsigned long long before_seq, after_seq;
dmi = _flatten_v1(dmt);
if (!dmi) {
@@ -705,6 +767,8 @@
dmi->name, dmi->uuid, dmt->newname ? " " : "",
dmt->newname ? dmt->newname : "",
dmi->data_size);
+
+ before_seq = get_seq();
if (dmt->type == DM_DEVICE_LIST) {
if (!_dm_names_v1(dmi))
goto bad;
@@ -724,10 +788,13 @@
#else /* Userspace alternative for testing */
#endif
+ after_seq = get_seq();
if (dmi->flags & DM_BUFFER_FULL_FLAG)
/* FIXME Increase buffer size and retry operation (if query) */
log_error("WARNING: libdevmapper buffer too small for data");
+ wait_4_udev(before_seq, after_seq);
+
switch (dmt->type) {
case DM_DEVICE_CREATE:
add_dev_node(dmt->dev_name, MAJOR(dmi->dev), MINOR(dmi->dev),
@@ -1706,6 +1773,7 @@
{
struct dm_ioctl *dmi;
unsigned command;
+ unsigned long long before_seq, after_seq;
#ifdef DM_COMPAT
if (_dm_version == 1)
@@ -1736,9 +1804,11 @@
return 0;
repeat_ioctl:
+ before_seq = get_seq();
if (!(dmi = _do_dm_ioctl(dmt, command, _ioctl_buffer_double_factor)))
return 0;
+ after_seq = get_seq();
if (dmi->flags & DM_BUFFER_FULL_FLAG) {
switch (dmt->type) {
case DM_DEVICE_LIST_VERSIONS:
@@ -1755,6 +1825,8 @@
}
}
+ wait_4_udev(before_seq, after_seq);
+
switch (dmt->type) {
case DM_DEVICE_CREATE:
if (dmt->dev_name && *dmt->dev_name)

484
device-mapper.changes Normal file
View File

@ -0,0 +1,484 @@
-------------------------------------------------------------------
Mon May 11 15:36:05 CST 2009 - xwhu@suse.de
- Enable pkgconfig for GNOME 2.28
-------------------------------------------------------------------
Mon Apr 27 18:37:32 CST 2009 - xwhu@suse.de
- Upgrade to 1.02.31
. Add "all" field to reports expanding to all fields of report type.
. Enforce device name length and character limitations in libdm.
. Replace _dm_snprintf with EMIT_PARAMS macro for creating target lines.
. Only resume devices in dm_tree_preload_children if size changes.
. Extend deptree buffers so the largest possible device numbers fit.
. Generate versioned libdevmapper-event.so.
. Underline longer report help text headings.
-------------------------------------------------------------------
Tue Apr 21 10:11:35 CEST 2009 - xwhu@suse.de
- bnc#479104, export additional information
-------------------------------------------------------------------
Tue Feb 3 08:42:58 CET 2009 - hare@suse.de
- No whitespace for DM_STATE export variable (bnc#440959)
- Remove obsolete reference to boot.scsidev from init script
-------------------------------------------------------------------
Wed Dec 10 12:34:56 CET 2008 - olh@suse.de
- use Obsoletes: -XXbit only for ppc64 to help solver during distupgrade
(bnc#437293)
-------------------------------------------------------------------
Wed Nov 5 16:57:47 CET 2008 - werner@suse.de
- As boot.crypto depends on boot.device-mapper, the later one has
even on shutdown to depend on boot.udev to make sure that events
will be processed (bnc#413059)
-------------------------------------------------------------------
Thu Oct 30 12:34:56 CET 2008 - olh@suse.de
- obsolete old -XXbit packages (bnc#437293)
-------------------------------------------------------------------
Sat Sep 13 07:03:44 CEST 2008 - xwhu@suse.de
- Fix typo for correct compiling
- Timeout if udevd's not running (bnc#425436)
-------------------------------------------------------------------
Wed Sep 10 11:56:17 CEST 2008 - xwhu@suse.de
- update to 1.02.27
Align struct memblock in dbg_malloc for sparc.
Add --unquoted and --rows to dmsetup.
Avoid compiler warning about cast in dmsetup.c's OFFSET_OF macro.
Fix inverted no_flush debug message.
Remove --enable-jobs from configure. (Set at runtime instead.)
Bring configure.in and list.h into line with the lvm2 versions.
-------------------------------------------------------------------
Wed Sep 3 11:09:34 CEST 2008 - hare@suse.de
- Call mkinitrd_setup during %post and %postun (bnc#413709)
-------------------------------------------------------------------
Mon Aug 25 12:03:57 CEST 2008 - prusnak@suse.cz
- enabled SELinux support [Fate#303662]
-------------------------------------------------------------------
Fri Aug 22 13:00:15 CEST 2008 - xwhu@suse.de
- Remove the -p option for fillup_and_insserv
-------------------------------------------------------------------
Wed Aug 13 06:26:49 CEST 2008 - xwhu@suse.de
- Add Should-Stop to boot.device-mapper
-------------------------------------------------------------------
Wed Jul 23 15:35:05 CEST 2008 - hare@suse.de
- Include mkinitrd scriptlets.
-------------------------------------------------------------------
Wed Jul 16 19:38:07 CEST 2008 - xwhu@suse.de
- repack device-mapper.1.02.26.tar.bz2 into bzip2.
- change the owner of device to root:disk, with permission
0640 (bnc#407952)
-------------------------------------------------------------------
Tue Jun 24 05:43:08 CEST 2008 - xwhu@suse.de
- update to new version 1.02.26
Initialise params buffer to empty string in _emit_segment.
Skip add_dev_node when ioctls disabled.
Make dm_hash_iter safe against deletion.
Accept a NULL pointer to dm_free silently.
Add tables_loaded, readonly and suspended columns to reports.
Add --nameprefixes to dmsetup.
Add field name prefix option to reporting functions.
Calculate string size within dm_pool_grow_object.
Remove redundant if-before-free tests.
Use log_warn for reporting field help text instead of log_print.
Change cluster mirror log type name (s/clustered_/clustered-/)
-------------------------------------------------------------------
Fri May 30 13:54:02 CEST 2008 - xwhu@suse.de
- Hold on mknod until udev finish it's job.
-------------------------------------------------------------------
Thu Apr 10 12:54:45 CEST 2008 - ro@suse.de
- added baselibs.conf file to build xxbit packages
for multilib support
-------------------------------------------------------------------
Wed Feb 27 13:00:25 CET 2008 - dmueller@suse.de
- fix static library installation again
-------------------------------------------------------------------
Tue Feb 26 21:55:47 CET 2008 - dmueller@suse.de
- fix "binary contains trace of $RPM_BUILD_ROOT" failure
-------------------------------------------------------------------
Thu Feb 7 08:59:16 CET 2008 - hare@suse.de
- Enable dmeventd (FATE#303381)
-------------------------------------------------------------------
Thu Jan 31 11:54:11 CET 2008 - fehr@suse.de
- update to new version 1.02.24
Fix deptree to pass new name to _resume_node after a rename.
Suppress other node operations if node is deleted.
Report error when empty device name passed to readahead functions.
-------------------------------------------------------------------
Mon Dec 10 11:25:40 CET 2007 - fehr@suse.de
- update to new version 1.02.23
Add readahead support to libdevmapper and dmsetup.
Fix double free in a libdevmapper-event error path.
Allow a DM_DEV_DIR environment variable to override /dev.
-------------------------------------------------------------------
Thu Nov 22 14:07:15 CET 2007 - fehr@suse.de
- update to new version 1.02.22
Fix inconsistent licence notices: executables are GPLv2; libraries LGPLv2.1.
Fix dmsetup -o devno string termination.
Fix default dmsetup report buffering and add --unbuffered.
Add tree-based and dependency fields to dmsetup reports.
-------------------------------------------------------------------
Mon May 7 11:46:29 CEST 2007 - kay.sievers@suse.de
- update to new version 1.02.19
Avoid trailing separator in reports when there are hidden sort fields.
Fix segfault in 'dmsetup status' without --showkeys against crypt target.
Migrate dmsetup column-based output over to new libdevmapper report framework.
Add descriptions to reporting field definitions.
Add basic reporting functions to libdevmapper.
- remove dmsetup option patch (upstream provides it)
- add dmsetup export command
-------------------------------------------------------------------
Sun Feb 11 11:58:37 CET 2007 - ro@suse.de
- fix build as non-root
-------------------------------------------------------------------
Tue Jan 16 14:25:01 CET 2007 - fehr@suse.de
- remove superfluouus /lib/libdevmapper.so (#235359)
- add call to ldconfig (#235359)
-------------------------------------------------------------------
Wed Dec 6 09:58:48 CET 2006 - fehr@suse.de
- update to new version 1.02.13
Update dmsetup man page (setgeometry & message).
Fix dmsetup free after getline with debug.
Suppress encryption key in 'dmsetup table' output unless --showkeys supplied.
-------------------------------------------------------------------
Mon Oct 16 13:01:52 CEST 2006 - fehr@suse.de
- update to new version 1.02.12
Avoid deptree attempting to suspend a device that's already suspended.
Add suspend noflush support.
Add basic dmsetup loop support.
Switch dmsetup to use dm_malloc and dm_free.
-------------------------------------------------------------------
Wed Sep 20 13:12:05 CEST 2006 - fehr@suse.de
- update to new version 1.02.10
Add dm_snprintf(), dm_split_words() and dm_split_lvm_name() to libdevmapper.
Reorder mm bounds_check code to reduce window for a dmeventd race.
-------------------------------------------------------------------
Thu Sep 14 13:40:12 CEST 2006 - mkoenig@suse.de
- fixed permissions for static lib
- removed static lib version extension
-------------------------------------------------------------------
Tue Sep 12 16:57:24 CEST 2006 - hvogel@suse.de
- split device-mapper-devel subpackage
- install static libs (needed to link cryptsetup from
util-linux-crypto static)
-------------------------------------------------------------------
Wed Aug 30 14:38:57 CEST 2006 - hare@suse.de
- Fix gcc warnings
- Fix field display for 'dmsetup info'.
-------------------------------------------------------------------
Wed Aug 30 09:10:36 CEST 2006 - hare@suse.de
- Add 'major', 'minor', and 'uuid' as valid fields for
'dmsetup info -o XXX'.
-------------------------------------------------------------------
Wed Aug 16 13:15:28 CEST 2006 - fehr@suse.de
- update to new version 1.02.09
Add --table argument to dmsetup for a one-line table.
Abort if errors are found during cmdline option processing.
Add lockfs indicator to debug output.
-------------------------------------------------------------------
Wed Jul 26 16:28:37 CEST 2006 - fehr@suse.de
- update to new version 1.02.08
Update dmsetup man page.
Add --force to dmsetup remove* to load error target.
dmsetup remove_all also performs mknodes.
Don't suppress identical table reloads if permission changes.
Fix corelog segment line.
-------------------------------------------------------------------
Mon May 22 17:16:40 CEST 2006 - fehr@suse.de
- update to new version 1.02.07
Add DM_CORELOG flag to dm_tree_node_add_mirror_target().
Avoid a dmeventd compiler warning.
- update to new version 1.02.06
Move DEFS into configure.h.
Fix leaks in error paths found by coverity.
Remove dmsetup line buffer limitation.
-------------------------------------------------------------------
Thu Apr 20 12:25:08 CEST 2006 - fehr@suse.de
- update to new version 1.02.05
Separate install_include target in makefiles.
Separate out DEFS from CFLAGS.
Support pkg-config.
Check for libsepol.
-------------------------------------------------------------------
Wed Apr 19 09:41:49 CEST 2006 - fehr@suse.de
- update to new version 1.02.04
Bring dmsetup man page up-to-date.
Use name-based device refs if kernel doesn't support device number refs.
Fix memory leak (struct dm_ioctl) when struct dm_task is reused.
If _create_and_load_v4 fails part way through, revert the creation.
dmeventd thread/fifo fixes.
Add file & line to dm_strdup_aux().
Add setgeometry.
-------------------------------------------------------------------
Tue Mar 14 11:26:03 CET 2006 - fehr@suse.de
- update to new version 1.02.03
Add exported functions to set uid, gid and mode.
Rename _log to dm_log and export.
Add dm_tree_skip_lockfs.
Fix dm_strdup debug definition.
Fix hash function to avoid using a negative array offset.
Don't inline _find in hash.c and tidy signed/unsigned etc.
Fix libdevmapper.h #endif.
Fix dmsetup version driver version.
Add sync, nosync and block_on_error mirror log parameters.
Add hweight32.
Fix dmeventd build.
-------------------------------------------------------------------
Thu Mar 2 08:29:42 CET 2006 - hare@suse.de
- Do not call devmap_mknod.sh (#150818)
-------------------------------------------------------------------
Wed Jan 25 21:35:26 CET 2006 - mls@suse.de
- converted neededforbuild to BuildRequires
--------------------------------------------------------------------
Tue Jan 24 15:28:30 CET 2006 - fehr@suse.de
- fix exit code of "dmsetup version" (#144794)
--------------------------------------------------------------------
Mon Jan 23 11:50:44 CET 2006 - fehr@suse.de
- add boot.udev to Required-Start section of init script (#144586)
--------------------------------------------------------------------
Tue Dec 6 16:10:55 CET 2005 - fehr@suse.de
- update to new version 1.02.02
--------------------------------------------------------------------
Tue Sep 27 09:32:02 CEST 2005 - fehr@suse.de
- update to new version 1.01.05
--------------------------------------------------------------------
Wed Sep 21 14:27:57 CEST 2005 - fehr@suse.de
- increase ioctl buffer size from 16k to 256k to allow larger number
of dm device visible by "dmsetup ls" and "dmsetup table"
-------------------------------------------------------------------
Wed Aug 3 12:00:40 CEST 2005 - fehr@suse.de
- update to new version 1.01.04
-------------------------------------------------------------------
Thu Jun 30 11:25:59 CEST 2005 - meissner@suse.de
- use RPM_OPT_FLAGS.
-------------------------------------------------------------------
Tue Jun 14 10:58:19 CEST 2005 - fehr@suse.de
- update to new version 1.01.03
-------------------------------------------------------------------
Wed May 18 15:02:07 CEST 2005 - fehr@suse.de
- update to new version 1.01.02
-------------------------------------------------------------------
Mon Apr 11 13:08:38 CEST 2005 - fehr@suse.de
- use -py instead of -pY as option for fillup_and_insserv (#76689)
- update to new version 1.01.01
-------------------------------------------------------------------
Tue Jan 18 11:07:41 CET 2005 - fehr@suse.de
- update to new version 1.01.00
-------------------------------------------------------------------
Tue Jan 11 17:39:14 CET 2005 - fehr@suse.de
- update to new version 1.00.21
-------------------------------------------------------------------
Thu Aug 26 11:11:33 CEST 2004 - fehr@suse.de
- /dev/mapper directory is now part of devs.rpm (#44258)
-------------------------------------------------------------------
Wed Jul 14 15:25:00 CEST 2004 - fehr@suse.de
- update to new version 1.00.19
-------------------------------------------------------------------
Thu May 27 16:24:22 CEST 2004 - fehr@suse.de
- do not unload dm modules on shutdown, this hangs on some machines
-------------------------------------------------------------------
Sat Apr 10 17:09:28 CEST 2004 - aj@suse.de
- devicemapper does not need 2.6 kernelsources.
-------------------------------------------------------------------
Thu Apr 1 09:34:25 CEST 2004 - fehr@suse.de
- update to new version 1.00.09
-------------------------------------------------------------------
Tue Mar 16 16:53:11 CET 2004 - fehr@suse.de
- fix typo in start script (#36168)
-------------------------------------------------------------------
Mon Mar 15 14:39:12 CET 2004 - fehr@suse.de
- do not depend on existence of /dev/mapper dir (#35825)
-------------------------------------------------------------------
Tue Mar 2 01:57:20 CET 2004 - ro@suse.de
- remove root-fsck stuff in bootscript
- instead depend on boot.rootfsck
-------------------------------------------------------------------
Fri Dec 5 13:19:50 CET 2003 - fehr@suse.de
- update to new version 1.00.07
-------------------------------------------------------------------
Mon Nov 17 17:27:07 CET 2003 - odabrunz@suse.de
- fix spec file to make it compile with both new and old glibc
(__kernel_dev_t)
-------------------------------------------------------------------
Thu Oct 2 11:55:09 CEST 2003 - fehr@suse.de
- add fix to make it compile with new glibc (use __kernel_old_dev_t)
-------------------------------------------------------------------
Thu Sep 18 13:05:20 CEST 2003 - fehr@suse.de
- fix boot.devicemapper to cope with LABEL= and UUID= in /etc/fstab
also check reiser filesystem (#31060)
-------------------------------------------------------------------
Wed Sep 17 11:57:03 CEST 2003 - fehr@suse.de
- add comment when remounting root fs read-only (#31060)
-------------------------------------------------------------------
Tue Sep 16 13:10:09 CEST 2003 - kukuk@suse.de
- Add missing PreRequires [Bug #31006]
-------------------------------------------------------------------
Tue Sep 2 11:02:52 CEST 2003 - fehr@suse.de
- update to version 1.00.05
-------------------------------------------------------------------
Mon Aug 25 10:24:48 CEST 2003 - fehr@suse.de
- update to version 1.00.04
-------------------------------------------------------------------
Thu Aug 21 12:21:50 CEST 2003 - fehr@suse.de
- update to version 1.00.03
-------------------------------------------------------------------
Mon Aug 18 17:34:00 CEST 2003 - garloff@suse.de
- (#29083) Add # X-UnitedLinux-Should-Start: boot.scsidev
-------------------------------------------------------------------
Fri Jul 25 09:29:48 CEST 2003 - fehr@suse.de
- update to version 1.00.02
-------------------------------------------------------------------
Tue Jul 1 15:55:12 CEST 2003 - fehr@suse.de
- add boot script for automated startup in system
- fix typos in boot script
-------------------------------------------------------------------
Mon Jun 30 17:32:06 CEST 2003 - fehr@suse.de
- created initial version of a SuSE package
-------------------------------------------------------------------

436
device-mapper.spec Normal file
View File

@ -0,0 +1,436 @@
#
# spec file for package device-mapper (Version 1.02.31)
#
# Copyright (c) 2009 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
Name: device-mapper
License: GPL v2 or later; LGPL v2.1 or later
Group: System/Base
AutoReqProv: on
# bug437293
%ifarch ppc64
Obsoletes: device-mapper-64bit
%endif
#
Version: 1.02.31
Release: 2
Summary: Device Mapper Tools
Source: LVM2.2.02.45.tar.bz2
Source1: boot.device-mapper
Source2: mkinitrd-setup.sh
Source3: mkinitrd-boot.sh
Patch: improve_probing.diff
Patch2: no-inc-audit.diff
Patch3: no_buildroot_shared.diff
Patch4: sys_mount_instead_linux_fs.diff
Patch5: pvscan_2TB_limit.diff
Patch6: man_page_sectors.diff
Patch10: lvm-no_chown.diff
Patch11: cmdline_large_minor.diff
Patch12: enable-clvmd.patch
Patch13: pipe_buff-definition.diff
Patch14: lvm-pv-create-link.diff
#Patch15: dmeventd-link-libcmd.diff
Patch16: clvmd-openais-use-dlm.diff
Patch17: bug-486952_clvmd-check-returncode-of-dlmrelease.diff
Patch18: sigterm_in_main_thread.diff
Patch19: dont_ignore_tmp_device_file.diff
Patch20: support-drbd-filter.diff
Patch21: call_cpg_leave_before_shutdown.diff
#Patches for device mapper
Patch60: k_dev_t.dif
Patch61: device-mapper-dmsetup-export.patch
Patch62: device-mapper-gcc-warning.diff
Patch63: device-mapper-static.diff
Patch64: device-mapper-wait_udev.diff
Patch65: device-mapper-dmsetup-deps-export.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: libselinux-devel
PreReq: %insserv_prereq %fillup_prereq
%description
Programs, libraries, and man pages for configuring and using the device
mapper.
Authors:
--------
Joe Thornber <thornber@sistina.com>
%package devel
License: GPL v2 or later; LGPL v2.1 or later
Summary: Development package for the device mapper
Group: System/Base
Requires: %name = %version
%description devel
Files needed for software development using the device mapper
Authors:
--------
Joe Thornber <thornber@sistina.com>
%prep
%setup -n LVM2.2.02.45
%patch
%patch2
%patch3
%patch4
%patch5
%patch6
%patch10
%patch11
%patch12
%patch13
%patch14 -p1
#%patch15 -p1
%patch16 -p1
%patch17 -p1
%patch18 -p1
%patch19 -p1
%patch20 -p1
%patch21 -p1
%patch60 -p1
%patch61 -p1
%patch62 -p1
%patch63 -p1
%patch64 -p1
%patch65 -p1
%build
CFLAGS="$RPM_OPT_FLAGS" \
%configure --bindir=/bin --libdir=/%_lib --sbindir=/sbin --enable-dmeventd \
--enable-selinux --enable-cmdlib \
--with-dmeventd-path=/sbin/dmeventd \
--with-device-uid=0 --with-device-gid=6 --with-device-mode=0640 \
--enable-pkgconfig
make %{?jobs:-j %jobs}
%install
#%makeinstall
make install_device-mapper DESTDIR=$RPM_BUILD_ROOT
#make libdir=$RPM_BUILD_ROOT/%_libdir install_static_lib
mkdir -p $RPM_BUILD_ROOT/%_libdir
ln -s /%_lib/libdevmapper.so.1.02 $RPM_BUILD_ROOT/%_libdir/libdevmapper.so
ln -s /%_lib/libdevmapper-event.so.1.02 $RPM_BUILD_ROOT/%_libdir/libdevmapper-event.so
rm $RPM_BUILD_ROOT/%_lib/libdevmapper.so
rm $RPM_BUILD_ROOT/%_lib/libdevmapper-event.so
rm $RPM_BUILD_ROOT/%_lib/libdevmapper-event-lvm2mirror.so
rm $RPM_BUILD_ROOT/%_lib/libdevmapper-event-lvm2mirror.so.2.02
rm $RPM_BUILD_ROOT/%_lib/libdevmapper-event-lvm2snapshot.so
rm $RPM_BUILD_ROOT/%_lib/libdevmapper-event-lvm2snapshot.so.2.02
#install -m 744 scripts/devmap_mknod.sh $RPM_BUILD_ROOT/sbin/
mkdir -p $RPM_BUILD_ROOT/etc/init.d
install -m 744 %{SOURCE1} $RPM_BUILD_ROOT/etc/init.d
install -d $RPM_BUILD_ROOT/lib/mkinitrd/scripts
install -m 755 %{SOURCE2} $RPM_BUILD_ROOT/lib/mkinitrd/scripts/setup-dm.sh
install -m 755 %{SOURCE3} $RPM_BUILD_ROOT/lib/mkinitrd/scripts/boot-dm.sh
%post
%{run_ldconfig}
[ -x /sbin/mkinitrd_setup ] && mkinitrd_setup
%{fillup_and_insserv -y boot.device-mapper}
%postun
%{run_ldconfig}
[ -x /sbin/mkinitrd_setup ] && mkinitrd_setup
%{insserv_cleanup}
%files
%defattr(-,root,root)
%doc INSTALL COPYING COPYING.LIB README VERSION_DM WHATS_NEW_DM
%config /etc/init.d/boot.device-mapper
/%_lib/libdevmapper.so.1.02
/%_lib/libdevmapper-event.so.1.02
/sbin/dmsetup
/sbin/dmeventd
#/sbin/devmap_mknod.sh
%{_mandir}/man8/dmsetup.8.gz
%dir /lib/mkinitrd
%dir /lib/mkinitrd/scripts
/lib/mkinitrd/scripts/setup-dm.sh
/lib/mkinitrd/scripts/boot-dm.sh
%files devel
%defattr(-,root,root)
/%_libdir/libdevmapper.so
/%_libdir/libdevmapper-event.so
/%_libdir/pkgconfig/*.pc
#%attr(644, root, root) %_libdir/libdevmapper.a
/usr/include/libdevmapper.h
/usr/include/libdevmapper-event.h
%changelog
* Mon May 11 2009 xwhu@suse.de
- Enable pkgconfig for GNOME 2.28
* Mon Apr 27 2009 xwhu@suse.de
- Upgrade to 1.02.31
. Add "all" field to reports expanding to all fields of report type.
. Enforce device name length and character limitations in libdm.
. Replace _dm_snprintf with EMIT_PARAMS macro for creating target lines.
. Only resume devices in dm_tree_preload_children if size changes.
. Extend deptree buffers so the largest possible device numbers fit.
. Generate versioned libdevmapper-event.so.
. Underline longer report help text headings.
* Tue Apr 21 2009 xwhu@suse.de
- bnc#479104, export additional information
* Tue Feb 03 2009 hare@suse.de
- No whitespace for DM_STATE export variable (bnc#440959)
- Remove obsolete reference to boot.scsidev from init script
* Wed Dec 10 2008 olh@suse.de
- use Obsoletes: -XXbit only for ppc64 to help solver during distupgrade
(bnc#437293)
* Wed Nov 05 2008 werner@suse.de
- As boot.crypto depends on boot.device-mapper, the later one has
even on shutdown to depend on boot.udev to make sure that events
will be processed (bnc#413059)
* Thu Oct 30 2008 olh@suse.de
- obsolete old -XXbit packages (bnc#437293)
* Fri Sep 12 2008 xwhu@suse.de
- Fix typo for correct compiling
- Timeout if udevd's not running (bnc#425436)
* Wed Sep 10 2008 xwhu@suse.de
- update to 1.02.27
Align struct memblock in dbg_malloc for sparc.
Add --unquoted and --rows to dmsetup.
Avoid compiler warning about cast in dmsetup.c's OFFSET_OF macro.
Fix inverted no_flush debug message.
Remove --enable-jobs from configure. (Set at runtime instead.)
Bring configure.in and list.h into line with the lvm2 versions.
* Wed Sep 03 2008 hare@suse.de
- Call mkinitrd_setup during %%post and %%postun (bnc#413709)
* Mon Aug 25 2008 prusnak@suse.cz
- enabled SELinux support [Fate#303662]
* Fri Aug 22 2008 xwhu@suse.de
- Remove the -p option for fillup_and_insserv
* Tue Aug 12 2008 xwhu@suse.de
- Add Should-Stop to boot.device-mapper
* Wed Jul 23 2008 hare@suse.de
- Include mkinitrd scriptlets.
* Wed Jul 16 2008 xwhu@suse.de
- repack device-mapper.1.02.26.tar.bz2 into bzip2.
- change the owner of device to root:disk, with permission
0640 (bnc#407952)
* Mon Jun 23 2008 xwhu@suse.de
- update to new version 1.02.26
Initialise params buffer to empty string in _emit_segment.
Skip add_dev_node when ioctls disabled.
Make dm_hash_iter safe against deletion.
Accept a NULL pointer to dm_free silently.
Add tables_loaded, readonly and suspended columns to reports.
Add --nameprefixes to dmsetup.
Add field name prefix option to reporting functions.
Calculate string size within dm_pool_grow_object.
Remove redundant if-before-free tests.
Use log_warn for reporting field help text instead of log_print.
Change cluster mirror log type name (s/clustered_/clustered-/)
* Fri May 30 2008 xwhu@suse.de
- Hold on mknod until udev finish it's job.
* Thu Apr 10 2008 ro@suse.de
- added baselibs.conf file to build xxbit packages
for multilib support
* Wed Feb 27 2008 dmueller@suse.de
- fix static library installation again
* Tue Feb 26 2008 dmueller@suse.de
- fix "binary contains trace of $RPM_BUILD_ROOT" failure
* Thu Feb 07 2008 hare@suse.de
- Enable dmeventd (FATE#303381)
* Thu Jan 31 2008 fehr@suse.de
- update to new version 1.02.24
Fix deptree to pass new name to _resume_node after a rename.
Suppress other node operations if node is deleted.
Report error when empty device name passed to readahead functions.
* Mon Dec 10 2007 fehr@suse.de
- update to new version 1.02.23
Add readahead support to libdevmapper and dmsetup.
Fix double free in a libdevmapper-event error path.
Allow a DM_DEV_DIR environment variable to override /dev.
* Thu Nov 22 2007 fehr@suse.de
- update to new version 1.02.22
Fix inconsistent licence notices: executables are GPLv2; libraries LGPLv2.1.
Fix dmsetup -o devno string termination.
Fix default dmsetup report buffering and add --unbuffered.
Add tree-based and dependency fields to dmsetup reports.
* Mon May 07 2007 kay.sievers@suse.de
- update to new version 1.02.19
Avoid trailing separator in reports when there are hidden sort fields.
Fix segfault in 'dmsetup status' without --showkeys against crypt target.
Migrate dmsetup column-based output over to new libdevmapper report framework.
Add descriptions to reporting field definitions.
Add basic reporting functions to libdevmapper.
- remove dmsetup option patch (upstream provides it)
- add dmsetup export command
* Sun Feb 11 2007 ro@suse.de
- fix build as non-root
* Tue Jan 16 2007 fehr@suse.de
- remove superfluouus /lib/libdevmapper.so (#235359)
- add call to ldconfig (#235359)
* Wed Dec 06 2006 fehr@suse.de
- update to new version 1.02.13
Update dmsetup man page (setgeometry & message).
Fix dmsetup free after getline with debug.
Suppress encryption key in 'dmsetup table' output unless --showkeys supplied.
* Mon Oct 16 2006 fehr@suse.de
- update to new version 1.02.12
Avoid deptree attempting to suspend a device that's already suspended.
Add suspend noflush support.
Add basic dmsetup loop support.
Switch dmsetup to use dm_malloc and dm_free.
* Wed Sep 20 2006 fehr@suse.de
- update to new version 1.02.10
Add dm_snprintf(), dm_split_words() and dm_split_lvm_name() to libdevmapper.
Reorder mm bounds_check code to reduce window for a dmeventd race.
* Thu Sep 14 2006 mkoenig@suse.de
- fixed permissions for static lib
- removed static lib version extension
* Tue Sep 12 2006 hvogel@suse.de
- split device-mapper-devel subpackage
- install static libs (needed to link cryptsetup from
util-linux-crypto static)
* Wed Aug 30 2006 hare@suse.de
- Fix gcc warnings
- Fix field display for 'dmsetup info'.
* Wed Aug 30 2006 hare@suse.de
- Add 'major', 'minor', and 'uuid' as valid fields for
'dmsetup info -o XXX'.
* Wed Aug 16 2006 fehr@suse.de
- update to new version 1.02.09
Add --table argument to dmsetup for a one-line table.
Abort if errors are found during cmdline option processing.
Add lockfs indicator to debug output.
* Wed Jul 26 2006 fehr@suse.de
- update to new version 1.02.08
Update dmsetup man page.
Add --force to dmsetup remove* to load error target.
dmsetup remove_all also performs mknodes.
Don't suppress identical table reloads if permission changes.
Fix corelog segment line.
* Mon May 22 2006 fehr@suse.de
- update to new version 1.02.07
Add DM_CORELOG flag to dm_tree_node_add_mirror_target().
Avoid a dmeventd compiler warning.
- update to new version 1.02.06
Move DEFS into configure.h.
Fix leaks in error paths found by coverity.
Remove dmsetup line buffer limitation.
* Thu Apr 20 2006 fehr@suse.de
- update to new version 1.02.05
Separate install_include target in makefiles.
Separate out DEFS from CFLAGS.
Support pkg-config.
Check for libsepol.
* Wed Apr 19 2006 fehr@suse.de
- update to new version 1.02.04
Bring dmsetup man page up-to-date.
Use name-based device refs if kernel doesn't support device number refs.
Fix memory leak (struct dm_ioctl) when struct dm_task is reused.
If _create_and_load_v4 fails part way through, revert the creation.
dmeventd thread/fifo fixes.
Add file & line to dm_strdup_aux().
Add setgeometry.
* Tue Mar 14 2006 fehr@suse.de
- update to new version 1.02.03
Add exported functions to set uid, gid and mode.
Rename _log to dm_log and export.
Add dm_tree_skip_lockfs.
Fix dm_strdup debug definition.
Fix hash function to avoid using a negative array offset.
Don't inline _find in hash.c and tidy signed/unsigned etc.
Fix libdevmapper.h #endif.
Fix dmsetup version driver version.
Add sync, nosync and block_on_error mirror log parameters.
Add hweight32.
Fix dmeventd build.
* Thu Mar 02 2006 hare@suse.de
- Do not call devmap_mknod.sh (#150818)
* Wed Jan 25 2006 mls@suse.de
- converted neededforbuild to BuildRequires
* Tue Jan 24 2006 fehr@suse.de
- fix exit code of "dmsetup version" (#144794)
* Mon Jan 23 2006 fehr@suse.de
- add boot.udev to Required-Start section of init script (#144586)
* Tue Dec 06 2005 fehr@suse.de
- update to new version 1.02.02
* Tue Sep 27 2005 fehr@suse.de
- update to new version 1.01.05
* Wed Sep 21 2005 fehr@suse.de
- increase ioctl buffer size from 16k to 256k to allow larger number
of dm device visible by "dmsetup ls" and "dmsetup table"
* Wed Aug 03 2005 fehr@suse.de
- update to new version 1.01.04
* Thu Jun 30 2005 meissner@suse.de
- use RPM_OPT_FLAGS.
* Tue Jun 14 2005 fehr@suse.de
- update to new version 1.01.03
* Wed May 18 2005 fehr@suse.de
- update to new version 1.01.02
* Mon Apr 11 2005 fehr@suse.de
- use -py instead of -pY as option for fillup_and_insserv (#76689)
- update to new version 1.01.01
* Tue Jan 18 2005 fehr@suse.de
- update to new version 1.01.00
* Tue Jan 11 2005 fehr@suse.de
- update to new version 1.00.21
* Thu Aug 26 2004 fehr@suse.de
- /dev/mapper directory is now part of devs.rpm (#44258)
* Wed Jul 14 2004 fehr@suse.de
- update to new version 1.00.19
* Thu May 27 2004 fehr@suse.de
- do not unload dm modules on shutdown, this hangs on some machines
* Sat Apr 10 2004 aj@suse.de
- devicemapper does not need 2.6 kernelsources.
* Thu Apr 01 2004 fehr@suse.de
- update to new version 1.00.09
* Tue Mar 16 2004 fehr@suse.de
- fix typo in start script (#36168)
* Mon Mar 15 2004 fehr@suse.de
- do not depend on existence of /dev/mapper dir (#35825)
* Mon Mar 01 2004 ro@suse.de
- remove root-fsck stuff in bootscript
- instead depend on boot.rootfsck
* Fri Dec 05 2003 fehr@suse.de
- update to new version 1.00.07
* Mon Nov 17 2003 odabrunz@suse.de
- fix spec file to make it compile with both new and old glibc
(__kernel_dev_t)
* Thu Oct 02 2003 fehr@suse.de
- add fix to make it compile with new glibc (use __kernel_old_dev_t)
* Thu Sep 18 2003 fehr@suse.de
- fix boot.devicemapper to cope with LABEL= and UUID= in /etc/fstab
also check reiser filesystem (#31060)
* Wed Sep 17 2003 fehr@suse.de
- add comment when remounting root fs read-only (#31060)
* Tue Sep 16 2003 kukuk@suse.de
- Add missing PreRequires [Bug #31006]
* Tue Sep 02 2003 fehr@suse.de
- update to version 1.00.05
* Mon Aug 25 2003 fehr@suse.de
- update to version 1.00.04
* Thu Aug 21 2003 fehr@suse.de
- update to version 1.00.03
* Mon Aug 18 2003 garloff@suse.de
- (#29083) Add # X-UnitedLinux-Should-Start: boot.scsidev
* Fri Jul 25 2003 fehr@suse.de
- update to version 1.00.02
* Tue Jul 01 2003 fehr@suse.de
- add boot script for automated startup in system
- fix typos in boot script
* Mon Jun 30 2003 fehr@suse.de
- created initial version of a SuSE package

View File

@ -1,26 +0,0 @@
Index: LVM2.2.02.39/dmeventd/mirror/Makefile.in
===================================================================
--- LVM2.2.02.39.orig/dmeventd/mirror/Makefile.in 2008-11-12 01:55:20.000000000 +0800
+++ LVM2.2.02.39/dmeventd/mirror/Makefile.in 2008-11-12 02:11:41.000000000 +0800
@@ -17,7 +17,7 @@
VPATH = @srcdir@
INCLUDES += -I${top_srcdir}/tools
-CLDFLAGS += -L${top_srcdir}/tools -ldevmapper $(LVM2CMD_LIB)
+CLDFLAGS += -L${top_srcdir}/tools -ldevmapper @LVM2CMD_LIB@
SOURCES = dmeventd_mirror.c
Index: LVM2.2.02.39/dmeventd/snapshot/Makefile.in
===================================================================
--- LVM2.2.02.39.orig/dmeventd/snapshot/Makefile.in 2008-11-12 01:55:20.000000000 +0800
+++ LVM2.2.02.39/dmeventd/snapshot/Makefile.in 2008-11-12 02:11:57.000000000 +0800
@@ -17,7 +17,7 @@
VPATH = @srcdir@
INCLUDES += -I${top_srcdir}/tools
-CLDFLAGS += -L${top_srcdir}/tools -ldevmapper $(LVM2CMD_LIB)
+CLDFLAGS += -L${top_srcdir}/tools -ldevmapper @LVM2CMD_LIB@
SOURCES = dmeventd_snapshot.c

View File

@ -0,0 +1,17 @@
Index: LVM2.2.02.39/lib/device/dev-cache.c
===================================================================
--- LVM2.2.02.39.orig/lib/device/dev-cache.c 2008-05-29 06:27:47.000000000 +0800
+++ LVM2.2.02.39/lib/device/dev-cache.c 2009-03-16 23:14:49.000000000 +0800
@@ -356,7 +356,11 @@
dirent_count = scandir(dir, &dirent, NULL, alphasort);
if (dirent_count > 0) {
for (n = 0; n < dirent_count; n++) {
- if (dirent[n]->d_name[0] == '.') {
+ if (dirent[n]->d_name[0] == '.' && dirent[n]->d_name[1] == '\0') {
+ free(dirent[n]);
+ continue;
+ }
+ if (dirent[0]->d_name[0] == '.' && dirent[n]->d_name[1] == '.' && dirent[n]->d_name[2] == '\0') {
free(dirent[n]);
continue;
}

View File

@ -1,5 +1,7 @@
--- lib/filters/filter.c.orig
+++ lib/filters/filter.c
Index: lib/filters/filter.c
===================================================================
--- lib/filters/filter.c.orig 2009-04-27 16:15:37.000000000 +0800
+++ lib/filters/filter.c 2009-04-27 16:15:39.000000000 +0800
@@ -13,6 +13,12 @@
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
@ -13,7 +15,7 @@
#include "lib.h"
#include "dev-cache.h"
#include "filter.h"
@@ -87,11 +93,18 @@
@@ -103,11 +109,18 @@
}
/* Check it's accessible */

22
k_dev_t.dif Normal file
View File

@ -0,0 +1,22 @@
Index: LVM2.2.02.45/libdm/ioctl/libdm-compat.h
===================================================================
--- LVM2.2.02.45.orig/libdm/ioctl/libdm-compat.h 2008-11-01 10:19:18.000000000 +0800
+++ LVM2.2.02.45/libdm/ioctl/libdm-compat.h 2009-04-27 17:43:08.000000000 +0800
@@ -40,7 +40,7 @@
int32_t open_count; /* out */
uint32_t flags; /* in/out */
- __kernel_dev_t dev; /* in/out */
+ __kernel_old_dev_t dev; /* in/out */
char name[DM_NAME_LEN]; /* device name */
char uuid[DM_UUID_LEN]; /* unique identifier for
@@ -60,7 +60,7 @@
struct dm_target_deps_v1 {
uint32_t count;
- __kernel_dev_t dev[0]; /* out */
+ __kernel_old_dev_t dev[0]; /* out */
};
enum {

View File

@ -1,38 +1,20 @@
--- daemons/clvmd/Makefile.in
+++ daemons/clvmd/Makefile.in
@@ -76,7 +76,7 @@
Index: daemons/clvmd/Makefile.in
===================================================================
--- daemons/clvmd/Makefile.in.orig 2009-04-27 16:51:29.000000000 +0800
+++ daemons/clvmd/Makefile.in 2009-04-27 16:51:32.000000000 +0800
@@ -107,7 +107,7 @@
.PHONY: install_clvmd
install_clvmd: $(TARGETS)
- $(INSTALL) -D $(OWNER) $(GROUP) -m 555 $(STRIP) clvmd \
+ $(INSTALL) -D -m 555 $(STRIP) clvmd \
$(sbindir)/clvmd
$(usrsbindir)/clvmd
install: $(INSTALL_TARGETS)
--- dmeventd/mirror/Makefile.in
+++ dmeventd/mirror/Makefile.in
@@ -30,7 +30,7 @@
include $(top_srcdir)/make.tmpl
install: libdevmapper-event-lvm2mirror.$(LIB_SUFFIX)
- $(INSTALL) -D $(OWNER) $(GROUP) -m 555 $(STRIP) $< \
+ $(INSTALL) -D -m 555 $(STRIP) $< \
$(libdir)/$<.$(LIB_VERSION)
$(LN_S) -f $<.$(LIB_VERSION) $(libdir)/$<
--- dmeventd/snapshot/Makefile.in
+++ dmeventd/snapshot/Makefile.in 2008/01/31 11:14:31
@@ -30,7 +30,7 @@
include $(top_srcdir)/make.tmpl
install: libdevmapper-event-lvm2snapshot.$(LIB_SUFFIX)
- $(INSTALL) -D $(OWNER) $(GROUP) -m 555 $(STRIP) $< \
+ $(INSTALL) -D -m 555 $(STRIP) $< \
$(libdir)/$<.$(LIB_VERSION)
$(LN_S) -f $<.$(LIB_VERSION) $(libdir)/$<
--- doc/Makefile.in
+++ doc/Makefile.in
Index: doc/Makefile.in
===================================================================
--- doc/Makefile.in.orig 2009-04-27 16:51:29.000000000 +0800
+++ doc/Makefile.in 2009-04-27 16:51:32.000000000 +0800
@@ -23,7 +23,7 @@
install:
@if [ ! -e $(confdir)/$(CONFDEST) ]; then \
@ -42,9 +24,11 @@
$(confdir)/$(CONFDEST); \
fi
--- lib/format1/Makefile.in
+++ lib/format1/Makefile.in
@@ -30,7 +30,7 @@
Index: lib/format1/Makefile.in
===================================================================
--- lib/format1/Makefile.in.orig 2009-04-27 16:51:29.000000000 +0800
+++ lib/format1/Makefile.in 2009-04-27 16:51:32.000000000 +0800
@@ -31,7 +31,7 @@
include $(top_srcdir)/make.tmpl
install: liblvm2format1.so
@ -53,9 +37,11 @@
$(libdir)/liblvm2format1.so.$(LIB_VERSION)
$(LN_S) -f liblvm2format1.so.$(LIB_VERSION) $(libdir)/liblvm2format1.so
--- lib/format_pool/Makefile.in
+++ lib/format_pool/Makefile.in
@@ -27,7 +27,7 @@
Index: lib/format_pool/Makefile.in
===================================================================
--- lib/format_pool/Makefile.in.orig 2009-04-27 16:51:29.000000000 +0800
+++ lib/format_pool/Makefile.in 2009-04-27 16:51:32.000000000 +0800
@@ -28,7 +28,7 @@
include $(top_srcdir)/make.tmpl
install: liblvm2formatpool.so
@ -64,9 +50,11 @@
$(libdir)/liblvm2formatpool.so.$(LIB_VERSION)
$(LN_S) -f liblvm2formatpool.so.$(LIB_VERSION) \
$(libdir)/liblvm2formatpool.so
--- lib/locking/Makefile.in
+++ lib/locking/Makefile.in
@@ -23,7 +23,7 @@
Index: lib/locking/Makefile.in
===================================================================
--- lib/locking/Makefile.in.orig 2009-04-27 16:51:29.000000000 +0800
+++ lib/locking/Makefile.in 2009-04-27 16:51:32.000000000 +0800
@@ -24,7 +24,7 @@
include $(top_srcdir)/make.tmpl
install install_cluster: liblvm2clusterlock.so
@ -75,9 +63,11 @@
$(libdir)/liblvm2clusterlock.so.$(LIB_VERSION)
$(LN_S) -f liblvm2clusterlock.so.$(LIB_VERSION) \
$(libdir)/liblvm2clusterlock.so
--- lib/mirror/Makefile.in
+++ lib/mirror/Makefile.in
@@ -23,7 +23,7 @@
Index: lib/mirror/Makefile.in
===================================================================
--- lib/mirror/Makefile.in.orig 2009-04-27 16:51:29.000000000 +0800
+++ lib/mirror/Makefile.in 2009-04-27 16:51:32.000000000 +0800
@@ -24,7 +24,7 @@
include $(top_srcdir)/make.tmpl
install: liblvm2mirror.so
@ -86,9 +76,11 @@
$(libdir)/liblvm2mirror.so.$(LIB_VERSION)
$(LN_S) -f liblvm2mirror.so.$(LIB_VERSION) $(libdir)/liblvm2mirror.so
--- lib/snapshot/Makefile.in
+++ lib/snapshot/Makefile.in
@@ -23,7 +23,7 @@
Index: lib/snapshot/Makefile.in
===================================================================
--- lib/snapshot/Makefile.in.orig 2009-04-27 16:51:29.000000000 +0800
+++ lib/snapshot/Makefile.in 2009-04-27 16:51:32.000000000 +0800
@@ -24,7 +24,7 @@
include $(top_srcdir)/make.tmpl
install: liblvm2snapshot.so
@ -97,9 +89,11 @@
$(libdir)/liblvm2snapshot.so.$(LIB_VERSION)
$(LN_S) -f liblvm2snapshot.so.$(LIB_VERSION) \
$(libdir)/liblvm2snapshot.so
--- man/Makefile.in
+++ man/Makefile.in
@@ -40,14 +40,14 @@
Index: man/Makefile.in
===================================================================
--- man/Makefile.in.orig 2009-04-27 16:51:29.000000000 +0800
+++ man/Makefile.in 2009-04-27 16:52:20.000000000 +0800
@@ -62,14 +62,14 @@
@for f in $(MAN8); \
do \
$(RM) $(MAN8DIR)/$$f; \
@ -116,47 +110,70 @@
done
install_cluster:
@@ -55,5 +55,5 @@
@@ -77,7 +77,7 @@
@for f in $(MAN8CLUSTER); \
do \
$(RM) $(MAN8DIR)/$$f; \
- @INSTALL@ -D $(OWNER) $(GROUP) -m 444 $$f $(MAN8DIR)/$$f; \
+ @INSTALL@ -D -m 444 $$f $(MAN8DIR)/$$f; \
done
--- po/Makefile.in
+++ po/Makefile.in
@@ -25,7 +25,7 @@
install_device-mapper:
@@ -85,5 +85,5 @@
@for f in $(MAN8DM); \
do \
$(RM) $(MAN8DIR)/$$f; \
- @INSTALL@ -D $(OWNER) $(GROUP) -m 444 $$f $(MAN8DIR)/$$f; \
+ @INSTALL@ -D -m 444 $$f $(MAN8DIR)/$$f; \
done
Index: po/Makefile.in
===================================================================
--- po/Makefile.in.orig 2009-04-27 16:51:29.000000000 +0800
+++ po/Makefile.in 2009-04-27 16:51:32.000000000 +0800
@@ -53,13 +53,13 @@
@echo Installing translation files in $(localedir)
@( \
for lang in $(LANGS); do \
- $(INSTALL) -D $(OWNER) $(GROUP) -m 444 $$lang.mo \
+ $(INSTALL) -D -m 444 $$lang.mo \
$(localedir)/$$lang/LC_MESSAGES/@INTL_PACKAGE@.mo;\
$(localedir)/$$lang/LC_MESSAGES/lvm2.mo;\
done; \
)
--- scripts/Makefile.in
+++ scripts/Makefile.in 2008/01/31 11:26:46
@@ -18,8 +18,8 @@
@( \
for lang in $(LANGS); do \
- $(INSTALL) -D $(OWNER) $(GROUP) -m 444 $$lang.mo \
+ $(INSTALL) -D -m 444 $$lang.mo \
$(localedir)/$$lang/LC_MESSAGES/device-mapper.mo;\
done; \
)
Index: scripts/Makefile.in
===================================================================
--- scripts/Makefile.in.orig 2009-04-27 16:51:29.000000000 +0800
+++ scripts/Makefile.in 2009-04-27 16:51:32.000000000 +0800
@@ -18,9 +18,9 @@
include $(top_srcdir)/make.tmpl
install:
- $(INSTALL) -D $(OWNER) $(GROUP) -m 555 $(STRIP) lvm_dump.sh \
+ $(INSTALL) -D -m 555 $(STRIP) lvm_dump.sh \
$(sbindir)/lvmdump
ifeq ("@FSADM@", "yes")
- $(INSTALL) -D $(OWNER) $(GROUP) -m 555 $(STRIP) fsadm.sh \
+ $(INSTALL) -D -m 555 $(STRIP) fsadm.sh \
$(sbindir)/fsadm
--- tools/Makefile.in
+++ tools/Makefile.in
@@ -142,21 +142,21 @@
endif
Index: tools/Makefile.in
===================================================================
--- tools/Makefile.in.orig 2009-04-27 16:51:29.000000000 +0800
+++ tools/Makefile.in 2009-04-27 16:51:32.000000000 +0800
@@ -156,21 +156,21 @@
endif
install_cmdlib_dynamic: liblvm2cmd.so
- $(INSTALL) -D $(OWNER) $(GROUP) -m 555 $(STRIP) liblvm2cmd.so \
+ $(INSTALL) -D -m 555 $(STRIP) liblvm2cmd.so \
$(libdir)/liblvm2cmd.so.$(LIB_VERSION)
$(LN_S) -f liblvm2cmd.so.$(LIB_VERSION) $(libdir)/liblvm2cmd.so
install_cmdlib_dynamic: liblvm2cmd.$(LIB_SUFFIX)
- $(INSTALL) -D $(OWNER) $(GROUP) -m 555 $(STRIP) liblvm2cmd.$(LIB_SUFFIX) \
+ $(INSTALL) -D -m 555 $(STRIP) liblvm2cmd.$(LIB_SUFFIX) \
$(libdir)/liblvm2cmd.$(LIB_SUFFIX).$(LIB_VERSION_LVM)
$(LN_S) -f liblvm2cmd.$(LIB_SUFFIX).$(LIB_VERSION_LVM) $(libdir)/liblvm2cmd.$(LIB_SUFFIX)
- $(INSTALL) -D $(OWNER) $(GROUP) -m 444 lvm2cmd.h \
+ $(INSTALL) -D -m 444 lvm2cmd.h \
$(includedir)/lvm2cmd.h
@ -164,8 +181,8 @@
install_cmdlib_static: liblvm2cmd-static.a
- $(INSTALL) -D $(OWNER) $(GROUP) -m 555 $(STRIP) liblvm2cmd-static.a \
+ $(INSTALL) -D -m 555 $(STRIP) liblvm2cmd-static.a \
$(libdir)/liblvm2cmd.a.$(LIB_VERSION)
$(LN_S) -f liblvm2cmd.a.$(LIB_VERSION) $(libdir)/liblvm2cmd.a
$(libdir)/liblvm2cmd.a.$(LIB_VERSION_LVM)
$(LN_S) -f liblvm2cmd.a.$(LIB_VERSION_LVM) $(libdir)/liblvm2cmd.a
- $(INSTALL) -D $(OWNER) $(GROUP) -m 444 lvm2cmd.h \
+ $(INSTALL) -D -m 444 lvm2cmd.h \
$(includedir)/lvm2cmd.h
@ -176,7 +193,7 @@
$(sbindir)/lvm
@echo Creating symbolic links for individual commands in $(sbindir)
@( \
@@ -167,7 +167,7 @@
@@ -181,14 +181,14 @@
)
install_tools_static: lvm.static
@ -184,4 +201,103 @@
+ $(INSTALL) -D -m 555 $(STRIP) lvm.static \
$(staticdir)/lvm.static
install: $(INSTALL_TARGETS)
install_dmsetup_dynamic: dmsetup
- $(INSTALL) -D $(OWNER) $(GROUP) -m 555 $(STRIP) $< $(sbindir)/$<
+ $(INSTALL) -D -m 555 $(STRIP) $< $(sbindir)/$<
install_dmsetup_static: dmsetup.static
- $(INSTALL) -D $(OWNER) $(GROUP) -m 555 $(STRIP) $< $(sbindir)/$<
+ $(INSTALL) -D -m 555 $(STRIP) $< $(sbindir)/$<
install_device-mapper: $(INSTALL_DMSETUP_TARGETS)
Index: daemons/dmeventd/Makefile.in
===================================================================
--- daemons/dmeventd/Makefile.in.orig 2008-11-05 01:25:32.000000000 +0800
+++ daemons/dmeventd/Makefile.in 2009-04-27 16:57:01.000000000 +0800
@@ -64,24 +64,24 @@
install_device-mapper: install
install_include:
- $(INSTALL) -D $(OWNER) $(GROUP) -m 444 libdevmapper-event.h \
+ $(INSTALL) -D -m 444 libdevmapper-event.h \
$(includedir)/libdevmapper-event.h
install_dynamic: libdevmapper-event.$(LIB_SUFFIX)
- $(INSTALL) -D $(OWNER) $(GROUP) -m 555 $(STRIP) $< \
+ $(INSTALL) -D -m 555 $(STRIP) $< \
$(libdir)/libdevmapper-event.$(LIB_SUFFIX).$(LIB_VERSION)
$(LN_S) -f libdevmapper-event.$(LIB_SUFFIX).$(LIB_VERSION) \
$(libdir)/libdevmapper-event.$(LIB_SUFFIX)
install_dmeventd: dmeventd
- $(INSTALL) -D $(OWNER) $(GROUP) -m 555 $(STRIP) $< $(sbindir)/$<
+ $(INSTALL) -D -m 555 $(STRIP) $< $(sbindir)/$<
install_pkgconfig:
- $(INSTALL) -D $(OWNER) $(GROUP) -m 444 libdevmapper-event.pc \
+ $(INSTALL) -D -m 444 libdevmapper-event.pc \
$(usrlibdir)/pkgconfig/devmapper-event.pc
install_static: libdevmapper-event.a
- $(INSTALL) -D $(OWNER) $(GROUP) -m 555 $(STRIP) $< \
+ $(INSTALL) -D -m 555 $(STRIP) $< \
$(libdir)/libdevmapper-event.a.$(LIB_VERSION)
$(LN_S) -f libdevmapper-event.a.$(LIB_VERSION) $(libdir)/libdevmapper-event.a
Index: daemons/dmeventd/plugins/mirror/Makefile.in
===================================================================
--- daemons/dmeventd/plugins/mirror/Makefile.in.orig 2008-11-04 06:14:26.000000000 +0800
+++ daemons/dmeventd/plugins/mirror/Makefile.in 2009-04-27 16:55:45.000000000 +0800
@@ -32,6 +32,6 @@
include $(top_srcdir)/make.tmpl
install: libdevmapper-event-lvm2mirror.$(LIB_SUFFIX)
- $(INSTALL) -D $(OWNER) $(GROUP) -m 555 $(STRIP) $< \
+ $(INSTALL) -D -m 555 $(STRIP) $< \
$(libdir)/$<.$(LIB_VERSION)
$(LN_S) -f $<.$(LIB_VERSION) $(libdir)/$<
Index: daemons/dmeventd/plugins/snapshot/Makefile.in
===================================================================
--- daemons/dmeventd/plugins/snapshot/Makefile.in.orig 2008-11-04 06:14:27.000000000 +0800
+++ daemons/dmeventd/plugins/snapshot/Makefile.in 2009-04-27 16:56:00.000000000 +0800
@@ -32,6 +32,6 @@
include $(top_srcdir)/make.tmpl
install: libdevmapper-event-lvm2snapshot.$(LIB_SUFFIX)
- $(INSTALL) -D $(OWNER) $(GROUP) -m 555 $(STRIP) $< \
+ $(INSTALL) -D -m 555 $(STRIP) $< \
$(libdir)/$<.$(LIB_VERSION)
$(LN_S) -f $<.$(LIB_VERSION) $(libdir)/$<
Index: libdm/Makefile.in
===================================================================
--- libdm/Makefile.in.orig 2008-11-15 04:59:56.000000000 +0800
+++ libdm/Makefile.in 2009-04-27 16:57:28.000000000 +0800
@@ -70,7 +70,7 @@
install_device-mapper: install
install_include:
- $(INSTALL) -D $(OWNER) $(GROUP) -m 444 libdevmapper.h \
+ $(INSTALL) -D -m 444 libdevmapper.h \
$(includedir)/libdevmapper.h
install_dynamic: install_@interface@
@@ -81,15 +81,15 @@
$(LN_S) -f libdevmapper.a.$(LIB_VERSION_DM) $(libdir)/libdevmapper.a
install_ioctl: ioctl/libdevmapper.$(LIB_SUFFIX)
- $(INSTALL) -D $(OWNER) $(GROUP) -m 555 $(STRIP) $< \
+ $(INSTALL) -D -m 555 $(STRIP) $< \
$(libdir)/libdevmapper.$(LIB_SUFFIX).$(LIB_VERSION_DM)
install_pkgconfig:
- $(INSTALL) -D $(OWNER) $(GROUP) -m 444 libdevmapper.pc \
+ $(INSTALL) -D -m 444 libdevmapper.pc \
$(usrlibdir)/pkgconfig/devmapper.pc
install_ioctl_static: ioctl/libdevmapper.a
- $(INSTALL) -D $(OWNER) $(GROUP) -m 555 $(STRIP) $< \
+ $(INSTALL) -D -m 555 $(STRIP) $< \
$(libdir)/libdevmapper.a.$(LIB_VERSION_DM)
$(VERSIONED_SHLIB): %.$(LIB_SUFFIX).$(LIB_VERSION_DM): $(interface)/%.$(LIB_SUFFIX)

View File

@ -1,8 +1,8 @@
Index: LVM2.2.02.39/tools/pvremove.c
Index: LVM2.2.02.45/tools/pvremove.c
===================================================================
--- LVM2.2.02.39.orig/tools/pvremove.c 2007-11-22 02:25:06.000000000 +0100
+++ LVM2.2.02.39/tools/pvremove.c 2008-09-11 16:10:31.000000000 +0200
@@ -18,6 +18,32 @@
--- LVM2.2.02.45.orig/tools/pvremove.c 2009-04-27 16:35:32.000000000 +0800
+++ LVM2.2.02.45/tools/pvremove.c 2009-04-27 16:49:48.000000000 +0800
@@ -18,6 +18,30 @@
const char _really_wipe[] =
"Really WIPE LABELS from physical volume \"%s\" of volume group \"%s\" [y/n]? ";
@ -12,11 +12,9 @@ Index: LVM2.2.02.39/tools/pvremove.c
+ char *pvuuid;
+ char pvuuid_link[70];
+
+ init_partial(1);
+ if (!(pv = pv_read(cmd, name, NULL, NULL, 1))) {
+ if (!(pv = pv_read(cmd, name, NULL, NULL, 0, 0))) {
+ return NULL;
+ }
+ init_partial(0);
+
+ pvuuid = malloc(sizeof(char)*40);
+ if (pvuuid == NULL) {
@ -35,7 +33,7 @@ Index: LVM2.2.02.39/tools/pvremove.c
/*
* Decide whether it is "safe" to wipe the labels on this device.
* 0 indicates we may not.
@@ -108,6 +134,8 @@
@@ -125,6 +149,8 @@
log_print("Labels on physical volume \"%s\" successfully wiped",
pv_name);
@ -44,11 +42,11 @@ Index: LVM2.2.02.39/tools/pvremove.c
ret = ECMD_PROCESSED;
error:
Index: LVM2.2.02.39/tools/pvcreate.c
Index: LVM2.2.02.45/tools/pvcreate.c
===================================================================
--- LVM2.2.02.39.orig/tools/pvcreate.c 2008-06-24 22:10:32.000000000 +0200
+++ LVM2.2.02.39/tools/pvcreate.c 2008-09-11 16:11:04.000000000 +0200
@@ -23,6 +23,95 @@
--- LVM2.2.02.45.orig/tools/pvcreate.c 2009-04-27 16:35:32.000000000 +0800
+++ LVM2.2.02.45/tools/pvcreate.c 2009-04-27 16:45:34.000000000 +0800
@@ -36,6 +36,89 @@
const char _really_init[] =
"Really INITIALIZE physical volume \"%s\" of volume group \"%s\" [y/n]? ";
@ -95,20 +93,14 @@ Index: LVM2.2.02.39/tools/pvcreate.c
+ struct physical_volume *pv;
+ char *pvuuid;
+ char *pvuuid_link;
+ int old_partial;
+
+ pvuuid_link = malloc(70);
+ if (pvuuid_link == NULL) return NULL;
+
+ old_partial = partial_mode();
+
+ init_partial(1);
+ if (!(pv = pv_read(cmd, name, NULL, NULL, 1))) {
+ if (!(pv = pv_read(cmd, name, NULL, NULL, 0, 0))) {
+ free(pvuuid_link);
+ init_partial(old_partial);
+ return NULL;
+ }
+ init_partial(old_partial);
+
+ pvuuid = malloc(sizeof(char)*40);
+ if (pvuuid == NULL) {
@ -144,31 +136,16 @@ Index: LVM2.2.02.39/tools/pvcreate.c
/*
* See if we may pvcreate on this device.
* 0 indicates we may not.
@@ -42,6 +131,7 @@
/* Is there a pv here already? */
/* FIXME Use partial mode here? */
+ init_partial(1);
pv = pv_read(cmd, name, NULL, NULL, 0);
/*
@@ -55,6 +145,7 @@
return_0;
pv = pv_read(cmd, name, NULL, NULL, 0);
}
+ init_partial(0);
/* Allow partial & exported VGs to be destroyed. */
/* We must have -ff to overwrite a non orphan */
@@ -151,6 +242,7 @@
const char *restorefile;
uint64_t pe_start = 0;
uint32_t extent_count = 0, extent_size = 0;
@@ -150,6 +233,8 @@
void *pv;
struct device *dev;
struct dm_list mdas;
+ const char *oldsymlink;
+
if (arg_count(cmd, uuidstr_ARG)) {
uuid = arg_str_value(cmd, uuidstr_ARG, "");
@@ -258,13 +350,23 @@
if (pp->idp) {
if ((dev = device_from_pvid(cmd, pp->idp)) &&
@@ -213,12 +298,22 @@
log_very_verbose("Writing physical volume data to disk \"%s\"",
pv_name);
@ -176,27 +153,26 @@ Index: LVM2.2.02.39/tools/pvcreate.c
+ oldsymlink = pv_symlink_handle(cmd, pv_name, 0);
+
if (!(pv_write(cmd, (struct physical_volume *)pv, &mdas,
arg_int64_value(cmd, labelsector_ARG,
DEFAULT_LABELSECTOR)))) {
pp->labelsector))) {
log_error("Failed to write physical volume \"%s\"", pv_name);
+ if (oldsymlink) free(oldsymlink);
goto error;
}
+ pv_symlink_handle(cmd, pv_name, 1);
+ if (oldsymlink) {
+ unlink(oldsymlink);
+ free(oldsymlink);
+ }
+ pv_symlink_handle(cmd, pv_name, 1);
+ if (oldsymlink) {
+ unlink(oldsymlink);
+ free(oldsymlink);
+ }
+
log_print("Physical volume \"%s\" successfully created", pv_name);
unlock_vg(cmd, VG_ORPHANS);
Index: LVM2.2.02.39/tools/pvchange.c
Index: LVM2.2.02.45/tools/pvchange.c
===================================================================
--- LVM2.2.02.39.orig/tools/pvchange.c 2008-02-06 16:47:28.000000000 +0100
+++ LVM2.2.02.39/tools/pvchange.c 2008-09-11 16:11:27.000000000 +0200
@@ -15,6 +15,95 @@
--- LVM2.2.02.45.orig/tools/pvchange.c 2009-04-27 16:35:32.000000000 +0800
+++ LVM2.2.02.45/tools/pvchange.c 2009-04-27 16:45:18.000000000 +0800
@@ -15,6 +15,90 @@
#include "tools.h"
@ -242,20 +218,15 @@ Index: LVM2.2.02.39/tools/pvchange.c
+ struct physical_volume *pv;
+ char *pvuuid;
+ char *pvuuid_link;
+ int old_partial;
+
+ pvuuid_link = malloc(70);
+ if (pvuuid_link == NULL) return NULL;
+
+ old_partial = partial_mode();
+
+ init_partial(1);
+ if (!(pv = pv_read(cmd, name, NULL, NULL, 1))) {
+ if (!(pv = pv_read(cmd, name, NULL, NULL, 0, 0))) {
+ free(pvuuid_link);
+ init_partial(old_partial);
+ return NULL;
+ }
+ init_partial(old_partial);
+
+ pvuuid = malloc(sizeof(char)*40);
+ if (pvuuid == NULL) {
@ -292,36 +263,7 @@ Index: LVM2.2.02.39/tools/pvchange.c
/* FIXME Locking. PVs in VG. */
static int _pvchange_single(struct cmd_context *cmd, struct physical_volume *pv,
@@ -169,16 +258,28 @@
}
log_verbose("Changing uuid of %s to %s.", pv_name, uuid);
if (!is_orphan(pv)) {
+ const char* oldsymlink;
+
orig_vg_name = pv_vg_name(pv);
orig_pe_alloc_count = pv_pe_alloc_count(pv);
pv->vg_name = pv->fmt->orphan_vg_name;
pv->pe_alloc_count = 0;
+ oldsymlink = pv_symlink_handle(cmd, pv_name, 0);
+
if (!(pv_write(cmd, pv, NULL, INT64_C(-1)))) {
log_error("pv_write with new uuid failed "
"for %s.", pv_name);
+ if (oldsymlink) free(oldsymlink);
unlock_vg(cmd, vg_name);
return 0;
}
+
+ pv_symlink_handle(cmd, pv_name, 1);
+ if (oldsymlink) {
+ unlink(oldsymlink);
+ free(oldsymlink);
+ }
+
pv->vg_name = orig_vg_name;
pv->pe_alloc_count = orig_pe_alloc_count;
}
@@ -193,11 +294,23 @@
@@ -202,11 +286,23 @@
return 0;
}
backup(vg);

46
lvm2-clvm.changes Normal file
View File

@ -0,0 +1,46 @@
-------------------------------------------------------------------
Mon Apr 27 18:37:32 CST 2009 - xwhu@suse.de
- Upgrade to LVM2 2.02.45
Avoid scanning empty metadata areas for VG names
Pass --test from lvresize to fsadm as --dry-run.
Remove duplicate cpg_initialize from clvmd startup.
Add option to /etc/sysconfig/cluster to select cluster type for clvmd.
Remove external dependency on the 'cut' command from fsadm.
Fix pvs segfault when pv mda attributes requested for not available PV.
Fix lvresize size conversion for fsadm when block size is not 1K.
Add pv_mda_size to pvs and vg_mda_size to vgs.
Add "--refresh" functionality to vgchange and vgmknodes.
Fix vgrename using UUID if there are VGs with identical names.
Fix segfault when invalid field given in reporting commands.
Merge device-mapper into the lvm2 tree.
Exit with non-zero status from vgdisplay if couldn't show any requested VG.
Fix snapshot monitoring library to not cancel monitoring invalid snapshot.
Fix conversion of md chunk size into sectors.
Fix misleading error message when there are no allocatable extents in VG.
Fix handling of PVs which reappeared with old metadata version.
Fix mirror DSO to call vgreduce with proper parameters.
Fix validation of --minor and --major in lvcreate to require -My always.
Fix release: clvmd build, vgreduce consolidate & tests, /dev/ioerror warning.
-------------------------------------------------------------------
Tue Apr 1 01:10:00 CST 2009 - lmb@suse.de
- clvmd: Ensure that the lockspace is released locally even we were the
lock master, avoiding an unclean shutdown (bnc#490415).
-------------------------------------------------------------------
Tue Mar 31 19:16:18 CST 2009 - xwhu@suse.de
- Call cpg_leave before shutting down clvmd
-------------------------------------------------------------------
Wed Mar 25 23:14:29 CST 2009 - xwhu@suse.de
- Do not filter out tmp device file(bnc#485572)
-------------------------------------------------------------------
Wed Mar 25 22:50:50 CST 2009 - xwhu@suse.de
- Newly splitted off from lvm2, as a independent package now

165
lvm2-clvm.spec Normal file
View File

@ -0,0 +1,165 @@
#
# spec file for package lvm2-clvm (Version 2.02.45)
#
# Copyright (c) 2009 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
Url: http://sources.redhat.com/cluster/clvm/
Name: lvm2-clvm
BuildRequires: device-mapper-devel libdlm-devel libopenais-devel readline-devel
BuildRequires: libselinux-devel
License: GPL v2 or later; LGPL v2.1 or later
Group: System/Base
Version: 2.02.45
Release: 2
Requires: device-mapper >= 1.02.25 lvm2 = %{version} openais
Provides: clvm
PreReq: %fillup_prereq %insserv_prereq
AutoReqProv: on
Summary: Clustered LVM2
Source: LVM2.%{version}.tar.bz2
Source1: lvm.conf
Source2: boot.lvm
Source3: sysconfig.lvm
Source4: mkinitrd-setup.sh
Source5: mkinitrd-boot.sh
Source6: 64-lvm2.rules
Source7: collect_lvm
Source8: clvmd.ocf
Patch: improve_probing.diff
Patch2: no-inc-audit.diff
Patch3: no_buildroot_shared.diff
Patch4: sys_mount_instead_linux_fs.diff
Patch5: pvscan_2TB_limit.diff
Patch6: man_page_sectors.diff
Patch10: lvm-no_chown.diff
Patch11: cmdline_large_minor.diff
Patch12: enable-clvmd.patch
Patch13: pipe_buff-definition.diff
Patch14: lvm-pv-create-link.diff
#Patch15: dmeventd-link-libcmd.diff
Patch16: clvmd-openais-use-dlm.diff
Patch17: bug-486952_clvmd-check-returncode-of-dlmrelease.diff
Patch18: sigterm_in_main_thread.diff
Patch19: dont_ignore_tmp_device_file.diff
Patch20: support-drbd-filter.diff
Patch21: call_cpg_leave_before_shutdown.diff
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%description
A daemon for using LVM2 Logival Volumes in a clustered environment.
%prep
%setup -n LVM2.%{version}
%patch
%patch2
%patch3
%patch4
%patch5
%patch6
%patch10
%patch11
%patch12
%patch13
%patch14 -p1
#%patch15 -p1
%patch16 -p1
%patch17 -p1
%patch18 -p1
%patch19 -p1
%patch20 -p1
%patch21 -p1
%build
CFLAGS="$RPM_OPT_FLAGS" MODPROBE_CMD=/sbin/modprobe \
LDFLAGS="-L /usr/%_lib/openais" \
./configure --prefix=/ \
--mandir=%{_mandir} \
--includedir=/usr/include \
--enable-selinux \
--enable-cmdlib \
--libdir=/%_lib --enable-dmeventd --enable-cmdlib \
--with-clvmd=openais
make
%install
pushd daemons
make install DESTDIR=$RPM_BUILD_ROOT
popd
pushd man
make install DESTDIR=$RPM_BUILD_ROOT
popd
install -D -m 755 $RPM_BUILD_ROOT/sbin/clvmd $RPM_BUILD_ROOT/usr/sbin/clvmd
rm $RPM_BUILD_ROOT/sbin/clvmd
rm $RPM_BUILD_ROOT/sbin/dmeventd
rm $RPM_BUILD_ROOT/usr/include/libdevmapper-event.h
rm $RPM_BUILD_ROOT/%{_lib}/libdevmapper-event-lvm2mirror.*
rm $RPM_BUILD_ROOT/%{_lib}/libdevmapper-event-lvm2snapshot.*
rm $RPM_BUILD_ROOT/%{_lib}/libdevmapper-event.*
rm -rf $RPM_BUILD_ROOT/%{_mandir}/man5
rm -f $RPM_BUILD_ROOT/%{_mandir}/man8/lv*
rm -f $RPM_BUILD_ROOT/%{_mandir}/man8/pv*
rm -f $RPM_BUILD_ROOT/%{_mandir}/man8/vg*
rm -f $RPM_BUILD_ROOT/%{_mandir}/man8/dmsetup*
rm -f $RPM_BUILD_ROOT/%{_mandir}/man8/fsadm*
install -m755 -D %{S:8} $RPM_BUILD_ROOT/usr/lib/ocf/resource.d/lvm2/clvmd
%clean
rm -rf $RPM_BUILD_ROOT
%files
%defattr(-,root,root)
/usr/sbin/clvmd
%dir /usr/lib/ocf
%dir /usr/lib/ocf/resource.d
%dir /usr/lib/ocf/resource.d/lvm2
/usr/lib/ocf/resource.d/lvm2/clvmd
%{_mandir}/man8/clvmd.8.gz
%changelog
* Mon Apr 27 2009 xwhu@suse.de
- Upgrade to LVM2 2.02.45
Avoid scanning empty metadata areas for VG names
Pass --test from lvresize to fsadm as --dry-run.
Remove duplicate cpg_initialize from clvmd startup.
Add option to /etc/sysconfig/cluster to select cluster type for clvmd.
Remove external dependency on the 'cut' command from fsadm.
Fix pvs segfault when pv mda attributes requested for not available PV.
Fix lvresize size conversion for fsadm when block size is not 1K.
Add pv_mda_size to pvs and vg_mda_size to vgs.
Add "--refresh" functionality to vgchange and vgmknodes.
Fix vgrename using UUID if there are VGs with identical names.
Fix segfault when invalid field given in reporting commands.
Merge device-mapper into the lvm2 tree.
Exit with non-zero status from vgdisplay if couldn't show any requested VG.
Fix snapshot monitoring library to not cancel monitoring invalid snapshot.
Fix conversion of md chunk size into sectors.
Fix misleading error message when there are no allocatable extents in VG.
Fix handling of PVs which reappeared with old metadata version.
Fix mirror DSO to call vgreduce with proper parameters.
Fix validation of --minor and --major in lvcreate to require -My always.
Fix release: clvmd build, vgreduce consolidate & tests, /dev/ioerror warning.
* Wed Apr 01 2009 lmb@suse.de
- clvmd: Ensure that the lockspace is released locally even we were the
lock master, avoiding an unclean shutdown (bnc#490415).
* Tue Mar 31 2009 xwhu@suse.de
- Call cpg_leave before shutting down clvmd
* Wed Mar 25 2009 xwhu@suse.de
- Do not filter out tmp device file(bnc#485572)
* Wed Mar 25 2009 xwhu@suse.de
- Newly splitted off from lvm2, as a independent package now

View File

@ -1,3 +1,74 @@
-------------------------------------------------------------------
Mon Apr 27 18:37:32 CST 2009 - xwhu@suse.de
- Upgrade to LVM2 2.02.45
Avoid scanning empty metadata areas for VG names
Pass --test from lvresize to fsadm as --dry-run.
Remove duplicate cpg_initialize from clvmd startup.
Add option to /etc/sysconfig/cluster to select cluster type for clvmd.
Remove external dependency on the 'cut' command from fsadm.
Fix pvs segfault when pv mda attributes requested for not available PV.
Fix lvresize size conversion for fsadm when block size is not 1K.
Add pv_mda_size to pvs and vg_mda_size to vgs.
Add "--refresh" functionality to vgchange and vgmknodes.
Fix vgrename using UUID if there are VGs with identical names.
Fix segfault when invalid field given in reporting commands.
Merge device-mapper into the lvm2 tree.
Exit with non-zero status from vgdisplay if couldn't show any requested VG.
Fix snapshot monitoring library to not cancel monitoring invalid snapshot.
Fix conversion of md chunk size into sectors.
Fix misleading error message when there are no allocatable extents in VG.
Fix handling of PVs which reappeared with old metadata version.
Fix mirror DSO to call vgreduce with proper parameters.
Fix validation of --minor and --major in lvcreate to require -My always.
Fix release: clvmd build, vgreduce consolidate & tests, /dev/ioerror warning.
-------------------------------------------------------------------
Tue Mar 31 11:59:03 CST 2009 - xwhu@suse.de
- Handle the case that drbd virtual device has the same PV uuid
with the underlining physical device.
-------------------------------------------------------------------
Wed Mar 25 23:14:29 CST 2009 - xwhu@suse.de
- Do not filter out tmp device file(bnc#485572)
- Do not try to activate VG when all paths are down already(bnc#479104)
-------------------------------------------------------------------
Wed Mar 25 22:50:50 CST 2009 - xwhu@suse.de
- Split CLVMD as a independent package
-------------------------------------------------------------------
Tue Mar 24 00:23:13 CST 2009 - xwhu@suse.de
- Fix for bnc#486952
use "killproc -INT" instead of "killproc"
handle signal in the main loop thread only
-------------------------------------------------------------------
Thu Feb 26 14:08:22 CST 2009 - xwhu@suse.de
- add daemon_options parameter to clvmd.ocf
- check EUNLOCK for dlm_ls_unlock_wait
-------------------------------------------------------------------
Wed Feb 25 18:39:26 CST 2009 - xwhu@suse.de
- bnc#479422, check both lksb.sb_status and status.
-------------------------------------------------------------------
Fri Feb 20 10:24:00 CET 2009 - xwhu@suse.de
- simplify patch of dlm lock to clvmd
-------------------------------------------------------------------
Fri Feb 20 08:06:37 CET 2009 - xwhu@suse.de
- bnc#476861, clvmd.ocf doesn't report the correct status when
kill -9 doesn't terminate the process
-------------------------------------------------------------------
Thu Jan 22 13:00:26 CST 2009 - xwhu@suse.de
@ -6,7 +77,7 @@ Thu Jan 22 13:00:26 CST 2009 - xwhu@suse.de
-------------------------------------------------------------------
Wed Jan 21 15:23:31 CET 2009 - ro@suse.de
- do not require a specific package release from subpackage
- do not require a specific package release from subpackage
(bnc#467704)
-------------------------------------------------------------------

110
lvm2.spec
View File

@ -1,5 +1,5 @@
#
# spec file for package lvm2 (Version 2.02.39)
# spec file for package lvm2 (Version 2.02.45)
#
# Copyright (c) 2009 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
@ -16,6 +16,7 @@
#
Url: http://sources.redhat.com/cluster/clvm/
Name: lvm2
BuildRequires: device-mapper-devel libdlm-devel libopenais-devel readline-devel
@ -27,8 +28,8 @@ Provides: lvm
Obsoletes: lvm
PreReq: %fillup_prereq %insserv_prereq
AutoReqProv: on
Version: 2.02.39
Release: 14
Version: 2.02.45
Release: 2
Summary: LVM2 Tools
Source: LVM2.%{version}.tar.bz2
Source1: lvm.conf
@ -50,8 +51,20 @@ Patch11: cmdline_large_minor.diff
Patch12: enable-clvmd.patch
Patch13: pipe_buff-definition.diff
Patch14: lvm-pv-create-link.diff
Patch15: dmeventd-link-libcmd.diff
#Patch15: dmeventd-link-libcmd.diff
Patch16: clvmd-openais-use-dlm.diff
Patch17: bug-486952_clvmd-check-returncode-of-dlmrelease.diff
Patch18: sigterm_in_main_thread.diff
Patch19: dont_ignore_tmp_device_file.diff
Patch20: support-drbd-filter.diff
Patch21: call_cpg_leave_before_shutdown.diff
#Patches for device mapper
Patch60: k_dev_t.dif
Patch61: device-mapper-dmsetup-export.patch
Patch62: device-mapper-gcc-warning.diff
Patch63: device-mapper-static.diff
Patch64: device-mapper-wait_udev.diff
Patch65: device-mapper-dmsetup-deps-export.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
# Not a real replacement but we drop evms
Provides: evms = 2.5.5 evms-gui = 2.5.5 evms-devel = 2.5.5 evms-ha = 2.5.5
@ -63,17 +76,6 @@ Volume Manager.
%package clvm
License: GPL v2 or later; LGPL v2.1 or later
Requires: %{name} = %{version} openais
Summary: Clustered LVM2
Group: System/Base
%description clvm
A daemon for using LVM2 Logival Volumes in a clustered environment.
%prep
%setup -n LVM2.%{version}
%patch
@ -87,8 +89,19 @@ A daemon for using LVM2 Logival Volumes in a clustered environment.
%patch12
%patch13
%patch14 -p1
%patch15 -p1
#%patch15 -p1
%patch16 -p1
%patch17 -p1
%patch18 -p1
%patch19 -p1
%patch20 -p1
%patch21 -p1
%patch60 -p1
%patch61 -p1
%patch62 -p1
%patch63 -p1
%patch64 -p1
%patch65 -p1
%build
CFLAGS="$RPM_OPT_FLAGS" MODPROBE_CMD=/sbin/modprobe \
@ -109,8 +122,8 @@ install -d -m 755 $RPM_BUILD_ROOT/etc/lvm/backup
install -d -m 755 $RPM_BUILD_ROOT/etc/lvm/archive
install -d -m 755 $RPM_BUILD_ROOT/etc/lvm/metadata
install -d -m 755 $RPM_BUILD_ROOT/var/lock/lvm
install -D -m 755 $RPM_BUILD_ROOT/sbin/clvmd $RPM_BUILD_ROOT/usr/sbin/clvmd
rm $RPM_BUILD_ROOT/sbin/clvmd
rm $RPM_BUILD_ROOT/%{_mandir}/man8/clvmd*
install -m 644 %{SOURCE1} $RPM_BUILD_ROOT/etc/lvm
mkdir -p $RPM_BUILD_ROOT/etc/init.d
install -m 755 %{SOURCE2} $RPM_BUILD_ROOT/etc/init.d
@ -123,7 +136,15 @@ rm $RPM_BUILD_ROOT/usr/include/lvm2cmd.h
# install 64-lvm2.rules and collect_lvm
install -m644 -D %{S:6} $RPM_BUILD_ROOT/lib/udev/rules.d/64-lvm2.rules
install -m755 -D %{S:7} $RPM_BUILD_ROOT/lib/udev/collect_lvm
install -m755 -D %{S:8} $RPM_BUILD_ROOT/usr/lib/ocf/resource.d/lvm2/clvmd
# remove all device mapper files
rm $RPM_BUILD_ROOT/%{_lib}/libdevmapper-event.so*
rm $RPM_BUILD_ROOT/%{_lib}/libdevmapper.so*
rm $RPM_BUILD_ROOT/sbin/dmeventd
rm $RPM_BUILD_ROOT/sbin/dmsetup
rm $RPM_BUILD_ROOT/usr/include/libdevmapper-event.h
rm $RPM_BUILD_ROOT/usr/include/libdevmapper.h
rm $RPM_BUILD_ROOT/%{_mandir}/man8/dmsetup.*
rm $RPM_BUILD_ROOT/%{_mandir}/man8/fsadm.*
%clean
rm -rf $RPM_BUILD_ROOT
@ -141,15 +162,6 @@ rm -rf $RPM_BUILD_ROOT
[ -x /sbin/mkinitrd_setup ] && mkinitrd_setup
/sbin/ldconfig
%files clvm
%defattr(-,root,root)
/usr/sbin/clvmd
%dir /usr/lib/ocf
%dir /usr/lib/ocf/resource.d
%dir /usr/lib/ocf/resource.d/lvm2
/usr/lib/ocf/resource.d/lvm2/clvmd
%{_mandir}/man8/clvmd.8.gz
%files
%defattr(-,root,root)
%doc INSTALL README WHATS_NEW doc/*
@ -265,6 +277,50 @@ rm -rf $RPM_BUILD_ROOT
%{_mandir}/man8/vgsplit.8.gz
%changelog
* Mon Apr 27 2009 xwhu@suse.de
- Upgrade to LVM2 2.02.45
Avoid scanning empty metadata areas for VG names
Pass --test from lvresize to fsadm as --dry-run.
Remove duplicate cpg_initialize from clvmd startup.
Add option to /etc/sysconfig/cluster to select cluster type for clvmd.
Remove external dependency on the 'cut' command from fsadm.
Fix pvs segfault when pv mda attributes requested for not available PV.
Fix lvresize size conversion for fsadm when block size is not 1K.
Add pv_mda_size to pvs and vg_mda_size to vgs.
Add "--refresh" functionality to vgchange and vgmknodes.
Fix vgrename using UUID if there are VGs with identical names.
Fix segfault when invalid field given in reporting commands.
Merge device-mapper into the lvm2 tree.
Exit with non-zero status from vgdisplay if couldn't show any requested VG.
Fix snapshot monitoring library to not cancel monitoring invalid snapshot.
Fix conversion of md chunk size into sectors.
Fix misleading error message when there are no allocatable extents in VG.
Fix handling of PVs which reappeared with old metadata version.
Fix mirror DSO to call vgreduce with proper parameters.
Fix validation of --minor and --major in lvcreate to require -My always.
Fix release: clvmd build, vgreduce consolidate & tests, /dev/ioerror warning.
* Tue Mar 31 2009 xwhu@suse.de
- Handle the case that drbd virtual device has the same PV uuid
with the underlining physical device.
* Wed Mar 25 2009 xwhu@suse.de
- Do not filter out tmp device file(bnc#485572)
- Do not try to activate VG when all paths are down already(bnc#479104)
* Wed Mar 25 2009 xwhu@suse.de
- Split CLVMD as a independent package
* Tue Mar 24 2009 xwhu@suse.de
- Fix for bnc#486952
use "killproc -INT" instead of "killproc"
handle signal in the main loop thread only
* Thu Feb 26 2009 xwhu@suse.de
- add daemon_options parameter to clvmd.ocf
- check EUNLOCK for dlm_ls_unlock_wait
* Wed Feb 25 2009 xwhu@suse.de
- bnc#479422, check both lksb.sb_status and status.
* Fri Feb 20 2009 xwhu@suse.de
- simplify patch of dlm lock to clvmd
* Fri Feb 20 2009 xwhu@suse.de
- bnc#476861, clvmd.ocf doesn't report the correct status when
kill -9 doesn't terminate the process
* Thu Jan 22 2009 xwhu@suse.de
- bnc#464851, use dlm instead of openais lck
* Wed Jan 21 2009 ro@suse.de

View File

@ -1,5 +1,7 @@
--- man/pvdisplay.8
+++ man/pvdisplay.8 2007/11/22 13:43:49
Index: man/pvdisplay.8.in
===================================================================
--- man/pvdisplay.8.in.orig 2009-04-27 16:17:35.000000000 +0800
+++ man/pvdisplay.8.in 2009-04-27 16:17:50.000000000 +0800
@@ -25,7 +25,7 @@
* physical volume device name

View File

@ -1,78 +1,23 @@
#!/bin/bash
#%stage: volumemanager
#%depends: evms
#%programs: /sbin/vgscan /sbin/vgchange /sbin/lvm
#%modules: linear
#%if: -n "$root_lvm2"
#%stage: boot
#%depends: start
#%modules: $dm_modules dm-mod dm-snapshot
#%programs: /sbin/dmsetup /sbin/blockdev
# dm-crypt dm-zero dm-mirror
#%if: -n "$root_dm"
#
##### LVM (Logical Volume Management)
##### Device Mapper
##
## This activates and waits for an LVM.
## If the root device uses device mapper, this initializes and waits for the control file
##
## Command line parameters
## -----------------------
##
## root_lvm2=1 use LVM
## root=/dev/mapper/... use this device as Volume Group
## vg_roots use this group as Volume Group
## root_dm=1 use device mapper
##
lvm2_get_vg() {
local param=$1
local vg_root vg_name
local sysdev
case $param in
/dev/disk/by-*/*)
vg_root=
;;
/dev/mapper/*)
vg_name=${o##root=/dev/mapper/}
vg_root=${vg_name%%-*}
;;
/dev/*)
set -- $(IFS=/ ; echo $param)
if [ "$#" = "3" ] ; then
# Check sysfs. If there are subdirectories
# matching this name it's a block device
for d in /sys/block/$2\!* ; do
if [ -d $d ] ; then
sysdev=$d
fi
done
# Not found in sysfs, looks like a VG then
if [ -z "$sysdev" ] ; then
vg_root=$2
fi
fi
;;
esac
echo $vg_root
}
# load the necessary module before we initialize the raid system
load_modules
if [ -n "$root_lvm2" ] ; then
o=$(get_param root)
# Fallback if 'root=' is not specified
[ -z "$o" ] && o=$rootdev
vg_root=$(lvm2_get_vg $o)
if [ "$vg_root" ] ; then
# We are waiting for a device-mapper device
root_major=$(sed -n 's/\(.*\) device-mapper/\1/p' /proc/devices)
fi
o=$(get_param resume)
vg_resume=$(lvm2_get_vg $o)
if [ "$vg_resume" ] ; then
resume_major=$(sed -n 's/\(.*\) device-mapper/\1/p' /proc/devices)
fi
fi
# initialize remebered and parameterized devices
for vgr in $vg_root $vg_resume $vg_roots; do
vgchange -a y $vgr
done
unset lvm2_get_vg
# because we run before udev we need to create the device node manually
mkdir /dev/mapper
mknod /dev/mapper/control c 10 63

View File

@ -1,44 +1,34 @@
#!/bin/bash
#
#%stage: volumemanager
#%depends: evms
#%stage: devicemapper
#%depends: dmroot
#
# get information about the current blockdev
update_blockdev
# Check whether we are using LVM2 (only available when not using EVMS)
if [ -z "$root_evms" ] && [ -x /sbin/lvdisplay ] ; then
lvm_blockdev=
for bd in $blockdev; do
update_blockdev $bd
# no dmsetup -> no dm
if [ -x /sbin/dmsetup ]; then
dm_blockdev=
vg_name=$(lvdisplay -c 2> /dev/null | sed -n "/.*:$blockmajor:$blockminor/p")
vg_dev=${vg_name%%:*}
vg_name=${vg_name#*:}
vg_root=${vg_name%%:*}
if [ "$vg_root" ] ; then
local vg_blockdev
root_lvm2=1
realrootdev=${vg_dev## }
vg_blockdev=$(vgs --noheadings --options pv_name $vg_root 2> /dev/null | sed "s@,@\n@g" | sed "s@([0-9]*)@@g;s@ @@g" | sort | uniq)
lvm_blockdev="$lvm_blockdev $vg_blockdev"
[ $? -eq 0 ] || return 1
vg_roots="$vg_roots $vg_root"
else
lvm_blockdev="$lvm_blockdev $bd"
# if any device before was on dm we have to activate it
[ "$tmp_root_dm" ] && root_dm=1
blockdev="$(dm_resolvedeps_recursive $blockdev)"
[ "$?" = 0 ] && root_dm=1
# include dm when using dm based block devs
[ "$DM_BLOCK" ] && root_dm=1
# include modules
if [ -n "$root_dm" ] ; then
# Add all dm modules
dm_modules=
for table in $(dmsetup table | cut -f 4 -d ' ' | sort | uniq); do
if [ "$table" ] && [ "$table" != "linear" ] && [ "$table" != "striped" ] ; then
dm_modules="$dm_modules dm-$table"
fi
done
fi
done
blockdev="$lvm_blockdev"
# include dm block var from sysconfig
mkdir -p etc/sysconfig
grep DM_BLOCK /etc/sysconfig/kernel > etc/sysconfig/kernel
save_var root_dm
fi
if use_script lvm2; then
tmp_root_dm=1 # lvm needs dm
mkdir -p $tmp_mnt/etc/lvm
mkdir -p $tmp_mnt/var/lock/lvm
cp -a /etc/lvm/lvm.conf $tmp_mnt/etc/lvm
fi
save_var root_lvm2
save_var vg_roots

View File

@ -1,5 +1,7 @@
--- lib/device/dev-io.c
+++ lib/device/dev-io.c
Index: lib/device/dev-io.c
===================================================================
--- lib/device/dev-io.c.orig 2009-04-27 16:15:36.000000000 +0800
+++ lib/device/dev-io.c 2009-04-27 16:15:42.000000000 +0800
@@ -31,6 +31,7 @@
# define u64 uint64_t /* Missing without __KERNEL__ */
# undef WNOHANG /* Avoid redefinition */
@ -8,13 +10,15 @@
# include <linux/fs.h> /* For block ioctl definitions */
# define BLKSIZE_SHIFT SECTOR_SHIFT
# ifndef BLKGETSIZE64 /* fs.h out-of-date */
--- lib/filters/filter.c
+++ lib/filters/filter.c
@@ -25,6 +25,7 @@
#include <fcntl.h>
#include <limits.h>
Index: lib/filters/filter.c
===================================================================
--- lib/filters/filter.c.orig 2009-04-27 16:15:39.000000000 +0800
+++ lib/filters/filter.c 2009-04-27 16:15:42.000000000 +0800
@@ -14,6 +14,7 @@
*/
#include <sys/ioctl.h>
+#define _LINUX_AUDIT_H_
#include <linux/fs.h>
#define NUMBER_OF_MAJORS 256
#undef MAJOR
#undef MINOR

View File

@ -1,8 +1,10 @@
--- tools/Makefile.in
+++ tools/Makefile.in 2006/04/20 15:25:48
Index: tools/Makefile.in
===================================================================
--- tools/Makefile.in.orig 2009-04-27 16:15:35.000000000 +0800
+++ tools/Makefile.in 2009-04-27 16:15:46.000000000 +0800
@@ -95,7 +95,7 @@
LVMLIBS += -ldevmapper
endif
LVMLIBS += -ldevmapper
-DEFS += -DLVM_SHARED_PATH=\"$(exec_prefix)/sbin/lvm\"
+DEFS += -DLVM_SHARED_PATH=\"/sbin/lvm\"

View File

@ -1,5 +1,7 @@
--- tools/pvscan.c
+++ tools/pvscan.c 2007/11/22 12:24:51
Index: tools/pvscan.c
===================================================================
--- tools/pvscan.c.orig 2008-11-04 06:14:30.000000000 +0800
+++ tools/pvscan.c 2009-04-27 16:15:52.000000000 +0800
@@ -166,7 +166,7 @@
size_new += pv_size(pv);
size_total += pv_size(pv);

View File

@ -0,0 +1,38 @@
Index: LVM2.2.02.39/daemons/clvmd/clvmd.c
===================================================================
--- LVM2.2.02.39.orig/daemons/clvmd/clvmd.c 2009-03-24 19:29:14.000000000 +0800
+++ LVM2.2.02.39/daemons/clvmd/clvmd.c 2009-03-24 19:34:01.000000000 +0800
@@ -348,9 +348,11 @@
signal(SIGHUP, sighup_handler);
signal(SIGPIPE, SIG_IGN);
- /* Block SIGUSR2 in the main process */
+ /* Block SIGUSR2/SIGINT/SIGTERM in process */
sigemptyset(&ss);
sigaddset(&ss, SIGUSR2);
+ sigaddset(&ss, SIGINT);
+ sigaddset(&ss, SIGTERM);
sigprocmask(SIG_BLOCK, &ss, NULL);
/* Initialise the LVM thread variables */
@@ -633,6 +635,11 @@
{
DEBUGLOG("Using timeout of %d seconds\n", cmd_timeout);
+ sigset_t ss;
+ sigemptyset(&ss);
+ sigaddset(&ss, SIGINT);
+ sigaddset(&ss, SIGTERM);
+ pthread_sigmask(SIG_UNBLOCK, &ss, NULL);
/* Main loop */
while (!quit) {
fd_set in;
@@ -771,6 +778,8 @@
}
closedown:
+
+ pthread_sigmask(SIG_BLOCK, &ss, NULL);
clops->cluster_closedown();
close(local_sock);
}

68
support-drbd-filter.diff Normal file
View File

@ -0,0 +1,68 @@
This is still very primitive support of drbd in lvm2.
Can we use some /sys information for this ?
Index: LVM2.2.02.39/lib/cache/lvmcache.c
===================================================================
--- LVM2.2.02.39.orig/lib/cache/lvmcache.c 2008-06-27 23:18:31.000000000 +0800
+++ LVM2.2.02.39/lib/cache/lvmcache.c 2009-03-31 12:08:29.000000000 +0800
@@ -1119,6 +1119,13 @@
pvid, dev_name(dev),
dev_name(existing->dev));
return NULL;
+ } else if (MAJOR(existing->dev->dev) == drbd_major() &&
+ MAJOR(dev->dev) != drbd_major()) {
+ log_very_verbose("Ignoring duplicate PV %s on "
+ "%s - using drbd %s",
+ pvid, dev_name(dev),
+ dev_name(existing->dev));
+ return NULL;
} else if (MAJOR(existing->dev->dev) != md_major() &&
MAJOR(dev->dev) == md_major())
log_very_verbose("Duplicate PV %s on %s - "
@@ -1131,6 +1138,12 @@
"using dm %s", pvid,
dev_name(existing->dev),
dev_name(dev));
+ else if (MAJOR(existing->dev->dev) != drbd_major() &&
+ MAJOR(dev->dev) == drbd_major())
+ log_very_verbose("Duplicate PV %s on %s - "
+ "using drbd %s", pvid,
+ dev_name(existing->dev),
+ dev_name(dev));
/* FIXME If both dm, check dependencies */
//else if (dm_is_dm_major(MAJOR(existing->dev->dev)) &&
//dm_is_dm_major(MAJOR(dev->dev)))
Index: LVM2.2.02.39/lib/filters/filter.c
===================================================================
--- LVM2.2.02.39.orig/lib/filters/filter.c 2009-03-31 11:48:52.000000000 +0800
+++ LVM2.2.02.39/lib/filters/filter.c 2009-03-31 11:57:38.000000000 +0800
@@ -46,12 +46,20 @@
static int _md_major = -1;
static int _device_mapper_major = -1;
+static int _drbd_major = -1;
int md_major(void)
{
return _md_major;
}
+/* FIXME: Should we consider filter out non-primary
+ drbd resource ?? */
+int drbd_major(void)
+{
+ return _drbd_major;
+}
+
/*
* Devices are only checked for partition tables if their minor number
* is a multiple of the number corresponding to their type below
@@ -208,6 +216,9 @@
if (!strncmp("md", line + i, 2) && isspace(*(line + i + 2)))
_md_major = line_maj;
+ if (!strncmp("drbd", line + i, 4) && isspace(*(line + i + 4)))
+ _drbd_major = line_maj;
+
/* Look for device-mapper device */
/* FIXME Cope with multiple majors */
if (!strncmp("device-mapper", line + i, 13) && isspace(*(line + i + 13)))

View File

@ -1,5 +1,7 @@
--- lib/device/dev-io.c
+++ lib/device/dev-io.c 2005/04/11 10:53:52
Index: lib/device/dev-io.c
===================================================================
--- lib/device/dev-io.c.orig 2009-04-27 16:15:42.000000000 +0800
+++ lib/device/dev-io.c 2009-04-27 16:15:49.000000000 +0800
@@ -32,7 +32,7 @@
# undef WNOHANG /* Avoid redefinition */
# undef WUNTRACED /* Avoid redefinition */
@ -9,8 +11,10 @@
# define BLKSIZE_SHIFT SECTOR_SHIFT
# ifndef BLKGETSIZE64 /* fs.h out-of-date */
# define BLKGETSIZE64 _IOR(0x12, 114, size_t)
--- lib/filters/filter.c
+++ lib/filters/filter.c 2005/04/11 10:54:57
Index: lib/filters/filter.c
===================================================================
--- lib/filters/filter.c.orig 2009-04-27 16:15:42.000000000 +0800
+++ lib/filters/filter.c 2009-04-27 16:15:49.000000000 +0800
@@ -15,7 +15,7 @@
#include <sys/ioctl.h>