Skip to content

Commit

Permalink
Revert "[PATCH] generic_file_buffered_write(): handle zero-length iov…
Browse files Browse the repository at this point in the history
…ec segments"

This reverts commit 81b0c87, which was
a bugfix against 6527c2b ("[PATCH]
generic_file_buffered_write(): deadlock on vectored write"), which we
also revert.

Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Nick Piggin <npiggin@suse.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Andrew Morton authored and Linus Torvalds committed Oct 16, 2007
1 parent 41cb8ac commit 4b49643
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 10 deletions.
9 changes: 1 addition & 8 deletions mm/filemap.c
Original file line number Diff line number Diff line change
Expand Up @@ -1895,12 +1895,6 @@ generic_file_buffered_write(struct kiocb *iocb, const struct iovec *iov,
break;
}

if (unlikely(bytes == 0)) {
status = 0;
copied = 0;
goto zero_length_segment;
}

status = a_ops->prepare_write(file, page, offset, offset+bytes);
if (unlikely(status)) {
loff_t isize = i_size_read(inode);
Expand Down Expand Up @@ -1930,8 +1924,7 @@ generic_file_buffered_write(struct kiocb *iocb, const struct iovec *iov,
page_cache_release(page);
continue;
}
zero_length_segment:
if (likely(copied >= 0)) {
if (likely(copied > 0)) {
if (!status)
status = copied;

Expand Down
4 changes: 2 additions & 2 deletions mm/filemap.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ filemap_set_next_iovec(const struct iovec **iovp, size_t *basep, size_t bytes)
const struct iovec *iov = *iovp;
size_t base = *basep;

do {
while (bytes) {
int copy = min(bytes, iov->iov_len - base);

bytes -= copy;
Expand All @@ -96,7 +96,7 @@ filemap_set_next_iovec(const struct iovec **iovp, size_t *basep, size_t bytes)
iov++;
base = 0;
}
} while (bytes);
}
*iovp = iov;
*basep = base;
}
Expand Down

0 comments on commit 4b49643

Please sign in to comment.