Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1674297

[PATCH 1/2] Tools: hv: vss: Skip freezing filesystems backed by loop

From kys@exchange.microsoft.com
Newsgroups linux.kernel
Subject [PATCH 1/2] Tools: hv: vss: Skip freezing filesystems backed by loop
Date 2017-06-25 21:50 +0200
Message-ID <tWlHH-Kx-3@gated-at.bofh.it> (permalink)
References <tWlHH-Kx-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Alex Ng <alexng@messages.microsoft.com>

Skip loop devices from the freeze/thaw operation.

Signed-off-by: Alex Ng <alexng@messages.microsoft.com>
Signed-off-by: Vyronas Tsingaras <vyronas@vtsingaras.me>
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
---
 tools/hv/hv_vss_daemon.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/tools/hv/hv_vss_daemon.c b/tools/hv/hv_vss_daemon.c
index 7ba5419..b2b4ebf 100644
--- a/tools/hv/hv_vss_daemon.c
+++ b/tools/hv/hv_vss_daemon.c
@@ -21,6 +21,7 @@
 #include <sys/types.h>
 #include <sys/poll.h>
 #include <sys/ioctl.h>
+#include <sys/stat.h>
 #include <fcntl.h>
 #include <stdio.h>
 #include <mntent.h>
@@ -30,6 +31,7 @@
 #include <ctype.h>
 #include <errno.h>
 #include <linux/fs.h>
+#include <linux/major.h>
 #include <linux/hyperv.h>
 #include <syslog.h>
 #include <getopt.h>
@@ -70,6 +72,7 @@ static int vss_operate(int operation)
 	char match[] = "/dev/";
 	FILE *mounts;
 	struct mntent *ent;
+	struct stat sb;
 	char errdir[1024] = {0};
 	unsigned int cmd;
 	int error = 0, root_seen = 0, save_errno = 0;
@@ -92,6 +95,10 @@ static int vss_operate(int operation)
 	while ((ent = getmntent(mounts))) {
 		if (strncmp(ent->mnt_fsname, match, strlen(match)))
 			continue;
+		if (stat(ent->mnt_fsname, &sb) == -1)
+			continue;
+		if (S_ISBLK(sb.st_mode) && major(sb.st_rdev) == LOOP_MAJOR)
+			continue;
 		if (hasmntopt(ent, MNTOPT_RO) != NULL)
 			continue;
 		if (strcmp(ent->mnt_type, "vfat") == 0)
-- 
1.7.1

Back to linux.kernel | Previous | Next | Find similar | Unroll thread


Thread

[PATCH 1/2] Tools: hv: vss: Skip freezing filesystems backed by loop kys@exchange.microsoft.com - 2017-06-25 21:50 +0200

csiph-web