public inbox for lvm2-cvs@sourceware.org
help / color / mirror / Atom feed
From: zkabelac@sourceware.org
To: lvm-devel@redhat.com, lvm2-cvs@sourceware.org
Subject: LVM2/libdm libdm-deptree.c
Date: Fri, 28 Oct 2011 20:11:00 -0000	[thread overview]
Message-ID: <20111028201122.26039.qmail@sourceware.org> (raw)

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	zkabelac@sourceware.org	2011-10-28 20:11:21

Modified files:
	libdm          : libdm-deptree.c 

Log message:
	Trying to fix the retry logic
	
	There should be no need for retry for our internal devices - it would be hinding
	our own bug in the tree processing.
	Update error messages to show also also device name.
	No WHATS_NEW - in release fix.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/libdm-deptree.c.diff?cvsroot=lvm2&r1=1.138&r2=1.139

--- LVM2/libdm/libdm-deptree.c	2011/10/20 10:39:07	1.138
+++ LVM2/libdm/libdm-deptree.c	2011/10/28 20:11:21	1.139
@@ -977,7 +977,7 @@
 	return r;
 }
 
-static int _check_device_not_in_use(struct dm_info *info)
+static int _check_device_not_in_use(const char *name, struct dm_info *info)
 {
 	if (!info->exists)
 		return 1;
@@ -985,8 +985,8 @@
 	/* If sysfs is not used, use open_count information only. */
 	if (!*dm_sysfs_dir()) {
 		if (info->open_count) {
-			log_error("Device %" PRIu32 ":%" PRIu32 " in use",
-				  info->major, info->minor);
+			log_error("Device %s (%" PRIu32 ":%" PRIu32 ") in use",
+				  name, info->major, info->minor);
 			return 0;
 		}
 
@@ -994,14 +994,14 @@
 	}
 
 	if (dm_device_has_holders(info->major, info->minor)) {
-		log_error("Device %" PRIu32 ":%" PRIu32 " is used "
-			  "by another device.", info->major, info->minor);
+		log_error("Device %s (%" PRIu32 ":%" PRIu32 ") is used "
+			  "by another device.", name, info->major, info->minor);
 		return 0;
 	}
 
 	if (dm_device_has_mounted_fs(info->major, info->minor)) {
-		log_error("Device %" PRIu32 ":%" PRIu32 " contains "
-			  "a filesystem in use.", info->major, info->minor);
+		log_error("Device %s (%" PRIu32 ":%" PRIu32 ") contains "
+			  "a filesystem in use.", name, info->major, info->minor);
 		return 0;
 	}
 
@@ -1413,8 +1413,27 @@
 		    !info.exists)
 			continue;
 
-		if (!_check_device_not_in_use(&info))
-			continue;
+		if (info.open_count) {
+			/* Skip internal non-toplevel opened nodes */
+			if (level)
+				continue;
+
+			/* When retry is not allowed, error */
+			if (!child->dtree->retry_remove) {
+				log_error("Unable to deactivate open %s (%" PRIu32
+					  ":%" PRIu32 ")", name, info.major, info.minor);
+				r = 0;
+				continue;
+			}
+
+			/* Check toplevel node for holders/mounted fs */
+			if (!_check_device_not_in_use(name, &info)) {
+				stack;
+				r = 0;
+				continue;
+			}
+			/* Go on with retry */
+		}
 
 		/* Also checking open_count in parent nodes of presuspend_node */
 		if ((child->presuspend_node &&
@@ -1437,7 +1456,7 @@
 
 		if (!_deactivate_node(name, info.major, info.minor,
 				      &child->dtree->cookie, child->udev_flags,
-				      child->dtree->retry_remove)) {
+				      (level == 0) ? child->dtree->retry_remove : 0)) {
 			log_error("Unable to deactivate %s (%" PRIu32
 				  ":%" PRIu32 ")", name, info.major,
 				  info.minor);


             reply	other threads:[~2011-10-28 20:11 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-28 20:11 zkabelac [this message]
  -- strict thread matches above, loose matches on Subject: below --
2012-05-15 20:03 agk
2012-05-15 14:10 agk
2012-03-04 16:05 zkabelac
2012-03-02 21:53 zkabelac
2012-01-25  8:46 zkabelac
2012-01-19 15:22 zkabelac
2011-11-04 12:39 zkabelac
2011-10-30 22:04 zkabelac
2011-10-20 10:39 zkabelac
2011-10-20 10:35 zkabelac
2011-10-19 16:45 zkabelac
2011-10-19 16:41 zkabelac
2011-10-17 14:15 zkabelac
2011-10-17 14:14 zkabelac
2011-10-03 18:29 zkabelac
2011-09-29  8:51 zkabelac
2011-07-08 19:13 agk
2011-06-22 12:56 prajnoha
2011-06-11 12:55 agk
2011-06-09 15:53 mbroz
2010-11-29 12:42 zkabelac
2010-11-29 11:26 zkabelac
2010-05-25  8:40 zkabelac
2010-04-07 23:51 agk
2010-04-07 21:25 agk
2010-01-15 16:00 jbrassow
2010-01-05 21:06 snitzer
2010-01-05 21:05 snitzer
2010-01-05 21:04 snitzer
2009-09-22 16:27 jbrassow
2009-07-07 16:36 agk
2008-12-12 18:45 agk

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20111028201122.26039.qmail@sourceware.org \
    --to=zkabelac@sourceware.org \
    --cc=lvm-devel@redhat.com \
    --cc=lvm2-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).