提交 94e18007 编写于 作者: J Jeff Layton 提交者: Steve French

cifs: don't try to unlock pagecache page after releasing it

We had a recent fix to fix the release of pagecache pages when
cifs_writev_requeue writes fail. Unfortunately, it releases the page
before trying to unlock it. At that point, the page might be gone by the
time the unlock comes in.

Unlock the page first before checking the value of "rc", and only then
end writeback and release the pages. The page lock isn't required for
any of those operations so this should be safe.
Reported-by: NAnton Altaparmakov <aia21@cam.ac.uk>
Signed-off-by: NJeff Layton <jlayton@redhat.com>
Signed-off-by: NSteve French <sfrench@us.ibm.com>
上级 25189643
...@@ -1909,12 +1909,12 @@ cifs_writev_requeue(struct cifs_writedata *wdata) ...@@ -1909,12 +1909,12 @@ cifs_writev_requeue(struct cifs_writedata *wdata)
} while (rc == -EAGAIN); } while (rc == -EAGAIN);
for (i = 0; i < wdata->nr_pages; i++) { for (i = 0; i < wdata->nr_pages; i++) {
unlock_page(wdata->pages[i]);
if (rc != 0) { if (rc != 0) {
SetPageError(wdata->pages[i]); SetPageError(wdata->pages[i]);
end_page_writeback(wdata->pages[i]); end_page_writeback(wdata->pages[i]);
page_cache_release(wdata->pages[i]); page_cache_release(wdata->pages[i]);
} }
unlock_page(wdata->pages[i]);
} }
mapping_set_error(inode->i_mapping, rc); mapping_set_error(inode->i_mapping, rc);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册