diff options
author | Matthew Wilcox <matthew@wil.cx> | 2007-12-06 11:19:57 -0500 |
---|---|---|
committer | Matthew Wilcox <willy@linux.intel.com> | 2007-12-06 17:35:48 -0500 |
commit | 0b94e97a25d9b06ef17fca8da23169200bead1e2 (patch) | |
tree | 4f7d920d03e9532d93921831efe704a4b645a3b4 | |
parent | 2687a3569e40b1302f96698bcd6329aeb0ce3dd2 (diff) |
Use lock_page_killable
Replacing lock_page with lock_page_killable in do_generic_mapping_read()
allows us to kill `cat' of a file on an NFS-mounted filesystem
Signed-off-by: Matthew Wilcox <willy@linux.intel.com>
-rw-r--r-- | mm/filemap.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/mm/filemap.c b/mm/filemap.c index ac8f690d2885..455119cc7f40 100644 --- a/mm/filemap.c +++ b/mm/filemap.c | |||
@@ -982,7 +982,8 @@ page_ok: | |||
982 | 982 | ||
983 | page_not_up_to_date: | 983 | page_not_up_to_date: |
984 | /* Get exclusive access to the page ... */ | 984 | /* Get exclusive access to the page ... */ |
985 | lock_page(page); | 985 | if (lock_page_killable(page)) |
986 | goto readpage_eio; | ||
986 | 987 | ||
987 | /* Did it get truncated before we got the lock? */ | 988 | /* Did it get truncated before we got the lock? */ |
988 | if (!page->mapping) { | 989 | if (!page->mapping) { |
@@ -1010,7 +1011,8 @@ readpage: | |||
1010 | } | 1011 | } |
1011 | 1012 | ||
1012 | if (!PageUptodate(page)) { | 1013 | if (!PageUptodate(page)) { |
1013 | lock_page(page); | 1014 | if (lock_page_killable(page)) |
1015 | goto readpage_eio; | ||
1014 | if (!PageUptodate(page)) { | 1016 | if (!PageUptodate(page)) { |
1015 | if (page->mapping == NULL) { | 1017 | if (page->mapping == NULL) { |
1016 | /* | 1018 | /* |
@@ -1021,15 +1023,16 @@ readpage: | |||
1021 | goto find_page; | 1023 | goto find_page; |
1022 | } | 1024 | } |
1023 | unlock_page(page); | 1025 | unlock_page(page); |
1024 | error = -EIO; | ||
1025 | shrink_readahead_size_eio(filp, ra); | 1026 | shrink_readahead_size_eio(filp, ra); |
1026 | goto readpage_error; | 1027 | goto readpage_eio; |
1027 | } | 1028 | } |
1028 | unlock_page(page); | 1029 | unlock_page(page); |
1029 | } | 1030 | } |
1030 | 1031 | ||
1031 | goto page_ok; | 1032 | goto page_ok; |
1032 | 1033 | ||
1034 | readpage_eio: | ||
1035 | error = -EIO; | ||
1033 | readpage_error: | 1036 | readpage_error: |
1034 | /* UHHUH! A synchronous read error occurred. Report it */ | 1037 | /* UHHUH! A synchronous read error occurred. Report it */ |
1035 | desc->error = error; | 1038 | desc->error = error; |