![]() | |||||||||||
Messages in this thread Complete thread (EXPERIMENTAL)Patch in this message |
Patch below applies to 2.4.21-pre2, and with offset to 2.4.20-ac2 and everything back to 2.4.4: please apply. I would like to prepare more backports from 2.5 (and -ac) in due course: for example, Alan has long had tighter large offset checking in shmem_file_write; but this read hang is bad enough to single out for immediate fix. Thank you, Mikael! Hugh [view this diff only] --- 2.4.21-pre2/mm/shmem.c Thu Nov 28 23:53:15 2002
+++ linux/mm/shmem.c Fri Dec 20 17:39:41 2002
@@ -919,14 +919,13 @@
struct inode *inode = filp->f_dentry->d_inode;
struct address_space *mapping = inode->i_mapping;
unsigned long index, offset;
- int nr = 1;
index = *ppos >> PAGE_CACHE_SHIFT;
offset = *ppos & ~PAGE_CACHE_MASK;
- while (nr && desc->count) {
+ for (;;) {
struct page *page;
- unsigned long end_index, nr;
+ unsigned long end_index, nr, ret;
end_index = inode->i_size >> PAGE_CACHE_SHIFT;
if (index > end_index)
@@ -956,12 +955,14 @@
* "pos" here (the actor routine has to update the user buffer
* pointers and the remaining count).
*/
- nr = file_read_actor(desc, page, offset, nr);
- offset += nr;
+ ret = file_read_actor(desc, page, offset, nr);
+ offset += ret;
index += offset >> PAGE_CACHE_SHIFT;
offset &= ~PAGE_CACHE_MASK;
page_cache_release(page);
+ if (ret != nr || !desc->count)
+ break;
}
*ppos = ((loff_t) index << PAGE_CACHE_SHIFT) + offset;
| ||||||||||
![]() | |||||||||||
| Last update: 2005-03-22 12:31 [W:0.736 / U:0.000 seconds] ©2003-2005 Jasper Spaans | |||||||||||