OSDN Git Service

afs: Fix afs_kill_pages()
authorDavid Howells <dhowells@redhat.com>
Thu, 16 Mar 2017 16:27:48 +0000 (16:27 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 20 Dec 2017 09:04:56 +0000 (10:04 +0100)
commit5e469e44c8fd338183ea08adb143bb6e9a645ff1
tree80f69d05b67b80d011a71ff34ebf5c8ae324d699
parent80f74cef482f3ea77f918eeb739e588aeaeb20f9
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>
fs/afs/write.c