From: "Nicholas A. Bellinger" <nab@linux-iscsi.org>
To: linux-scsi <linux-scsi@vger.kernel.org>,
James Bottomley <James.Bottomley@HansenPartnership.com>
Cc: Christoph Hellwig <hch@lst.de>,
Mike Christie <michaelc@cs.wisc.edu>,
Hannes Reinecke <hare@suse.de>,
FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>,
Joel Becker <jlbec@evilplan.org>,
Douglas Gilbert <dgilbert@interlog.com>,
Nicholas Bellinger <nab@linux-iscsi.org>
Subject: [PATCH 02/12] target: Fix top-level configfs_subsystem default_group shutdown breakage
Date: Thu, 3 Feb 2011 22:45:02 -0800 [thread overview]
Message-ID: <1296801912-18857-3-git-send-email-nab@linux-iscsi.org> (raw)
In-Reply-To: <1296801912-18857-1-git-send-email-nab@linux-iscsi.org>
From: Nicholas Bellinger <nab@linux-iscsi.org>
This patch fixes two bugs uncovered during testing with slub_debug=FPUZ
during module_exit() -> target_core_exit_configfs() with release of
configfs subsystem consumer default groups, namely how this should be
working with fs/configfs/dir.c:configfs_unregister_subsystem() release
logic for struct config_group->default_group.
The first issue involves configfs_unregister_subsystem() expecting to
walk+drain the top-level subsys->su_group.default_groups directly in
unlink_group(), and not directly from the configfs subsystem consumer
for the top level struct config_group->default_groups. This patch drops
the walk+drain of subsys->su_group.default_groups from TCM configfs
subsystem consumer code, and moves the top-level ->default_groups kfree()
after configfs_unregister_subsystem() has been called.
The second issue involves calling core_alua_free_lu_gp(se_global->default_lu_gp)
to release the default_lu_gp->lu_gp_group before configfs_unregister_subsystem()
has been called. This patches also moves the core_alua_free_lu_gp() call to
release default_lu_group->lu_gp_group after the subsys has been unregistered.
Finally, this patch explictly clears the [lu_gp,alua,hba]_cg->default_groups
pointers after kfree() to ensure that no stale memory is picked up from
child struct config_group->default_group[] while configfs_unregister_subsystem()
is called.
Reported-by: Fubo Chen <fubo.chen@gmail.com>
Cc: Joel Becker <jlbec@evilplan.org>
Cc: Christoph Hellwig <hch@lst.de>
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
---
drivers/target/target_core_configfs.c | 20 +++++++++++---------
1 files changed, 11 insertions(+), 9 deletions(-)
diff --git a/drivers/target/target_core_configfs.c b/drivers/target/target_core_configfs.c
index 30ae3af..431cd2e 100644
--- a/drivers/target/target_core_configfs.c
+++ b/drivers/target/target_core_configfs.c
@@ -3206,8 +3206,7 @@ static void target_core_exit_configfs(void)
config_item_put(item);
}
kfree(lu_gp_cg->default_groups);
- core_alua_free_lu_gp(se_global->default_lu_gp);
- se_global->default_lu_gp = NULL;
+ lu_gp_cg->default_groups = NULL;
alua_cg = &se_global->alua_group;
for (i = 0; alua_cg->default_groups[i]; i++) {
@@ -3216,6 +3215,7 @@ static void target_core_exit_configfs(void)
config_item_put(item);
}
kfree(alua_cg->default_groups);
+ alua_cg->default_groups = NULL;
hba_cg = &se_global->target_core_hbagroup;
for (i = 0; hba_cg->default_groups[i]; i++) {
@@ -3224,15 +3224,17 @@ static void target_core_exit_configfs(void)
config_item_put(item);
}
kfree(hba_cg->default_groups);
-
- for (i = 0; subsys->su_group.default_groups[i]; i++) {
- item = &subsys->su_group.default_groups[i]->cg_item;
- subsys->su_group.default_groups[i] = NULL;
- config_item_put(item);
- }
+ hba_cg->default_groups = NULL;
+ /*
+ * We expect subsys->su_group.default_groups to be released
+ * by configfs subsystem provider logic..
+ */
+ configfs_unregister_subsystem(subsys);
kfree(subsys->su_group.default_groups);
- configfs_unregister_subsystem(subsys);
+ core_alua_free_lu_gp(se_global->default_lu_gp);
+ se_global->default_lu_gp = NULL;
+
printk(KERN_INFO "TARGET_CORE[0]: Released ConfigFS Fabric"
" Infrastructure\n");
--
1.7.4
next prev parent reply other threads:[~2011-02-04 6:45 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-02-04 6:45 [PATCH 00/12] target: Updates for .38-rc4 Nicholas A. Bellinger
2011-02-04 6:45 ` [PATCH 01/12] target: Avoid mem leak and needless work in transport_generic_get_mem Nicholas A. Bellinger
2011-02-04 6:45 ` Nicholas A. Bellinger [this message]
2011-02-04 6:45 ` [PATCH 03/12] target: Move core_delete_hba() into ->release() callback Nicholas A. Bellinger
2011-02-04 6:45 ` [PATCH 04/12] target: Move subdev release logic " Nicholas A. Bellinger
2011-02-04 6:45 ` [PATCH 05/12] target: Move core_alua_free_lu_gp() " Nicholas A. Bellinger
2011-02-04 6:45 ` [PATCH 06/12] target: Move core_alua_free_tg_pt_gp() " Nicholas A. Bellinger
2011-02-04 6:45 ` [PATCH 07/12] target: Move fabric dependent struct se_wwn free " Nicholas A. Bellinger
2011-02-04 6:45 ` [PATCH 08/12] target: Move fabric dependent se_portal_group " Nicholas A. Bellinger
2011-02-04 6:45 ` [PATCH 09/12] target: Move fabric dependent se_node_acl free into ->release callback() Nicholas A. Bellinger
2011-02-04 6:45 ` [PATCH 10/12] target: Move fabric dependent struct se_tpg_np free into ->release() callback Nicholas A. Bellinger
2011-02-04 6:45 ` [PATCH 11/12] target: Move fabric independent se_lun_acl " Nicholas A. Bellinger
2011-02-04 6:45 ` [PATCH 12/12] target: Remove procfs based target_core_mib.c code Nicholas A. Bellinger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1296801912-18857-3-git-send-email-nab@linux-iscsi.org \
--to=nab@linux-iscsi.org \
--cc=James.Bottomley@HansenPartnership.com \
--cc=dgilbert@interlog.com \
--cc=fujita.tomonori@lab.ntt.co.jp \
--cc=hare@suse.de \
--cc=hch@lst.de \
--cc=jlbec@evilplan.org \
--cc=linux-scsi@vger.kernel.org \
--cc=michaelc@cs.wisc.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox