NFSv4: Fix up mirror allocation
authorTrond Myklebust <trond.myklebust@primarydata.com>
Sat, 19 Aug 2017 14:10:34 +0000 (10:10 -0400)
committerTrond Myklebust <trond.myklebust@primarydata.com>
Sun, 20 Aug 2017 14:36:35 +0000 (10:36 -0400)
commit14abcb0bf59a30cf65a74f6c6f53974cd7224bc6
treee941cf6c9d88ecbdb5a921a8a89c8ef3086efd9c
parentef954844c7ace62f773f4f23e28d2d915adc419f
NFSv4: Fix up mirror allocation

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>
Cc: stable@vger.kernel.org # 4.0+
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
fs/nfs/pagelist.c