summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorJeff Layton <jlayton@primarydata.com>2014-07-30 08:27:20 -0400
committerJ. Bruce Fields <bfields@redhat.com>2014-08-05 10:55:06 -0400
commit3738d50e7f6d04dd58d219cf9111bf927c17c6f2 (patch)
tree827de04966e2b6805b589022ee8ef3a6404289cf /fs
parent69fc9edf987ca451831575b1e5450a9fe49fbfe0 (diff)
nfsd: add a list_head arg to nfsd_foreach_client_lock
In a later patch, we'll want to collect the locks onto a list for later destruction. If "func" is defined and "collect" is defined, then we'll add the lock stateid to the list. Signed-off-by: Jeff Layton <jlayton@primarydata.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/nfsd/nfs4state.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index 226d89e2c7b2..b661294144ba 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -5811,6 +5811,7 @@ static void nfsd_print_count(struct nfs4_client *clp, unsigned int count,
}
static u64 nfsd_foreach_client_lock(struct nfs4_client *clp, u64 max,
+ struct list_head *collect,
void (*func)(struct nfs4_ol_stateid *))
{
struct nfs4_openowner *oop;
@@ -5823,8 +5824,12 @@ static u64 nfsd_foreach_client_lock(struct nfs4_client *clp, u64 max,
&oop->oo_owner.so_stateids, st_perstateowner) {
list_for_each_entry_safe(lst, lst_next,
&stp->st_locks, st_locks) {
- if (func)
+ if (func) {
func(lst);
+ if (collect)
+ list_add(&lst->st_locks,
+ collect);
+ }
if (++count == max)
return count;
}
@@ -5836,12 +5841,12 @@ static u64 nfsd_foreach_client_lock(struct nfs4_client *clp, u64 max,
u64 nfsd_forget_client_locks(struct nfs4_client *clp, u64 max)
{
- return nfsd_foreach_client_lock(clp, max, release_lock_stateid);
+ return nfsd_foreach_client_lock(clp, max, NULL, release_lock_stateid);
}
u64 nfsd_print_client_locks(struct nfs4_client *clp, u64 max)
{
- u64 count = nfsd_foreach_client_lock(clp, max, NULL);
+ u64 count = nfsd_foreach_client_lock(clp, max, NULL, NULL);
nfsd_print_count(clp, count, "locked files");
return count;
}