All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nathan Chancellor <nathan@kernel.org>
To: Longlong Xia <xialonglong1@huawei.com>
Cc: gregkh@linuxfoundation.org, chenwandun@huawei.com,
	linux-kernel@vger.kernel.org, rafael@kernel.org,
	sunnanyong@huawei.com, wangkefeng.wang@huawei.com,
	linux-btrfs@vger.kernel.org
Subject: Re: [PATCH -next v2 1/3] driver core: add error handling for devtmpfs_create_node()
Date: Mon, 13 Feb 2023 17:14:22 -0700	[thread overview]
Message-ID: <Y+rSXg14z1Myd8Px@dev-arch.thelio-3990X> (raw)
In-Reply-To: <20230210095444.4067307-2-xialonglong1@huawei.com>

Hi Longlong,

On Fri, Feb 10, 2023 at 09:54:42AM +0000, Longlong Xia wrote:
> In some cases, devtmpfs_create_node() can return error value.
> So, make use of it.
> 
> Signed-off-by: Longlong Xia <xialonglong1@huawei.com>
> ---
>  drivers/base/core.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/base/core.c b/drivers/base/core.c
> index 7dab705f2937..aaa3088e5456 100644
> --- a/drivers/base/core.c
> +++ b/drivers/base/core.c
> @@ -3405,7 +3405,9 @@ int device_add(struct device *dev)
>  		if (error)
>  			goto SysEntryError;
>  
> -		devtmpfs_create_node(dev);
> +		error = devtmpfs_create_node(dev);
> +		if (error)
> +			goto DevtmpfsError;
>  	}
>  
>  	/* Notify clients of device addition.  This call must come
> @@ -3461,6 +3463,8 @@ int device_add(struct device *dev)
>  done:
>  	put_device(dev);
>  	return error;
> + DevtmpfsError:
> +	device_remove_sys_dev_entry(dev);
>   SysEntryError:
>  	if (MAJOR(dev->devt))
>  		device_remove_file(dev, &dev_attr_dev);
> -- 
> 2.25.1
> 

After this change in -next as commit 31b4b6730fd4 ("driver core: add
error handling for devtmpfs_create_node()"), my test machines failed to
boot after the rootfs could not be mounted. I added some logging to see
which device was failing, which triggers a few times with the exact same
message:

  device: 'btrfs-control': devtmpfs_create_node() failed, err = -17

with -17 being -EEXIST. I am not sure why this device is getting
registered more than once, it appears to occur during module insertion
though, as I am able to get to systemd starting within the initrd.

Should this particular return value be downgraded to a warning so that
the device still loads or should the driver be fixed? I have cc'd the
btrfs mailing list, in case they have any input.

Cheers,
Nathan

  reply	other threads:[~2023-02-14  0:14 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-10  9:54 [PATCH -next v2 0/3] cleanup of devtmpfs_*_node() Longlong Xia
2023-02-10  9:54 ` [PATCH -next v2 1/3] driver core: add error handling for devtmpfs_create_node() Longlong Xia
2023-02-14  0:14   ` Nathan Chancellor [this message]
2023-02-14  0:33     ` Nathan Chancellor
2023-02-14  7:59       ` Greg KH
2023-02-10  9:54 ` [PATCH -next v2 2/3] devtmpfs: add debug info to handle() Longlong Xia
2023-02-10  9:54 ` [PATCH -next v2 3/3] devtmpfs: remove return value of devtmpfs_delete_node() Longlong Xia
2023-02-10 10:27 ` [PATCH -next v2 0/3] cleanup of devtmpfs_*_node() Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Y+rSXg14z1Myd8Px@dev-arch.thelio-3990X \
    --to=nathan@kernel.org \
    --cc=chenwandun@huawei.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rafael@kernel.org \
    --cc=sunnanyong@huawei.com \
    --cc=wangkefeng.wang@huawei.com \
    --cc=xialonglong1@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.