From patchwork Mon Feb 2 22:38:46 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Haynes X-Patchwork-Id: 5765031 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 B030BBF440 for ; Mon, 2 Feb 2015 22:40:49 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id DF917209EB for ; Mon, 2 Feb 2015 22:40:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1C680209EA for ; Mon, 2 Feb 2015 22:40:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965362AbbBBWkr (ORCPT ); Mon, 2 Feb 2015 17:40:47 -0500 Received: from mail-pa0-f52.google.com ([209.85.220.52]:64935 "EHLO mail-pa0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965072AbbBBWkq (ORCPT ); Mon, 2 Feb 2015 17:40:46 -0500 Received: by mail-pa0-f52.google.com with SMTP id kx10so87842101pab.11 for ; Mon, 02 Feb 2015 14:40:46 -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=j96D7D9U0uXwwdwRO/qaeQG6yLA91LVx0x8IqbLbKtxMIhZfb975R24hu5XV2NTLex 5jEF3C2vICLpTjNx3yJIQtCX9EVOCODW1nXyUjNx7ctQqCO9HoWFyAmd1GLdwM6kcZ2/ LAWYquoQAhKbiWECcgudJ12VkBAfqNb5P471yhKjWriSZeql7siHGoeTsK0+cUU4eRoS tZSPupRYUnYqiiikjTLNc85ur+nLuqeka2Xzz2wjSmcuJi0Qy6jrlaurFf0D7gPAjGco ARHchrNeu0DAjyGs14Odh7yLVTbLurM8zwusV7XHEZQQaBlY+BwLKMQ2HQ71lUTfPYvs mGMA== X-Gm-Message-State: ALoCoQn1ldq7Bsy+dnAJdm0R3ylU6xzHE04LpGv2p0N/3cLvmik8HyOkFD1PYn9ekNz0OxGGsrb5 X-Received: by 10.68.231.102 with SMTP id tf6mr32969837pbc.40.1422916846424; Mon, 02 Feb 2015 14:40:46 -0800 (PST) Received: from localhost.localdomain ([50.242.95.105]) by mx.google.com with ESMTPSA id bx13sm94656pdb.19.2015.02.02.14.40.44 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 02 Feb 2015 14:40:45 -0800 (PST) From: Tom Haynes X-Google-Original-From: Tom Haynes To: Trond Myklebust Cc: Linux NFS Mailing list Subject: [PATCH v6 32/53] nfs: handle overlapping reqs in lock_and_join Date: Mon, 2 Feb 2015 14:38:46 -0800 Message-Id: <1422916747-86649-33-git-send-email-loghyr@primarydata.com> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1422916747-86649-1-git-send-email-loghyr@primarydata.com> References: <1422916747-86649-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