|
|
f41bc7 |
tools/lvconvert.c | 19 ++++++++++---------
|
|
|
f41bc7 |
1 file changed, 10 insertions(+), 9 deletions(-)
|
|
|
f41bc7 |
|
|
|
f41bc7 |
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
|
|
|
f41bc7 |
index 4ebda4c..bfaf4c0 100644
|
|
|
f41bc7 |
--- a/tools/lvconvert.c
|
|
|
f41bc7 |
+++ b/tools/lvconvert.c
|
|
|
f41bc7 |
@@ -5599,6 +5599,16 @@ static int _lvconvert_writecache_attach_single(struct cmd_context *cmd,
|
|
|
f41bc7 |
goto bad;
|
|
|
f41bc7 |
}
|
|
|
f41bc7 |
|
|
|
f41bc7 |
+ /*
|
|
|
f41bc7 |
+ * To permit this we need to check the block size of the fs using lv
|
|
|
f41bc7 |
+ * (recently in libblkid) so that we can use a matching writecache
|
|
|
f41bc7 |
+ * block size. We also want to do that if the lv is inactive.
|
|
|
f41bc7 |
+ */
|
|
|
f41bc7 |
+ if (lv_is_active(lv)) {
|
|
|
f41bc7 |
+ log_error("LV %s must be inactive to attach writecache.", display_lvname(lv));
|
|
|
f41bc7 |
+ goto bad;
|
|
|
f41bc7 |
+ }
|
|
|
f41bc7 |
+
|
|
|
f41bc7 |
/* fast LV shouldn't generally be active by itself, but just in case. */
|
|
|
f41bc7 |
if (lv_info(cmd, lv_fast, 1, NULL, 0, 0)) {
|
|
|
f41bc7 |
log_error("LV %s must be inactive to attach.", display_lvname(lv_fast));
|
|
|
f41bc7 |
@@ -5639,15 +5649,6 @@ static int _lvconvert_writecache_attach_single(struct cmd_context *cmd,
|
|
|
f41bc7 |
memcpy(&lockd_fast_id, &lv_fast->lvid.id[1], sizeof(struct id));
|
|
|
f41bc7 |
}
|
|
|
f41bc7 |
|
|
|
f41bc7 |
- /*
|
|
|
f41bc7 |
- * TODO: use libblkid to get the sector size of lv. If it doesn't
|
|
|
f41bc7 |
- * match the block_size we are using for the writecache, then warn that
|
|
|
f41bc7 |
- * an existing file system on lv may become unmountable with the
|
|
|
f41bc7 |
- * writecache attached because of the changing sector size. If this
|
|
|
f41bc7 |
- * happens, then use --splitcache, and reattach the writecache using a
|
|
|
f41bc7 |
- * writecache block_size value matching the sector size of lv.
|
|
|
f41bc7 |
- */
|
|
|
f41bc7 |
-
|
|
|
f41bc7 |
if (!_writecache_zero(cmd, lv_fast)) {
|
|
|
f41bc7 |
log_error("LV %s could not be zeroed.", display_lvname(lv_fast));
|
|
|
f41bc7 |
return ECMD_FAILED;
|