X-Git-Url: http://git.lttng.org./?a=blobdiff_plain;f=src%2Fbin%2Flttng-sessiond%2Fkernel.c;h=86a1957cf400a2f8c6cd080ff42c28a864dda427;hb=976731c81935b744ae0fdf4044d1e6f7f9c1e0e8;hp=3b0d6e5f5ee05146aff5d2e31b61517577eed62b;hpb=096102bd1f0665d96f75ad12410ea23189fbf861;p=lttng-tools.git diff --git a/src/bin/lttng-sessiond/kernel.c b/src/bin/lttng-sessiond/kernel.c index 3b0d6e5f5..86a1957cf 100644 --- a/src/bin/lttng-sessiond/kernel.c +++ b/src/bin/lttng-sessiond/kernel.c @@ -623,31 +623,50 @@ int kernel_validate_version(int tracer_fd) } /* Validate version */ - if (version.version > KERN_MODULES_VERSION) { + if (version.version != KERN_MODULES_PRE_VERSION + && version.version != KERN_MODULES_VERSION) { goto error_version; - } else { - if (version.patchlevel > KERN_MODULES_PATCHLEVEL) { - goto error_version; - } - else { - if (version.sublevel > KERN_MODULES_SUBLEVEL) { - goto error_version; - } - } } - DBG2("Kernel tracer version validated (%d.%d.%d)", version.version, - version.patchlevel, version.sublevel); - + DBG2("Kernel tracer version validated (major version %d)", version.version); return 0; error_version: - ERR("Kernel version is not compatible %d.%d.%d (supporting <= %d.%d.%d)", - version.version, version.patchlevel, version.sublevel, - KERN_MODULES_VERSION, KERN_MODULES_PATCHLEVEL, - KERN_MODULES_SUBLEVEL); + ERR("Kernel major version %d is not compatible (supporting <= %d)", + version.version, KERN_MODULES_VERSION) ret = -1; error: return ret; } + +/* + * Kernel work-arounds called at the start of sessiond main(). + */ +int init_kernel_workarounds(void) +{ + int ret; + FILE *fp; + + /* + * boot_id needs to be read once before being used concurrently + * to deal with a Linux kernel race. A fix is proposed for + * upstream, but the work-around is needed for older kernels. + */ + fp = fopen("/proc/sys/kernel/random/boot_id", "r"); + if (!fp) { + goto end_boot_id; + } + while (!feof(fp)) { + char buf[37] = ""; + + ret = fread(buf, 1, sizeof(buf), fp); + if (ret < 0) { + /* Ignore error, we don't really care */ + } + } + fclose(fp); +end_boot_id: + + return 0; +}