Skip to contentSkip to conversation

master - dmsetup: use noflush with force removal

PATCH Zdenek Kabelac 1 participant 1 message Sep 18, 2015

lore
Share & tools
lore
#0 lore raw
Gitweb:        http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=791e76ff700304da574ce03e9762c880cd17e522
Commit:        791e76ff700304da574ce03e9762c880cd17e522
Parent:        e0d915a8733c690abc36f91f89cdcc542b35dc82
Author:        Zdenek Kabelac <[email protected]>
AuthorDate:    Fri Sep 18 14:35:52 2015 +0200
Committer:     Zdenek Kabelac <[email protected]>
CommitterDate: Fri Sep 18 17:45:45 2015 +0200

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.

---
 WHATS_NEW_DM    |    1 +
 tools/dmsetup.c |    6 +++++-
 2 files changed, 6 insertions(+), 1 deletions(-)
WHATS_NEW_DM +1 -0
index 006421b..3669b85 100644
@@ -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.
tools/dmsetup.c +5 -1
index 8b7ad74..632c4ca 100644
@@ -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;