Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 29fba38b authored by Benny Halevy's avatar Benny Halevy
Browse files

nfs41: lease renewal



Send a NFSv4.1 SEQUENCE op rather than RENEW that was deprecated in
minorversion 1.
Use the nfs_client minorversion to select reboot_recover/
network_partition_recovery/state_renewal ops.

Note: we use reclaimer to create the nfs41 session before there are any
cl_superblocks for the nfs_client.

Signed-off-by: default avatarBenny Halevy <bhalevy@panasas.com>
[nfs41: check for session not minorversion]
Signed-off-by: default avatarAndy Adamson <andros@netapp.com>
Signed-off-by: default avatarBenny Halevy <bhalevy@panasas.com>
[revamped patch for new nfs4_state_manager design]
Signed-off-by: default avatarBenny Halevy <bhalevy@panasas.com>
[nfs41: obliterate nfs4_state_recovery_ops.renew_lease method]
    moved to nfs4_state_maintenance_ops
[also undid per-minorversion nfs4_state_recovery_ops here]
Signed-off-by: default avatarBenny Halevy <bhalevy@panasas.com>
Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
parent b069d94a
Loading
Loading
Loading
Loading
+6 −0
Original line number Original line Diff line number Diff line
@@ -180,6 +180,10 @@ struct nfs4_state_recovery_ops {
	int (*recover_lock)(struct nfs4_state *, struct file_lock *);
	int (*recover_lock)(struct nfs4_state *, struct file_lock *);
};
};


struct nfs4_state_maintenance_ops {
	int (*sched_state_renewal)(struct nfs_client *, struct rpc_cred *);
};

extern const struct dentry_operations nfs4_dentry_operations;
extern const struct dentry_operations nfs4_dentry_operations;
extern const struct inode_operations nfs4_dir_inode_operations;
extern const struct inode_operations nfs4_dir_inode_operations;


@@ -220,6 +224,8 @@ static inline int nfs4_setup_sequence(struct nfs_client *clp,
}
}
#endif /* CONFIG_NFS_V4_1 */
#endif /* CONFIG_NFS_V4_1 */


extern struct nfs4_state_maintenance_ops *nfs4_state_renewal_ops[];

extern const u32 nfs4_fattr_bitmap[2];
extern const u32 nfs4_fattr_bitmap[2];
extern const u32 nfs4_statfs_bitmap[2];
extern const u32 nfs4_statfs_bitmap[2];
extern const u32 nfs4_pathconf_bitmap[2];
extern const u32 nfs4_pathconf_bitmap[2];
+24 −0
Original line number Original line Diff line number Diff line
@@ -3016,6 +3016,9 @@ static void nfs4_renew_done(struct rpc_task *task, void *data)
	if (time_before(clp->cl_last_renewal,timestamp))
	if (time_before(clp->cl_last_renewal,timestamp))
		clp->cl_last_renewal = timestamp;
		clp->cl_last_renewal = timestamp;
	spin_unlock(&clp->cl_lock);
	spin_unlock(&clp->cl_lock);
	dprintk("%s calling put_rpccred on rpc_cred %p\n", __func__,
				task->tk_msg.rpc_cred);
	put_rpccred(task->tk_msg.rpc_cred);
}
}


static const struct rpc_call_ops nfs4_renew_ops = {
static const struct rpc_call_ops nfs4_renew_ops = {
@@ -4790,6 +4793,27 @@ struct nfs4_state_recovery_ops nfs4_nograce_recovery_ops = {
	.recover_lock	= nfs4_lock_expired,
	.recover_lock	= nfs4_lock_expired,
};
};


struct nfs4_state_maintenance_ops nfs40_state_renewal_ops = {
	.sched_state_renewal = nfs4_proc_async_renew,
};

#if defined(CONFIG_NFS_V4_1)
struct nfs4_state_maintenance_ops nfs41_state_renewal_ops = {
	.sched_state_renewal = nfs41_proc_async_sequence,
};
#endif

/*
 * Per minor version reboot and network partition recovery ops
 */

struct nfs4_state_maintenance_ops *nfs4_state_renewal_ops[] = {
	&nfs40_state_renewal_ops,
#if defined(CONFIG_NFS_V4_1)
	&nfs41_state_renewal_ops,
#endif
};

static const struct inode_operations nfs4_file_inode_operations = {
static const struct inode_operations nfs4_file_inode_operations = {
	.permission	= nfs_permission,
	.permission	= nfs_permission,
	.getattr	= nfs_getattr,
	.getattr	= nfs_getattr,
+3 −1
Original line number Original line Diff line number Diff line
@@ -59,12 +59,14 @@
void
void
nfs4_renew_state(struct work_struct *work)
nfs4_renew_state(struct work_struct *work)
{
{
	struct nfs4_state_maintenance_ops *ops;
	struct nfs_client *clp =
	struct nfs_client *clp =
		container_of(work, struct nfs_client, cl_renewd.work);
		container_of(work, struct nfs_client, cl_renewd.work);
	struct rpc_cred *cred;
	struct rpc_cred *cred;
	long lease, timeout;
	long lease, timeout;
	unsigned long last, now;
	unsigned long last, now;


	ops = nfs4_state_renewal_ops[clp->cl_minorversion];
	dprintk("%s: start\n", __func__);
	dprintk("%s: start\n", __func__);
	/* Are there any active superblocks? */
	/* Are there any active superblocks? */
	if (list_empty(&clp->cl_superblocks))
	if (list_empty(&clp->cl_superblocks))
@@ -86,7 +88,7 @@ nfs4_renew_state(struct work_struct *work)
			nfs_expire_all_delegations(clp);
			nfs_expire_all_delegations(clp);
		} else {
		} else {
			/* Queue an asynchronous RENEW. */
			/* Queue an asynchronous RENEW. */
			nfs4_proc_async_renew(clp, cred);
			ops->sched_state_renewal(clp, cred);
			put_rpccred(cred);
			put_rpccred(cred);
		}
		}
		timeout = (2 * lease) / 3;
		timeout = (2 * lease) / 3;