2014-06-22 17:42:16

by Oleg Drokin

[permalink] [raw]
Subject: Re: [PATCH] staging: lustre use kernel socket sockopt apis

So I came back to this patch (now part of Greg's tree)

On May 2, 2014, at 10:50 PM, Fredrick John Berchmans wrote:

> Change old way of ops->setsockopt or ops->getsockopt in kernel
> to kernel_setsockopt or kernel_getsockopt.
>
> --- a/drivers/staging/lustre/lustre/libcfs/linux/linux-tcpip.c
> +++ b/drivers/staging/lustre/lustre/libcfs/linux/linux-tcpip.c
> @@ -56,21 +56,8 @@ libcfs_sock_ioctl(int cmd, unsigned long arg)
> CERROR ("Can't create socket: %d\n", rc);
> return rc;
> }
> -
> - sock_filp = sock_alloc_file(sock, 0, NULL);
> - if (IS_ERR(sock_filp)) {
> - sock_release(sock);
> - rc = PTR_ERR(sock_filp);
> - goto out;
> - }
> -
> - set_fs(KERNEL_DS);
> - if (sock_filp->f_op->unlocked_ioctl)
> - rc = sock_filp->f_op->unlocked_ioctl(sock_filp, cmd, arg);
> - set_fs(oldmm);
> -
> - fput(sock_filp);
> -out:
> + rc = kernel_sock_ioctl(sock, cmd, arg);
> + sock_release(sock);
> return rc;
> }

This part totally breaks lustre, we use this to also call things like SIOCGIFCONF that are not available from socket proto_ops because this is really coming from dev_ioctl and I do not see any better way to access it.
So I'd like this to be reverted or if there is a better way to access this, I am interested to learn it.

Bye,
Oleg-