pNFS/flexfiles: Fix list corruption if the mirror count changes
commit 8b04013737341442ed914b336cde866b902664ae upstream.
If the mirror count changes in the new layout we pick up inside
ff_layout_pg_init_write(), then we can end up adding the
request to the wrong mirror and corrupting the mirror->pg_list.
Fixes: d600ad1f2b
("NFS41: pop some layoutget errors to application")
Cc: stable@vger.kernel.org
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
7b99577ff3
commit
02917bef8f
@ -984,9 +984,8 @@ ff_layout_pg_init_write(struct nfs_pageio_descriptor *pgio,
|
||||
goto out_mds;
|
||||
|
||||
/* Use a direct mapping of ds_idx to pgio mirror_idx */
|
||||
if (WARN_ON_ONCE(pgio->pg_mirror_count !=
|
||||
FF_LAYOUT_MIRROR_COUNT(pgio->pg_lseg)))
|
||||
goto out_mds;
|
||||
if (pgio->pg_mirror_count != FF_LAYOUT_MIRROR_COUNT(pgio->pg_lseg))
|
||||
goto out_eagain;
|
||||
|
||||
for (i = 0; i < pgio->pg_mirror_count; i++) {
|
||||
mirror = FF_LAYOUT_COMP(pgio->pg_lseg, i);
|
||||
@ -1008,7 +1007,10 @@ ff_layout_pg_init_write(struct nfs_pageio_descriptor *pgio,
|
||||
(NFS_MOUNT_SOFT|NFS_MOUNT_SOFTERR))
|
||||
pgio->pg_maxretrans = io_maxretrans;
|
||||
return;
|
||||
|
||||
out_eagain:
|
||||
pnfs_generic_pg_cleanup(pgio);
|
||||
pgio->pg_error = -EAGAIN;
|
||||
return;
|
||||
out_mds:
|
||||
trace_pnfs_mds_fallback_pg_init_write(pgio->pg_inode,
|
||||
0, NFS4_MAX_UINT64, IOMODE_RW,
|
||||
@ -1018,6 +1020,7 @@ ff_layout_pg_init_write(struct nfs_pageio_descriptor *pgio,
|
||||
pgio->pg_lseg = NULL;
|
||||
pgio->pg_maxretrans = 0;
|
||||
nfs_pageio_reset_write_mds(pgio);
|
||||
pgio->pg_error = -EAGAIN;
|
||||
}
|
||||
|
||||
static unsigned int
|
||||
|
Loading…
Reference in New Issue
Block a user