mirror of
https://github.com/FEX-Emu/linux.git
synced 2024-12-25 02:48:21 +00:00
pNFS: Fix post-layoutget error handling in pnfs_update_layout()
The non-retry error path is currently broken and ends up releasing the
reference to the layout twice. It also can end up clearing the
NFS_LAYOUT_FIRST_LAYOUTGET flag twice, causing a race.
In addition, the retry path will fail to decrement the plh_outstanding
counter.
Fixes: 183d9e7b11
("pnfs: rework LAYOUTGET retry handling")
Cc: stable@vger.kernel.org # 4.7
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Reviewed-by: Jeff Layton <jlayton@redhat.com>
This commit is contained in:
parent
8487c479e2
commit
56b38a1f7c
@ -1645,6 +1645,7 @@ lookup_again:
|
|||||||
lseg = send_layoutget(lo, ctx, &stateid, &arg, &timeout, gfp_flags);
|
lseg = send_layoutget(lo, ctx, &stateid, &arg, &timeout, gfp_flags);
|
||||||
trace_pnfs_update_layout(ino, pos, count, iomode, lo, lseg,
|
trace_pnfs_update_layout(ino, pos, count, iomode, lo, lseg,
|
||||||
PNFS_UPDATE_LAYOUT_SEND_LAYOUTGET);
|
PNFS_UPDATE_LAYOUT_SEND_LAYOUTGET);
|
||||||
|
atomic_dec(&lo->plh_outstanding);
|
||||||
if (IS_ERR(lseg)) {
|
if (IS_ERR(lseg)) {
|
||||||
switch(PTR_ERR(lseg)) {
|
switch(PTR_ERR(lseg)) {
|
||||||
case -ERECALLCONFLICT:
|
case -ERECALLCONFLICT:
|
||||||
@ -1652,26 +1653,26 @@ lookup_again:
|
|||||||
lseg = NULL;
|
lseg = NULL;
|
||||||
/* Fallthrough */
|
/* Fallthrough */
|
||||||
case -EAGAIN:
|
case -EAGAIN:
|
||||||
pnfs_put_layout_hdr(lo);
|
break;
|
||||||
if (first)
|
|
||||||
pnfs_clear_first_layoutget(lo);
|
|
||||||
if (lseg) {
|
|
||||||
trace_pnfs_update_layout(ino, pos, count,
|
|
||||||
iomode, lo, lseg, PNFS_UPDATE_LAYOUT_RETRY);
|
|
||||||
goto lookup_again;
|
|
||||||
}
|
|
||||||
/* Fallthrough */
|
|
||||||
default:
|
default:
|
||||||
if (!nfs_error_is_fatal(PTR_ERR(lseg))) {
|
if (!nfs_error_is_fatal(PTR_ERR(lseg))) {
|
||||||
pnfs_layout_clear_fail_bit(lo, pnfs_iomode_to_fail_bit(iomode));
|
pnfs_layout_clear_fail_bit(lo, pnfs_iomode_to_fail_bit(iomode));
|
||||||
lseg = NULL;
|
lseg = NULL;
|
||||||
}
|
}
|
||||||
|
goto out_put_layout_hdr;
|
||||||
|
}
|
||||||
|
if (lseg) {
|
||||||
|
if (first)
|
||||||
|
pnfs_clear_first_layoutget(lo);
|
||||||
|
trace_pnfs_update_layout(ino, pos, count,
|
||||||
|
iomode, lo, lseg, PNFS_UPDATE_LAYOUT_RETRY);
|
||||||
|
pnfs_put_layout_hdr(lo);
|
||||||
|
goto lookup_again;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
pnfs_layout_clear_fail_bit(lo, pnfs_iomode_to_fail_bit(iomode));
|
pnfs_layout_clear_fail_bit(lo, pnfs_iomode_to_fail_bit(iomode));
|
||||||
}
|
}
|
||||||
|
|
||||||
atomic_dec(&lo->plh_outstanding);
|
|
||||||
out_put_layout_hdr:
|
out_put_layout_hdr:
|
||||||
if (first)
|
if (first)
|
||||||
pnfs_clear_first_layoutget(lo);
|
pnfs_clear_first_layoutget(lo);
|
||||||
|
Loading…
Reference in New Issue
Block a user