Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1065753ybl; Wed, 14 Aug 2019 10:09:16 -0700 (PDT) X-Google-Smtp-Source: APXvYqxxIf4AuAN+dqoqs+h8+d1AguVKsmQlUu2Lffj+GrcwJQJHW5JosUlWs6YEJBExuI9O57I0 X-Received: by 2002:a17:90b:d8f:: with SMTP id bg15mr691414pjb.65.1565802556091; Wed, 14 Aug 2019 10:09:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565802556; cv=none; d=google.com; s=arc-20160816; b=Ke6UM7OZdqMIQ9pHA2xXCmP0IK0hb7bYNm6d/JKmZ5J9Zp0yaamDTIQ8XsbumwnpM4 RmUBFZc5+AYFOtkisxy3SHljmepmyeskR8fI55YAeiW3IVMnWYo0dAy07S4JmRnXkt15 pqQsmNhgVYvotu1w3uJcJh2uYx2aw2+24BijWv59M5qNWf6bQd0m0nDg/8oqQjbi8nyX S4aPzyIPNbFoOiH8Jpc7FuUZ9NdJeAa016pe1q10ctlMotSQtExAC4KpyHYCnDjV0nbU KKUzORoMJ/qgNN5UVOUKwjBzFb+Ow/zSPcg55G4O4swq1ff8f5cV8SJk1mwo9YskA1KM A3JA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=0KiNchUqO1Dr6KalJg4k85SwWTMZeow3rrjpmQkPVXo=; b=yOAC5Kbo0uv4vzAN7bowcUWiI9j7C38ZzIqflNhb6adlnno/3SQFoVAmzt3zXhLHSf dcEfAemBawxOTtzPKipmVNdtIQetto78/wNUdg9saY8eTqgacIiHov8/EpqfF20E0voP /LNAXfY3nWMp5AZxwcNmK/DB/e27zSq3ixjdPaodU04L7THZbDEOvBz9zKi3D2Ww1kqv a7yM+/yC/5XzpS1ijIqpaelCjPv7EI/PMxCPdwqGKoL3Q0KrSoRuBCc2Koy8xcy37+aW YS7n4a8sAUdqulLW8Yu/fUbT5L5uQqwbaJJfVyUBfyjXwBLoGEprbDY8tQwO+l7V+A5w DjoA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=vyVfW1YW; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i15si58797pfd.259.2019.08.14.10.08.59; Wed, 14 Aug 2019 10:09:16 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=vyVfW1YW; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729958AbfHNRHq (ORCPT + 99 others); Wed, 14 Aug 2019 13:07:46 -0400 Received: from mail.kernel.org ([198.145.29.99]:57332 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728866AbfHNRHn (ORCPT ); Wed, 14 Aug 2019 13:07:43 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 198172173E; Wed, 14 Aug 2019 17:07:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1565802462; bh=sGq5WL4OrlVm5sETWr0NMRgMXh1mIXO4iTxq/TmCj5c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vyVfW1YWP57GHIM8lCbCM4GBNSJFTY9GypWRF1hVps/ilJziJctfdxeceVsM4ExLk zb+jXXWfxZm+J9zSQjWAX863RWBROhsIX8K6QXXyAoAtVV7tFBsyrgShy5wsoVG4GF giIMjZxcz5WE3R0oaaUGLmdJPHz3Pw0EIl5aZ67A= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Trond Myklebust Subject: [PATCH 5.2 135/144] NFSv4: Check the return value of update_open_stateid() Date: Wed, 14 Aug 2019 19:01:31 +0200 Message-Id: <20190814165805.589869846@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190814165759.466811854@linuxfoundation.org> References: <20190814165759.466811854@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Trond Myklebust commit e3c8dc761ead061da2220ee8f8132f729ac3ddfe upstream. Ensure that we always check the return value of update_open_stateid() so that we can retry if the update of local state failed. This fixes infinite looping on state recovery. Fixes: e23008ec81ef3 ("NFSv4 reduce attribute requests for open reclaim") Signed-off-by: Trond Myklebust Cc: stable@vger.kernel.org # v3.7+ Signed-off-by: Greg Kroah-Hartman --- fs/nfs/nfs4proc.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c @@ -1878,8 +1878,9 @@ _nfs4_opendata_reclaim_to_nfs4_state(str if (data->o_res.delegation_type != 0) nfs4_opendata_check_deleg(data, state); update: - update_open_stateid(state, &data->o_res.stateid, NULL, - data->o_arg.fmode); + if (!update_open_stateid(state, &data->o_res.stateid, + NULL, data->o_arg.fmode)) + return ERR_PTR(-EAGAIN); refcount_inc(&state->count); return state; @@ -1944,8 +1945,11 @@ _nfs4_opendata_to_nfs4_state(struct nfs4 if (data->o_res.delegation_type != 0) nfs4_opendata_check_deleg(data, state); - update_open_stateid(state, &data->o_res.stateid, NULL, - data->o_arg.fmode); + if (!update_open_stateid(state, &data->o_res.stateid, + NULL, data->o_arg.fmode)) { + nfs4_put_open_state(state); + state = ERR_PTR(-EAGAIN); + } out: nfs_release_seqid(data->o_arg.seqid); return state;