Re: [PATCH v2] devcoredump: Send uevent once devcd is ready

From: Greg KH
Date: Tue Nov 07 2023 - 06:23:41 EST


On Tue, Nov 07, 2023 at 04:33:46PM +0530, Mukesh Ojha wrote:
> dev_coredumpm() creates a devcoredump device and adds it
> to the core kernel framework which eventually end up
> sending uevent to the user space and later creates a
> symbolic link to the failed device. An application
> running in userspace may be interested in this symbolic
> link to get the name of the failed device.
>
> In a issue scenario, once uevent sent to the user space
> it start reading '/sys/class/devcoredump/devcdX/failing_device'
> to get the actual name of the device which might not been
> created and it is in its path of creation.
>
> To fix this, suppress sending uevent till the failing device
> symbolic link gets created and send uevent once symbolic
> link is created successfully.
>
> Fixes: 833c95456a70 ("device coredump: add new device coredump class")
> Signed-off-by: Mukesh Ojha <quic_mojha@xxxxxxxxxxx>
> ---
> Change in v2:
> - Added Fixes tag as per suggestion from [Johannes]
>
> drivers/base/devcoredump.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/base/devcoredump.c b/drivers/base/devcoredump.c
> index 91536ee05f14..7e2d1f0d903a 100644
> --- a/drivers/base/devcoredump.c
> +++ b/drivers/base/devcoredump.c
> @@ -362,6 +362,7 @@ void dev_coredumpm(struct device *dev, struct module *owner,
> devcd->devcd_dev.class = &devcd_class;
>
> mutex_lock(&devcd->mutex);
> + dev_set_uevent_suppress(&devcd->devcd_dev, true);
> if (device_add(&devcd->devcd_dev))
> goto put_device;
>
> @@ -376,6 +377,8 @@ void dev_coredumpm(struct device *dev, struct module *owner,
> "devcoredump"))
> dev_warn(dev, "devcoredump create_link failed\n");
>
> + dev_set_uevent_suppress(&devcd->devcd_dev, false);
> + kobject_uevent(&devcd->devcd_dev.kobj, KOBJ_ADD);
> INIT_DELAYED_WORK(&devcd->del_wk, devcd_del);
> schedule_delayed_work(&devcd->del_wk, DEVCD_TIMEOUT);
> mutex_unlock(&devcd->mutex);
> --
> 2.7.4
>

Hi,

This is the friendly patch-bot of Greg Kroah-Hartman. You have sent him
a patch that has triggered this response. He used to manually respond
to these common problems, but in order to save his sanity (he kept
writing the same thing over and over, yet to different people), I was
created. Hopefully you will not take offence and will fix the problem
in your patch and resubmit it so that it can be accepted into the Linux
kernel tree.

You are receiving this message because of the following common error(s)
as indicated below:

- You have marked a patch with a "Fixes:" tag for a commit that is in an
older released kernel, yet you do not have a cc: stable line in the
signed-off-by area at all, which means that the patch will not be
applied to any older kernel releases. To properly fix this, please
follow the documented rules in the
Documentation/process/stable-kernel-rules.rst file for how to resolve
this.

If you wish to discuss this problem further, or you have questions about
how to resolve this issue, please feel free to respond to this email and
Greg will reply once he has dug out from the pending patches received
from other developers.

thanks,

greg k-h's patch email bot