Commit c51bb0ea authored by Ouyang Maochun's avatar Ouyang Maochun Committed by Steve French

cifs: bugfix for unreclaimed writeback pages in cifs_writev_requeue()

Pages get the PG_writeback flag set before cifs sends its
request to SMB server in cifs_writepages(), if the SMB service
goes down, cifs may try to recommit the writing requests in
cifs_writev_requeue(). However, it does not clean its PG_writeback
flag and relaimed the pages even if it fails again in
cifs_writev_requeue(), which may lead to the hanging of the
processes accessing the cifs directory. This patch just cleans
the PG_writeback flags and reclaims the pages under that circumstances.

    Steps to reproduce the bug(trying serveral times may trigger the issue):
    1.Write from cifs client continuously.(e.g dd if=/dev/zero of=<cifs file>)
    2.Stop SMB service from server.(e.g service smb stop)
    3.Wait for two minutes, and then start SMB service from
server.(e.g service smb start)
    4.The processes which are accessing cifs directory may hang up.
Signed-off-by: default avatarOuyang Maochun <ouyang.maochun@zte.com.cn>
Signed-off-by: default avatarJiang Yong <jian.yong5@zte.com.cn>
Tested-by: default avatarZhang Xianwei <zhang.xianwei8@zte.com.cn>
Reviewed-by: default avatarWang Liang <wang.liang82@zte.com.cn>
Reviewed-by: default avatarCai Qu <cai.qu@zte.com.cn>
Reviewed-by: default avatarJiang Biao <jiang.biao2@zte.com.cn>
Reviewed-by: default avatarJeff Layton <jlayton@redhat.com>
Reviewed-by: default avatarPavel Shilovsky <piastry@etersoft.ru>
Signed-off-by: default avatarSteve French <sfrench@us.ibm.com>
parent 0b7bc840
......@@ -1909,8 +1909,11 @@ cifs_writev_requeue(struct cifs_writedata *wdata)
} while (rc == -EAGAIN);
for (i = 0; i < wdata->nr_pages; i++) {
if (rc != 0)
if (rc != 0) {
SetPageError(wdata->pages[i]);
end_page_writeback(wdata->pages[i]);
page_cache_release(wdata->pages[i]);
}
unlock_page(wdata->pages[i]);
}
......
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