patch-2.3.21 linux/mm/filemap.c

Next file: linux/net/core/sock.c
Previous file: linux/kernel/signal.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.20/linux/mm/filemap.c linux/mm/filemap.c
@@ -912,6 +912,8 @@
 	ahead = 0;
 	while (ahead < max_ahead) {
 		ahead += PAGE_CACHE_SIZE;
+		if ((raend + ahead) >= inode->i_size)
+			break;
 		page_cache_read(filp, raend + ahead);
 	}
 /*
@@ -1779,6 +1781,7 @@
 	long		status;
 	int		err;
 
+	down(&inode->i_sem);
 	err = file->f_error;
 	if (err) {
 		file->f_error = 0;
@@ -1872,6 +1875,7 @@
 
 	err = written ? written : status;
 out:
+	up(&inode->i_sem);
 	return err;
 }
 

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)