Commit 4b49643f authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

Revert "[PATCH] generic_file_buffered_write(): handle zero-length iovec segments"

This reverts commit 81b0c871, which was
a bugfix against 6527c2bd ("[PATCH]
generic_file_buffered_write(): deadlock on vectored write"), which we
also revert.
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarNick Piggin <npiggin@suse.de>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 41cb8ac0
...@@ -1895,12 +1895,6 @@ generic_file_buffered_write(struct kiocb *iocb, const struct iovec *iov, ...@@ -1895,12 +1895,6 @@ generic_file_buffered_write(struct kiocb *iocb, const struct iovec *iov,
break; break;
} }
if (unlikely(bytes == 0)) {
status = 0;
copied = 0;
goto zero_length_segment;
}
status = a_ops->prepare_write(file, page, offset, offset+bytes); status = a_ops->prepare_write(file, page, offset, offset+bytes);
if (unlikely(status)) { if (unlikely(status)) {
loff_t isize = i_size_read(inode); loff_t isize = i_size_read(inode);
...@@ -1930,8 +1924,7 @@ generic_file_buffered_write(struct kiocb *iocb, const struct iovec *iov, ...@@ -1930,8 +1924,7 @@ generic_file_buffered_write(struct kiocb *iocb, const struct iovec *iov,
page_cache_release(page); page_cache_release(page);
continue; continue;
} }
zero_length_segment: if (likely(copied > 0)) {
if (likely(copied >= 0)) {
if (!status) if (!status)
status = copied; status = copied;
......
...@@ -87,7 +87,7 @@ filemap_set_next_iovec(const struct iovec **iovp, size_t *basep, size_t bytes) ...@@ -87,7 +87,7 @@ filemap_set_next_iovec(const struct iovec **iovp, size_t *basep, size_t bytes)
const struct iovec *iov = *iovp; const struct iovec *iov = *iovp;
size_t base = *basep; size_t base = *basep;
do { while (bytes) {
int copy = min(bytes, iov->iov_len - base); int copy = min(bytes, iov->iov_len - base);
bytes -= copy; bytes -= copy;
...@@ -96,7 +96,7 @@ filemap_set_next_iovec(const struct iovec **iovp, size_t *basep, size_t bytes) ...@@ -96,7 +96,7 @@ filemap_set_next_iovec(const struct iovec **iovp, size_t *basep, size_t bytes)
iov++; iov++;
base = 0; base = 0;
} }
} while (bytes); }
*iovp = iov; *iovp = iov;
*basep = base; *basep = base;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment