From: Kevin Wolf <kwolf@redhat.com>
To: qemu-devel@nongnu.org
Cc: kwolf@redhat.com, peter.maydell@linaro.org, mreitz@redhat.com
Subject: [Qemu-devel] [PULL 5/6] block/raw-posix: Only sync after successful preallocation
Date: Tue, 18 Nov 2014 12:35:07 +0100 [thread overview]
Message-ID: <1416310508-5122-6-git-send-email-kwolf@redhat.com> (raw)
In-Reply-To: <1416310508-5122-1-git-send-email-kwolf@redhat.com>
From: Max Reitz <mreitz@redhat.com>
The loop which filled the file with zeroes may have been left early due
to an error. In that case, the fsync() should be skipped.
Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
block/raw-posix.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/block/raw-posix.c b/block/raw-posix.c
index e0e48c5..d106fc4 100644
--- a/block/raw-posix.c
+++ b/block/raw-posix.c
@@ -1453,7 +1453,9 @@ static int raw_create(const char *filename, QemuOpts *opts, Error **errp)
}
left -= result;
}
- fsync(fd);
+ if (result >= 0) {
+ fsync(fd);
+ }
g_free(buf);
break;
}
--
1.8.3.1
next prev parent reply other threads:[~2014-11-18 11:35 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-18 11:35 [Qemu-devel] [PULL 0/6] Block patches for 2.2.0-rc2 Kevin Wolf
2014-11-18 11:35 ` [Qemu-devel] [PULL 1/6] raw-posix: Fix comment for raw_co_get_block_status() Kevin Wolf
2014-11-18 11:35 ` [Qemu-devel] [PULL 2/6] raw-posix: SEEK_HOLE suffices, get rid of FIEMAP Kevin Wolf
2014-11-18 11:35 ` [Qemu-devel] [PULL 3/6] raw-posix: The SEEK_HOLE code is flawed, rewrite it Kevin Wolf
2014-11-18 11:35 ` [Qemu-devel] [PULL 4/6] block/raw-posix: Fix preallocating write() loop Kevin Wolf
2014-11-18 11:35 ` Kevin Wolf [this message]
2014-11-18 11:35 ` [Qemu-devel] [PULL 6/6] block/raw-posix: Catch fsync() errors Kevin Wolf
2014-11-18 14:46 ` [Qemu-devel] [PULL 0/6] Block patches for 2.2.0-rc2 Peter Maydell
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=1416310508-5122-6-git-send-email-kwolf@redhat.com \
--to=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=peter.maydell@linaro.org \
--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).