Re: 2.6.18-rc1-mm1

Andrew Morton
2006-07-09T12:10:38Z

On Sun, 9 Jul 2006 13:02:48 +0200
"Michal Piotrowski" <michal.k.k.piotrowski@gmail.com> wrote:

> TP hangs on
>
> <<<test_output>>>
> setrlimit01 1 PASS : RLIMIT_NOFILE functionality is correct
> setrlimit01 0 WARN : caught signal 2, not SIGSEGV
> <<<execution_status>>>
> duration=1071 termination_type=driver_interrupt termination_id=1 corefile=no
> cutime=0 cstime=1
> <<<test_end>>>

Yep, thanks.

RLIMIT_FSIZE can cause generic_write_checks() to reduce `count'. So we cannot
assume that `count' is equal to the total length size of the incoming iovec.

--- a/mm/filemap.c~add-address_space_operationsbatch_write-fix
+++ a/mm/filemap.c
@@ -2205,9 +2205,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;
_