Skip to content

Commit

Permalink
hostfs: Handle page write errors correctly
Browse files Browse the repository at this point in the history
If a page can't be written back, we need to call mapping_set_error(),
not clear the page's Uptodate flag.  Also remove the clearing of PageError
on success; that flag is used for read errors, not write errors.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
  • Loading branch information
Matthew Wilcox (Oracle) committed Aug 2, 2022
1 parent 31e748e commit e775dfb
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions fs/hostfs/hostfs_kern.c
Original file line number Diff line number Diff line change
Expand Up @@ -416,15 +416,15 @@ static int hostfs_writepage(struct page *page, struct writeback_control *wbc)

err = write_file(HOSTFS_I(inode)->fd, &base, buffer, count);
if (err != count) {
ClearPageUptodate(page);
if (err >= 0)
err = -EIO;
mapping_set_error(mapping, err);
goto out;
}

if (base > inode->i_size)
inode->i_size = base;

if (PageError(page))
ClearPageError(page);
err = 0;

out:
Expand Down

0 comments on commit e775dfb

Please sign in to comment.