summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBryan Schumaker <bjschuma@netapp.com>2011-12-14 20:39:56 +0100
committerJ. Bruce Fields <bfields@redhat.com>2011-12-14 23:38:00 +0100
commit2d3475c0ad625f7a43844a6cd0130d136416e604 (patch)
tree3f1317a2afcddf614dec6fe5e8dc36ef05a139a1
parentNFSD: Only reinitilize the recall_lru list under the recall lock (diff)
downloadlinux-2d3475c0ad625f7a43844a6cd0130d136416e604.tar.xz
linux-2d3475c0ad625f7a43844a6cd0130d136416e604.zip
NFSD: forget_delegations should use list_for_each_entry_safe
Otherwise the for loop could try to use a file recently removed from the file_hashtbl list and oops. Signed-off-by: Bryan Schumaker <bjschuma@netapp.com> Tested-by: Casey Bodley <cbodley@citi.umich.edu> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
-rw-r--r--fs/nfsd/nfs4state.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index 19ca9b54200b..7355fe405d69 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -4505,18 +4505,19 @@ void nfsd_forget_openowners(u64 num)
int nfsd_process_n_delegations(u64 num, void (*deleg_func)(struct nfs4_delegation *))
{
int i, count = 0;
- struct nfs4_file *fp;
- struct nfs4_delegation *dp, *next;
+ struct nfs4_file *fp, *fnext;
+ struct nfs4_delegation *dp, *dnext;
for (i = 0; i < FILE_HASH_SIZE; i++) {
- list_for_each_entry(fp, &file_hashtbl[i], fi_hash) {
- list_for_each_entry_safe(dp, next, &fp->fi_delegations, dl_perfile) {
+ list_for_each_entry_safe(fp, fnext, &file_hashtbl[i], fi_hash) {
+ list_for_each_entry_safe(dp, dnext, &fp->fi_delegations, dl_perfile) {
deleg_func(dp);
if (++count == num)
return count;
}
}
}
+
return count;
}