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

writecache: use cleaner message instead of table reload

When detaching writecache, make the first stage send a message
to dm-writecache to set the cleaner option.  This is instead of
reloading the dm table with the cleaner option set.  Reloading
the table causes udev to process/probe the dm dev, which gets
stalled because of the writeback activity, and the stalled udev
in turn stalls the lvconvert command when it tries to sync with
udev events.

When getting writecache status we do not need to get
open_count or read_head info, which can cause extra steps.
This commit is contained in:
David Teigland 2021-01-27 16:23:00 -06:00
parent f08ef23856
commit a690d16d29
2 changed files with 9 additions and 3 deletions

View File

@ -75,7 +75,7 @@ static int _get_writecache_kernel_status(struct cmd_context *cmd,
return 0;
}
if (!lv_info_with_seg_status(cmd, first_seg(lv), &status, 1, 1)) {
if (!lv_info_with_seg_status(cmd, first_seg(lv), &status, 0, 0)) {
log_error("Failed to get device mapper status for %s", display_lvname(lv));
goto fail;
}
@ -434,8 +434,12 @@ int lv_writecache_set_cleaner(struct logical_volume *lv)
seg->writecache_settings.cleaner_set = 1;
if (lv_is_active(lv)) {
if (!lv_update_and_reload(lv)) {
log_error("Failed to update VG and reload LV.");
if (!vg_write(lv->vg) || !vg_commit(lv->vg)) {
log_error("Failed to update VG.");
return 0;
}
if (!lv_writecache_message(lv, "cleaner")) {
log_error("Failed to set writecache cleaner for %s.", display_lvname(lv));
return 0;
}
} else {

View File

@ -5720,6 +5720,8 @@ static int _lvconvert_detach_writecache_when_clean(struct cmd_context *cmd,
return 0;
}
log_debug("detach writecache check clean reading vg %s", id->vg_name);
vg = vg_read(cmd, id->vg_name, NULL, READ_FOR_UPDATE, lockd_state, &error_flags, NULL);
if (!vg) {