[lttng-dev] [PATCH lttng-tools] Fix: ignore error when loading optional kmod

David Goulet dgoulet at efficios.com
Fri Sep 19 12:14:05 EDT 2014


Merged!

On 15 Sep (13:43:56), Philippe Proulx wrote:
> This commit also improves the accuracy of debug messages:
> a module is not "successfully" loaded when it's optional
> and actually not loaded.
> 
> Fixes: #837
> 
> Signed-off-by: Philippe Proulx <eeppeliteloop at gmail.com>
> ---
>  src/bin/lttng-sessiond/modprobe.c | 35 +++++++++++++++++++++++++++++------
>  1 file changed, 29 insertions(+), 6 deletions(-)
> 
> diff --git a/src/bin/lttng-sessiond/modprobe.c b/src/bin/lttng-sessiond/modprobe.c
> index 968b265..5c2bb05 100644
> --- a/src/bin/lttng-sessiond/modprobe.c
> +++ b/src/bin/lttng-sessiond/modprobe.c
> @@ -205,8 +205,16 @@ static int modprobe_lttng(struct kern_modules_param *modules,
>  
>  		ret = kmod_module_probe_insert_module(mod, KMOD_PROBE_IGNORE_LOADED,
>  				NULL, NULL, NULL, NULL);
> -		if (required && ret < 0) {
> -			ERR("Unable to load module %s", modules[i].name);
> +		if (ret < 0) {
> +			if (required) {
> +				ERR("Unable to load required module %s",
> +						modules[i].name);
> +				goto error;
> +			} else {
> +				DBG("Unable to load optional module %s; continuing",
> +						modules[i].name);
> +				ret = 0;
> +			}
>  		} else {
>  			DBG("Modprobe successfully %s", modules[i].name);
>  		}
> @@ -241,10 +249,25 @@ static int modprobe_lttng(struct kern_modules_param *modules,
>  		modprobe[sizeof(modprobe) - 1] = '\0';
>  		ret = system(modprobe);
>  		if (ret == -1) {
> -			ERR("Unable to launch modprobe for module %s",
> -					modules[i].name);
> -		} else if (required && WEXITSTATUS(ret) != 0) {
> -			ERR("Unable to load module %s", modules[i].name);
> +			if (required) {
> +				ERR("Unable to launch modprobe for required module %s",
> +						modules[i].name);
> +				goto error;
> +			} else {
> +				DBG("Unable to launch modprobe for optional module %s; continuing",
> +						modules[i].name);
> +				ret = 0;
> +			}
> +		} else if (WEXITSTATUS(ret) != 0) {
> +			if (required) {
> +				ERR("Unable to load required module %s",
> +						modules[i].name);
> +				goto error;
> +			} else {
> +				DBG("Unable to load optional module %s; continuing",
> +						modules[i].name);
> +				ret = 0;
> +			}
>  		} else {
>  			DBG("Modprobe successfully %s", modules[i].name);
>  		}
> -- 
> 2.1.0
> 
> 
> _______________________________________________
> lttng-dev mailing list
> lttng-dev at lists.lttng.org
> http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 603 bytes
Desc: Digital signature
URL: <http://lists.lttng.org/pipermail/lttng-dev/attachments/20140919/630d344c/attachment.sig>


More information about the lttng-dev mailing list