linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [QUOTA] Drop spin lock when calling request_module
@ 2003-11-05 11:10 Herbert Xu
  2003-11-06 16:18 ` Jan Kara
  0 siblings, 1 reply; 4+ messages in thread
From: Herbert Xu @ 2003-11-05 11:10 UTC (permalink / raw)
  To: mvw, Linux Kernel Mailing List

[-- Attachment #1: Type: text/plain, Size: 323 bytes --]

Hi:

This patch drops the spin lock when calling request_module as the
latter will sleep.

Cheers,
-- 
Debian GNU/Linux 3.0 is out! ( http://www.debian.org/ )
Email:  Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

[-- Attachment #2: p --]
[-- Type: text/plain, Size: 937 bytes --]

Index: kernel-source-2.5/fs/dquot.c
===================================================================
RCS file: /home/gondolin/herbert/src/CVS/debian/kernel-source-2.5/fs/dquot.c,v
retrieving revision 1.3
diff -u -r1.3 dquot.c
--- kernel-source-2.5/fs/dquot.c	26 Oct 2003 03:20:37 -0000	1.3
+++ kernel-source-2.5/fs/dquot.c	5 Nov 2003 11:04:30 -0000
@@ -128,17 +128,21 @@
 	if (!actqf || !try_module_get(actqf->qf_owner)) {
 		int qm;
 
+		spin_unlock(&dq_list_lock);
+
 		for (qm = 0; module_names[qm].qm_fmt_id && module_names[qm].qm_fmt_id != id; qm++);
 		if (!module_names[qm].qm_fmt_id || request_module(module_names[qm].qm_mod_name)) {
 			actqf = NULL;
 			goto out;
 		}
+
+		spin_lock(&dq_list_lock);
 		for (actqf = quota_formats; actqf && actqf->qf_fmt_id != id; actqf = actqf->qf_next);
 		if (actqf && !try_module_get(actqf->qf_owner))
 			actqf = NULL;
 	}
-out:
 	spin_unlock(&dq_list_lock);
+out:
 	return actqf;
 }
 

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

* Re: [QUOTA] Drop spin lock when calling request_module
  2003-11-05 11:10 [QUOTA] Drop spin lock when calling request_module Herbert Xu
@ 2003-11-06 16:18 ` Jan Kara
  2003-11-06 16:28   ` Linus Torvalds
  0 siblings, 1 reply; 4+ messages in thread
From: Jan Kara @ 2003-11-06 16:18 UTC (permalink / raw)
  To: Herbert Xu, torvalds, akpm; +Cc: Linux Kernel Mailing List

  Hi,

> This patch drops the spin lock when calling request_module as the
> latter will sleep.
  The patch looks right. Linus please apply if you find it serious
enough (or Andrew please queue it up for next releases...)...

							Thanks
								Honza

Index: kernel-source-2.5/fs/dquot.c
===================================================================
RCS file: /home/gondolin/herbert/src/CVS/debian/kernel-source-2.5/fs/dquot.c,v
retrieving revision 1.3
diff -u -r1.3 dquot.c
--- kernel-source-2.5/fs/dquot.c	26 Oct 2003 03:20:37 -0000	1.3
+++ kernel-source-2.5/fs/dquot.c	5 Nov 2003 11:04:30 -0000
@@ -128,17 +128,21 @@
 	if (!actqf || !try_module_get(actqf->qf_owner)) {
 		int qm;
 
+		spin_unlock(&dq_list_lock);
+
 		for (qm = 0; module_names[qm].qm_fmt_id && module_names[qm].qm_fmt_id != id; qm++);
 		if (!module_names[qm].qm_fmt_id || request_module(module_names[qm].qm_mod_name)) {
 			actqf = NULL;
 			goto out;
 		}
+
+		spin_lock(&dq_list_lock);
 		for (actqf = quota_formats; actqf && actqf->qf_fmt_id != id; actqf = actqf->qf_next);
 		if (actqf && !try_module_get(actqf->qf_owner))
 			actqf = NULL;
 	}
-out:
 	spin_unlock(&dq_list_lock);
+out:
 	return actqf;
 }

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

* Re: [QUOTA] Drop spin lock when calling request_module
  2003-11-06 16:18 ` Jan Kara
@ 2003-11-06 16:28   ` Linus Torvalds
  2003-11-06 18:11     ` Jan Kara
  0 siblings, 1 reply; 4+ messages in thread
From: Linus Torvalds @ 2003-11-06 16:28 UTC (permalink / raw)
  To: Jan Kara; +Cc: Herbert Xu, akpm, Linux Kernel Mailing List


On Thu, 6 Nov 2003, Jan Kara wrote:
>  			actqf = NULL;
>  			goto out;

Mind changing this to just a "return NULL" instead and just remove the
label entirely, now that it doesn't actually need to play with any
spinlocks?

I don't mind goto's if there is a _point_ to them, but this one doesn't 
seem to fall under that heading.

		Linus



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

* Re: [QUOTA] Drop spin lock when calling request_module
  2003-11-06 16:28   ` Linus Torvalds
@ 2003-11-06 18:11     ` Jan Kara
  0 siblings, 0 replies; 4+ messages in thread
From: Jan Kara @ 2003-11-06 18:11 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: Herbert Xu, akpm, Linux Kernel Mailing List

> 
> On Thu, 6 Nov 2003, Jan Kara wrote:
> >  			actqf = NULL;
> >  			goto out;
> 
> Mind changing this to just a "return NULL" instead and just remove the
> label entirely, now that it doesn't actually need to play with any
> spinlocks?
> 
> I don't mind goto's if there is a _point_ to them, but this one doesn't 
> seem to fall under that heading.
  You're right. The nicer fix is attached.

									Honza

----------------------------Cut here--------------------------------------

diff -ruX ../kerndiffexclude linux-2.6.0-test9/fs/dquot.c linux-2.6.0-test9-loadfix/fs/dquot.c
--- linux-2.6.0-test9/fs/dquot.c	Sat Oct 25 20:44:03 2003
+++ linux-2.6.0-test9-loadfix/fs/dquot.c	Thu Nov  6 19:10:37 2003
@@ -128,16 +128,17 @@
 	if (!actqf || !try_module_get(actqf->qf_owner)) {
 		int qm;
 
+		spin_unlock(&dq_list_lock);
+		
 		for (qm = 0; module_names[qm].qm_fmt_id && module_names[qm].qm_fmt_id != id; qm++);
-		if (!module_names[qm].qm_fmt_id || request_module(module_names[qm].qm_mod_name)) {
-			actqf = NULL;
-			goto out;
-		}
+		if (!module_names[qm].qm_fmt_id || request_module(module_names[qm].qm_mod_name))
+			return NULL;
+
+		spin_lock(&dq_list_lock);
 		for (actqf = quota_formats; actqf && actqf->qf_fmt_id != id; actqf = actqf->qf_next);
 		if (actqf && !try_module_get(actqf->qf_owner))
 			actqf = NULL;
 	}
-out:
 	spin_unlock(&dq_list_lock);
 	return actqf;
 }

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

end of thread, other threads:[~2003-11-06 18:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-11-05 11:10 [QUOTA] Drop spin lock when calling request_module Herbert Xu
2003-11-06 16:18 ` Jan Kara
2003-11-06 16:28   ` Linus Torvalds
2003-11-06 18:11     ` Jan Kara

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).