Subject: Re: linux-next: build failure after merge of the net-next tree

From: Ursula Braun <[email-masked]>
Date: Tue, 10 Jan 2017 16:14:25 +0100

ACK - smc_splice_read() is just a place holder at the moment. Its implementation for AF_SMC will follow.

Regards, Ursula Braun

On 01/10/2017 12:59 AM, Stephen Rothwell wrote:
> Hi all,
> 
> After merging the net-next tree, today's linux-next build (x86_64
> allmodconfig) failed like this:
> 
> net/smc/af_smc.c: In function 'smc_splice_read':
> net/smc/af_smc.c:1258:39: error: passing argument 1 of 'smc->clcsock->ops->splice_read' from incompatible pointer type [-Werror=incompatible-pointer-types]
>    rc = smc->clcsock->ops->splice_read(smc->clcsock, ppos,
>                                        ^
> net/smc/af_smc.c:1258:39: note: expected 'struct file *' but argument is of type 'struct socket *'
> net/smc/af_smc.c: At top level:
> net/smc/af_smc.c:1288:17: error: initialization from incompatible pointer type [-Werror=incompatible-pointer-types]
>   .splice_read = smc_splice_read,   
>                  ^
> net/smc/af_smc.c:1288:17: note: (near initialization for 'smc_sock_ops.splice_read')
> 
> Caused by commit
> 
>   ac7138746e14 ("smc: establish new socket family")
> 
> interacting with commit
> 
>   15a8f657c71d ("switch socket ->splice_read() to struct file *")
> 
> from the vfs tree.
> 
> I applied the following merge fix patch which could well be incorrect ...
> 
> From: Stephen Rothwell <[email-masked]>
> Date: Tue, 10 Jan 2017 10:52:38 +1100
> Subject: [PATCH] smc: merge fix for "switch socket ->splice_read() to struct file *"
> 
> Signed-off-by: Stephen Rothwell <[email-masked]>
> ---
>  net/smc/af_smc.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/net/smc/af_smc.c b/net/smc/af_smc.c
> index 5d4208ad029e..4875e65f0c4a 100644
> --- a/net/smc/af_smc.c
> +++ b/net/smc/af_smc.c
> @@ -1242,10 +1242,11 @@ static ssize_t smc_sendpage(struct socket *sock, struct page *page,
>  	return rc;
>  }
> 
> -static ssize_t smc_splice_read(struct socket *sock, loff_t *ppos,
> +static ssize_t smc_splice_read(struct file *file, loff_t *ppos,
>  			       struct pipe_inode_info *pipe, size_t len,
>  				    unsigned int flags)
>  {
> +	struct socket *sock = file->private_data;
>  	struct sock *sk = sock->sk;
>  	struct smc_sock *smc;
>  	int rc = -ENOTCONN;
> @@ -1255,7 +1256,7 @@ static ssize_t smc_splice_read(struct socket *sock, loff_t *ppos,
>  	if ((sk->sk_state != SMC_ACTIVE) && (sk->sk_state != SMC_CLOSED))
>  		goto out;
>  	if (smc->use_fallback) {
> -		rc = smc->clcsock->ops->splice_read(smc->clcsock, ppos,
> +		rc = smc->clcsock->ops->splice_read(file, ppos,
>  						    pipe, len, flags);
>  	} else {
>  		rc = -EOPNOTSUPP;
>