diff options
-rw-r--r-- | mm/filemap.c | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/mm/filemap.c b/mm/filemap.c index 7c8643630023..9940895f734c 100644 --- a/mm/filemap.c +++ b/mm/filemap.c | |||
@@ -2511,21 +2511,17 @@ generic_file_direct_IO(int rw, struct kiocb *iocb, const struct iovec *iov, | |||
2511 | } | 2511 | } |
2512 | 2512 | ||
2513 | retval = mapping->a_ops->direct_IO(rw, iocb, iov, offset, nr_segs); | 2513 | retval = mapping->a_ops->direct_IO(rw, iocb, iov, offset, nr_segs); |
2514 | if (retval) | ||
2515 | goto out; | ||
2516 | 2514 | ||
2517 | /* | 2515 | /* |
2518 | * Finally, try again to invalidate clean pages which might have been | 2516 | * Finally, try again to invalidate clean pages which might have been |
2519 | * faulted in by get_user_pages() if the source of the write was an | 2517 | * cached by non-direct readahead, or faulted in by get_user_pages() |
2520 | * mmap()ed region of the file we're writing. That's a pretty crazy | 2518 | * if the source of the write was an mmap'ed region of the file |
2521 | * thing to do, so we don't support it 100%. If this invalidation | 2519 | * we're writing. Either one is a pretty crazy thing to do, |
2522 | * fails and we have -EIOCBQUEUED we ignore the failure. | 2520 | * so we don't support it 100%. If this invalidation |
2521 | * fails, tough, the write still worked... | ||
2523 | */ | 2522 | */ |
2524 | if (rw == WRITE && mapping->nrpages) { | 2523 | if (rw == WRITE && mapping->nrpages) { |
2525 | int err = invalidate_inode_pages2_range(mapping, | 2524 | invalidate_inode_pages2_range(mapping, offset >> PAGE_CACHE_SHIFT, end); |
2526 | offset >> PAGE_CACHE_SHIFT, end); | ||
2527 | if (err && retval >= 0) | ||
2528 | retval = err; | ||
2529 | } | 2525 | } |
2530 | out: | 2526 | out: |
2531 | return retval; | 2527 | return retval; |