提交 c7750c5e 编写于 作者: T Trond Myklebust 提交者: Zheng Zengkai

NFSv4/pNFS: Do not fail I/O when we fail to allocate the pNFS layout

stable inclusion
from stable-v5.10.121
commit 96fdbb1c8563ab4382937e1142dda5114360e286
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I5L6CQ

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=96fdbb1c8563ab4382937e1142dda5114360e286

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

[ Upstream commit 3764a17e ]

Commit 587f03de caused pnfs_update_layout() to stop returning ENOMEM
when the memory allocation fails, and hence causes it to fall back to
trying to do I/O through the MDS. There is no guarantee that this will
fare any better. If we're failing the pNFS layout allocation, then we
should just redirty the page and retry later.
Reported-by: NOlga Kornievskaia <aglo@umich.edu>
Fixes: 587f03de ("pnfs: refactor send_layoutget")
Signed-off-by: NTrond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: NAnna Schumaker <Anna.Schumaker@Netapp.com>
Signed-off-by: NSasha Levin <sashal@kernel.org>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
Acked-by: NXie XiuQi <xiexiuqi@huawei.com>
上级 6d26ccf4
...@@ -2006,6 +2006,7 @@ pnfs_update_layout(struct inode *ino, ...@@ -2006,6 +2006,7 @@ pnfs_update_layout(struct inode *ino,
lo = pnfs_find_alloc_layout(ino, ctx, gfp_flags); lo = pnfs_find_alloc_layout(ino, ctx, gfp_flags);
if (lo == NULL) { if (lo == NULL) {
spin_unlock(&ino->i_lock); spin_unlock(&ino->i_lock);
lseg = ERR_PTR(-ENOMEM);
trace_pnfs_update_layout(ino, pos, count, iomode, lo, lseg, trace_pnfs_update_layout(ino, pos, count, iomode, lo, lseg,
PNFS_UPDATE_LAYOUT_NOMEM); PNFS_UPDATE_LAYOUT_NOMEM);
goto out; goto out;
...@@ -2134,6 +2135,7 @@ pnfs_update_layout(struct inode *ino, ...@@ -2134,6 +2135,7 @@ pnfs_update_layout(struct inode *ino,
lgp = pnfs_alloc_init_layoutget_args(ino, ctx, &stateid, &arg, gfp_flags); lgp = pnfs_alloc_init_layoutget_args(ino, ctx, &stateid, &arg, gfp_flags);
if (!lgp) { if (!lgp) {
lseg = ERR_PTR(-ENOMEM);
trace_pnfs_update_layout(ino, pos, count, iomode, lo, NULL, trace_pnfs_update_layout(ino, pos, count, iomode, lo, NULL,
PNFS_UPDATE_LAYOUT_NOMEM); PNFS_UPDATE_LAYOUT_NOMEM);
nfs_layoutget_end(lo); nfs_layoutget_end(lo);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册