From patchwork Wed Sep 9 15:58:38 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew W Elble X-Patchwork-Id: 7147331 Return-Path: X-Original-To: patchwork-linux-nfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 762C89F314 for ; Wed, 9 Sep 2015 15:58:43 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 962852081C for ; Wed, 9 Sep 2015 15:58:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8865F20816 for ; Wed, 9 Sep 2015 15:58:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752283AbbIIP6j (ORCPT ); Wed, 9 Sep 2015 11:58:39 -0400 Received: from discipline.rit.edu ([129.21.6.207]:65348 "HELO discipline.rit.edu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1751495AbbIIP6j (ORCPT ); Wed, 9 Sep 2015 11:58:39 -0400 Received: (qmail 40446 invoked by uid 501); 9 Sep 2015 15:58:38 -0000 From: Andrew W Elble To: linux-nfs@vger.kernel.org Subject: Re: upgrade/downgrade race References: Date: Wed, 09 Sep 2015 11:58:38 -0400 In-Reply-To: (Andrew W. Elble's message of "Wed, 09 Sep 2015 09:37:31 -0400") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (berkeley-unix) 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, 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 Or, put into really half-baked (I've only spent an evening looking at nfs client code) terms, isn't something like this required? diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index 11fe5d7..15b8150 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c @@ -1923,8 +1923,16 @@ static void nfs4_open_done(struct rpc_task *task, void *calldata) renew_lease(data->o_res.server, data->timestamp); if (!(data->o_res.rflags & NFS4_OPEN_RESULT_CONFIRM)) nfs_confirm_seqid(&data->owner->so_seqid, 0); + + if (nfs4_stateid_is_newer(&data->state->open_stateid, &data->o_res.stateid) && + !can_open_cached(data->state, data->o_arg.fmode, data->o_arg.open_flags)) { + rpc_restart_call_prepare(task); + goto out; + } } data->rpc_done = 1; +out: + return; } static void nfs4_open_release(void *calldata)