aboutsummaryrefslogtreecommitdiffstats
path: root/mm/filemap.c
diff options
context:
space:
mode:
authorOleg Nesterov <oleg@tv-sign.ru>2008-06-08 13:20:43 -0400
committerIngo Molnar <mingo@elte.hu>2008-10-14 11:15:33 -0400
commit85462323555dda749f1c5373a8d72679464c968d (patch)
treeaeec1f9a2ad6665c70a88483cbe5e9a3a2f33536 /mm/filemap.c
parent7591103c08abade60aeddb432ed0686ddd0de1c6 (diff)
do_generic_file_read: s/EINTR/EIO/ if lock_page_killable() fails
If lock_page_killable() fails because the task was killed by SIGKILL or any other fatal signal, do_generic_file_read() returns -EIO. This seems to be OK, because in fact the userspace won't see this error, the task will dequeue SIGKILL and exit. However, /sbin/init is different, it will dequeue SIGKILL, ignore it, and return to the user-space with the bogus -EIO. Change the code to return the error code from lock_page_killable(), -EINTR. This doesn't fix the bug, but perhaps makes sense anyway. Imho, with this change the code looks a bit more logical, and the "good" init should handle the spurious EINTR or short read. Afaics we can also change lock_page_killable() to return -ERESTARTNOINTR, but this can't prevent the short reads. Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'mm/filemap.c')
-rw-r--r--mm/filemap.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/mm/filemap.c b/mm/filemap.c
index 876bc595d0f8..494ff20b6cfa 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -1100,8 +1100,9 @@ page_ok:
1100 1100
1101page_not_up_to_date: 1101page_not_up_to_date:
1102 /* Get exclusive access to the page ... */ 1102 /* Get exclusive access to the page ... */
1103 if (lock_page_killable(page)) 1103 error = lock_page_killable(page);
1104 goto readpage_eio; 1104 if (unlikely(error))
1105 goto readpage_error;
1105 1106
1106page_not_up_to_date_locked: 1107page_not_up_to_date_locked:
1107 /* Did it get truncated before we got the lock? */ 1108 /* Did it get truncated before we got the lock? */
@@ -1130,8 +1131,9 @@ readpage:
1130 } 1131 }
1131 1132
1132 if (!PageUptodate(page)) { 1133 if (!PageUptodate(page)) {
1133 if (lock_page_killable(page)) 1134 error = lock_page_killable(page);
1134 goto readpage_eio; 1135 if (unlikely(error))
1136 goto readpage_error;
1135 if (!PageUptodate(page)) { 1137 if (!PageUptodate(page)) {
1136 if (page->mapping == NULL) { 1138 if (page->mapping == NULL) {
1137 /* 1139 /*
@@ -1143,15 +1145,14 @@ readpage:
1143 } 1145 }
1144 unlock_page(page); 1146 unlock_page(page);
1145 shrink_readahead_size_eio(filp, ra); 1147 shrink_readahead_size_eio(filp, ra);
1146 goto readpage_eio; 1148 error = -EIO;
1149 goto readpage_error;
1147 } 1150 }
1148 unlock_page(page); 1151 unlock_page(page);
1149 } 1152 }
1150 1153
1151 goto page_ok; 1154 goto page_ok;
1152 1155
1153readpage_eio:
1154 error = -EIO;
1155readpage_error: 1156readpage_error:
1156 /* UHHUH! A synchronous read error occurred. Report it */ 1157 /* UHHUH! A synchronous read error occurred. Report it */
1157 desc->error = error; 1158 desc->error = error;