fix file position for hugetlbfs-read-support
Subsystems (2)
PATCH 1/1 fix file position for hugetlbfs-read-support
While working on a related area, I ran into a bug in hugetlbfs file read support that is currently in -mm tree (hugetlbfs-read-support.patch).
The problem is that hugetlb file position wasn't updated in hugetlbfs_read(), so sys_read() will always read from same file location. A simple "cp" command that reads file until EOF will never terminate. Fix it by updating the ppos at the end of hugetlbfs_read().
fs/hugetlbfs/inode.c +2 -2
@@ -228,9 +228,9 @@ hugetlbfs_read(struct file *filpstruct address_space *mapping = filp->f_mapping;struct inode *inode = mapping->host;unsigned long index = *ppos >>HPAGE_SHIFT ; +unsigned long offset = *ppos & ~HPAGE_MASK ;unsigned long end_index;loff_t isize; -unsigned long offset;ssize_t retval =0 ;/* validate length */
@@ -241,7 +241,6 @@ hugetlbfs_read(struct file *filpif (!isize) goto out; - offset = *ppos & ~HPAGE_MASK ; end_index = (isize -1 ) >>HPAGE_SHIFT ;for (;;) {struct page *page;
@@ -290,6 +289,7 @@ hugetlbfs_read(struct file *filp goto out; } out: + *ppos = ((loff_t ) index <<HPAGE_SHIFT ) + offset;return retval; }
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 4 lines · Ken Chen
While working on a related area, I ran into a bug in hugetlbfs file read support that is currently in -mm tree (hugetlbfs-read-support.patch).
Quoted 8 lines
The problem is that hugetlb file position wasn't updated in
hugetlbfs_read(), sosys_read()will always read from same file location. A simple "cp" command that reads file until EOF will never terminate. Fix it by updating the ppos at the end ofhugetlbfs_read().Signed-off-by Ken Chen <[email protected]>
Thank you.
Thanks,
Badari
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>