diff options
Diffstat (limited to 'mm/filemap.c')
-rw-r--r-- | mm/filemap.c | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/mm/filemap.c b/mm/filemap.c index f4d0cded0e10..89ce6fe5f8be 100644 --- a/mm/filemap.c +++ b/mm/filemap.c | |||
@@ -185,6 +185,12 @@ static int sync_page(void *word) | |||
185 | return 0; | 185 | return 0; |
186 | } | 186 | } |
187 | 187 | ||
188 | static int sync_page_killable(void *word) | ||
189 | { | ||
190 | sync_page(word); | ||
191 | return fatal_signal_pending(current) ? -EINTR : 0; | ||
192 | } | ||
193 | |||
188 | /** | 194 | /** |
189 | * __filemap_fdatawrite_range - start writeback on mapping dirty pages in range | 195 | * __filemap_fdatawrite_range - start writeback on mapping dirty pages in range |
190 | * @mapping: address space structure to write | 196 | * @mapping: address space structure to write |
@@ -589,6 +595,14 @@ void fastcall __lock_page(struct page *page) | |||
589 | } | 595 | } |
590 | EXPORT_SYMBOL(__lock_page); | 596 | EXPORT_SYMBOL(__lock_page); |
591 | 597 | ||
598 | int fastcall __lock_page_killable(struct page *page) | ||
599 | { | ||
600 | DEFINE_WAIT_BIT(wait, &page->flags, PG_locked); | ||
601 | |||
602 | return __wait_on_bit_lock(page_waitqueue(page), &wait, | ||
603 | sync_page_killable, TASK_KILLABLE); | ||
604 | } | ||
605 | |||
592 | /* | 606 | /* |
593 | * Variant of lock_page that does not require the caller to hold a reference | 607 | * Variant of lock_page that does not require the caller to hold a reference |
594 | * on the page's mapping. | 608 | * on the page's mapping. |
@@ -980,7 +994,8 @@ page_ok: | |||
980 | 994 | ||
981 | page_not_up_to_date: | 995 | page_not_up_to_date: |
982 | /* Get exclusive access to the page ... */ | 996 | /* Get exclusive access to the page ... */ |
983 | lock_page(page); | 997 | if (lock_page_killable(page)) |
998 | goto readpage_eio; | ||
984 | 999 | ||
985 | /* Did it get truncated before we got the lock? */ | 1000 | /* Did it get truncated before we got the lock? */ |
986 | if (!page->mapping) { | 1001 | if (!page->mapping) { |
@@ -1008,7 +1023,8 @@ readpage: | |||
1008 | } | 1023 | } |
1009 | 1024 | ||
1010 | if (!PageUptodate(page)) { | 1025 | if (!PageUptodate(page)) { |
1011 | lock_page(page); | 1026 | if (lock_page_killable(page)) |
1027 | goto readpage_eio; | ||
1012 | if (!PageUptodate(page)) { | 1028 | if (!PageUptodate(page)) { |
1013 | if (page->mapping == NULL) { | 1029 | if (page->mapping == NULL) { |
1014 | /* | 1030 | /* |
@@ -1019,15 +1035,16 @@ readpage: | |||
1019 | goto find_page; | 1035 | goto find_page; |
1020 | } | 1036 | } |
1021 | unlock_page(page); | 1037 | unlock_page(page); |
1022 | error = -EIO; | ||
1023 | shrink_readahead_size_eio(filp, ra); | 1038 | shrink_readahead_size_eio(filp, ra); |
1024 | goto readpage_error; | 1039 | goto readpage_eio; |
1025 | } | 1040 | } |
1026 | unlock_page(page); | 1041 | unlock_page(page); |
1027 | } | 1042 | } |
1028 | 1043 | ||
1029 | goto page_ok; | 1044 | goto page_ok; |
1030 | 1045 | ||
1046 | readpage_eio: | ||
1047 | error = -EIO; | ||
1031 | readpage_error: | 1048 | readpage_error: |
1032 | /* UHHUH! A synchronous read error occurred. Report it */ | 1049 | /* UHHUH! A synchronous read error occurred. Report it */ |
1033 | desc->error = error; | 1050 | desc->error = error; |