public inbox for linux-ext4@vger.kernel.org
 help / color / mirror / Atom feed
From: Dmitry Monakhov <dmonakhov@openvz.org>
To: linux-ext4@vger.kernel.org
Cc: tytso@mit.edu, Dmitry Monakhov <dmonakhov@openvz.org>
Subject: [PATCH 2/2] ext2fs: check fsync error code
Date: Wed,  7 Dec 2016 18:55:18 +0400	[thread overview]
Message-ID: <1481122518-19021-2-git-send-email-dmonakhov@openvz.org> (raw)
In-Reply-To: <1481122518-19021-1-git-send-email-dmonakhov@openvz.org>

testcase: f_mke2fs_baddisk
Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
---
 lib/ext2fs/unix_io.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/lib/ext2fs/unix_io.c b/lib/ext2fs/unix_io.c
index 429ea24..6c54cbe 100644
--- a/lib/ext2fs/unix_io.c
+++ b/lib/ext2fs/unix_io.c
@@ -1030,7 +1030,10 @@ static errcode_t unix_flush(io_channel channel)
 #ifndef NO_IO_CACHE
 	retval = flush_cached_blocks(channel, data, 0);
 #endif
-	fsync(data->dev);
+	if(fsync(data->dev)) {
+		if (!retval)
+			retval = errno;
+	}
 	return retval;
 }
 
-- 
2.7.4


  reply	other threads:[~2016-12-07 14:55 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-07 14:55 [PATCH 1/2] test: add f_mke2fs_baddisk v2 Dmitry Monakhov
2016-12-07 14:55 ` Dmitry Monakhov [this message]
2017-01-30 22:18 ` Theodore Ts'o
  -- strict thread matches above, loose matches on Subject: below --
2016-12-07 13:14 [PATCH 1/2] test: add f_mke2fs_baddisk Dmitry Monakhov
2016-12-07 13:14 ` [PATCH 2/2] ext2fs: check fsync error code Dmitry Monakhov

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=1481122518-19021-2-git-send-email-dmonakhov@openvz.org \
    --to=dmonakhov@openvz.org \
    --cc=linux-ext4@vger.kernel.org \
    --cc=tytso@mit.edu \
    /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