[CRIU] [RFC PATCH 1/1] make resolve_source() more friendly to FSTYPE__AUTO mounts

Oleg Nesterov oleg at redhat.com
Fri Apr 10 08:19:36 PDT 2015


resolve_source() insists on kdev_major() == 0, and this makes sense.
However, at least FSTYPE__AUTO can try to use mi->source as a block
device and pray it will work.

Signed-off-by: Oleg Nesterov <oleg at redhat.com>
---
 mount.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/mount.c b/mount.c
index eb739f2..6314307 100644
--- a/mount.c
+++ b/mount.c
@@ -1420,6 +1420,15 @@ static char *resolve_source(struct mount_info *mi)
 		 */
 		return mi->source;
 
+	if (mi->fstype->code == FSTYPE__AUTO) {
+		struct stat st;
+
+		if (!stat(mi->source, &st) && S_ISBLK(st.st_mode) &&
+		    major(st.st_rdev) == kdev_major(mi->s_dev) &&
+		    minor(st.st_rdev) == kdev_minor(mi->s_dev))
+			return mi->source;
+	}
+
 	pr_err("No device for %s mount\n", mi->mountpoint);
 	return NULL;
 }
-- 
1.5.5.1




More information about the CRIU mailing list