Re: [QUOTA] Drop spin lock when calling request_module
From: Jan Kara
Date: Thu Nov 06 2003 - 13:12:16 EST
>
> 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;
}
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/