From patchwork Thu Feb 27 19:13:50 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Adamson X-Patchwork-Id: 3735301 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.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id BE56BBF13A for ; Thu, 27 Feb 2014 19:14:01 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id AACCD2022D for ; Thu, 27 Feb 2014 19:14:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 86F8E20103 for ; Thu, 27 Feb 2014 19:13:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750765AbaB0TN6 (ORCPT ); Thu, 27 Feb 2014 14:13:58 -0500 Received: from mx12.netapp.com ([216.240.18.77]:16326 "EHLO mx12.netapp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750742AbaB0TN5 (ORCPT ); Thu, 27 Feb 2014 14:13:57 -0500 X-IronPort-AV: E=Sophos;i="4.97,556,1389772800"; d="scan'208";a="146060445" Received: from vmwexceht05-prd.hq.netapp.com ([10.106.77.35]) by mx12-out.netapp.com with ESMTP; 27 Feb 2014 11:13:57 -0800 Received: from smtp1.corp.netapp.com (10.57.156.124) by VMWEXCEHT05-PRD.hq.netapp.com (10.106.77.35) with Microsoft SMTP Server id 14.3.123.3; Thu, 27 Feb 2014 11:13:57 -0800 Received: from netapp41.cthon.org (vpn2ntap-14318.vpn.netapp.com [10.55.70.147]) by smtp1.corp.netapp.com (8.13.1/8.13.1/NTAP-1.6) with ESMTP id s1RJDulh005315; Thu, 27 Feb 2014 11:13:56 -0800 (PST) From: To: CC: , , Andy Adamson Subject: [PATCH 1/1] NFSv4 always compare stateids in nfs4_stateid_is_current Date: Thu, 27 Feb 2014 14:13:50 -0500 Message-ID: <1393528430-5237-1-git-send-email-andros@netapp.com> X-Mailer: git-send-email 1.8.3.1 MIME-Version: 1.0 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, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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: Andy Adamson When nfs4_stateid_is_current does not compare the from the wire stateid to the current stateid, nfs4_read/write_stateid_changed can return a false positive resulting in a READ or WRITE looping forever retrying a bad stateid and never triggering a stateid recovery. Do not check the non-boolean return from nfs4_set_rw_stateid. Signed-off-by: Andy Adamson --- fs/nfs/nfs4proc.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index 8672323..11566a4 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c @@ -4051,10 +4051,9 @@ static bool nfs4_stateid_is_current(nfs4_stateid *stateid, const struct nfs_lock_context *l_ctx, fmode_t fmode) { - nfs4_stateid current_stateid; + nfs4_stateid current_stateid = &zero_stateid; - if (nfs4_set_rw_stateid(¤t_stateid, ctx, l_ctx, fmode)) - return false; + nfs4_set_rw_stateid(¤t_stateid, ctx, l_ctx, fmode); return nfs4_stateid_match(stateid, ¤t_stateid); }