[sheepdog] [PATCH] sbd: use kernel_setsockopt helper

Hitoshi Mitake mitake.hitoshi at gmail.com
Tue May 5 02:16:40 CEST 2015


At Mon,  4 May 2015 16:46:17 +0800,
Liu Yuan wrote:
> 
> From: Liu Yuan <liuyuan at cmss.chinamobile.com>
> 
> Signed-off-by: Liu Yuan <liuyuan at cmss.chinamobile.com>
> ---
>  sbd/sheep.c | 13 ++++---------
>  1 file changed, 4 insertions(+), 9 deletions(-)

Applied, thanks.
Hitoshi

> 
> diff --git a/sbd/sheep.c b/sbd/sheep.c
> index bfc935b..8b74b59 100644
> --- a/sbd/sheep.c
> +++ b/sbd/sheep.c
> @@ -34,7 +34,6 @@ static struct sbd_device *sheep_aiocb_to_device(struct sheep_aiocb *aiocb)
>  static int socket_create(struct socket **sock, const char *ip_addr, int port)
>  {
>  	struct sockaddr_in addr;
> -	mm_segment_t oldmm = get_fs();
>  	struct linger linger_opt = {1, 0};
>  	int ret, nodelay = 1;
>  
> @@ -44,19 +43,15 @@ static int socket_create(struct socket **sock, const char *ip_addr, int port)
>  		return ret;
>  	}
>  
> -	set_fs(KERNEL_DS);
> -	ret = sock_setsockopt(*sock, SOL_SOCKET, SO_LINGER,
> -			      (char *)&linger_opt, sizeof(linger_opt));
> -	set_fs(oldmm);
> +	ret = kernel_setsockopt(*sock, SOL_SOCKET, SO_LINGER,
> +				(char *)&linger_opt, sizeof(linger_opt));
>  	if (ret != 0) {
>  		pr_err("Can't set SO_LINGER: %d\n", ret);
>  		goto shutdown;
>  	}
>  
> -	set_fs(KERNEL_DS);
> -	ret = sock_setsockopt(*sock, SOL_TCP, TCP_NODELAY,
> -			      (char *)&nodelay, sizeof(nodelay));
> -	set_fs(oldmm);
> +	ret = kernel_setsockopt(*sock, SOL_TCP, TCP_NODELAY,
> +				(char *)&nodelay, sizeof(nodelay));
>  	if (ret != 0) {
>  		pr_err("Can't set nodelay: %d\n", ret);
>  		goto shutdown;
> -- 
> 1.9.1
> 
> -- 
> sheepdog mailing list
> sheepdog at lists.wpkg.org
> https://lists.wpkg.org/mailman/listinfo/sheepdog



More information about the sheepdog mailing list