Commit d3978bb3 authored by Chuck Lever's avatar Chuck Lever Committed by Trond Myklebust

NFS: Move cl_delegations to the nfs_server struct

Delegations are per-inode, not per-nfs_client.  When a server file
system is migrated, delegations on the client must be moved from the
source to the destination nfs_server.  Make it easier to manage a
mount point's delegation list across a migration event by moving the
list to the nfs_server struct.

Clean up: I added documenting comments to public functions I changed
in this patch.  For consistency I added comments to all the other
public functions in fs/nfs/delegation.c.
Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
parent dda4b225
...@@ -172,7 +172,6 @@ static struct nfs_client *nfs_alloc_client(const struct nfs_client_initdata *cl_ ...@@ -172,7 +172,6 @@ static struct nfs_client *nfs_alloc_client(const struct nfs_client_initdata *cl_
if (err) if (err)
goto error_cleanup; goto error_cleanup;
INIT_LIST_HEAD(&clp->cl_delegations);
spin_lock_init(&clp->cl_lock); spin_lock_init(&clp->cl_lock);
INIT_DELAYED_WORK(&clp->cl_renewd, nfs4_renew_state); INIT_DELAYED_WORK(&clp->cl_renewd, nfs4_renew_state);
rpc_init_wait_queue(&clp->cl_rpcwaitq, "NFS client"); rpc_init_wait_queue(&clp->cl_rpcwaitq, "NFS client");
...@@ -1040,6 +1039,7 @@ static struct nfs_server *nfs_alloc_server(void) ...@@ -1040,6 +1039,7 @@ static struct nfs_server *nfs_alloc_server(void)
/* Zero out the NFS state stuff */ /* Zero out the NFS state stuff */
INIT_LIST_HEAD(&server->client_link); INIT_LIST_HEAD(&server->client_link);
INIT_LIST_HEAD(&server->master_link); INIT_LIST_HEAD(&server->master_link);
INIT_LIST_HEAD(&server->delegations);
atomic_set(&server->active, 0); atomic_set(&server->active, 0);
......
This diff is collapsed.
...@@ -44,6 +44,7 @@ void nfs_expire_all_delegation_types(struct nfs_client *clp, fmode_t flags); ...@@ -44,6 +44,7 @@ void nfs_expire_all_delegation_types(struct nfs_client *clp, fmode_t flags);
void nfs_expire_unreferenced_delegations(struct nfs_client *clp); void nfs_expire_unreferenced_delegations(struct nfs_client *clp);
void nfs_handle_cb_pathdown(struct nfs_client *clp); void nfs_handle_cb_pathdown(struct nfs_client *clp);
int nfs_client_return_marked_delegations(struct nfs_client *clp); int nfs_client_return_marked_delegations(struct nfs_client *clp);
int nfs_delegations_present(struct nfs_client *clp);
void nfs_delegation_mark_reclaim(struct nfs_client *clp); void nfs_delegation_mark_reclaim(struct nfs_client *clp);
void nfs_delegation_reap_unclaimed(struct nfs_client *clp); void nfs_delegation_reap_unclaimed(struct nfs_client *clp);
......
...@@ -80,7 +80,7 @@ nfs4_renew_state(struct work_struct *work) ...@@ -80,7 +80,7 @@ nfs4_renew_state(struct work_struct *work)
cred = ops->get_state_renewal_cred_locked(clp); cred = ops->get_state_renewal_cred_locked(clp);
spin_unlock(&clp->cl_lock); spin_unlock(&clp->cl_lock);
if (cred == NULL) { if (cred == NULL) {
if (list_empty(&clp->cl_delegations)) { if (!nfs_delegations_present(clp)) {
set_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state); set_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state);
goto out; goto out;
} }
......
...@@ -47,7 +47,6 @@ struct nfs_client { ...@@ -47,7 +47,6 @@ struct nfs_client {
u64 cl_clientid; /* constant */ u64 cl_clientid; /* constant */
unsigned long cl_state; unsigned long cl_state;
struct list_head cl_delegations;
spinlock_t cl_lock; spinlock_t cl_lock;
unsigned long cl_lease_time; unsigned long cl_lease_time;
...@@ -152,6 +151,7 @@ struct nfs_server { ...@@ -152,6 +151,7 @@ struct nfs_server {
struct rb_root openowner_id; struct rb_root openowner_id;
struct rb_root lockowner_id; struct rb_root lockowner_id;
#endif #endif
struct list_head delegations;
void (*destroy)(struct nfs_server *); void (*destroy)(struct nfs_server *);
atomic_t active; /* Keep trace of any activity to this server */ atomic_t active; /* Keep trace of any activity to this server */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment