diff options
author | Meelap Shah <meelap@umich.edu> | 2007-07-17 07:04:40 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-07-17 13:23:07 -0400 |
commit | 47f9940c55c0bdc65188749cae4e841601f513bb (patch) | |
tree | ff24a78f815591d8309e368e504347371d96ef60 | |
parent | c2f1a551dea8b37c2e0cb886885c250fb703e9d8 (diff) |
knfsd: nfsd4: don't delegate files that have had conflicts
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" <bfields@citi.umich.edu>
Signed-off-by: Neil Brown <neilb@suse.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | fs/nfsd/nfs4state.c | 4 | ||||
-rw-r--r-- | include/linux/nfsd/state.h | 1 |
2 files changed, 5 insertions, 0 deletions
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index 46249886ea86..e4a4c87ec8c6 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c | |||
@@ -195,6 +195,8 @@ alloc_init_deleg(struct nfs4_client *clp, struct nfs4_stateid *stp, struct svc_f | |||
195 | struct nfs4_callback *cb = &stp->st_stateowner->so_client->cl_callback; | 195 | struct nfs4_callback *cb = &stp->st_stateowner->so_client->cl_callback; |
196 | 196 | ||
197 | dprintk("NFSD alloc_init_deleg\n"); | 197 | dprintk("NFSD alloc_init_deleg\n"); |
198 | if (fp->fi_had_conflict) | ||
199 | return NULL; | ||
198 | if (num_delegations > max_delegations) | 200 | if (num_delegations > max_delegations) |
199 | return NULL; | 201 | return NULL; |
200 | dp = kmem_cache_alloc(deleg_slab, GFP_KERNEL); | 202 | dp = kmem_cache_alloc(deleg_slab, GFP_KERNEL); |
@@ -1002,6 +1004,7 @@ alloc_init_file(struct inode *ino) | |||
1002 | list_add(&fp->fi_hash, &file_hashtbl[hashval]); | 1004 | list_add(&fp->fi_hash, &file_hashtbl[hashval]); |
1003 | fp->fi_inode = igrab(ino); | 1005 | fp->fi_inode = igrab(ino); |
1004 | fp->fi_id = current_fileid++; | 1006 | fp->fi_id = current_fileid++; |
1007 | fp->fi_had_conflict = false; | ||
1005 | return fp; | 1008 | return fp; |
1006 | } | 1009 | } |
1007 | return NULL; | 1010 | return NULL; |
@@ -1328,6 +1331,7 @@ do_recall(void *__dp) | |||
1328 | { | 1331 | { |
1329 | struct nfs4_delegation *dp = __dp; | 1332 | struct nfs4_delegation *dp = __dp; |
1330 | 1333 | ||
1334 | dp->dl_file->fi_had_conflict = true; | ||
1331 | nfsd4_cb_recall(dp); | 1335 | nfsd4_cb_recall(dp); |
1332 | return 0; | 1336 | return 0; |
1333 | } | 1337 | } |
diff --git a/include/linux/nfsd/state.h b/include/linux/nfsd/state.h index 732de9cad4a8..db348f749376 100644 --- a/include/linux/nfsd/state.h +++ b/include/linux/nfsd/state.h | |||
@@ -224,6 +224,7 @@ struct nfs4_file { | |||
224 | struct inode *fi_inode; | 224 | struct inode *fi_inode; |
225 | u32 fi_id; /* used with stateowner->so_id | 225 | u32 fi_id; /* used with stateowner->so_id |
226 | * for stateid_hashtbl hash */ | 226 | * for stateid_hashtbl hash */ |
227 | bool fi_had_conflict; | ||
227 | }; | 228 | }; |
228 | 229 | ||
229 | /* | 230 | /* |