diff options
Diffstat (limited to 'fs/hugetlbfs/inode.c')
-rw-r--r-- | fs/hugetlbfs/inode.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c index 7d479ce3aceb..6903d37af037 100644 --- a/fs/hugetlbfs/inode.c +++ b/fs/hugetlbfs/inode.c | |||
@@ -252,6 +252,7 @@ static ssize_t hugetlbfs_read(struct file *filp, char __user *buf, | |||
252 | for (;;) { | 252 | for (;;) { |
253 | struct page *page; | 253 | struct page *page; |
254 | unsigned long nr, ret; | 254 | unsigned long nr, ret; |
255 | int ra; | ||
255 | 256 | ||
256 | /* nr is the maximum number of bytes to copy from this page */ | 257 | /* nr is the maximum number of bytes to copy from this page */ |
257 | nr = huge_page_size(h); | 258 | nr = huge_page_size(h); |
@@ -274,16 +275,19 @@ static ssize_t hugetlbfs_read(struct file *filp, char __user *buf, | |||
274 | */ | 275 | */ |
275 | ret = len < nr ? len : nr; | 276 | ret = len < nr ? len : nr; |
276 | if (clear_user(buf, ret)) | 277 | if (clear_user(buf, ret)) |
277 | ret = -EFAULT; | 278 | ra = -EFAULT; |
279 | else | ||
280 | ra = 0; | ||
278 | } else { | 281 | } else { |
279 | /* | 282 | /* |
280 | * We have the page, copy it to user space buffer. | 283 | * We have the page, copy it to user space buffer. |
281 | */ | 284 | */ |
282 | ret = hugetlbfs_read_actor(page, offset, buf, len, nr); | 285 | ra = hugetlbfs_read_actor(page, offset, buf, len, nr); |
286 | ret = ra; | ||
283 | } | 287 | } |
284 | if (ret < 0) { | 288 | if (ra < 0) { |
285 | if (retval == 0) | 289 | if (retval == 0) |
286 | retval = ret; | 290 | retval = ra; |
287 | if (page) | 291 | if (page) |
288 | page_cache_release(page); | 292 | page_cache_release(page); |
289 | goto out; | 293 | goto out; |
@@ -506,7 +510,6 @@ static struct inode *hugetlbfs_get_inode(struct super_block *sb, uid_t uid, | |||
506 | inode->i_mode = mode; | 510 | inode->i_mode = mode; |
507 | inode->i_uid = uid; | 511 | inode->i_uid = uid; |
508 | inode->i_gid = gid; | 512 | inode->i_gid = gid; |
509 | inode->i_blocks = 0; | ||
510 | inode->i_mapping->a_ops = &hugetlbfs_aops; | 513 | inode->i_mapping->a_ops = &hugetlbfs_aops; |
511 | inode->i_mapping->backing_dev_info =&hugetlbfs_backing_dev_info; | 514 | inode->i_mapping->backing_dev_info =&hugetlbfs_backing_dev_info; |
512 | inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; | 515 | inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; |