summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZdenek Kabelac <zkabelac@redhat.com>2015-09-18 14:35:52 +0200
committerZdenek Kabelac <zkabelac@redhat.com>2015-09-18 17:45:45 +0200
commit791e76ff700304da574ce03e9762c880cd17e522 (patch)
tree1e7d92a2f6624ca6ef5c832b532a9bb8e9d5438e
parente0d915a8733c690abc36f91f89cdcc542b35dc82 (diff)
downloadlvm2-791e76ff700304da574ce03e9762c880cd17e522.tar.gz
dmsetup: use noflush with force removal
When user specifies '--force' with remove/remove_all/wipe_table use '--noflush --nolockfs' resume flags, so the operation will not block when device underneath is blocked.
-rw-r--r--WHATS_NEW_DM1
-rw-r--r--tools/dmsetup.c6
2 files changed, 6 insertions, 1 deletions
diff --git a/WHATS_NEW_DM b/WHATS_NEW_DM
index 006421b3e..3669b8592 100644
--- a/WHATS_NEW_DM
+++ b/WHATS_NEW_DM
@@ -1,5 +1,6 @@
Version 1.02.109 -
======================================
+ Use --noflush and --nolockfs when removing device with --force.
Parse new Overflow status string for snapshot target.
Check dir path components are valid if using dm_create_dir, error out if not.
Fix /dev/mapper handling to remove dangling entries if symlinks are found.
diff --git a/tools/dmsetup.c b/tools/dmsetup.c
index 8b7ad744e..632c4ca7c 100644
--- a/tools/dmsetup.c
+++ b/tools/dmsetup.c
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
- * Copyright (C) 2004-2012 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2004-2015 Red Hat, Inc. All rights reserved.
* Copyright (C) 2005-2007 NEC Corporation
*
* This file is part of the device-mapper userspace tools.
@@ -1923,6 +1923,10 @@ static int _error_device(CMD_ARGS)
if (!_task_run(dmt))
goto_bad;
+ if (_switches[FORCE_ARG])
+ /* Avoid hang on flushing with --force */
+ _switches[NOLOCKFS_ARG] = _switches[NOFLUSH_ARG] = 1;
+
if (!_simple(DM_DEVICE_RESUME, name, 0, 0)) {
_simple(DM_DEVICE_CLEAR, name, 0, 0);
goto_bad;