nfsd: make delegations shutdown network namespace aware
authorStanislav Kinsbursky <skinsbursky@parallels.com>
Mon, 26 Nov 2012 12:22:03 +0000 (15:22 +0300)
committerJ. Bruce Fields <bfields@redhat.com>
Wed, 28 Nov 2012 15:13:50 +0000 (10:13 -0500)
NFSv4 delegations are stored in global list. But they are nfs4_client
dependent, which is network namespace aware already.
State shutdown and laundromat are done per network namespace as well.
So, delegations unhash have to be done in network namespace context.

Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
fs/nfsd/nfs4state.c

index 0e7e174de209d414fbab4d4c8cea1fefcd2a3723..bc2fc9f076fc8b00f0d9a7ad2386c497380757ad 100644 (file)
@@ -3230,6 +3230,8 @@ nfs4_laundromat(struct nfsd_net *nn)
        spin_lock(&recall_lock);
        list_for_each_safe(pos, next, &del_recall_lru) {
                dp = list_entry (pos, struct nfs4_delegation, dl_recall_lru);
+               if (net_generic(dp->dl_stid.sc_client->net, nfsd_net_id) != nn)
+                       continue;
                if (time_after((unsigned long)dp->dl_time, (unsigned long)cutoff)) {
                        u = dp->dl_time - cutoff;
                        if (test_val > u)
@@ -4922,6 +4924,8 @@ __nfs4_state_shutdown(struct net *net)
        spin_lock(&recall_lock);
        list_for_each_safe(pos, next, &del_recall_lru) {
                dp = list_entry (pos, struct nfs4_delegation, dl_recall_lru);
+               if (dp->dl_stid.sc_client->net != net)
+                       continue;
                list_move(&dp->dl_recall_lru, &reaplist);
        }
        spin_unlock(&recall_lock);