All of lore.kernel.org
 help / color / mirror / Atom feed
From: Zdenek Kabelac <zkabelac@sourceware.org>
To: lvm-devel@redhat.com
Subject: main - dev-cache: skip different filesystems on dir scan
Date: Mon, 18 Oct 2021 17:19:28 +0000 (GMT)	[thread overview]
Message-ID: <20211018171928.336193858404@sourceware.org> (raw)

Gitweb:        https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=9cf4eac250ef7abd5e0961da2371294da07ab4de
Commit:        9cf4eac250ef7abd5e0961da2371294da07ab4de
Parent:        bae1083472d9c589d59f93a4e0a137cb94ba5ed0
Author:        Zdenek Kabelac <zkabelac@redhat.com>
AuthorDate:    Mon Oct 18 19:04:44 2021 +0200
Committer:     Zdenek Kabelac <zkabelac@redhat.com>
CommitterDate: Mon Oct 18 19:17:26 2021 +0200

dev-cache: skip different filesystems on dir scan

When scanning configured  /dev dir, avoid entring
directories with different filesystem.

This minimizes risk we will block on i.e. entring
directory with mount point.
---
 WHATS_NEW              | 1 +
 lib/device/dev-cache.c | 9 +++++++++
 2 files changed, 10 insertions(+)

diff --git a/WHATS_NEW b/WHATS_NEW
index d87cb7e37..0199c174e 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
 Version 2.03.14 - 
 ==================================
+  Device scanning is skipping different filesystems.
   Print info message with too many or too large archived files.
   Reduce metadata readings during scanning phase.
   Optimize computation of crc32 check sum with multiple PVs.
diff --git a/lib/device/dev-cache.c b/lib/device/dev-cache.c
index d454b5b30..6d706eb1e 100644
--- a/lib/device/dev-cache.c
+++ b/lib/device/dev-cache.c
@@ -1101,6 +1101,7 @@ static void _insert_dirs(struct dm_list *dirs)
 static int _insert(const char *path, const struct stat *info,
 		   int rec, int check_with_udev_db)
 {
+	static long _st_dev = -1;
 	struct stat tinfo;
 
 	if (!info) {
@@ -1111,12 +1112,20 @@ static int _insert(const char *path, const struct stat *info,
 		info = &tinfo;
 	}
 
+	if (_st_dev == -1)
+		_st_dev = info->st_dev; /* first dir device */
+
 	if (check_with_udev_db && !_device_in_udev_db(info->st_rdev)) {
 		log_very_verbose("%s: Not in udev db", path);
 		return 0;
 	}
 
 	if (S_ISDIR(info->st_mode)) {	/* add a directory */
+		if (info->st_dev != _st_dev) {
+			log_debug_devs("%s: Different filesystem in directory", path);
+			return 1;
+		}
+
 		/* check it's not a symbolic link */
 		if (lstat(path, &tinfo) < 0) {
 			log_sys_very_verbose("lstat", path);



                 reply	other threads:[~2021-10-18 17:19 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=20211018171928.336193858404@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.