Commit 1e4db2b3 authored by Peng Tao's avatar Peng Tao Committed by Greg Kroah-Hartman

staging/lustre: fix LBUG and inode refcount bug

ldlm_proc_setup and ldlm_proc_cleanup should reset global
pde pointers otherwise remount may hit
LASSERT(ldlm_ns_proc_dir == NULL);

Also in libcfs_sock_ioctl, fput() includes itself sock_release.
So don't call sock_release twice otherwise kernel may oops
due to incorrect inode ref counting.
Signed-off-by: default avatarPeng Tao <tao.peng@emc.com>
Signed-off-by: default avatarAndreas Dilger <andreas.dilger@intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 73bb1da6
...@@ -130,6 +130,8 @@ int ldlm_proc_setup(void) ...@@ -130,6 +130,8 @@ int ldlm_proc_setup(void)
lprocfs_remove(&ldlm_type_proc_dir); lprocfs_remove(&ldlm_type_proc_dir);
err: err:
ldlm_svc_proc_dir = NULL; ldlm_svc_proc_dir = NULL;
ldlm_type_proc_dir = NULL;
ldlm_ns_proc_dir = NULL;
RETURN(rc); RETURN(rc);
} }
...@@ -143,6 +145,10 @@ void ldlm_proc_cleanup(void) ...@@ -143,6 +145,10 @@ void ldlm_proc_cleanup(void)
if (ldlm_type_proc_dir) if (ldlm_type_proc_dir)
lprocfs_remove(&ldlm_type_proc_dir); lprocfs_remove(&ldlm_type_proc_dir);
ldlm_svc_proc_dir = NULL;
ldlm_type_proc_dir = NULL;
ldlm_ns_proc_dir = NULL;
} }
static int lprocfs_ns_resources_seq_show(struct seq_file *m, void *v) static int lprocfs_ns_resources_seq_show(struct seq_file *m, void *v)
......
...@@ -49,7 +49,6 @@ libcfs_sock_ioctl(int cmd, unsigned long arg) ...@@ -49,7 +49,6 @@ libcfs_sock_ioctl(int cmd, unsigned long arg)
{ {
mm_segment_t oldmm = get_fs(); mm_segment_t oldmm = get_fs();
struct socket *sock; struct socket *sock;
int fd = -1;
int rc; int rc;
struct file *sock_filp; struct file *sock_filp;
...@@ -61,6 +60,7 @@ libcfs_sock_ioctl(int cmd, unsigned long arg) ...@@ -61,6 +60,7 @@ libcfs_sock_ioctl(int cmd, unsigned long arg)
sock_filp = sock_alloc_file(sock, 0, NULL); sock_filp = sock_alloc_file(sock, 0, NULL);
if (!sock_filp) { if (!sock_filp) {
sock_release(sock);
rc = -ENOMEM; rc = -ENOMEM;
goto out; goto out;
} }
...@@ -71,12 +71,7 @@ libcfs_sock_ioctl(int cmd, unsigned long arg) ...@@ -71,12 +71,7 @@ libcfs_sock_ioctl(int cmd, unsigned long arg)
set_fs(oldmm); set_fs(oldmm);
fput(sock_filp); fput(sock_filp);
out:
out:
if (fd >= 0)
sys_close(fd);
else
sock_release(sock);
return rc; return rc;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment