lkml.org 
[lkml]   [1998]   [Jun]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    SubjectRe: pre-patch-2.1.107 breaks kmod
    From
    Date
    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>
    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 = obj_load(fp)) == NULL)
    return 1;
    - fclose(fp);

    /* Version correspondence? */

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

    + fclose(fp);
    return 0;
    }

    \
     
     \ /
      Last update: 2005-03-22 13:43    [W:0.021 / U:63.176 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site