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

thin: fix thin LV flagging for udev to skip scanning

Only flag thin LV for no scanning in udev if this LV is about
to be wiped. This happens only in case the thin LV's pool was not
created with zeroing of the new blocks enabled.
This commit is contained in:
Peter Rajnoha 2014-01-20 12:38:21 +01:00
parent 79768b2e9c
commit 91b26b63b4
2 changed files with 15 additions and 4 deletions

View File

@ -1,5 +1,6 @@
Version 2.02.105 -
=====================================
Fix thin LV flagging for udev to skip scanning only if the LV is wiped
Replace use of xfs_check with xfs_reparir in fsadm.
Mark lvm1 format metadata as FMT_OBSOLETE. Do not use it with lvmetad.
Invalidate cached VG struct after a PV in it gets orphaned. (2.02.87)

View File

@ -5634,6 +5634,18 @@ out:
return 1;
}
static int _should_wipe_lv(struct lvcreate_params *lp, struct logical_volume *lv) {
int r = lp->zero | lp->wipe_signatures;
if (!seg_is_thin(lp))
return r;
if (lv_is_thin_volume(lv))
return r && !lp->snapshot && !first_seg(first_seg(lv)->pool_lv)->zero_new_blocks;
return 0;
}
/* Thin notes:
* If lp->thin OR lp->activate is AY*, activate the pool if not already active.
* If lp->thin, create thin LV within the pool - as a snapshot if lp->snapshot.
@ -6029,7 +6041,7 @@ static struct logical_volume *_lv_create_an_lv(struct volume_group *vg,
}
/* Do not scan this LV until properly zeroed/wiped. */
if (lp->zero | lp->wipe_signatures)
if (_should_wipe_lv(lp, lv))
lv->status |= LV_NOSCAN;
if (lp->temporary)
@ -6110,9 +6122,7 @@ static struct logical_volume *_lv_create_an_lv(struct volume_group *vg,
log_verbose("Signature wiping on \"%s/%s\" not requested", lv->vg->name, lv->name);
}
if ((!seg_is_thin(lp) ||
(lv_is_thin_volume(lv) && !lp->snapshot &&
!first_seg(first_seg(lv)->pool_lv)->zero_new_blocks))) {
if (_should_wipe_lv(lp, lv)) {
if (!wipe_lv(lv, (struct wipe_params)
{
.do_zero = lp->zero,