master - cleanup: test for -1 value for lseek error
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=39705ed20123d3...
Commit: 39705ed20123d394f1f0d122704855ec783973da
Parent: 56779c32c500426db33d0e6032160ef4f5e0bbcc
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed May 29 12:38:09 2013 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu May 30 17:26:42 2013 +0200
cleanup: test for -1 value for lseek error
Error is defined as -1.
Yet it seems we are unable to seek to 0 for devices > 8Exabytes.
---
lib/device/dev-io.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/lib/device/dev-io.c b/lib/device/dev-io.c
index bb50ae4..34e3064 100644
--- a/lib/device/dev-io.c
+++ b/lib/device/dev-io.c
@@ -83,7 +83,7 @@ static int _io(struct device_area *where, char *buffer, int should_write)
return 0;
}
- if (lseek(fd, (off_t) where->start, SEEK_SET) < 0) {
+ if (lseek(fd, (off_t) where->start, SEEK_SET) == (off_t) -1) {
log_error("%s: lseek %" PRIu64 " failed: %s",
dev_name(where->dev), (uint64_t) where->start,
strerror(errno));
10 years, 10 months
master - snapshot: fix resize of 100% full cow
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=56779c32c50042...
Commit: 56779c32c500426db33d0e6032160ef4f5e0bbcc
Parent: 99f04835802ee675242a4896697eb784717ee998
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed May 29 21:17:15 2013 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu May 30 17:26:20 2013 +0200
snapshot: fix resize of 100% full cow
When the COW area is using all the available space (100%) it can be still
a valid snapshot which may need a resize. So support it.
---
WHATS_NEW | 1 +
tools/lvresize.c | 2 +-
2 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 86357fd..1888c62 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.99 -
===================================
+ Fix lvresize --use-policies of VALID but 100% full snapshot.
Do not accept size parameters bigger then 16EiB.
Fix release of PV's fid in free_pv_fid().
Skip monitoring of snapshots that are already bigger then origin.
diff --git a/tools/lvresize.c b/tools/lvresize.c
index b679bf9..b1008ec 100644
--- a/tools/lvresize.c
+++ b/tools/lvresize.c
@@ -321,7 +321,7 @@ static int _adjust_policy_params(struct cmd_context *cmd,
} else {
if (!lv_snapshot_percent(lv, &percent))
return_0;
- if (!(PERCENT_0 < percent && percent < PERCENT_100) || percent <= policy_threshold)
+ if (!(PERCENT_0 < percent && percent <= PERCENT_100) || percent <= policy_threshold)
return 1; /* nothing to do */
}
10 years, 10 months
master - args: do not accept >=16EiB sizes
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=99f04835802ee6...
Commit: 99f04835802ee675242a4896697eb784717ee998
Parent: c5c452a137ba36840d71f3bde23b1a6b496ede4f
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed May 29 14:50:21 2013 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu May 30 17:23:51 2013 +0200
args: do not accept >=16EiB sizes
Instead of seeing wierd overflows inside the lvm code,
giving false error messages, kill the user experiment in the begining.
Who needs to use more then 16EiB with lvm2 and 64bit anyway...
---
WHATS_NEW | 1 +
tools/lvmcmdline.c | 4 ++++
2 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index f5adc0b..86357fd 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.99 -
===================================
+ Do not accept size parameters bigger then 16EiB.
Fix release of PV's fid in free_pv_fid().
Skip monitoring of snapshots that are already bigger then origin.
Add lv_is_cow_covering_origin() to check if cow covers origin size.
diff --git a/tools/lvmcmdline.c b/tools/lvmcmdline.c
index 0b64ed8..89ead2c 100644
--- a/tools/lvmcmdline.c
+++ b/tools/lvmcmdline.c
@@ -340,6 +340,10 @@ static int _size_arg(struct cmd_context *cmd __attribute__((unused)), struct arg
} else
v *= factor;
+ if ((uint64_t) v >= (UINT64_MAX >> SECTOR_SHIFT)) {
+ log_error("Size is too big (>=16EiB).");
+ return 0;
+ }
av->i_value = (int32_t) v;
av->ui_value = (uint32_t) v;
av->i64_value = (int64_t) v;
10 years, 10 months
master - libdm: add public macro DM_TO_STRING
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=c5c452a137ba36...
Commit: c5c452a137ba36840d71f3bde23b1a6b496ede4f
Parent: 2f1a571c9707d596d7716cec9488e54ba4c0c946
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed May 29 12:46:21 2013 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu May 30 16:53:59 2013 +0200
libdm: add public macro DM_TO_STRING
Since this stringifying macro is usable in more places,
move it to the public header with DM_ prefix.
---
WHATS_NEW_DM | 1 +
libdm/libdevmapper.h | 4 ++++
libdm/libdm-common.c | 8 ++------
3 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/WHATS_NEW_DM b/WHATS_NEW_DM
index 4a2947a..46ce9b0 100644
--- a/WHATS_NEW_DM
+++ b/WHATS_NEW_DM
@@ -1,5 +1,6 @@
Version 1.02.78 -
===================================
+ Add DM_TO_STRING public macro.
Always return success on dmeventd -V command call.
Fix parsing of 64bit snapshot status in dmeventd snapshot plugin.
Add dm_get_status_snapshot() for parsing snapshot status.
diff --git a/libdm/libdevmapper.h b/libdm/libdevmapper.h
index 1bf5807..dba8548 100644
--- a/libdm/libdevmapper.h
+++ b/libdm/libdevmapper.h
@@ -34,6 +34,10 @@
# define __typeof__ typeof
#endif
+/* Macros to make string defines */
+#define DM_TO_STRING_EXP(A) #A
+#define DM_TO_STRING(A) DM_TO_STRING_EXP(A)
+
#ifdef __cplusplus
extern "C" {
#endif
diff --git a/libdm/libdm-common.c b/libdm/libdm-common.c
index 4b0ba08..d18de9c 100644
--- a/libdm/libdm-common.c
+++ b/libdm/libdm-common.c
@@ -1591,10 +1591,6 @@ static void _unmangle_mountinfo_string(const char *src, char *buf)
*buf = '\0';
}
-/* Macros to make string defines */
-#define TO_STRING_EXP(A) #A
-#define TO_STRING(A) TO_STRING_EXP(A)
-
/* Parse one line of mountinfo and unmangled target line */
static int _mountinfo_parse_line(const char *line, unsigned *maj, unsigned *min, char *buf)
{
@@ -1602,8 +1598,8 @@ static int _mountinfo_parse_line(const char *line, unsigned *maj, unsigned *min,
char target[PATH_MAX + 1];
/* TODO: maybe detect availability of %ms glib support ? */
- if (sscanf(line, "%*u %*u %u:%u %" TO_STRING(PATH_MAX)
- "s %" TO_STRING(PATH_MAX) "s",
+ if (sscanf(line, "%*u %*u %u:%u %" DM_TO_STRING(PATH_MAX)
+ "s %" DM_TO_STRING(PATH_MAX) "s",
maj, min, root, target) < 4) {
log_error("Failed to parse mountinfo line.");
return 0;
10 years, 10 months
master - fid: fix reset of PV fid
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=2f1a571c9707d5...
Commit: 2f1a571c9707d596d7716cec9488e54ba4c0c946
Parent: 55f42944bd76ffdf3f77331c491e7de24ed56a2f
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed May 29 12:42:09 2013 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu May 30 16:52:39 2013 +0200
fid: fix reset of PV fid
Avoid hitting memory corruption (double free) in code path,
where PV FID has been already destroyed and the released pointer
was left in PV structure and could have been tried to be released
from there 2nd. time with final context destruction.
---
WHATS_NEW | 1 +
lib/metadata/metadata.c | 3 +--
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 40fd569..f5adc0b 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.99 -
===================================
+ Fix release of PV's fid in free_pv_fid().
Skip monitoring of snapshots that are already bigger then origin.
Add lv_is_cow_covering_origin() to check if cow covers origin size.
Use libdm dm_get_status_snapshot() to parse snapshot status.
diff --git a/lib/metadata/metadata.c b/lib/metadata/metadata.c
index 351d157..62b5c3f 100644
--- a/lib/metadata/metadata.c
+++ b/lib/metadata/metadata.c
@@ -3402,8 +3402,7 @@ void free_pv_fid(struct physical_volume *pv)
if (!pv)
return;
- if (pv->fid)
- pv->fid->fmt->ops->destroy_instance(pv->fid);
+ pv_set_fid(pv, NULL);
}
/* This is only called by lv_from_lvid, which is only called from
10 years, 10 months
master - dmeventd: revert back percent to int
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=55f42944bd76ff...
Commit: 55f42944bd76ffdf3f77331c491e7de24ed56a2f
Parent: 5e7cdd60f0043d54651a8441803daaea345897f1
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed May 29 12:29:48 2013 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu May 30 16:46:58 2013 +0200
dmeventd: revert back percent to int
int is perfectly ok here.
---
.../dmeventd/plugins/snapshot/dmeventd_snapshot.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/daemons/dmeventd/plugins/snapshot/dmeventd_snapshot.c b/daemons/dmeventd/plugins/snapshot/dmeventd_snapshot.c
index ac33ef3..98dd1b4 100644
--- a/daemons/dmeventd/plugins/snapshot/dmeventd_snapshot.c
+++ b/daemons/dmeventd/plugins/snapshot/dmeventd_snapshot.c
@@ -134,7 +134,7 @@ void process_event(struct dm_task *dmt,
char *params;
struct dm_status_snapshot *status = NULL;
const char *device = dm_task_get_name(dmt);
- uint64_t percent;
+ int percent;
struct dso_state *state = *private;
/* No longer monitoring, waiting for remove */
@@ -175,7 +175,7 @@ void process_event(struct dm_task *dmt,
goto out;
}
- percent = 100 * status->used_sectors / status->total_sectors;
+ percent = (int) (100 * status->used_sectors / status->total_sectors);
if (percent >= state->percent_check) {
/* Usage has raised more than CHECK_STEP since the last
time. Run actions. */
10 years, 10 months
master - man: ea_start/ea_size -> ba_start/ba_size
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=5e7cdd60f0043d...
Commit: 5e7cdd60f0043d54651a8441803daaea345897f1
Parent: 798ed9ea1c72b24a02d38106ecaea9379a673c6f
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Thu May 30 11:45:44 2013 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Thu May 30 11:45:44 2013 +0200
man: ea_start/ea_size -> ba_start/ba_size
---
man/pvcreate.8.in | 2 +-
man/pvs.8.in | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/man/pvcreate.8.in b/man/pvcreate.8.in
index c3a652c..bd979aa 100644
--- a/man/pvcreate.8.in
+++ b/man/pvcreate.8.in
@@ -174,7 +174,7 @@ The start of the bootloader area is always aligned, see also \fB--dataalignment\
and \fB--dataalignmentoffset\fP. The bootloader area size may eventually
end up increased due to the alignment, but it's never less than the
size that is requested. To see the bootloader area start and size of
-an existing Physical Volume use \fBpvs -o +ea_start,ea_size\fP.
+an existing Physical Volume use \fBpvs -o +ba_start,ba_size\fP.
.TP
.B \-\-setphysicalvolumesize \fIsize
Overrides the automatically-detected size of the PV. Use with care.
diff --git a/man/pvs.8.in b/man/pvs.8.in
index 7fff4fd..7ec724a 100644
--- a/man/pvs.8.in
+++ b/man/pvs.8.in
@@ -63,7 +63,7 @@ and \fB-o pvseg_all\fP to select all Physical Volume segment columns.
Use \fB-o help\fP to view the full list of columns available.
.IP
Column names include: pv_fmt, pv_uuid, dev_size, pv_name, pv_mda_free,
-pv_mda_size, ea_start, ea_size, pe_start, pv_size, pv_free, pv_used,
+pv_mda_size, ba_start, ba_size, pe_start, pv_size, pv_free, pv_used,
pv_attr, pv_pe_count, pv_pe_alloc_count, pv_tags, pv_mda_count,
pv_mda_used_count, pvseg_start, and pvseg_size
.IP
10 years, 10 months
master - WHATS_NEW: return success on dmeventd -V
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=798ed9ea1c72b2...
Commit: 798ed9ea1c72b24a02d38106ecaea9379a673c6f
Parent: 6ad17fd7129dc7f50c0623181681157faea806a1
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Wed May 29 13:24:16 2013 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Wed May 29 13:24:16 2013 +0200
WHATS_NEW: return success on dmeventd -V
---
WHATS_NEW_DM | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/WHATS_NEW_DM b/WHATS_NEW_DM
index 6dcf9f8..4a2947a 100644
--- a/WHATS_NEW_DM
+++ b/WHATS_NEW_DM
@@ -1,5 +1,6 @@
Version 1.02.78 -
===================================
+ Always return success on dmeventd -V command call.
Fix parsing of 64bit snapshot status in dmeventd snapshot plugin.
Add dm_get_status_snapshot() for parsing snapshot status.
Detecte mounted fs also via reading /proc/self/mountinfo.
10 years, 10 months
master - dmeventd: always return success on dmevetnd -V
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=6ad17fd7129dc7...
Commit: 6ad17fd7129dc7f50c0623181681157faea806a1
Parent: be25f7ac83bcf0f910a6213d4c1d195fbdd0d45d
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Wed May 29 12:54:42 2013 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Wed May 29 12:54:42 2013 +0200
dmeventd: always return success on dmevetnd -V
---
daemons/dmeventd/dmeventd.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/daemons/dmeventd/dmeventd.c b/daemons/dmeventd/dmeventd.c
index 95fb837..4710910 100644
--- a/daemons/dmeventd/dmeventd.c
+++ b/daemons/dmeventd/dmeventd.c
@@ -1928,10 +1928,10 @@ int main(int argc, char *argv[])
switch (opt) {
case 'h':
usage(argv[0], stdout);
- exit(0);
+ exit(EXIT_SUCCESS);
case '?':
usage(argv[0], stderr);
- exit(0);
+ exit(EXIT_SUCCESS);
case 'R':
_restart++;
break;
@@ -1943,7 +1943,7 @@ int main(int argc, char *argv[])
break;
case 'V':
printf("dmeventd version: %s\n", DM_LIB_VERSION);
- exit(1);
+ exit(EXIT_SUCCESS);
}
}
10 years, 10 months
master - WHATS_NEW: ea_start, ea_size -> ba_start, ba_size
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=be25f7ac83bcf0...
Commit: be25f7ac83bcf0f910a6213d4c1d195fbdd0d45d
Parent: 732859d21f3b41bdb188f92b60f25d5c94dcee8a
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Tue May 28 12:43:26 2013 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Tue May 28 12:43:26 2013 +0200
WHATS_NEW: ea_start,ea_size -> ba_start,ba_size
---
WHATS_NEW | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 977519c..40fd569 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -38,7 +38,7 @@ Version 2.02.99 -
Add --withcomments and --withversions switch to lvm dumpconfig.
Add --type {current|default|missing|new} and --atversion to lvm dumpconfig.
Support automatic config validation and add 'config' section to lvm.conf.
- Add pvs -o ea_start,ea_size to report bootloader area start and size.
+ Add pvs -o ba_start,ba_size to report bootloader area start and size.
Add --bootloaderareasize to pvcreate and vgconvert to create a bootloader area.
Add PV header extension: extension version, flags and bootloader areas.
Initial support for lvconvert of thin external origin.
10 years, 10 months