From patchwork Sat Mar 29 02:23:47 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kinglong Mee X-Patchwork-Id: 3908071 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.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 093B99F369 for ; Sat, 29 Mar 2014 02:24:22 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id ED2F820274 for ; Sat, 29 Mar 2014 02:24:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id ED53120256 for ; Sat, 29 Mar 2014 02:24:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751455AbaC2CX6 (ORCPT ); Fri, 28 Mar 2014 22:23:58 -0400 Received: from mail-pd0-f176.google.com ([209.85.192.176]:37134 "EHLO mail-pd0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751435AbaC2CX5 (ORCPT ); Fri, 28 Mar 2014 22:23:57 -0400 Received: by mail-pd0-f176.google.com with SMTP id r10so5573066pdi.21 for ; Fri, 28 Mar 2014 19:23:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=y8czxpXcxpshM8geWnPbm8AJa5A/enFQXRSd2LYeTC8=; b=THiTiWo8WON7dBycYU9V7hjICSAOR1+jKASEvBGv5ukOS5z56OpLTd+FdxCbzXb/kJ yicd/Juoj3v48jIACDz/cmSw1JzpZttjQxuCRVch2y7hGKgv+qDKqDaoADbIJTD4Nj/h N0urcXRAIYj44cP4P3ZWIhngw0Ub3/Or70EUV+1enAJXcmnc1oLC8VWlxyDZGpfE/Ndy jJa0U6F1cgDgPlYbL0BzPq6iHKkBZvXrVk9LMCnzIIMCMenWkqTTLJdDWqRsxpLPszWv QPEeg0jlCGdvy3aY+VTttPvvIL4z3u5SJddwsGmoqAHA8aQG9ZliCdCKX2wI7wqYzv37 3z1Q== X-Received: by 10.68.7.66 with SMTP id h2mr11919447pba.91.1396059837056; Fri, 28 Mar 2014 19:23:57 -0700 (PDT) Received: from [192.168.0.100] ([171.208.189.127]) by mx.google.com with ESMTPSA id cz3sm28042978pbc.9.2014.03.28.19.23.54 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 28 Mar 2014 19:23:55 -0700 (PDT) Message-ID: <53362EB3.2040809@gmail.com> Date: Sat, 29 Mar 2014 10:23:47 +0800 From: Kinglong Mee User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.4.0 MIME-Version: 1.0 To: "J. Bruce Fields" CC: linux-nfs@vger.kernel.org Subject: [PATCH v2] NFSD: Clear wcc data between compound ops References: <533299E9.6010806@gmail.com> <20140328211920.GD6041@fieldses.org> <5335FAB2.8050404@gmail.com> <20140329005831.GO6041@fieldses.org> In-Reply-To: <20140329005831.GO6041@fieldses.org> 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.2 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, 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 Testing NFS4.0 by pynfs, I got some messeages as, "nfsd: inode locked twice during operation." When one compound RPC contains two or more ops that locks the filehandle,the second op will cause the message. As two SETATTR ops, after the first SETATTR, nfsd will not call fh_put() to release current filehandle, it means filehandle have unlocked with fh_post_saved = 1. The second SETATTR find fh_post_saved = 1, and printk the message. v2: introduce helper fh_clear_wcc(). Signed-off-by: Kinglong Mee --- fs/nfsd/nfs4proc.c | 2 ++ fs/nfsd/nfsfh.h | 14 +++++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c index 550faf2..9849c61 100644 --- a/fs/nfsd/nfs4proc.c +++ b/fs/nfsd/nfs4proc.c @@ -1358,6 +1358,8 @@ nfsd4_proc_compound(struct svc_rqst *rqstp, goto encode_op; } + fh_clear_wcc(current_fh); + /* If op is non-idempotent */ if (opdesc->op_flags & OP_MODIFIES_SOMETHING) { plen = opdesc->op_rsize_bop(rqstp, op); diff --git a/fs/nfsd/nfsfh.h b/fs/nfsd/nfsfh.h index 4775bc4..ad67964 100644 --- a/fs/nfsd/nfsfh.h +++ b/fs/nfsd/nfsfh.h @@ -133,6 +133,17 @@ fh_init(struct svc_fh *fhp, int maxsize) #ifdef CONFIG_NFSD_V3 /* + * The wcc data stored in current_fh should be cleared + * between compound ops. + */ +static inline void +fh_clear_wcc(struct svc_fh *fhp) +{ + fhp->fh_post_saved = 0; + fhp->fh_pre_saved = 0; +} + +/* * Fill in the pre_op attr for the wcc data */ static inline void @@ -152,7 +163,8 @@ fill_pre_wcc(struct svc_fh *fhp) extern void fill_post_wcc(struct svc_fh *); #else -#define fill_pre_wcc(ignored) +#define fh_clear_wcc(ignored) +#define fill_pre_wcc(ignored) #define fill_post_wcc(notused) #endif /* CONFIG_NFSD_V3 */