Whamcloud - gitweb
LU-2073 procfs: procfs symlinks are apparently never freed
authoryangsheng <ys@whamcloud.com>
Thu, 1 Nov 2012 15:33:05 +0000 (23:33 +0800)
committerOleg Drokin <green@whamcloud.com>
Wed, 7 Nov 2012 17:23:57 +0000 (12:23 -0500)
We shouldn't set proc_dir_entry->data to NULL in any case.
There must cause memleak when it is a symlink entry.

Signed-off-by: yang sheng <ys@whamcloud.com>
Change-Id: I45c82fd206be738b5fdc4b2e612c3d87a708df67
Reviewed-on: http://review.whamcloud.com/4434
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Reviewed-by: Bobi Jam <bobijam@whamcloud.com>
lustre/obdclass/lprocfs_status.c

index 516d798..de523b9 100644 (file)
@@ -413,23 +413,6 @@ void lprocfs_remove_nolock(struct proc_dir_entry **rooth)
                          "0x%p  %s/%s len %d\n", rm_entry, temp->name,
                          rm_entry->name, (int)strlen(rm_entry->name));
 
-#ifdef HAVE_PROCFS_USERS
-                /* if procfs uses user count to synchronize deletion of
-                 * proc entry, there is no protection for rm_entry->data,
-                 * then lprocfs_fops_read and lprocfs_fops_write maybe
-                 * call proc_dir_entry->read_proc (or write_proc) with
-                 * proc_dir_entry->data == NULL, then cause kernel Oops.
-                 * see bug19706 for detailed information */
-
-                /* procfs won't free rm_entry->data if it isn't a LINK,
-                 * and Lustre won't use rm_entry->data if it is a LINK */
-                if (S_ISLNK(rm_entry->mode))
-                        rm_entry->data = NULL;
-#else
-                /* Now, the rm_entry->deleted flags is protected
-                 * by _lprocfs_lock. */
-                rm_entry->data = NULL;
-#endif
                 remove_proc_entry(rm_entry->name, temp);
                 if (temp == parent)
                         break;