diff options
author | Richard Weinberger <richard@nod.at> | 2015-03-04 12:44:03 +0100 |
---|---|---|
committer | Richard Weinberger <richard@nod.at> | 2015-03-26 23:27:53 +0100 |
commit | b86b413a321105cb75373b48fd7ba53fcbc7ec4c (patch) | |
tree | 29e08921ac4ed420361003277ea5cb82e26766ff /fs/hostfs | |
parent | hostfs: Remove superfluous initializations in hostfs_open() (diff) | |
download | linux-b86b413a321105cb75373b48fd7ba53fcbc7ec4c.tar.xz linux-b86b413a321105cb75373b48fd7ba53fcbc7ec4c.zip |
hostfs: Set page flags in hostfs_readpage() correctly
In case of an error set the page error flag and clear the up-to-date
flag.
If the read was successful clear the error flag unconditionally.
Signed-off-by: Richard Weinberger <richard@nod.at>
Diffstat (limited to 'fs/hostfs')
-rw-r--r-- | fs/hostfs/hostfs_kern.c | 10 |
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) { char *buffer; long long start; - int bytes_read, ret; + int bytes_read, ret = 0; start = (long long) page->index << PAGE_CACHE_SHIFT; buffer = kmap(page); bytes_read = read_file(FILE_HOSTFS_I(file)->fd, &start, buffer, PAGE_CACHE_SIZE); if (bytes_read < 0) { + ClearPageUptodate(page); + SetPageError(page); ret = bytes_read; goto out; } memset(buffer + bytes_read, 0, PAGE_CACHE_SIZE - bytes_read); - flush_dcache_page(page); + ClearPageError(page); SetPageUptodate(page); - if (PageError(page)) ClearPageError(page); - ret = 0; + out: + flush_dcache_page(page); kunmap(page); unlock_page(page); return ret; |