Jens Axboe
620a324b74
splice: __generic_file_splice_read: fix read/truncate race
...
Original patch and description from Neil Brown <neilb@suse.de>,
merged and adapted to splice branch by me. Neils text follows:
__generic_file_splice_read() currently samples the i_size at the start
and doesn't do so again unless it needs to call ->readpage to load
a page. After ->readpage it has to re-sample i_size as a truncate
may have caused that page to be filled with zeros, and the read()
call should not see these.
However there are other activities that might cause ->readpage to be
called on a page between the time that __generic_file_splice_read()
samples i_size and when it finds that it has an uptodate page. These
include at least read-ahead and possibly another thread performing a
read
So we must sample i_size *after* it has an uptodate page. Thus the
current sampling at the start and after a read can be replaced with a
sampling before page addition into spd.
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
2007-06-08 08:34:11 +02:00
..
2007-05-21 09:18:19 -07:00
2007-05-17 05:23:04 -07:00
2007-05-21 09:18:19 -07:00
2007-05-31 07:58:14 -07:00
2007-05-11 08:29:36 -07:00
2007-05-11 08:29:36 -07:00
2007-05-17 05:23:04 -07:00
2007-05-17 05:23:04 -07:00
2007-05-17 05:23:04 -07:00
2007-05-21 09:18:19 -07:00
2007-05-21 09:18:19 -07:00
2007-05-07 12:12:51 -07:00
2007-05-08 11:14:59 -07:00
2007-05-07 12:26:27 -07:00
2007-05-23 20:14:15 -07:00
2007-05-17 05:23:04 -07:00
2007-05-08 11:15:07 -07:00
2007-05-17 05:23:04 -07:00
2007-05-17 05:23:04 -07:00
2007-05-31 16:20:15 -04:00
2007-05-17 05:23:04 -07:00
2007-05-08 11:14:59 -07:00
2007-05-23 20:14:13 -07:00
2007-05-21 09:18:19 -07:00
2007-05-21 09:18:19 -07:00
2007-05-21 09:18:19 -07:00
2007-05-08 11:14:57 -07:00
2007-05-21 09:18:19 -07:00
2007-05-17 05:23:04 -07:00
2007-05-17 05:23:04 -07:00
2007-05-09 08:58:16 +02:00
2007-05-09 08:58:16 +02:00
2007-06-04 17:54:09 -07:00
2007-05-17 05:23:04 -07:00
2007-05-14 19:33:46 -04:00
2007-05-21 09:18:19 -07:00
2007-05-21 09:18:19 -07:00
2007-05-30 16:26:01 -04:00
2007-05-21 09:18:19 -07:00
2007-05-31 07:58:13 -07:00
2007-05-25 11:06:37 -07:00
2007-05-17 05:23:04 -07:00
2007-05-21 21:38:17 -07:00
2007-05-17 05:23:04 -07:00
2007-05-17 05:23:04 -07:00
2007-06-07 17:11:13 -07:00
2007-05-23 20:14:13 -07:00
2007-05-17 05:23:04 -07:00
2007-05-21 09:18:19 -07:00
2007-05-21 09:18:19 -07:00
2007-05-17 05:23:04 -07:00
2007-06-01 08:18:28 -07:00
2007-05-17 05:23:04 -07:00
2007-05-29 18:15:17 +10:00
2007-05-11 08:29:37 -07:00
2007-05-11 08:29:36 -07:00
2007-05-08 11:15:07 -07:00
2007-05-08 11:15:07 -07:00
2007-05-08 11:15:07 -07:00
2007-05-08 11:15:15 -07:00
2007-05-08 11:15:07 -07:00
2007-05-21 09:18:19 -07:00
2007-05-08 11:15:07 -07:00
2007-05-07 12:12:55 -07:00
2007-05-17 05:23:04 -07:00
2007-05-21 09:15:32 -07:00
2007-05-25 17:37:46 -07:00
2007-05-23 20:14:12 -07:00
2007-05-08 11:15:07 -07:00
2007-05-09 12:54:17 -07:00
2007-05-17 05:23:05 -07:00
2007-05-18 13:09:34 -07:00
2007-05-15 08:54:00 -07:00
2007-05-23 20:14:13 -07:00
2007-05-21 09:18:19 -07:00
2007-05-08 11:15:07 -07:00
2007-05-08 11:15:01 -07:00
2007-05-17 05:23:04 -07:00
2007-05-08 11:15:11 -07:00
2007-05-08 11:15:09 -07:00
2007-06-04 13:25:10 -07:00
2007-05-09 08:58:15 +02:00
2007-05-21 14:34:00 +09:00
2007-05-09 06:44:57 +02:00
2007-05-17 05:23:04 -07:00
2007-05-11 08:29:36 -07:00
2007-05-11 08:29:35 -07:00
2007-05-11 05:38:26 -04:00
2007-05-08 11:15:12 -07:00
2007-05-08 20:10:00 -07:00
2007-05-08 11:15:03 -07:00
2007-05-08 11:15:11 -07:00
2007-05-17 05:23:05 -07:00
2007-05-08 11:14:59 -07:00
2007-05-08 11:15:09 -07:00
2007-05-09 07:10:02 +02:00
2007-05-23 20:14:14 -07:00
2007-06-08 08:34:11 +02:00
2007-05-08 11:15:07 -07:00
2007-05-08 11:15:01 -07:00
2007-05-08 11:15:04 -07:00
2007-05-18 13:09:34 -07:00
2007-05-08 11:15:18 -07:00
2007-05-11 05:38:26 -04:00