]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commitdiff
libext2fs: retry a short write retry-write
authorTheodore Ts'o <tytso@mit.edu>
Tue, 5 Aug 2014 01:16:23 +0000 (21:16 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Tue, 5 Aug 2014 01:16:23 +0000 (21:16 -0400)
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
lib/ext2fs/unix_io.c

index 0dd149014b20ea0b814681aa2ba125234a98384e..79be8ebca4442d124f2a1b929f036dd4ade67e73 100644 (file)
@@ -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;