From patchwork Wed Dec 24 07:13:11 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Haynes X-Patchwork-Id: 5537091 Return-Path: X-Original-To: patchwork-linux-nfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id C8DB89F301 for ; Wed, 24 Dec 2014 07:14:14 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 18683201B9 for ; Wed, 24 Dec 2014 07:14:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4086C200F2 for ; Wed, 24 Dec 2014 07:14:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751887AbaLXHOJ (ORCPT ); Wed, 24 Dec 2014 02:14:09 -0500 Received: from mail-ig0-f179.google.com ([209.85.213.179]:64822 "EHLO mail-ig0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751866AbaLXHOG (ORCPT ); Wed, 24 Dec 2014 02:14:06 -0500 Received: by mail-ig0-f179.google.com with SMTP id r2so6627521igi.0 for ; Tue, 23 Dec 2014 23:14:06 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=jOt9lzQAumjWJXTpR69g5hrJPbZPMb2NM5ukqsID5QQ=; b=jMcaheeB4rB42wKzQ3EetTbpOBvq21LpxkFjU+Hc0DSOUQo4gYONCLhJqt9TrFBsb9 N3hBmwOvCE/J5nLySljDBibsnnkZPgqSl/VQ3aXdwgZDSNOPXN0Plp5MIxo/6ChlOew/ 8gfntT9OCwjicSAQ81GafbQWnDOeTD/a9eJVWWXkiQdkM9spZ/h/TTGodg2JXUnhrYMw 2LMwI/lSHOoPVimSHMalZSlUjJ5GS/Tc/afpzxVbCcA7RBYlV4hMzRnrqv2QHONrmZ2h 6KaTkfx8eVHKbkWYtrgePtBKkGN4OhXHxMuHneXLrLNwkuof6JbLLAF6UW1ntF21IURh N7dQ== X-Gm-Message-State: ALoCoQkLijrvlMC1LPfVog5R3bnTdCEgQChhuly6en1PxMHFyuhDDxy2U9AdHG+8MjjHIXQsDBcT X-Received: by 10.50.79.193 with SMTP id l1mr24950800igx.30.1419405245949; Tue, 23 Dec 2014 23:14:05 -0800 (PST) Received: from localhost.localdomain (c-68-40-185-14.hsd1.mi.comcast.net. [68.40.185.14]) by mx.google.com with ESMTPSA id 37sm8821410iog.39.2014.12.23.23.14.05 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 23 Dec 2014 23:14:05 -0800 (PST) From: Tom Haynes X-Google-Original-From: Tom Haynes To: Trond Myklebust Cc: Linux NFS Mailing List Subject: [PATCH v2 32/49] nfs: handle overlapping reqs in lock_and_join Date: Tue, 23 Dec 2014 23:13:11 -0800 Message-Id: <1419405208-25975-33-git-send-email-loghyr@primarydata.com> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1419405208-25975-1-git-send-email-loghyr@primarydata.com> References: <1419405208-25975-1-git-send-email-loghyr@primarydata.com> Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Weston Andros Adamson This is needed for mirrored DS support, where multuple requests cover the same range. Signed-off-by: Weston Andros Adamson --- fs/nfs/write.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/fs/nfs/write.c b/fs/nfs/write.c index ab392af..a6eadac 100644 --- a/fs/nfs/write.c +++ b/fs/nfs/write.c @@ -473,13 +473,18 @@ try_again: do { /* * Subrequests are always contiguous, non overlapping - * and in order. If not, it's a programming error. + * and in order - but may be repeated (mirrored writes). */ - WARN_ON_ONCE(subreq->wb_offset != - (head->wb_offset + total_bytes)); - - /* keep track of how many bytes this group covers */ - total_bytes += subreq->wb_bytes; + if (subreq->wb_offset == (head->wb_offset + total_bytes)) { + /* keep track of how many bytes this group covers */ + total_bytes += subreq->wb_bytes; + } else if (WARN_ON_ONCE(subreq->wb_offset < head->wb_offset || + ((subreq->wb_offset + subreq->wb_bytes) > + (head->wb_offset + total_bytes)))) { + nfs_page_group_unlock(head); + spin_unlock(&inode->i_lock); + return ERR_PTR(-EIO); + } if (!nfs_lock_request(subreq)) { /* releases page group bit lock and