提交 7fe35576 编写于 作者: T Trond Myklebust 提交者: Yang Yingliang

NFS: Don't move layouts to plh_return_segs list while in use

stable inclusion
from linux-4.19.140
commit ceefd5f9a60e25a89f6acd8f00bd4d1ecc229b00

--------------------------------

commit ff041727 upstream.

If the layout segment is still in use for a read or a write, we should
not move it to the layout plh_return_segs list. If we do, we can end
up returning the layout while I/O is still in progress.

Fixes: e0b7d420 ("pNFS: Don't discard layout segments that are marked for return")
Cc: stable@vger.kernel.org # v4.19+
Signed-off-by: NTrond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
Reviewed-by: NHou Tao <houtao1@huawei.com>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 33bdf393
...@@ -2327,16 +2327,6 @@ pnfs_layout_process(struct nfs4_layoutget *lgp) ...@@ -2327,16 +2327,6 @@ pnfs_layout_process(struct nfs4_layoutget *lgp)
return ERR_PTR(-EAGAIN); return ERR_PTR(-EAGAIN);
} }
static int
mark_lseg_invalid_or_return(struct pnfs_layout_segment *lseg,
struct list_head *tmp_list)
{
if (!mark_lseg_invalid(lseg, tmp_list))
return 0;
pnfs_cache_lseg_for_layoutreturn(lseg->pls_layout, lseg);
return 1;
}
/** /**
* pnfs_mark_matching_lsegs_return - Free or return matching layout segments * pnfs_mark_matching_lsegs_return - Free or return matching layout segments
* @lo: pointer to layout header * @lo: pointer to layout header
...@@ -2373,7 +2363,7 @@ pnfs_mark_matching_lsegs_return(struct pnfs_layout_hdr *lo, ...@@ -2373,7 +2363,7 @@ pnfs_mark_matching_lsegs_return(struct pnfs_layout_hdr *lo,
lseg, lseg->pls_range.iomode, lseg, lseg->pls_range.iomode,
lseg->pls_range.offset, lseg->pls_range.offset,
lseg->pls_range.length); lseg->pls_range.length);
if (mark_lseg_invalid_or_return(lseg, tmp_list)) if (mark_lseg_invalid(lseg, tmp_list))
continue; continue;
remaining++; remaining++;
set_bit(NFS_LSEG_LAYOUTRETURN, &lseg->pls_flags); set_bit(NFS_LSEG_LAYOUTRETURN, &lseg->pls_flags);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册