qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Adam Litke <agl@us.ibm.com>
To: Jes.Sorensen@redhat.com
Cc: qemu-devel@nongnu.org, mdroth@linux.vnet.ibm.com
Subject: [Qemu-devel] Re: [PATCH 1/2] Add virtagent file system freeze/thaw
Date: Tue, 01 Feb 2011 08:48:25 -0600	[thread overview]
Message-ID: <1296571705.2167.35.camel@aglitke> (raw)
In-Reply-To: <1296557928-30019-2-git-send-email-Jes.Sorensen@redhat.com>

On Tue, 2011-02-01 at 11:58 +0100, Jes.Sorensen@redhat.com wrote:
> +/*
> + * va_fsfreeze(): Walk list of mounted file systems in the guest, and
> + *   freeze the ones which are real local file systems.
> + * rpc return values: Number of file systems frozen, -1 on error.
> + */
> +static xmlrpc_value *va_fsfreeze(xmlrpc_env *env,
> +                                 xmlrpc_value *params,
> +                                 void *user_data)
> +{
> +    xmlrpc_int32 ret = 0, i = 0;
> +    xmlrpc_value *result;
> +    struct direntry *entry;
> +    int fd;
> +    SLOG("va_fsfreeze()");
> +
> +    if (fsfreeze_status == FREEZE_FROZEN) {
> +        ret = 0;
> +        goto out;
> +    }
> +
> +    ret = build_mount_list();
> +    if (ret < 0) {
> +        goto out;
> +    }
> +
> +    fsfreeze_status = FREEZE_INPROGRESS;
> +
> +    entry = mount_list;
> +    while(entry) {
> +        fd = qemu_open(entry->dirname, O_RDONLY);
> +        if (fd == -1) {
> +            ret = errno;
> +            goto error;
> +        }
> +        ret = ioctl(fd, FIFREEZE);
> +        if (ret < 0 && ret != EOPNOTSUPP) {
> +            goto error;
> +        }

Here we silently ignore filesystems that do not support the FIFREEZE
ioctl.  Do we need to have a more complex return value so that we can
communicate which mount points could not be frozen?  Otherwise, an
unsuspecting host could retrieve a corrupted snapshot of that
filesystem, right?

> +
> +        close(fd);
> +        entry = entry->next;
> +        i++;
> +    }
> +
> +    fsfreeze_status = FREEZE_FROZEN;
> +    ret = i;
> +out:
> +    result = xmlrpc_build_value(env, "i", ret);
> +    return result;
> +error:
> +    if (i > 0) {
> +        fsfreeze_status = FREEZE_ERROR;
> +    }
> +    goto out;
> +}

-- 
Thanks,
Adam

  parent reply	other threads:[~2011-02-01 14:48 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-01 10:58 [Qemu-devel] [PATCH 0/2] virtagent - fsfreeze support Jes.Sorensen
2011-02-01 10:58 ` [Qemu-devel] [PATCH 1/2] Add virtagent file system freeze/thaw Jes.Sorensen
2011-02-01 14:12   ` Stefan Hajnoczi
2011-02-01 14:26     ` Jes Sorensen
2011-02-01 14:34       ` Stefan Hajnoczi
2011-02-01 14:36         ` Jes Sorensen
2011-02-01 14:41           ` Stefan Hajnoczi
2011-02-01 17:22             ` Michael Roth
2011-02-01 14:48   ` Adam Litke [this message]
2011-02-01 15:02     ` [Qemu-devel] " Jes Sorensen
2011-02-01 16:50   ` Michael Roth
2011-02-02  8:38     ` Jes Sorensen
2011-02-02  7:57   ` [Qemu-devel] " Stefan Hajnoczi
2011-02-02  8:48     ` Jes Sorensen
2011-02-03 17:41       ` Michael Roth
2011-02-04  6:13         ` Stefan Hajnoczi
2011-02-04 16:27           ` Michael Roth
2011-02-04 16:52             ` Stefan Hajnoczi
2011-02-04 11:03         ` Jes Sorensen
2011-02-04 16:51           ` Michael Roth
2011-02-01 10:58 ` [Qemu-devel] [PATCH 2/2] Add monitor commands for fsfreeze support Jes.Sorensen
2011-02-01 11:25 ` [Qemu-devel] [PATCH 0/2] virtagent - " Vasiliy G Tolstov
2011-02-01 13:02   ` Jes Sorensen
2011-02-01 16:04   ` Richard W.M. Jones
2011-02-01 20:04     ` Vasiliy G Tolstov
2011-02-01 20:17       ` Richard W.M. Jones
2011-02-01 14:16 ` Stefan Hajnoczi
2011-02-01 14:28   ` Jes Sorensen
  -- strict thread matches above, loose matches on Subject: below --
2011-02-02  8:42 [Qemu-devel] [PATCH v2 " Jes.Sorensen
2011-02-02  8:42 ` [Qemu-devel] [PATCH 1/2] Add virtagent file system freeze/thaw Jes.Sorensen
2011-02-03 18:11   ` [Qemu-devel] " Michael Roth
2011-02-04 10:54     ` Jes Sorensen

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=1296571705.2167.35.camel@aglitke \
    --to=agl@us.ibm.com \
    --cc=Jes.Sorensen@redhat.com \
    --cc=mdroth@linux.vnet.ibm.com \
    --cc=qemu-devel@nongnu.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).