Messages in this thread Patch in this message | | | Date | Tue, 10 Jun 2003 17:58:53 +0100 (BST) | From | Hugh Dickins <> | Subject | [PATCH] tmpfs 1/3 shmem_file_write EFAULT |
| |
Here's the first of three small unrelated patches to mm/shmem.c. Based on 2.5.70-mm7. Aggregate diffstat is:
include/linux/shmem_fs.h | 2 - mm/shmem.c | 73 +++++++++++++++++++++++++++-------------------- 2 files changed, 43 insertions(+), 32 deletions(-)
tmpfs 1/3 shmem_file_write EFAULT
generic_file_aio_write_nolock (phew!) has recently been corrected for when partial writes hit -EFAULT: now bring shmem_file_write into line.
--- 2.5.70-mm7/mm/shmem.c Thu Jun 5 10:27:34 2003 +++ tmpfs1/mm/shmem.c Fri Jun 6 19:20:21 2003 @@ -1186,30 +1186,32 @@ left = __copy_from_user(kaddr + offset, buf, bytes); kunmap(page); } + + written += bytes; + count -= bytes; + pos += bytes; + buf += bytes; + if (pos > inode->i_size) + inode->i_size = pos; + flush_dcache_page(page); + set_page_dirty(page); + if (!PageReferenced(page)) + SetPageReferenced(page); + page_cache_release(page); + if (left) { - page_cache_release(page); + pos -= left; + written -= left; err = -EFAULT; break; } - if (!PageReferenced(page)) - SetPageReferenced(page); - set_page_dirty(page); - page_cache_release(page); - /* * Our dirty pages are not counted in nr_dirty, * and we do not attempt to balance dirty pages. */ - written += bytes; - count -= bytes; - pos += bytes; - buf += bytes; - if (pos > inode->i_size) - inode->i_size = pos; - cond_resched(); } while (count); - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |