From patchwork Thu Dec 13 06:37:16 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: ycnian@gmail.com X-Patchwork-Id: 1871371 Return-Path: X-Original-To: patchwork-linux-nfs@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 99E744006A for ; Thu, 13 Dec 2012 06:47:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751137Ab2LMGra (ORCPT ); Thu, 13 Dec 2012 01:47:30 -0500 Received: from mail-pa0-f46.google.com ([209.85.220.46]:40946 "EHLO mail-pa0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750720Ab2LMGra (ORCPT ); Thu, 13 Dec 2012 01:47:30 -0500 Received: by mail-pa0-f46.google.com with SMTP id bh2so1300707pad.19 for ; Wed, 12 Dec 2012 22:47:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer; bh=dqLalbfGNnwN5mVGuPAWnKfIiM8LUeT4IJJNUWuxzYY=; b=Z7uvXg7TE55SRUAny3tdN7J1HFsTWcnqvgvxR/eW8hubKVwkbNcRpHQy23OiOKYMQf 5XayQoMCmILvj2XKmj0bOTruLxpLAl47TkLzOv2Vy5vd772RmFpTOdqSqL7sWLa240OF oU5/QGeYadLHzxGWCnEHEdbXk87UZ6RUDJ5t6KgWoe7cctSiv08p6LfE2/K1qFv4PZlz M+wDmQUqeE+KiGpGDz+TvuMtxenvjLvashXwDGpkDZiP36FRExtHsqDCN5Z3yj3O9Uii AG60zkKLd2DT+/WYO61on5K1hMJmrROK9D+F3iNAB0fooQ2wpUJdo1UkNtlvdzKVDh6r hR9Q== Received: by 10.66.85.103 with SMTP id g7mr3532976paz.45.1355381249918; Wed, 12 Dec 2012 22:47:29 -0800 (PST) Received: from localhost ([159.226.5.131]) by mx.google.com with ESMTPS id wf8sm489107pbc.65.2012.12.12.22.47.27 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 12 Dec 2012 22:47:29 -0800 (PST) From: ycnian@gmail.com To: Trond.Myklebust@netapp.com Cc: linux-kernel@vger.kernel.org, linux-nfs@vger.kernel.org, Yanchuan Nian Subject: [PATCH] nfs: Don't return referenced delegations Date: Thu, 13 Dec 2012 14:37:16 +0800 Message-Id: <1355380636-10915-1-git-send-email-ycnian@gmail.com> X-Mailer: git-send-email 1.7.4.4 Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org From: Yanchuan Nian The client returns unreferenced delegations in state management. It scans all delegations and tests the NFS_DELEGATION_REFERENCED flag. if this flag is not set, NFS_DELEGATION_RETURN will be set and the delegation will be returned. But unfortunately NFS_DELEGATION_REFERENCED is cleared after the testing, so delegations which are still being used will be returned in the next state management. Signed-off-by: Yanchuan Nian --- fs/nfs/delegation.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/fs/nfs/delegation.c b/fs/nfs/delegation.c index 81c5eec..485e8c0 100644 --- a/fs/nfs/delegation.c +++ b/fs/nfs/delegation.c @@ -506,7 +506,7 @@ static void nfs_mark_return_unreferenced_delegations(struct nfs_server *server) struct nfs_delegation *delegation; list_for_each_entry_rcu(delegation, &server->delegations, super_list) { - if (test_and_clear_bit(NFS_DELEGATION_REFERENCED, &delegation->flags)) + if (test_bit(NFS_DELEGATION_REFERENCED, &delegation->flags)) continue; nfs_mark_return_delegation(server, delegation); }