NFSv4.1: Ensure memory ordering between nfs4_ds_connect and nfs4_fl_prepare_ds
authorTrond Myklebust <Trond.Myklebust@netapp.com>
Thu, 26 Sep 2013 18:32:56 +0000 (14:32 -0400)
committerTrond Myklebust <Trond.Myklebust@netapp.com>
Sun, 29 Sep 2013 19:58:35 +0000 (15:58 -0400)
We need to ensure that the initialisation of the data server nfs_client
structure in nfs4_ds_connect is correctly ordered w.r.t. the read of
ds->ds_clp in nfs4_fl_prepare_ds.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
fs/nfs/nfs4filelayoutdev.c

index cd3aef571c34655cba1aa329b7e1a29161952255..c7c295e556ed87501c069053d0c133e44dcadc97 100644 (file)
@@ -185,6 +185,7 @@ nfs4_ds_connect(struct nfs_server *mds_srv, struct nfs4_pnfs_ds *ds)
        if (status)
                goto out_put;
 
+       smp_wmb();
        ds->ds_clp = clp;
        dprintk("%s [new] addr: %s\n", __func__, ds->ds_remotestr);
 out:
@@ -809,6 +810,7 @@ nfs4_fl_prepare_ds(struct pnfs_layout_segment *lseg, u32 ds_idx)
                filelayout_mark_devid_invalid(devid);
                goto out;
        }
+       smp_rmb();
        if (ds->ds_clp)
                goto out_test_devid;