From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759154AbXFUEd0 (ORCPT ); Thu, 21 Jun 2007 00:33:26 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1756730AbXFUEba (ORCPT ); Thu, 21 Jun 2007 00:31:30 -0400 Received: from mx2.suse.de ([195.135.220.15]:59926 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757411AbXFUEb3 (ORCPT ); Thu, 21 Jun 2007 00:31:29 -0400 From: NeilBrown To: Andrew Morton Date: Thu, 21 Jun 2007 14:31:19 +1000 Message-Id: <1070621043119.1159@suse.de> X-face: [Gw_3E*Gng}4rRrKRYotwlE?.2|**#s9D Cc: "J. Bruce Fields" Cc: Neil Brown Subject: [PATCH 008 of 8] knfsd: nfsd4: don't delegate files that have had conflicts References: <20070621142604.727.patches@notabene> Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org From: "J. Bruce Fields" One more incremental delegation policy improvement: don't give out a delegation on a file if conflicting access has previously required that a delegation be revoked on that file. (In practice we'll forget about the conflict when the struct nfs4_file is removed on close, so this is of limited use for now, though it should at least solve a temporary problem with self-conflicts on write opens from the same client.) Signed-off-by: "J. Bruce Fields" Signed-off-by: Neil Brown ### Diffstat output ./fs/nfsd/nfs4state.c | 4 ++++ ./include/linux/nfsd/state.h | 1 + 2 files changed, 5 insertions(+) diff .prev/fs/nfsd/nfs4state.c ./fs/nfsd/nfs4state.c --- .prev/fs/nfsd/nfs4state.c 2007-06-21 14:14:47.000000000 +1000 +++ ./fs/nfsd/nfs4state.c 2007-06-21 14:16:21.000000000 +1000 @@ -194,6 +194,8 @@ alloc_init_deleg(struct nfs4_client *clp struct nfs4_callback *cb = &stp->st_stateowner->so_client->cl_callback; dprintk("NFSD alloc_init_deleg\n"); + if (fp->fi_had_conflict) + return NULL; if (num_delegations > max_delegations) return NULL; dp = kmem_cache_alloc(deleg_slab, GFP_KERNEL); @@ -1002,6 +1004,7 @@ alloc_init_file(struct inode *ino) list_add(&fp->fi_hash, &file_hashtbl[hashval]); fp->fi_inode = igrab(ino); fp->fi_id = current_fileid++; + fp->fi_had_conflict = false; return fp; } return NULL; @@ -1328,6 +1331,7 @@ do_recall(void *__dp) { struct nfs4_delegation *dp = __dp; + dp->dl_file->fi_had_conflict = true; nfsd4_cb_recall(dp); return 0; } diff .prev/include/linux/nfsd/state.h ./include/linux/nfsd/state.h --- .prev/include/linux/nfsd/state.h 2007-06-21 14:09:31.000000000 +1000 +++ ./include/linux/nfsd/state.h 2007-06-21 14:16:21.000000000 +1000 @@ -224,6 +224,7 @@ struct nfs4_file { struct inode *fi_inode; u32 fi_id; /* used with stateowner->so_id * for stateid_hashtbl hash */ + bool fi_had_conflict; }; /*