summaryrefslogtreecommitdiffstats
path: root/fs/nfs/flexfilelayout
diff options
context:
space:
mode:
authorTrond Myklebust <trond.myklebust@primarydata.com>2016-10-03 18:13:20 -0400
committerTrond Myklebust <trond.myklebust@primarydata.com>2016-12-03 15:37:44 -0500
commit2f8220c16ee0055f7ea541782651b30398752ee4 (patch)
treea84f2794e42034d44c033563dde215e524d43ea7 /fs/nfs/flexfilelayout
parent08e2e5bc6c9a1b0e92da5225080bbb33786abd08 (diff)
downloadlinux-2f8220c16ee0055f7ea541782651b30398752ee4.tar.bz2
NFS: Fix up read of mirror stats
Need to lock while reading in order to ensure 64-bit reads are correct. Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Diffstat (limited to 'fs/nfs/flexfilelayout')
-rw-r--r--fs/nfs/flexfilelayout/flexfilelayout.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/fs/nfs/flexfilelayout/flexfilelayout.c b/fs/nfs/flexfilelayout/flexfilelayout.c
index f61df1641567..c18afd5cc0bb 100644
--- a/fs/nfs/flexfilelayout/flexfilelayout.c
+++ b/fs/nfs/flexfilelayout/flexfilelayout.c
@@ -2250,10 +2250,12 @@ ff_layout_mirror_prepare_stats(struct pnfs_layout_hdr *lo,
memcpy(&devinfo->dev_id, &dev->deviceid, NFS4_DEVICEID4_SIZE);
devinfo->offset = 0;
devinfo->length = NFS4_MAX_UINT64;
+ spin_lock(&mirror->lock);
devinfo->read_count = mirror->read_stat.io_stat.ops_completed;
devinfo->read_bytes = mirror->read_stat.io_stat.bytes_completed;
devinfo->write_count = mirror->write_stat.io_stat.ops_completed;
devinfo->write_bytes = mirror->write_stat.io_stat.bytes_completed;
+ spin_unlock(&mirror->lock);
devinfo->layout_type = LAYOUT_FLEX_FILES;
devinfo->layoutstats_encode = ff_layout_encode_layoutstats;
devinfo->layout_private = mirror;