From 317bc732073134159bc74e126339f8e498bdb376 Mon Sep 17 00:00:00 2001 From: Yi Wang Date: Fri, 13 Aug 2021 13:49:13 +0800 Subject: [PATCH] lvchange: fix lvchange refresh failed for dm suspend or resume failed When multiple lvchange refresh processes executed at the same time, suspend/resume ioctl on the same dm, some of these commands will be failed for dm aready change status, and ioctl will return EINVAL in _do_dm_ioctl function. to avoid this problem, add READ_FOR_ACTIVATE flags in lvchange refresh process, it will hold LCK_WRITE lock and avoid suspend/resume dm at the same time. Signed-off-by: Long YunJian Signed-off-by: Yi Wang (cherry picked from commit 47bcb446b83f9aa4fca74301fda109a8bf670fbb) --- tools/lvchange.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/lvchange.c b/tools/lvchange.c index 8293f5035..fb9ac895f 100644 --- a/tools/lvchange.c +++ b/tools/lvchange.c @@ -1620,7 +1620,7 @@ int lvchange_refresh_cmd(struct cmd_context *cmd, int argc, char **argv) cmd->handles_missing_pvs = 1; cmd->lockd_vg_default_sh = 1; - return process_each_lv(cmd, argc, argv, NULL, NULL, 0, + return process_each_lv(cmd, argc, argv, NULL, NULL, READ_FOR_ACTIVATE, NULL, &_lvchange_refresh_check, &_lvchange_refresh_single); } -- 2.34.1