From 791e76ff700304da574ce03e9762c880cd17e522 Mon Sep 17 00:00:00 2001 From: Zdenek Kabelac Date: Fri, 18 Sep 2015 14:35:52 +0200 Subject: [PATCH] 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 deletion(-) 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;