Re: [PATCH] ksmbd: hide socket error message when ipv6 config is disable

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 9/27/2022 5:51 PM, Namjae Jeon wrote:
When ipv6 config is disable(CONFIG_IPV6 is not set), ksmbd fallback to
create ipv4 socket. User reported that this error message lead to
misunderstood some issue. Users have requested not to print this error
message that occurs even though there is no problem.

Signed-off-by: Namjae Jeon <linkinjeon@xxxxxxxxxx>
---
  fs/ksmbd/transport_tcp.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/ksmbd/transport_tcp.c b/fs/ksmbd/transport_tcp.c
index 143bba4e4db8..9b35afcdcf0d 100644
--- a/fs/ksmbd/transport_tcp.c
+++ b/fs/ksmbd/transport_tcp.c
@@ -399,7 +399,8 @@ static int create_socket(struct interface *iface)
ret = sock_create(PF_INET6, SOCK_STREAM, IPPROTO_TCP, &ksmbd_socket);
  	if (ret) {
-		pr_err("Can't create socket for ipv6, try ipv4: %d\n", ret);
+		if (ret != -EAFNOSUPPORT)
+			pr_err("Can't create socket for ipv6, try ipv4: %d\n", ret);

Why not just eliminate the splat? The only real error seems to be
that IPv6 is not configured, which is undoubtedly intentional, and
in any case there's nothing to do about it. Suggesting to "try ipv4"
is kind of pointless, isn't it?

  		ret = sock_create(PF_INET, SOCK_STREAM, IPPROTO_TCP,
  				  &ksmbd_socket);
  		if (ret) {

The same question applies to IPv4 - socket creation is not something
that fails in general, and spraying the kernel log isn't particularly
useful toward fixing it. In any case, the error propagates back up
to the caller, right? Why wouldn't ksmbd.mountd do the reporting?

Tom.



[Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux