Re: pre-patch-2.1.107 breaks kmod

James H. Cloos Jr. (cloos@jhcloos.com)
26 Jun 1998 06:54:28 -0500


> If you are reading this, your mail reader may not support MIME.
> Some parts of this message will be readable as plain text.

--26.Jun.1998mysteryboxofun
Content-Type: text/plain

Linus> The problem is that if you have two threads that want to load
Linus> the same module with kmod, _both_ of them have to succeed, and
Linus> _both_ of them have to wait not until after create_module(),
Linus> but until after init_module() has successfully returned.

So, would the attatched patch to insmod.c, based on the suggestion
(was it Alan's?) to lock the module file solve the problem?

-JimC

-- 
James H. Cloos, Jr.
<cloos@jhcloos.com>

--26.Jun.1998mysteryboxofun Content-Type: text/plain; charset=us-ascii; name="insmod_diff" Content-Description: insmod_diff Content-Transfer-Encoding: quoted-printable

diff -u --recursive --new-file modutils-2.1.85/insmod/insmod.c modutils/insmod/insmod.c --- modutils-2.1.85/insmod/insmod.c Fri Feb 6 03:26:33 1998 +++ modutils/insmod/insmod.c Fri Jun 26 06:47:09 1998 @@ -34,6 +34,7 @@ #include <getopt.h> #include <sys/utsname.h> #include <sys/stat.h> +#include <sys/file.h> =

#include "module.h" #include "obj.h" @@ -1467,9 +1468,13 @@ error("%s: %m", filename); return 1; } + else if (flock(fileno(fp), LOCK_EX)) + { + error("%s: %m", filename); + return 1; + } else if ((f =3D obj_load(fp)) =3D=3D NULL) return 1; - fclose(fp); =

/* Version correspondence? */ =

@@ -1620,5 +1625,6 @@ if (flag_load_map) print_load_map(f); =

+ fclose(fp); return 0; }

--26.Jun.1998mysteryboxofun Content-Type: text/plain

--26.Jun.1998mysteryboxofun--

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu