* [PATCH] Tools: hv: vssdaemon: ignore the EBUSY on multiple freezing the same partition
@ 2014-09-22 18:02 Dexuan Cui
2014-09-23 3:59 ` Dexuan Cui
0 siblings, 1 reply; 2+ messages in thread
From: Dexuan Cui @ 2014-09-22 18:02 UTC (permalink / raw)
To: gregkh, linux-kernel, driverdev-devel, olaf, apw, jasowang; +Cc: kys, haiyangz
Signed-off-by: Dexuan Cui <decui@microsoft.com>
Reviewed-by: K. Y. Srinivasan <kys@microsoft.com>
---
tools/hv/hv_vss_daemon.c | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/tools/hv/hv_vss_daemon.c b/tools/hv/hv_vss_daemon.c
index 6a213b8..19567c5 100644
--- a/tools/hv/hv_vss_daemon.c
+++ b/tools/hv/hv_vss_daemon.c
@@ -51,6 +51,27 @@ static int vss_do_freeze(char *dir, unsigned int cmd, char *fs_op)
if (fd < 0)
return 1;
ret = ioctl(fd, cmd, 0);
+
+ /*
+ * If a partition is mounted more than once, only the first
+ * FREEZE/THAW can succeed and the later ones will get
+ * EBUSY/EINVAL respectively: there could be 2 cases:
+ * 1) a user may mount the same partition to differnt directories
+ * by mistake or on purpose;
+ * 2) The subvolume of btrfs appears to have the same partition
+ * mounted more than once.
+ */
+ if (ret) {
+ if ((cmd == FIFREEZE && errno == EBUSY) ||
+ (cmd == FITHAW && errno == EINVAL)) {
+ syslog(LOG_INFO, "VSS: %s of %s: %s: ignored\n",
+ fs_op, dir,
+ errno == EBUSY ? "EBUSY" : "EINVAL");
+ close(fd);
+ return 0;
+ }
+ }
+
syslog(LOG_INFO, "VSS: %s of %s: %s\n", fs_op, dir, strerror(errno));
close(fd);
return !!ret;
--
1.9.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* RE: [PATCH] Tools: hv: vssdaemon: ignore the EBUSY on multiple freezing the same partition
2014-09-22 18:02 [PATCH] Tools: hv: vssdaemon: ignore the EBUSY on multiple freezing the same partition Dexuan Cui
@ 2014-09-23 3:59 ` Dexuan Cui
0 siblings, 0 replies; 2+ messages in thread
From: Dexuan Cui @ 2014-09-23 3:59 UTC (permalink / raw)
To: gregkh, linux-kernel, driverdev-devel, olaf, apw, jasowang
Cc: KY Srinivasan, Haiyang Zhang
> -----Original Message-----
> From: linux-kernel-owner@vger.kernel.org [mailto:linux-kernel-
> owner@vger.kernel.org] On Behalf Of Dexuan Cui
> Sent: Tuesday, September 23, 2014 2:02 AM
> To: gregkh@linuxfoundation.org; linux-kernel@vger.kernel.org; driverdev-
> devel@linuxdriverproject.org; olaf@aepfle.de; apw@canonical.com;
> jasowang@redhat.com
> Cc: KY Srinivasan; Haiyang Zhang
> Subject: [PATCH] Tools: hv: vssdaemon: ignore the EBUSY on multiple
> freezing the same partition
>
> Signed-off-by: Dexuan Cui <decui@microsoft.com>
> Reviewed-by: K. Y. Srinivasan <kys@microsoft.com>
> ---
> tools/hv/hv_vss_daemon.c | 21 +++++++++++++++++++++
Please use the v2 patch I sent out just now.
I added a "errno = 0;' before the ioctl() to fix some false warnings.
Thanks,
-- Dexuan
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-09-23 4:00 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-22 18:02 [PATCH] Tools: hv: vssdaemon: ignore the EBUSY on multiple freezing the same partition Dexuan Cui
2014-09-23 3:59 ` Dexuan Cui
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome