[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Cluster-devel] Re: [NFS] [RFC PATCH 1/3] NLM lock failover - lock release



On Thu, 2006-06-29 at 14:11 -0400, Wendy Cheng wrote:
> The patch piggy-backs the logic into "rq_daddr" field of struct svc_rqst 
> where NFS server ip address is stored. Upon writing IPv4 address in 
> standard dot notation into /proc/fs/nfsd/nlm_unlock, the logic will 
> examine NLM's global nlm_files list and subsequently unlock the 
> associated file if server ip address matches.
> 
> Due to the size of rq_daddr (u32), we would not be able to support IPV6 
> for this round of changes. Another to-do item is to enable client:server 
> ip pairs to allow NFS V4 failover.
> 
> 
> 
> 
> plain text document attachment (gfs_nlm_unlock.patch)
>  fs/lockd/svcsubs.c          |   58 ++++++++++++++++++++++++++++++++++++++++----
>  fs/nfsd/nfsctl.c            |   54 ++++++++++++++++++++++++++++++++++++++++
>  include/linux/lockd/bind.h  |    5 +++
>  include/linux/lockd/lockd.h |    3 ++
>  net/sunrpc/svcsock.c        |    5 +++
>  5 files changed, 120 insertions(+), 5 deletions(-)
> 
> --- linux-2.6.17/include/linux/lockd/lockd.h	2006-06-17 21:49:35.000000000 -0400
> +++ linux-2.6.17-1/include/linux/lockd/lockd.h	2006-06-27 10:58:47.000000000 -0400
> @@ -105,6 +105,7 @@ struct nlm_file {
>  	unsigned int		f_count;	/* reference count */
>  	struct semaphore	f_sema;		/* avoid concurrent access */
>  	int		       	f_hash;		/* hash of f_handle */
> +	__u32			f_iaddr;	/* server ip for failover */
>  };
>  
>  /*
> @@ -133,6 +134,7 @@ struct nlm_block {
>  #define NLM_ACT_CHECK		0		/* check for locks */
>  #define NLM_ACT_MARK		1		/* mark & sweep */
>  #define NLM_ACT_UNLOCK		2		/* release all locks */
> +#define NLM_ACT_FO_UNLOCK	3		/* failover release locks */
>  
>  /*
>   * Global variables
> @@ -196,6 +198,7 @@ void		  nlm_release_file(struct nlm_file
>  void		  nlmsvc_mark_resources(void);
>  void		  nlmsvc_free_host_resources(struct nlm_host *);
>  void		  nlmsvc_invalidate_all(void);
> +int 		  nlmsvc_fo_unlock(struct in_addr *);
>  
>  static __inline__ struct inode *
>  nlmsvc_file_inode(struct nlm_file *file)
> --- linux-2.6.17/net/sunrpc/svcsock.c	2006-06-17 21:49:35.000000000 -0400
> +++ linux-2.6.17-1/net/sunrpc/svcsock.c	2006-06-27 10:58:47.000000000 -0400
> @@ -454,6 +454,7 @@ svc_recvfrom(struct svc_rqst *rqstp, str
>  	struct msghdr	msg;
>  	struct socket	*sock;
>  	int		len, alen;
> +	struct sockaddr_in   daddr;
>  
>  	rqstp->rq_addrlen = sizeof(rqstp->rq_addr);
>  	sock = rqstp->rq_sock->sk_sock;
> @@ -474,6 +475,10 @@ svc_recvfrom(struct svc_rqst *rqstp, str
>  	alen = sizeof(rqstp->rq_addr);
>  	sock->ops->getname(sock, (struct sockaddr *)&rqstp->rq_addr, &alen, 1);
>  
> +	/* add server ip for nlm lock failover */
> +	sock->ops->getname(sock, (struct sockaddr *)&daddr, &alen, 0);
> +	rqstp->rq_daddr = daddr.sin_addr.s_addr;
> +

Hmm.... Why would you want to do this on every receive when you could
just store the ip address in the struct svc_sock once and for all?

That said, how do you envisage this working in the cases where the
socket is bound to INADDR_ANY?

Cheers,
  Trond



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]