From patchwork Tue Dec 16 19:01:35 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Haynes X-Patchwork-Id: 5503061 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 B5D8B9F326 for ; Tue, 16 Dec 2014 19:03:07 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C9AA1209C1 for ; Tue, 16 Dec 2014 19:03:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id EB8DA209BD for ; Tue, 16 Dec 2014 19:03:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751225AbaLPTDE (ORCPT ); Tue, 16 Dec 2014 14:03:04 -0500 Received: from mail-pa0-f52.google.com ([209.85.220.52]:34162 "EHLO mail-pa0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751265AbaLPTDE (ORCPT ); Tue, 16 Dec 2014 14:03:04 -0500 Received: by mail-pa0-f52.google.com with SMTP id eu11so14700511pac.39 for ; Tue, 16 Dec 2014 11:03:03 -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=HqQQ4stOq98NkjTYjB1li1zI1ZH7j/pNXvi7psoabCImamtD335joWMm6Q44PLcKXD CZzmWf9ePv89XgcX0SJM/gJkg4NlE5DMT2LTAz5q8f4g+T7rSv4ttDp5dwkKYcq2R/6c lfiBog58wI8RUF7zrMa2bDVQRaIDAd6jSMgY03N9goF7jWT6AtNMpoPN0utURNbcGcH9 fic0zL0QZyRd9U8sroMXj/AP8pJ0PK/h2dYsBdOoBVMeBNui0NKa6+MVuGMzz048Cr41 5K/FrMk4uBvDRXbDBrWe5tqPoFYDcV3P6QlFOOtz15CFg6DWFVeU8PIPn5Yi7d5JQkfj x8kw== X-Gm-Message-State: ALoCoQlxMf8mJGZBIteYJYUWrMsZ4Wmgjn0oKn2mrMR4wznv/675aBiVobyuCnc8rXgdS90S0YBe X-Received: by 10.68.139.68 with SMTP id qw4mr63754082pbb.164.1418756583317; Tue, 16 Dec 2014 11:03:03 -0800 (PST) Received: from localhost.localdomain ([50.242.95.105]) by mx.google.com with ESMTPSA id q4sm1620669pdh.79.2014.12.16.11.03.02 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 16 Dec 2014 11:03:02 -0800 (PST) From: Tom Haynes X-Google-Original-From: Tom Haynes To: Trond Myklebust Cc: Linux NFS Mailing List Subject: [PATCH 32/50] nfs: handle overlapping reqs in lock_and_join Date: Tue, 16 Dec 2014 11:01:35 -0800 Message-Id: <1418756513-95187-33-git-send-email-loghyr@primarydata.com> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1418756513-95187-1-git-send-email-loghyr@primarydata.com> References: <1418756513-95187-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