mirror of https://gitee.com/openkylin/linux.git
staging/lustre/libcfs: revert changes to libcfs_sock_ioctl
Changes introduced by 80db2734ac
unfortunately totally break lustre, we use this function
to access not only socket proto obs, but also device ioctl
like SIOCGIFCONF that now fail.
Reverting part of the previous patch to regain the needed
functionality.
Signed-off-by: Oleg Drokin <green@linuxhacker.ru>
CC: Fredrick John Berchmans <fredrickprashanth@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
1cd683a814
commit
3eeb821eff
|
@ -46,16 +46,31 @@
|
||||||
int
|
int
|
||||||
libcfs_sock_ioctl(int cmd, unsigned long arg)
|
libcfs_sock_ioctl(int cmd, unsigned long arg)
|
||||||
{
|
{
|
||||||
|
mm_segment_t oldmm = get_fs();
|
||||||
struct socket *sock;
|
struct socket *sock;
|
||||||
int rc;
|
int rc;
|
||||||
|
struct file *sock_filp;
|
||||||
|
|
||||||
rc = sock_create (PF_INET, SOCK_STREAM, 0, &sock);
|
rc = sock_create (PF_INET, SOCK_STREAM, 0, &sock);
|
||||||
if (rc != 0) {
|
if (rc != 0) {
|
||||||
CERROR ("Can't create socket: %d\n", rc);
|
CERROR ("Can't create socket: %d\n", rc);
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
rc = kernel_sock_ioctl(sock, cmd, arg);
|
|
||||||
sock_release(sock);
|
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:
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue