From patchwork Mon Jan 20 08:15:31 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: shaobingqing X-Patchwork-Id: 3511021 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 602EDC02DC for ; Mon, 20 Jan 2014 08:16:49 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8AB5D20160 for ; Mon, 20 Jan 2014 08:16:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 77ACC2013D for ; Mon, 20 Jan 2014 08:16:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751697AbaATIQp (ORCPT ); Mon, 20 Jan 2014 03:16:45 -0500 Received: from mx.bwstor.com.cn ([211.103.180.228]:35193 "EHLO mx.bwstor.cn" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751467AbaATIQp (ORCPT ); Mon, 20 Jan 2014 03:16:45 -0500 Received: from localhost (localhost [127.0.0.1]) by mx.bwstor.cn (Postfix) with ESMTP id BDE2565B85; Mon, 20 Jan 2014 16:16:19 +0800 (CST) Received: from mx.bwstor.cn ([127.0.0.1]) by localhost (mx1.bwstor.com.cn [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id hnunZYhUxfFD; Mon, 20 Jan 2014 16:16:19 +0800 (CST) Received: from linux-odmv.site (unknown [10.10.37.58]) by mx.bwstor.cn (Postfix) with ESMTPA id 89C5865B81; Mon, 20 Jan 2014 16:16:19 +0800 (CST) From: shaobingqing To: trond.myklebust@primarydata.com Cc: linux-nfs@vger.kernel.org, linux-kernel@vger.kernel.org, shaobingqing Subject: [PATCH] NFSv4.1: new layout stateid can not be overwrite by one out of date Date: Mon, 20 Jan 2014 16:15:31 +0800 Message-Id: <1390205731-21005-1-git-send-email-shaobingqing@bwstor.com.cn> X-Mailer: git-send-email 1.7.4.2 In-Reply-To: References: Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, 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 If initiate_file_draining returned NFS4ERR_DELAY, all the lsegs of a file might be released before the retrying cb_layout request arriving at the client. In this situation, layoutget request of the file will use open stateid to obtain a new layout stateid. And if the retrying cb_layout request arrived at the client after the layoutget reply, new layout stateid would be overwrite by one out of date. Signed-off-by: shaobingqing --- fs/nfs/callback_proc.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/fs/nfs/callback_proc.c b/fs/nfs/callback_proc.c index ae2e87b..98fed13 100644 --- a/fs/nfs/callback_proc.c +++ b/fs/nfs/callback_proc.c @@ -174,7 +174,9 @@ static u32 initiate_file_draining(struct nfs_client *clp, rv = NFS4ERR_DELAY; else rv = NFS4ERR_NOMATCHING_LAYOUT; - pnfs_set_layout_stateid(lo, &args->cbl_stateid, true); + if (memcmp(args->cbl_stateid.other, lo->plh_stateid.other, + NFS4_STATEID_OTHER_SIZE) == 0) + pnfs_set_layout_stateid(lo, &args->cbl_stateid, true); spin_unlock(&ino->i_lock); pnfs_free_lseg_list(&free_me_list); pnfs_put_layout_hdr(lo);