From patchwork Thu Aug 8 02:59:37 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: NeilBrown X-Patchwork-Id: 2840714 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 17D119F487 for ; Thu, 8 Aug 2013 02:59:53 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4B06F20217 for ; Thu, 8 Aug 2013 02:59:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8E109201FB for ; Thu, 8 Aug 2013 02:59:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757591Ab3HHC7t (ORCPT ); Wed, 7 Aug 2013 22:59:49 -0400 Received: from cantor2.suse.de ([195.135.220.15]:53534 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757555Ab3HHC7t (ORCPT ); Wed, 7 Aug 2013 22:59:49 -0400 Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id E7380A4EB7 for ; Thu, 8 Aug 2013 04:59:47 +0200 (CEST) Date: Thu, 8 Aug 2013 12:59:37 +1000 From: NeilBrown To: NFS Subject: [PATCH/RFC] remove incorrect "Lock reclaim failed" warning when delegation is in force. Message-ID: <20130808125937.126d8ef1@notabene.brown> X-Mailer: Claws Mail 3.9.0 (GTK+ 2.24.18; x86_64-suse-linux-gnu) 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, RP_MATCHES_RCVD, T_TVD_MIME_EPI, UNPARSEABLE_RELAY autolearn=unavailable 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 Hi, I'm trying to track down a strange problem with state ids going bad (possibly linked to ntp changing the system time on the non-Linux server) and am still learning about how the state management works. But I've come across an error where I don't think there should be one. For whatever reason the client gets a BAD_STATEID on a file that it has a lock on. The open gets a write delegation so that when it runs nfs4_reclaim_locks(), nfs4_lock_reclaim aborts early without doing anything (it doesn't need to because there is a delegation). But the code below then checks that NFS_LOCK_INITIALIZED is set on all lock states. But it isn't because nfs4_clear_open_state cleared it and nfs4_lock_reclaim didn't bother setting it. So I think the error should only be printed if there is no delegated state, hence this patch. Does it look right, or have I misunderstood something? Thanks, NeilBrown diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c index 1fab140..1876ee7 100644 --- a/fs/nfs/nfs4state.c +++ b/fs/nfs/nfs4state.c @@ -1444,14 +1444,16 @@ restart: if (status >= 0) { status = nfs4_reclaim_locks(state, ops); if (status >= 0) { - spin_lock(&state->state_lock); - list_for_each_entry(lock, &state->lock_states, ls_locks) { - if (!test_bit(NFS_LOCK_INITIALIZED, &lock->ls_flags)) - pr_warn_ratelimited("NFS: " - "%s: Lock reclaim " - "failed!\n", __func__); + if (test_bit(NFS_DELEGATED_STATE, &state->flags) != 0) { + spin_lock(&state->state_lock); + list_for_each_entry(lock, &state->lock_states, ls_locks) { + if (!test_bit(NFS_LOCK_INITIALIZED, &lock->ls_flags)) + pr_warn_ratelimited("NFS: " + "%s: Lock reclaim " + "failed!\n", __func__); + } + spin_unlock(&state->state_lock); } - spin_unlock(&state->state_lock); nfs4_put_open_state(state); spin_lock(&sp->so_lock); goto restart;