orangefs: four fixes from Zhang Xiaoxu and two from Colin Ian King
Zhang: fixed problems with memory leaks on exit in sysfs and debufs. fs/orangefs/orangefs-debugfs.c fs/orangefs/orangefs-sysfs.c fs/orangefs/orangefs-debugfs.c fs/orangefs/orangefs-mod.c Colin: removed an unused variable and an unneeded assignment. fs/orangefs/file.c fs/orangefs/inode.c -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEIGSFVdO6eop9nER2z0QOqevODb4FAmOQ+4sACgkQz0QOqevO Db4hLg//Vj5t1OBMxc/qbHGs6DwyIThQATss2jE2q0dkWwXxwsmxa23dwXzQGe6b hF+gLzh5AgJ4BnaoFYAgF/pJ7Su1iz3FLzh1J4dQ1zfPA/cr0vAhoxmpMH0X4+H8 nycDNn/gZuZVn/2x1SVnDrut6R9mIQM6ESYdO/99TK8z2IIgqiaCZRi0timPp6Gs z3XYibdSbFib4xjbNLcdwLsLphzR4XupMdaXGai7MBriEc3lLN5dIn1hElbrmHD8 k3xRVyWlyBknp1/xb8icnn05vim35PIbuY6K9RaJfhx94qdfu51c0rST1Ay4zY0Z FKTI6CocraXJWZ2557yXrLCxUa+/t7VYvxmF7oYgrqCD4xlzybEO79iGo6mvJ1cd 47PERjJFDa5AvVYFC9Ggm5V4qJhX60fUxXubmwhQVtMNFNjo/P9dpxbmkHmFmTG3 Op+N45MsVJNxQDtE1qwcoTU5nBEX/6ziQGaYkgXa8YArSn89xs4i89wQlACsJElM xXZCoKxQgT1wyq2DvoieVAShFSXXJ9OQjOYI3lGN57n+jHSweR0Jr5IfUGq3dfax nyyjcDr2p291w2weFbsQtdUTdGKKhEiky7aSIvFMtCXUHdsIIty+YSx3vjAk3A/p a0HFgZBuTPYwdbwW4EA+12Prf2xnsoHV/51dbklCAhKEGAPSMg0= =2ddP -----END PGP SIGNATURE----- Merge tag 'for-linus-6.2-ofs1' of git://git.kernel.org/pub/scm/linux/kernel/git/hubcap/linux Pull orangefs updates from Mike Marshall: - fix problems with memory leaks on exit in sysfs and debufs (Zhang) - remove an unused variable and an unneeded assignment (Colin) * tag 'for-linus-6.2-ofs1' of git://git.kernel.org/pub/scm/linux/kernel/git/hubcap/linux: orangefs: Fix kmemleak in orangefs_{kernel,client}_debug_init() orangefs: Fix kmemleak in orangefs_sysfs_init() orangefs: Fix kmemleak in orangefs_prepare_debugfs_help_string() orangefs: Fix sysfs not cleanup when dev init failed orangefs: remove redundant assignment to variable buffer_index orangefs: remove variable i
This commit is contained in:
commit
6f1f5caed5
|
@ -273,7 +273,6 @@ out:
|
|||
gossip_debug(GOSSIP_FILE_DEBUG,
|
||||
"%s(%pU): PUT buffer_index %d\n",
|
||||
__func__, handle, buffer_index);
|
||||
buffer_index = -1;
|
||||
}
|
||||
op_release(new_op);
|
||||
return ret;
|
||||
|
|
|
@ -530,7 +530,6 @@ static ssize_t orangefs_direct_IO(struct kiocb *iocb,
|
|||
size_t count = iov_iter_count(iter);
|
||||
ssize_t total_count = 0;
|
||||
ssize_t ret = -EINVAL;
|
||||
int i = 0;
|
||||
|
||||
gossip_debug(GOSSIP_FILE_DEBUG,
|
||||
"%s-BEGIN(%pU): count(%d) after estimate_max_iovecs.\n",
|
||||
|
@ -556,7 +555,6 @@ static ssize_t orangefs_direct_IO(struct kiocb *iocb,
|
|||
while (iov_iter_count(iter)) {
|
||||
size_t each_count = iov_iter_count(iter);
|
||||
size_t amt_complete;
|
||||
i++;
|
||||
|
||||
/* how much to transfer in this loop iteration */
|
||||
if (each_count > orangefs_bufmap_size_query())
|
||||
|
|
|
@ -194,15 +194,10 @@ void orangefs_debugfs_init(int debug_mask)
|
|||
*/
|
||||
static void orangefs_kernel_debug_init(void)
|
||||
{
|
||||
int rc = -ENOMEM;
|
||||
char *k_buffer = NULL;
|
||||
static char k_buffer[ORANGEFS_MAX_DEBUG_STRING_LEN] = { };
|
||||
|
||||
gossip_debug(GOSSIP_DEBUGFS_DEBUG, "%s: start\n", __func__);
|
||||
|
||||
k_buffer = kzalloc(ORANGEFS_MAX_DEBUG_STRING_LEN, GFP_KERNEL);
|
||||
if (!k_buffer)
|
||||
goto out;
|
||||
|
||||
if (strlen(kernel_debug_string) + 1 < ORANGEFS_MAX_DEBUG_STRING_LEN) {
|
||||
strcpy(k_buffer, kernel_debug_string);
|
||||
strcat(k_buffer, "\n");
|
||||
|
@ -213,15 +208,14 @@ static void orangefs_kernel_debug_init(void)
|
|||
|
||||
debugfs_create_file(ORANGEFS_KMOD_DEBUG_FILE, 0444, debug_dir, k_buffer,
|
||||
&kernel_debug_fops);
|
||||
|
||||
out:
|
||||
gossip_debug(GOSSIP_DEBUGFS_DEBUG, "%s: rc:%d:\n", __func__, rc);
|
||||
}
|
||||
|
||||
|
||||
void orangefs_debugfs_cleanup(void)
|
||||
{
|
||||
debugfs_remove_recursive(debug_dir);
|
||||
kfree(debug_help_string);
|
||||
debug_help_string = NULL;
|
||||
}
|
||||
|
||||
/* open ORANGEFS_KMOD_DEBUG_HELP_FILE */
|
||||
|
@ -297,18 +291,13 @@ static int help_show(struct seq_file *m, void *v)
|
|||
/*
|
||||
* initialize the client-debug file.
|
||||
*/
|
||||
static int orangefs_client_debug_init(void)
|
||||
static void orangefs_client_debug_init(void)
|
||||
{
|
||||
|
||||
int rc = -ENOMEM;
|
||||
char *c_buffer = NULL;
|
||||
static char c_buffer[ORANGEFS_MAX_DEBUG_STRING_LEN] = { };
|
||||
|
||||
gossip_debug(GOSSIP_DEBUGFS_DEBUG, "%s: start\n", __func__);
|
||||
|
||||
c_buffer = kzalloc(ORANGEFS_MAX_DEBUG_STRING_LEN, GFP_KERNEL);
|
||||
if (!c_buffer)
|
||||
goto out;
|
||||
|
||||
if (strlen(client_debug_string) + 1 < ORANGEFS_MAX_DEBUG_STRING_LEN) {
|
||||
strcpy(c_buffer, client_debug_string);
|
||||
strcat(c_buffer, "\n");
|
||||
|
@ -322,13 +311,6 @@ static int orangefs_client_debug_init(void)
|
|||
debug_dir,
|
||||
c_buffer,
|
||||
&kernel_debug_fops);
|
||||
|
||||
rc = 0;
|
||||
|
||||
out:
|
||||
|
||||
gossip_debug(GOSSIP_DEBUGFS_DEBUG, "%s: rc:%d:\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
/* open ORANGEFS_KMOD_DEBUG_FILE or ORANGEFS_CLIENT_DEBUG_FILE.*/
|
||||
|
@ -671,6 +653,7 @@ int orangefs_prepare_debugfs_help_string(int at_boot)
|
|||
memset(debug_help_string, 0, DEBUG_HELP_STRING_SIZE);
|
||||
strlcat(debug_help_string, new, string_size);
|
||||
mutex_unlock(&orangefs_help_file_lock);
|
||||
kfree(new);
|
||||
}
|
||||
|
||||
rc = 0;
|
||||
|
|
|
@ -141,7 +141,7 @@ static int __init orangefs_init(void)
|
|||
gossip_err("%s: could not initialize device subsystem %d!\n",
|
||||
__func__,
|
||||
ret);
|
||||
goto cleanup_device;
|
||||
goto cleanup_sysfs;
|
||||
}
|
||||
|
||||
ret = register_filesystem(&orangefs_fs_type);
|
||||
|
@ -152,11 +152,11 @@ static int __init orangefs_init(void)
|
|||
goto out;
|
||||
}
|
||||
|
||||
orangefs_sysfs_exit();
|
||||
|
||||
cleanup_device:
|
||||
orangefs_dev_cleanup();
|
||||
|
||||
cleanup_sysfs:
|
||||
orangefs_sysfs_exit();
|
||||
|
||||
sysfs_init_failed:
|
||||
orangefs_debugfs_cleanup();
|
||||
|
||||
|
|
|
@ -896,9 +896,18 @@ static struct attribute *orangefs_default_attrs[] = {
|
|||
};
|
||||
ATTRIBUTE_GROUPS(orangefs_default);
|
||||
|
||||
static struct kobject *orangefs_obj;
|
||||
|
||||
static void orangefs_obj_release(struct kobject *kobj)
|
||||
{
|
||||
kfree(orangefs_obj);
|
||||
orangefs_obj = NULL;
|
||||
}
|
||||
|
||||
static struct kobj_type orangefs_ktype = {
|
||||
.sysfs_ops = &orangefs_sysfs_ops,
|
||||
.default_groups = orangefs_default_groups,
|
||||
.release = orangefs_obj_release,
|
||||
};
|
||||
|
||||
static struct orangefs_attribute acache_hard_limit_attribute =
|
||||
|
@ -934,9 +943,18 @@ static struct attribute *acache_orangefs_default_attrs[] = {
|
|||
};
|
||||
ATTRIBUTE_GROUPS(acache_orangefs_default);
|
||||
|
||||
static struct kobject *acache_orangefs_obj;
|
||||
|
||||
static void acache_orangefs_obj_release(struct kobject *kobj)
|
||||
{
|
||||
kfree(acache_orangefs_obj);
|
||||
acache_orangefs_obj = NULL;
|
||||
}
|
||||
|
||||
static struct kobj_type acache_orangefs_ktype = {
|
||||
.sysfs_ops = &orangefs_sysfs_ops,
|
||||
.default_groups = acache_orangefs_default_groups,
|
||||
.release = acache_orangefs_obj_release,
|
||||
};
|
||||
|
||||
static struct orangefs_attribute capcache_hard_limit_attribute =
|
||||
|
@ -972,9 +990,18 @@ static struct attribute *capcache_orangefs_default_attrs[] = {
|
|||
};
|
||||
ATTRIBUTE_GROUPS(capcache_orangefs_default);
|
||||
|
||||
static struct kobject *capcache_orangefs_obj;
|
||||
|
||||
static void capcache_orangefs_obj_release(struct kobject *kobj)
|
||||
{
|
||||
kfree(capcache_orangefs_obj);
|
||||
capcache_orangefs_obj = NULL;
|
||||
}
|
||||
|
||||
static struct kobj_type capcache_orangefs_ktype = {
|
||||
.sysfs_ops = &orangefs_sysfs_ops,
|
||||
.default_groups = capcache_orangefs_default_groups,
|
||||
.release = capcache_orangefs_obj_release,
|
||||
};
|
||||
|
||||
static struct orangefs_attribute ccache_hard_limit_attribute =
|
||||
|
@ -1010,9 +1037,18 @@ static struct attribute *ccache_orangefs_default_attrs[] = {
|
|||
};
|
||||
ATTRIBUTE_GROUPS(ccache_orangefs_default);
|
||||
|
||||
static struct kobject *ccache_orangefs_obj;
|
||||
|
||||
static void ccache_orangefs_obj_release(struct kobject *kobj)
|
||||
{
|
||||
kfree(ccache_orangefs_obj);
|
||||
ccache_orangefs_obj = NULL;
|
||||
}
|
||||
|
||||
static struct kobj_type ccache_orangefs_ktype = {
|
||||
.sysfs_ops = &orangefs_sysfs_ops,
|
||||
.default_groups = ccache_orangefs_default_groups,
|
||||
.release = ccache_orangefs_obj_release,
|
||||
};
|
||||
|
||||
static struct orangefs_attribute ncache_hard_limit_attribute =
|
||||
|
@ -1048,9 +1084,18 @@ static struct attribute *ncache_orangefs_default_attrs[] = {
|
|||
};
|
||||
ATTRIBUTE_GROUPS(ncache_orangefs_default);
|
||||
|
||||
static struct kobject *ncache_orangefs_obj;
|
||||
|
||||
static void ncache_orangefs_obj_release(struct kobject *kobj)
|
||||
{
|
||||
kfree(ncache_orangefs_obj);
|
||||
ncache_orangefs_obj = NULL;
|
||||
}
|
||||
|
||||
static struct kobj_type ncache_orangefs_ktype = {
|
||||
.sysfs_ops = &orangefs_sysfs_ops,
|
||||
.default_groups = ncache_orangefs_default_groups,
|
||||
.release = ncache_orangefs_obj_release,
|
||||
};
|
||||
|
||||
static struct orangefs_attribute pc_acache_attribute =
|
||||
|
@ -1079,9 +1124,18 @@ static struct attribute *pc_orangefs_default_attrs[] = {
|
|||
};
|
||||
ATTRIBUTE_GROUPS(pc_orangefs_default);
|
||||
|
||||
static struct kobject *pc_orangefs_obj;
|
||||
|
||||
static void pc_orangefs_obj_release(struct kobject *kobj)
|
||||
{
|
||||
kfree(pc_orangefs_obj);
|
||||
pc_orangefs_obj = NULL;
|
||||
}
|
||||
|
||||
static struct kobj_type pc_orangefs_ktype = {
|
||||
.sysfs_ops = &orangefs_sysfs_ops,
|
||||
.default_groups = pc_orangefs_default_groups,
|
||||
.release = pc_orangefs_obj_release,
|
||||
};
|
||||
|
||||
static struct orangefs_attribute stats_reads_attribute =
|
||||
|
@ -1103,19 +1157,20 @@ static struct attribute *stats_orangefs_default_attrs[] = {
|
|||
};
|
||||
ATTRIBUTE_GROUPS(stats_orangefs_default);
|
||||
|
||||
static struct kobject *stats_orangefs_obj;
|
||||
|
||||
static void stats_orangefs_obj_release(struct kobject *kobj)
|
||||
{
|
||||
kfree(stats_orangefs_obj);
|
||||
stats_orangefs_obj = NULL;
|
||||
}
|
||||
|
||||
static struct kobj_type stats_orangefs_ktype = {
|
||||
.sysfs_ops = &orangefs_sysfs_ops,
|
||||
.default_groups = stats_orangefs_default_groups,
|
||||
.release = stats_orangefs_obj_release,
|
||||
};
|
||||
|
||||
static struct kobject *orangefs_obj;
|
||||
static struct kobject *acache_orangefs_obj;
|
||||
static struct kobject *capcache_orangefs_obj;
|
||||
static struct kobject *ccache_orangefs_obj;
|
||||
static struct kobject *ncache_orangefs_obj;
|
||||
static struct kobject *pc_orangefs_obj;
|
||||
static struct kobject *stats_orangefs_obj;
|
||||
|
||||
int orangefs_sysfs_init(void)
|
||||
{
|
||||
int rc = -EINVAL;
|
||||
|
|
Loading…
Reference in New Issue