pnfs/flexfiles: Fix misplaced barrier in nfs4_ff_layout_prepare_ds
authorBaptiste Lepers <baptiste.lepers@gmail.com>
Mon, 6 Sep 2021 01:59:24 +0000 (11:59 +1000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 18 Nov 2021 18:17:00 +0000 (19:17 +0100)
commit5ab7612ff0b58c5cb7590e8e90bc667cf6585779
tree24c601b801f78db0f38c6440a3ba9741cf2ae660
parent6967d9967b7a37cdd2f2e83def026e34e2c6a51a
pnfs/flexfiles: Fix misplaced barrier in nfs4_ff_layout_prepare_ds

[ Upstream commit a2915fa06227b056a8f9b0d79b61dca08ad5cfc6 ]

_nfs4_pnfs_v3/v4_ds_connect do
   some work
   smp_wmb
   ds->ds_clp = clp;

And nfs4_ff_layout_prepare_ds currently does
   smp_rmb
   if(ds->ds_clp)
      ...

This patch places the smp_rmb after the if. This ensures that following
reads only happen once nfs4_ff_layout_prepare_ds has checked that data
has been properly initialized.

Fixes: d67ae825a59d6 ("pnfs/flexfiles: Add the FlexFile Layout Driver")
Signed-off-by: Baptiste Lepers <baptiste.lepers@gmail.com>
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/nfs/flexfilelayout/flexfilelayoutdev.c
fs/nfs/pnfs_nfs.c