Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1162676imm; Wed, 1 Aug 2018 11:13:04 -0700 (PDT) X-Google-Smtp-Source: AAOMgpc3KIJWR7n3/m055YyS5roObzG/CTZVCq1h5rqSObwJ5y8i7nJcFU0zHYWj7xaN9d6II3nk X-Received: by 2002:a63:6949:: with SMTP id e70-v6mr26312718pgc.119.1533147184053; Wed, 01 Aug 2018 11:13:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533147184; cv=none; d=google.com; s=arc-20160816; b=ylFXJ5yqg2WWJ7+d471eHQJ3jJ3gifa2aP3SWd6LOxbzsle15KlDTVUv3n7nYlhReB LwSldsRnkP8nB8XW7U/AW3g4gQrHqbppfqeGzSo0WyE20COBtBelsG+CU0G0ENEEDlmS xSYMB3pYtrhmuBk8h4A5jjA03R0UCTx8WvhYXpxr7BKu4tdiZgX4K5ln1W9R8UyV2FyH a1kFTuQS1rG9D8bBAFMtf1txEhsagsODGB2uuV9YeejKK1An1wFIRadNce7kVl66H2tf eFbgceXuAEyk0UziQpnLwcff4p2HTUN7oD7hgVOZ1q7j3kXfdoCv0FniLXnnuayQ+oQV MN9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=P9lHC7/Lx6Nbg5lIIspEGQu3EEKTP0gveqUOLb/qgCM=; b=sfkBo6ycqHZJQlG/Qh8TQUPtdZnG0EShf6Nbd/OyTnW/a1AoSifec7wpC67pDlKJaV mAZkIOxBfNIQaONfImS3xVbV7z34BbCbuhj849MCvdZkAGf1R96HuEBfh8sXzqfY663E 89czqj/S9scgvIlbfNcI1jeNnUoit5ASi7LaNfShxpDHXMYRYud9oBk/CP/Wslbb5rGH e5Z3ubdkOqcgQJOikSfePp8fsEchcOGQKoXm1fmKxw8tQlXwhZNwJGHSd0cS76aeWlAb TIGOorlVyl/FKydABFi0I+cnGCaiE3blOiJDHCjcUm+4PUVOv/D2aICuhGNsdpf4C65h 7yag== ARC-Authentication-Results: i=1; mx.google.com; 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 q30-v6si15747678pgk.253.2018.08.01.11.12.49; Wed, 01 Aug 2018 11:13:04 -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; 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 S1732519AbeHAT6u (ORCPT + 99 others); Wed, 1 Aug 2018 15:58:50 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:50082 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2405709AbeHATIf (ORCPT ); Wed, 1 Aug 2018 15:08:35 -0400 Received: from localhost (D57E6652.static.ziggozakelijk.nl [213.126.102.82]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id C84FD1393; Wed, 1 Aug 2018 17:14:34 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Trond Myklebust , Sasha Levin Subject: [PATCH 4.14 054/246] pnfs: Dont release the sequence slot until weve processed layoutget on open Date: Wed, 1 Aug 2018 18:49:24 +0200 Message-Id: <20180801165014.300306695@linuxfoundation.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180801165011.700991984@linuxfoundation.org> References: <20180801165011.700991984@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Trond Myklebust [ Upstream commit ae55e59da0e401893b3c52b575fc18a00623d0a1 ] If the server recalls the layout that was just handed out, we risk hitting a race as described in RFC5661 Section 2.10.6.3 unless we ensure that we release the sequence slot after processing the LAYOUTGET operation that was sent as part of the OPEN compound. Signed-off-by: Trond Myklebust Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- fs/nfs/nfs4proc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c @@ -2695,7 +2695,7 @@ static int _nfs4_open_and_get_state(stru if (ret != 0) goto out; - state = nfs4_opendata_to_nfs4_state(opendata); + state = _nfs4_opendata_to_nfs4_state(opendata); ret = PTR_ERR(state); if (IS_ERR(state)) goto out; @@ -2731,6 +2731,7 @@ static int _nfs4_open_and_get_state(stru nfs4_schedule_stateid_recovery(server, state); } out: + nfs4_sequence_free_slot(&opendata->o_res.seq_res); return ret; }