From patchwork Sat Dec 3 20:57:23 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Trond Myklebust X-Patchwork-Id: 9459799 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 0F76D60459 for ; Sat, 3 Dec 2016 20:58:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 02FC6283E8 for ; Sat, 3 Dec 2016 20:58:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EC0C1283F1; Sat, 3 Dec 2016 20:58:14 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.3 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AA8E0283E8 for ; Sat, 3 Dec 2016 20:58:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751292AbcLCU6N (ORCPT ); Sat, 3 Dec 2016 15:58:13 -0500 Received: from mail-io0-f193.google.com ([209.85.223.193]:34614 "EHLO mail-io0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751317AbcLCU6I (ORCPT ); Sat, 3 Dec 2016 15:58:08 -0500 Received: by mail-io0-f193.google.com with SMTP id r94so14855529ioe.1 for ; Sat, 03 Dec 2016 12:57:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:subject:date:message-id:in-reply-to:references; bh=90jAXWvMMtcHob3yx9R3M6WvlvynpDIBQ+rW5RbXFQw=; b=BCKvSHcfcYRExmhJv9+OJ1WI9d6rxTJG2NCIqeUIMFksHvZ720/8RwhkqsuEQhzkaC jlDhPQZfXiiOUMN/eStJfcLcrhk+XSpkwthyXd77bOQoJTzksCat7+tIWBObo/4A7W4Q BGe2vbqsdOpl6b7EZCUtKxZ1UAnRye8JXYkxEGfEISbWQ+F46aIr2xK0WFqKRA1ltLzD NcOteM5Yo2r+g7vE67OBfQ+dPd45+/FCUqK7a64Zu1oJs50DcQz1ec3JeUKR5GNI8Lif X7e40IEYHyV5vjLUYFFT1IyO30mW5Qp64MvN/36cFZD5KZ2yE6xuqhSZw/wRjXqdCvNJ tymQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:subject:date:message-id :in-reply-to:references; bh=90jAXWvMMtcHob3yx9R3M6WvlvynpDIBQ+rW5RbXFQw=; b=FIHKvkrdkTAO+p8dDaHuWeJhpBsdmSqqlwcJIaZnScWcf+9Uax4KcAcip/YTY0OcUB n9HtJT5lVvminXTVGco8GpwBhRDDxvl+0ESehCurGaIkjeRc1FkXjQRoYvxnE4lSgriI PN7BnwH7LvXJOlHyqBFA/jDH3AFU1Jd0uQ/MuE28ZkjTAxgorpnhJnb13GVTnxg50c4z K3nLH9UwXRA8iId5FXTw+HAe8pV3IUGyTVmuGaYk6iJvh9qP3z3Il+TFi1Nem0n2gaPR tjEV19yMQbk3MqmX9HzP4xtn8DDyASkemh8eK7M1OLld0elxgNNdsnJR7iRzi8aRQjLP SxJQ== X-Gm-Message-State: AKaTC01xCk5ygj4DpuIkt5sX6y1gfnNrqybW857TCGZYwu0Uj3SiVoOyk2RyTiML91MzEg== X-Received: by 10.36.250.201 with SMTP id v192mr2839440ith.106.1480798656370; Sat, 03 Dec 2016 12:57:36 -0800 (PST) Received: from localhost.localdomain (c-68-49-162-121.hsd1.mi.comcast.net. [68.49.162.121]) by smtp.gmail.com with ESMTPSA id x63sm4355061iod.5.2016.12.03.12.57.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 03 Dec 2016 12:57:35 -0800 (PST) From: Trond Myklebust To: linux-nfs@vger.kernel.org Subject: [PATCH 08/10] NFS: Fix up read of mirror stats Date: Sat, 3 Dec 2016 15:57:23 -0500 Message-Id: <20161203205725.12961-9-trond.myklebust@primarydata.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20161203205725.12961-8-trond.myklebust@primarydata.com> References: <20161203205725.12961-1-trond.myklebust@primarydata.com> <20161203205725.12961-2-trond.myklebust@primarydata.com> <20161203205725.12961-3-trond.myklebust@primarydata.com> <20161203205725.12961-4-trond.myklebust@primarydata.com> <20161203205725.12961-5-trond.myklebust@primarydata.com> <20161203205725.12961-6-trond.myklebust@primarydata.com> <20161203205725.12961-7-trond.myklebust@primarydata.com> <20161203205725.12961-8-trond.myklebust@primarydata.com> Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Need to lock while reading in order to ensure 64-bit reads are correct. Signed-off-by: Trond Myklebust --- fs/nfs/flexfilelayout/flexfilelayout.c | 2 ++ 1 file changed, 2 insertions(+) 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;