NFSv4: Fix up mirror allocation
authorTrond Myklebust <trond.myklebust@primarydata.com>
Sat, 19 Aug 2017 14:10:34 +0000 (10:10 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 13 Sep 2017 21:17:30 +0000 (14:17 -0700)
commitda0f4931ec5264146fa7377e07ab10c582737cff
treedc1fe9bbcb1c786469645434907acaa171ff32d8
parent3307d5f5099c186d1ae43205eb23c29fabc6f5b8
NFSv4: Fix up mirror allocation

commit 14abcb0bf59a30cf65a74f6c6f53974cd7224bc6 upstream.

There are a number of callers of nfs_pageio_complete() that want to
continue using the nfs_pageio_descriptor without needing to call
nfs_pageio_init() again. Examples include nfs_pageio_resend() and
nfs_pageio_cond_complete().

The problem is that nfs_pageio_complete() also calls
nfs_pageio_cleanup_mirroring(), which frees up the array of mirrors.
This can lead to writeback errors, in the next call to
nfs_pageio_setup_mirroring().

Fix by simply moving the allocation of the mirrors to
nfs_pageio_setup_mirroring().

Link: https://bugzilla.kernel.org/show_bug.cgi?id=196709
Reported-by: JianhongYin <yin-jianhong@163.com>
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/nfs/pagelist.c