diff options
author | Theodore Ts'o <tytso@mit.edu> | 2014-08-04 21:16:23 -0400 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2014-08-04 21:16:23 -0400 |
commit | b9c1c9d6cec025f42ce86993306af6c881b20899 (patch) | |
tree | 25fa3271a8e5e6f77107e6eb9488e96da8e84762 | |
parent | b6edbf6b900d2dcc1fb0365c173cada8fa917db3 (diff) | |
download | e2fsprogs-retry-write.tar.gz |
libext2fs: retry a short writeretry-write
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
-rw-r--r-- | lib/ext2fs/unix_io.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/ext2fs/unix_io.c b/lib/ext2fs/unix_io.c index 0dd149014..79be8ebca 100644 --- a/lib/ext2fs/unix_io.c +++ b/lib/ext2fs/unix_io.c @@ -232,8 +232,14 @@ static errcode_t raw_write_blk(io_channel channel, if ((channel->align == 0) || (IS_ALIGNED(buf, channel->align) && IS_ALIGNED(size, channel->align))) { + retry: actual = write(data->dev, buf, size); if (actual != size) { + if (actual > 0 && (actual % 4096) == 0) { + buf += actual; + size -= actual; + goto retry; + } short_write: retval = EXT2_ET_SHORT_WRITE; goto error_out; |