Commit 3376cbf3 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] nfs_writepage() retval fix

Both ->writepage() and ->writepages() should return 0 or a negative error
code.  It shouldn't return the number of bytes which were written.

From: Trond Myklebust <trond.myklebust@fys.uio.no>

   Redirty the page if all of the modified parts of the page weren't
   written out.
parent cf259c1c
......@@ -316,9 +316,13 @@ int nfs_writepage(struct page *page, struct writeback_control *wbc)
err = WRITEPAGE_ACTIVATE;
}
} else {
err = nfs_writepage_sync(NULL, inode, page, 0, offset, priority);
if (err == offset)
err = nfs_writepage_sync(NULL, inode, page, 0,
offset, priority);
if (err >= 0) {
if (err != offset)
redirty_page_for_writepage(wbc, page);
err = 0;
}
}
unlock_kernel();
out:
......@@ -357,8 +361,10 @@ int nfs_writepages(struct address_space *mapping, struct writeback_control *wbc)
goto out;
}
err = nfs_commit_inode(inode, 0, 0, wb_priority(wbc));
if (err > 0)
if (err > 0) {
wbc->nr_to_write -= err;
err = 0;
}
out:
clear_bit(BDI_write_congested, &bdi->state);
wake_up_all(&nfs_write_congestion);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment