All of lore.kernel.org
 help / color / mirror / Atom feed
From: Zdenek Kabelac <zkabelac@sourceware.org>
To: lvm-devel@redhat.com
Subject: main - label: avoid rescaning unusable DM devices
Date: Wed, 10 Feb 2021 14:43:57 +0000 (GMT)	[thread overview]
Message-ID: <20210210144357.0D118385DC33@sourceware.org> (raw)

Gitweb:        https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=a3835861774f4758e0de2a4b462eb51b91a3f09b
Commit:        a3835861774f4758e0de2a4b462eb51b91a3f09b
Parent:        f90082ce8f218781ff3b9361e748dbff0ff0e2e3
Author:        Zdenek Kabelac <zkabelac@redhat.com>
AuthorDate:    Wed Feb 10 00:43:40 2021 +0100
Committer:     Zdenek Kabelac <zkabelac@redhat.com>
CommitterDate: Wed Feb 10 15:39:03 2021 +0100

label: avoid rescaning unusable DM devices

---
 lib/label/label.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/lib/label/label.c b/lib/label/label.c
index 1e777d7c2..030d2c578 100644
--- a/lib/label/label.c
+++ b/lib/label/label.c
@@ -707,6 +707,19 @@ static int _scan_list(struct cmd_context *cmd, struct dev_filter *f,
 		if (!rem_prefetches)
 			break;
 
+		/* FIXME: figure better solution to avoid opening DM we shouldn't open */
+		if (dm_is_dm_major(MAJOR(devl->dev->dev)) &&
+		    !device_is_usable(devl->dev, (struct dev_usable_check_params) {
+					.check_blocked = 1,
+					.check_suspended = ignore_suspended_devices(),
+					.check_reserved = 1,
+					.check_error_target = 1,
+				      })) {
+			log_debug_devs("Scan skips unusuable DM device %s.", dev_name(devl->dev));
+			dm_list_del(&devl->list);
+			continue;
+		}
+
 		if (!_in_bcache(devl->dev)) {
 			if (!_scan_dev_open(devl->dev)) {
 				log_debug_devs("Scan failed to open %s.", dev_name(devl->dev));



                 reply	other threads:[~2021-02-10 14:43 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20210210144357.0D118385DC33@sourceware.org \
    --to=zkabelac@sourceware.org \
    --cc=lvm-devel@redhat.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.