NFSv4/pnfs: Fix the layout barrier update
authorTrond Myklebust <trond.myklebust@hammerspace.com>
Fri, 2 Jul 2021 20:37:15 +0000 (16:37 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 20 Jul 2021 14:02:21 +0000 (16:02 +0200)
commit03165436f99b39df0710688e6f5448f8bd1063d8
tree626d8aefa7c79462d22fd776c41ab4f9ee26e17f
parenta85411bbc2a9d7cc56c8fd5157005bb84fa74c70
NFSv4/pnfs: Fix the layout barrier update

[ Upstream commit aa95edf309ef31e2df4a37ebf0e5c2ca2a6772ab ]

If we have multiple outstanding layoutget requests, the current code to
update the layout barrier assumes that the outstanding layout stateids
are updated in order. That's not necessarily the case.

Instead of using the value of lo->plh_outstanding as a guesstimate for
the window of values we need to accept, just wait to update the window
until we're processing the last one. The intention here is just to
ensure that we don't process 2^31 seqid updates without also updating
the barrier.

Fixes: 1bcf34fdac5f ("pNFS/NFSv4: Update the layout barrier when we schedule a layoutreturn")
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/nfs/pnfs.c