From patchwork Mon Jan 21 14:54:15 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benny Halevy X-Patchwork-Id: 2012811 Return-Path: X-Original-To: patchwork-linux-nfs@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id C67C9DF23A for ; Mon, 21 Jan 2013 14:54:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752635Ab3AUOyW (ORCPT ); Mon, 21 Jan 2013 09:54:22 -0500 Received: from mail-ee0-f52.google.com ([74.125.83.52]:59113 "EHLO mail-ee0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752612Ab3AUOyU (ORCPT ); Mon, 21 Jan 2013 09:54:20 -0500 Received: by mail-ee0-f52.google.com with SMTP id b15so2726406eek.25 for ; Mon, 21 Jan 2013 06:54:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:sender:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references; bh=rmwm1cNUBolSawcJJY1lWJGbzQZ+rTFJUR3PXmzO0kE=; b=arakpvkcpGzFC3x+QMiirlMckuQ4Gecs29z+Icbo0v1M0DcIGdgAk28imdk+9K3YMS HmoQH/gb6U2JY/JnWSEiawTCu4+EKCq5l/JuCIyTysqvrdJldATiHREfbKeQTdIAchEk 81grFm/rAlrISWlXGO68tRDgGpTYNauOJITejvFg74qCjg0nCI+7g8+7zprI1pAdYLO0 BSarfkCU1C6piQRxhcdigr3OUNReomRikf0VT0KA9bPpn/bJYxDH49rE2/N27Vme5xT0 hrYdcdAgLjKNhmI4vkWM6yfY+kpC6flbPiGCJnIxVsix7VdVd++EwO/IOIeZsnuGTeoO BZ8w== X-Received: by 10.14.1.195 with SMTP id 43mr61384922eed.31.1358780059052; Mon, 21 Jan 2013 06:54:19 -0800 (PST) Received: from bhalevy-lt.il.tonian.com ([46.120.7.251]) by mx.google.com with ESMTPS id k4sm22635186eep.15.2013.01.21.06.54.17 (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 21 Jan 2013 06:54:18 -0800 (PST) From: Benny Halevy To: linux-nfs@vger.kernel.org Cc: Benny Halevy Subject: [PATCH 1/9] SQUASHME: pnfsd: fix lrs_present calculation Date: Mon, 21 Jan 2013 16:54:15 +0200 Message-Id: <1358780055-5884-1-git-send-email-bhalevy@tonian.com> X-Mailer: git-send-email 1.7.11.7 In-Reply-To: <50FD5646.4020206@tonian.com> References: <50FD5646.4020206@tonian.com> Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org lrs_present must be set to zero iff the client holds no layout state on the respective file. Signed-off-by: Benny Halevy --- fs/nfsd/nfs4pnfsd.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/fs/nfsd/nfs4pnfsd.c b/fs/nfsd/nfs4pnfsd.c index 3931e52..5c50d8a 100644 --- a/fs/nfsd/nfs4pnfsd.c +++ b/fs/nfsd/nfs4pnfsd.c @@ -893,7 +893,7 @@ struct super_block * struct nfs4_layout *lp, *nextlp; dprintk("%s: clp %p fp %p\n", __func__, clp, fp); - lrp->lrs_present = 1; + lrp->lrs_present = 0; spin_lock(&layout_lock); list_for_each_entry_safe (lp, nextlp, &fp->fi_layouts, lo_perfile) { dprintk("%s: lp %p client %p,%p lo_type %x,%x iomode %d,%d\n", @@ -901,19 +901,22 @@ struct super_block * lp->lo_client, clp, lp->lo_seg.layout_type, lrp->args.lr_seg.layout_type, lp->lo_seg.iomode, lrp->args.lr_seg.iomode); - if (lp->lo_client != clp || - lp->lo_seg.layout_type != lrp->args.lr_seg.layout_type || + if (lp->lo_client != clp) + continue; + if (lp->lo_seg.layout_type != lrp->args.lr_seg.layout_type || (lp->lo_seg.iomode != lrp->args.lr_seg.iomode && lrp->args.lr_seg.iomode != IOMODE_ANY) || - !lo_seg_overlapping(&lp->lo_seg, &lrp->args.lr_seg)) + !lo_seg_overlapping(&lp->lo_seg, &lrp->args.lr_seg)) { + lrp->lrs_present = 1; continue; + } layouts_found++; trim_layout(&lp->lo_seg, &lrp->args.lr_seg); if (!lp->lo_seg.length) { - lrp->lrs_present = 0; dequeue_layout(lp); destroy_layout(lp); - } + } else + lrp->lrs_present = 1; } if (ls && layouts_found && lrp->lrs_present) update_layout_stateid_locked(ls, &lrp->lr_sid);