From: Andrew Morton RLIMIT_FSIZE can cause generic_write_checks() to reduce `count'. So we cannot assume that `count' is equal to the total size of the incoming iovec. Cc: Vladimir Saveliev Cc: Christoph Hellwig Cc: Hans Reiser Cc: Miklos Szeredi Cc: Nathan Scott Cc: Steven Whitehouse Signed-off-by: Andrew Morton --- mm/filemap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff -puN mm/filemap.c~add-address_space_operationsbatch_write-fix mm/filemap.c --- a/mm/filemap.c~add-address_space_operationsbatch_write-fix +++ a/mm/filemap.c @@ -2224,9 +2224,9 @@ generic_file_buffered_write(struct kiocb do { /* do not walk over current segment */ desc.buf = cur_iov->iov_base + iov_base; - desc.count = cur_iov->iov_len - iov_base; + desc.count = min(count, cur_iov->iov_len - iov_base); if (desc.count > 0) - status = batch_write(file, &desc, &copied); + status = (*batch_write)(file, &desc, &copied); else { copied = 0; status = 0; _