aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/hostfs/hostfs_kern.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/fs/hostfs/hostfs_kern.c b/fs/hostfs/hostfs_kern.c
index cf80a30058b0..f1547479e62e 100644
--- a/fs/hostfs/hostfs_kern.c
+++ b/fs/hostfs/hostfs_kern.c
@@ -445,24 +445,26 @@ static int hostfs_readpage(struct file *file, struct page *page)
445{ 445{
446 char *buffer; 446 char *buffer;
447 long long start; 447 long long start;
448 int bytes_read, ret; 448 int bytes_read, ret = 0;
449 449
450 start = (long long) page->index << PAGE_CACHE_SHIFT; 450 start = (long long) page->index << PAGE_CACHE_SHIFT;
451 buffer = kmap(page); 451 buffer = kmap(page);
452 bytes_read = read_file(FILE_HOSTFS_I(file)->fd, &start, buffer, 452 bytes_read = read_file(FILE_HOSTFS_I(file)->fd, &start, buffer,
453 PAGE_CACHE_SIZE); 453 PAGE_CACHE_SIZE);
454 if (bytes_read < 0) { 454 if (bytes_read < 0) {
455 ClearPageUptodate(page);
456 SetPageError(page);
455 ret = bytes_read; 457 ret = bytes_read;
456 goto out; 458 goto out;
457 } 459 }
458 460
459 memset(buffer + bytes_read, 0, PAGE_CACHE_SIZE - bytes_read); 461 memset(buffer + bytes_read, 0, PAGE_CACHE_SIZE - bytes_read);
460 462
461 flush_dcache_page(page); 463 ClearPageError(page);
462 SetPageUptodate(page); 464 SetPageUptodate(page);
463 if (PageError(page)) ClearPageError(page); 465
464 ret = 0;
465 out: 466 out:
467 flush_dcache_page(page);
466 kunmap(page); 468 kunmap(page);
467 unlock_page(page); 469 unlock_page(page);
468 return ret; 470 return ret;