From patchwork Wed Mar 26 09:12:09 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kinglong Mee X-Patchwork-Id: 3892441 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 95CBB9F2E8 for ; Wed, 26 Mar 2014 09:12:18 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CCC632021A for ; Wed, 26 Mar 2014 09:12:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 08F0620219 for ; Wed, 26 Mar 2014 09:12:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751149AbaCZJMQ (ORCPT ); Wed, 26 Mar 2014 05:12:16 -0400 Received: from mail-oa0-f42.google.com ([209.85.219.42]:53835 "EHLO mail-oa0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751130AbaCZJMP (ORCPT ); Wed, 26 Mar 2014 05:12:15 -0400 Received: by mail-oa0-f42.google.com with SMTP id i4so2195155oah.29 for ; Wed, 26 Mar 2014 02:12:15 -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 :content-type:content-transfer-encoding; bh=4uEsZDw+YIClDXPzN5c9IHBAelCJILbLegC//6tDfbU=; b=prgyitML4Sgtr6N3lXlStuE4OgypRqHKCxEGtt0AuOOr0fLZu3eKTo7/faSoSwXnik zTImWz58+gAcbS4XvSCAUNjsF6Ii/Z3BRBZ56nUPtz5kaskjU5+LW487GHSXGwEcsB04 YvMtf/rulx7nz2qiiRP9qSuD/BfTYLdXYQFRllwo5G/FOOriqRAakNMPplYmt9ieFCm+ eZAedvgip7jnvLWXxhg7eydY7tuqiNMtOklSVipve7myaUAB6+b+Fh8fA471Tz6k2nsz PX4QEPl0MOQLHf+ScZbuFRp4rpNvDUI+39KqjDApxzRpS6b1tm58yq1i+yuVwCET/5HH MZNA== X-Received: by 10.182.165.3 with SMTP id yu3mr25317542obb.14.1395825135219; Wed, 26 Mar 2014 02:12:15 -0700 (PDT) Received: from [192.168.0.105] ([171.208.189.127]) by mx.google.com with ESMTPSA id wj7sm3807848obc.8.2014.03.26.02.12.12 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 26 Mar 2014 02:12:14 -0700 (PDT) Message-ID: <533299E9.6010806@gmail.com> Date: Wed, 26 Mar 2014 17:12:09 +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: bfields@fieldses.org CC: linux-nfs@vger.kernel.org Subject: [PATCH 2/2] NFSD: Re-initialize fh_post/pre_saved between two operations 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 SETATTR operation for one filehandle,the second SETATTR will cause the message. Because 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. This patch re-initialize fh_post/pre_saved between two operations. Signed-off-by: Kinglong Mee --- fs/nfsd/nfs4proc.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c index 550faf2..103d1ac 100644 --- a/fs/nfsd/nfs4proc.c +++ b/fs/nfsd/nfs4proc.c @@ -1356,6 +1356,9 @@ nfsd4_proc_compound(struct svc_rqst *rqstp, !(opdesc->op_flags & ALLOWED_ON_ABSENT_FS)) { op->status = nfserr_moved; goto encode_op; + } else { + current_fh->fh_post_saved = 0; + current_fh->fh_pre_saved = 0; } /* If op is non-idempotent */