diff options
author | David Howells <dhowells@redhat.com> | 2017-03-16 16:27:48 +0000 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-12-20 10:01:31 +0100 |
commit | dea197784167ddcd4a53f63b194f1a0c0ebf36e9 (patch) | |
tree | 5587394a9febdab728c86ccdd8f21e196c2bd9d8 /fs | |
parent | b1718fdda0f2d47634c0e8e96b0a77cfc34d4424 (diff) | |
download | linux-stable-dea197784167ddcd4a53f63b194f1a0c0ebf36e9.tar.gz linux-stable-dea197784167ddcd4a53f63b194f1a0c0ebf36e9.tar.bz2 linux-stable-dea197784167ddcd4a53f63b194f1a0c0ebf36e9.zip |
afs: Fix afs_kill_pages()
[ Upstream commit 7286a35e893176169b09715096a4aca557e2ccd2 ]
Fix afs_kill_pages() in two ways:
(1) If a writeback has been partially flushed, then if we try and kill the
pages it contains, some of them may no longer be undergoing writeback
and end_page_writeback() will assert.
Fix this by checking to see whether the page in question is actually
undergoing writeback before ending that writeback.
(2) The loop that scans for pages to kill doesn't increase the first page
index, and so the loop may not terminate, but it will try to process
the same pages over and over again.
Fix this by increasing the first page index to one after the last page
we processed.
Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/afs/write.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/fs/afs/write.c b/fs/afs/write.c index 9f816624e212..c4817b2f6aa7 100644 --- a/fs/afs/write.c +++ b/fs/afs/write.c @@ -300,10 +300,14 @@ static void afs_kill_pages(struct afs_vnode *vnode, bool error, ASSERTCMP(pv.nr, ==, count); for (loop = 0; loop < count; loop++) { - ClearPageUptodate(pv.pages[loop]); + struct page *page = pv.pages[loop]; + ClearPageUptodate(page); if (error) - SetPageError(pv.pages[loop]); - end_page_writeback(pv.pages[loop]); + SetPageError(page); + if (PageWriteback(page)) + end_page_writeback(page); + if (page->index >= first) + first = page->index + 1; } __pagevec_release(&pv); |