From patchwork Thu Jan 22 23:36:04 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Haynes X-Patchwork-Id: 5689631 Return-Path: X-Original-To: patchwork-linux-nfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id F0B3CC058D for ; Thu, 22 Jan 2015 23:37:55 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 37D9B20272 for ; Thu, 22 Jan 2015 23:37:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4E3882026F for ; Thu, 22 Jan 2015 23:37:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754569AbbAVXhx (ORCPT ); Thu, 22 Jan 2015 18:37:53 -0500 Received: from mail-pd0-f178.google.com ([209.85.192.178]:36101 "EHLO mail-pd0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754442AbbAVXhx (ORCPT ); Thu, 22 Jan 2015 18:37:53 -0500 Received: by mail-pd0-f178.google.com with SMTP id y10so4589380pdj.9 for ; Thu, 22 Jan 2015 15:37:52 -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=q02b8fA7RmCRPYVu4ZfRUEC8/JC+NFdtgPhugcIS6B4=; b=ZB40Cxwrq4vOilrtC6qXqULU8eb5gz2/nbzH0ZF5cTJEwjCcZfFdfU9LCBJhJpkLcW 84hV1vg/bVZ8dhqfh6XoLiENd5fjv1Aan2lPd2pk5KLDAMah9DX2VqncbqXCiCda8apo NgJKSXCaKlpExEgh6GvHZBH2KdDS5i8Ug5El0wpp038IiDMzs6ZL4zdrxmbQ3e20fdS6 GlzJQAVUHZBC0JVYdMEi8H9ohXUJW2cCaOi2nHF+8Zwp3/7TkCrDbAyyjY3pWKWCURxE 8WiQoS0fYwssqxhcmwdJCBbd9VJtYjZZqL2MXPipVA+wQ/m1Llp9xS0tokRNIhhb2Nfe egdw== X-Gm-Message-State: ALoCoQkz9/Clg+aqnhSn1zf0DHL48ejBZa5r2gXcu2qSwKeGiWFbhAfz5TFe0sfpdicCSq3fYBrA X-Received: by 10.68.132.103 with SMTP id ot7mr6700270pbb.0.1421969872660; Thu, 22 Jan 2015 15:37:52 -0800 (PST) Received: from localhost.localdomain ([50.242.95.105]) by mx.google.com with ESMTPSA id fu1sm366817pdb.80.2015.01.22.15.37.51 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 22 Jan 2015 15:37:52 -0800 (PST) From: Tom Haynes X-Google-Original-From: Tom Haynes To: Trond Myklebust Cc: Linux NFS Mailing list Subject: [PATCH v5 32/51] nfs: handle overlapping reqs in lock_and_join Date: Thu, 22 Jan 2015 15:36:04 -0800 Message-Id: <1421969783-92997-33-git-send-email-loghyr@primarydata.com> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1421969783-92997-1-git-send-email-loghyr@primarydata.com> References: <1421969783-92997-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 8800bd3..e997457 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