]> git.baikalelectronics.ru Git - kernel.git/commitdiff
hostfs: Handle page write errors correctly
authorMatthew Wilcox (Oracle) <willy@infradead.org>
Fri, 27 May 2022 15:20:56 +0000 (11:20 -0400)
committerMatthew Wilcox (Oracle) <willy@infradead.org>
Tue, 2 Aug 2022 16:34:02 +0000 (12:34 -0400)
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>
fs/hostfs/hostfs_kern.c

index cc1bc6f93a0101b6e1be37f9abf82c6cbf714af2..07881b76d42f99070c146c4e28972d94f61856af 100644 (file)
@@ -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: