public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] xfs: Register hotcpu notifier after initialization
@ 2013-08-19 20:56 Richard Weinberger
  2013-08-19 22:21 ` Ben Myers
  0 siblings, 1 reply; 3+ messages in thread
From: Richard Weinberger @ 2013-08-19 20:56 UTC (permalink / raw)
  To: xfs; +Cc: bpm, elder, linux-kernel, Richard Weinberger

Currently the code initializizes mp->m_icsb_mutex and other things
_after_ register_hotcpu_notifier().
As the notifier takes mp->m_icsb_mutex it can happen
that it takes the lock before it's initialization.

Signed-off-by: Richard Weinberger <richard@nod.at>
---
 fs/xfs/xfs_mount.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/fs/xfs/xfs_mount.c b/fs/xfs/xfs_mount.c
index 2b0ba35..986f9cf 100644
--- a/fs/xfs/xfs_mount.c
+++ b/fs/xfs/xfs_mount.c
@@ -2260,12 +2260,6 @@ xfs_icsb_init_counters(
 	if (mp->m_sb_cnts == NULL)
 		return -ENOMEM;
 
-#ifdef CONFIG_HOTPLUG_CPU
-	mp->m_icsb_notifier.notifier_call = xfs_icsb_cpu_notify;
-	mp->m_icsb_notifier.priority = 0;
-	register_hotcpu_notifier(&mp->m_icsb_notifier);
-#endif /* CONFIG_HOTPLUG_CPU */
-
 	for_each_online_cpu(i) {
 		cntp = (xfs_icsb_cnts_t *)per_cpu_ptr(mp->m_sb_cnts, i);
 		memset(cntp, 0, sizeof(xfs_icsb_cnts_t));
@@ -2278,6 +2272,13 @@ xfs_icsb_init_counters(
 	 * initial balance kicks us off correctly
 	 */
 	mp->m_icsb_counters = -1;
+
+#ifdef CONFIG_HOTPLUG_CPU
+	mp->m_icsb_notifier.notifier_call = xfs_icsb_cpu_notify;
+	mp->m_icsb_notifier.priority = 0;
+	register_hotcpu_notifier(&mp->m_icsb_notifier);
+#endif /* CONFIG_HOTPLUG_CPU */
+
 	return 0;
 }
 
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] xfs: Register hotcpu notifier after initialization
  2013-08-19 20:56 [PATCH] xfs: Register hotcpu notifier after initialization Richard Weinberger
@ 2013-08-19 22:21 ` Ben Myers
  2013-08-22 19:11   ` Ben Myers
  0 siblings, 1 reply; 3+ messages in thread
From: Ben Myers @ 2013-08-19 22:21 UTC (permalink / raw)
  To: Richard Weinberger; +Cc: xfs, elder, linux-kernel

On Mon, Aug 19, 2013 at 10:56:44PM +0200, Richard Weinberger wrote:
> Currently the code initializizes mp->m_icsb_mutex and other things
> _after_ register_hotcpu_notifier().
> As the notifier takes mp->m_icsb_mutex it can happen
> that it takes the lock before it's initialization.
> 
> Signed-off-by: Richard Weinberger <richard@nod.at>

Looks good.  Thanks Richard.

Reviewed-by: Ben Myers <bpm@sgi.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] xfs: Register hotcpu notifier after initialization
  2013-08-19 22:21 ` Ben Myers
@ 2013-08-22 19:11   ` Ben Myers
  0 siblings, 0 replies; 3+ messages in thread
From: Ben Myers @ 2013-08-22 19:11 UTC (permalink / raw)
  To: Richard Weinberger; +Cc: elder, linux-kernel, xfs

On Mon, Aug 19, 2013 at 05:21:29PM -0500, Ben Myers wrote:
> On Mon, Aug 19, 2013 at 10:56:44PM +0200, Richard Weinberger wrote:
> > Currently the code initializizes mp->m_icsb_mutex and other things
> > _after_ register_hotcpu_notifier().
> > As the notifier takes mp->m_icsb_mutex it can happen
> > that it takes the lock before it's initialization.
> > 
> > Signed-off-by: Richard Weinberger <richard@nod.at>
> 
> Looks good.  Thanks Richard.
> 
> Reviewed-by: Ben Myers <bpm@sgi.com>

Applied.  Thanks Richard.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-08-22 19:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-19 20:56 [PATCH] xfs: Register hotcpu notifier after initialization Richard Weinberger
2013-08-19 22:21 ` Ben Myers
2013-08-22 19:11   ` Ben Myers

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox