Skip to contentSkip to conversation

master - activation: check for open count with a timeout before removal/deactivation of an LV

PATCH Peter Rajnoha 1 participant 1 message Oct 15, 2013

lore
Share & tools
lore
#0 lore raw
Gitweb:        http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=48df36b8c531a43da8602b50759c9e841e1d9f44
Commit:        48df36b8c531a43da8602b50759c9e841e1d9f44
Parent:        d97583cfd395e5e31888558361ae9467cea60260
Author:        Peter Rajnoha <[email protected]>
AuthorDate:    Tue Oct 15 12:44:42 2013 +0200
Committer:     Peter Rajnoha <[email protected]>
CommitterDate: Tue Oct 15 12:44:42 2013 +0200

activation: check for open count with a timeout before removal/deactivation of an LV

This patch reinstates the lv_info call to check for open count of the LV we're removing/deactivating - this was changed with commit 125712b some time ago and we relied on the ioctl retry logic deeper in the libdm while calling the exact 'remove' ioctl.

However, there are still some situations in which it's still required to check for open count before we do any 'remove' actions - this mainly applies to LVs which consist of several sub LVs, like it is for virtual snapshot devices.

The commit 1146691 fixed the issue with ordering of actions during virtual snapshot removal while the snapshot is still open. But the check for the open status of the snapshot is still prone to marking the snapshot as in use with an immediate exit even though this could be a temporary asynchronous open only, most notably because of udev and its WATCH udev rule with accompanying scans for the event which is asynchronous. The situation where this crops up most often is when we're closing the LV that was open for read-write and then calling lvremove immediately.

This patch reinstates the original lv_info call for the open status of the LV in the lv_check_not_in_use fn that gets called before we do any LV removal/deactivation. In addition to original logic, this patch adds its own retry loop with a delay (25x0.2 seconds) besides the existing ioctl retry loop.

---
 WHATS_NEW               |    1 +
 lib/activate/activate.c |   51 ++++++++++++++++++++++++++++++----------------
 2 files changed, 34 insertions(+), 18 deletions(-)
WHATS_NEW +1 -0
index 04be5f1..f5f0256 100644
@@ -1,5 +1,6 @@
 Version 2.02.104
 ===================================
+  Check for open count with a timeout before removal/deactivation of an LV.
   Report RAID images split with tracking as out-of-sync ("I").
   Improve parsing of snapshot lv segment.
   Add workaround for deactivation problem of opened virtual snapshot.
lib/activate/activate.c +33 -18

74 lines not on this page · raw message