]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
NFSv4/pNFS: Always allow update of a zero valued layout barrier
authorTrond Myklebust <trond.myklebust@hammerspace.com>
Fri, 23 Jul 2021 12:57:20 +0000 (08:57 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 18 Sep 2021 11:40:13 +0000 (13:40 +0200)
[ Upstream commit 45baadaad7bf9183651fb74f4ed1200da48505a5 ]

A zero value for the layout barrier indicates that it has been cleared
(since seqid '0' is an illegal value), so we should always allow it to
be updated.

Fixes: d29b468da4f9 ("pNFS/NFSv4: Improve rejection of out-of-order layouts")
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/nfs/pnfs.c

index fef0537d15b0b6655a2bba84789932951b96c9d0..741b6283ac9cf4a7863e901f17dad8551dcbe4e1 100644 (file)
@@ -335,7 +335,7 @@ static bool pnfs_seqid_is_newer(u32 s1, u32 s2)
 
 static void pnfs_barrier_update(struct pnfs_layout_hdr *lo, u32 newseq)
 {
-       if (pnfs_seqid_is_newer(newseq, lo->plh_barrier))
+       if (pnfs_seqid_is_newer(newseq, lo->plh_barrier) || !lo->plh_barrier)
                lo->plh_barrier = newseq;
 }