[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <514a60e04f3c4ccb813ae68dc888d32f@SN2PR03MB061.namprd03.prod.outlook.com>
Date: Tue, 12 Mar 2013 21:49:10 +0000
From: KY Srinivasan <kys@...rosoft.com>
To: Olaf Hering <olaf@...fle.de>
CC: "gregkh@...uxfoundation.org" <gregkh@...uxfoundation.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"devel@...uxdriverproject.org" <devel@...uxdriverproject.org>,
"apw@...onical.com" <apw@...onical.com>,
"jasowang@...hat.com" <jasowang@...hat.com>,
Evgeniy Polyakov <zbr@...emap.net>
Subject: RE: [PATCH 1/1] Drivers: hv: Add a new driver to support host
initiated backup
> -----Original Message-----
> From: Olaf Hering [mailto:olaf@...fle.de]
> Sent: Tuesday, March 12, 2013 2:49 PM
> To: KY Srinivasan
> Cc: gregkh@...uxfoundation.org; linux-kernel@...r.kernel.org;
> devel@...uxdriverproject.org; apw@...onical.com; jasowang@...hat.com;
> Evgeniy Polyakov
> Subject: Re: [PATCH 1/1] Drivers: hv: Add a new driver to support host initiated
> backup
>
> On Tue, Mar 12, K. Y. Srinivasan wrote:
>
> > +static int vss_operate(int operation)
> > +{
> > + char *fs_op;
> > + char cmd[512];
> > + char buf[512];
> > + FILE *file;
> > + char *p;
> > + char *x;
> > + int error;
> > +
> > + switch (operation) {
> > + case VSS_OP_FREEZE:
> > + fs_op = "-f ";
> > + break;
> > + case VSS_OP_THAW:
> > + fs_op = "-u ";
> > + break;
> > + }
> > +
> > + sprintf(cmd, "%s", "mount | grep ^/dev/ | awk '{print $3 }'");
>
> I think this can be char cmd[] = "mount | awk '/^\/dev\/ { print $3'";
Yes; will make the change.
>
> > + file = popen(cmd, "r");
> > + if (file == NULL)
> > + return;
> > +
> > + while ((p = fgets(buf, sizeof(buf), file)) != NULL) {
> > + x = strchr(p, '\n');
> > + *x = '\0';
> > + if (!strncmp(p, "/", sizeof("/")))
> > + continue;
> > +
> > + sprintf(cmd, "%s %s %s", "fsfreeze ", fs_op, p);
> > + syslog(LOG_INFO, "VSS cmd is %s\n", cmd);
> > + error = system(cmd);
>
> error is not handled here, and it looks like only one error can be
> reported anyway.
> In case of an error, will the host thaw the filesystems?
Both freeze and thaw operations will not fail if properly applied. The only time the
freeze operation fails is when there is already an active freeze in force. Likewise,
the only time thaw fails is when there has not been a preceding freeze operation. So these
errors will occur only when the VM user happens to be applying freeze/thaw operations
independent of the host. In this case, the host simply reports an error on the host on
the backup operation and nothing else is done.
Regards,
K. Y
>
> > + }
> > + pclose(file);
> > +
> > + sprintf(cmd, "%s %s %s", "fsfreeze ", fs_op, "/");
> > + syslog(LOG_INFO, "VSS cmd is %s\n", cmd);
> > + error = system(cmd);
> > +
> > + return error;
> > +}
>
>
Powered by blists - more mailing lists