{"id":2219177,"url":"http://patchwork.ozlabs.org/api/1.0/covers/2219177/?format=json","project":{"id":12,"url":"http://patchwork.ozlabs.org/api/1.0/projects/12/?format=json","name":"Linux CIFS Client","link_name":"linux-cifs-client","list_id":"linux-cifs.vger.kernel.org","list_email":"linux-cifs@vger.kernel.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20260402141839.461257-1-huiwen.he@linux.dev>","date":"2026-04-02T14:18:26","name":"[v3,00/13] smb: improve search speed of SMB1 maperror","submitter":{"id":93029,"url":"http://patchwork.ozlabs.org/api/1.0/people/93029/?format=json","name":null,"email":"huiwen.he@linux.dev"},"series":[{"id":498490,"url":"http://patchwork.ozlabs.org/api/1.0/series/498490/?format=json","date":"2026-04-02T14:18:28","name":"smb: improve search speed of SMB1 maperror","version":3,"mbox":"http://patchwork.ozlabs.org/series/498490/mbox/"}],"headers":{"Return-Path":"\n <linux-cifs+bounces-10633-incoming=patchwork.ozlabs.org@vger.kernel.org>","X-Original-To":["incoming@patchwork.ozlabs.org","linux-cifs@vger.kernel.org"],"Delivered-To":"patchwork-incoming@legolas.ozlabs.org","Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (1024-bit key;\n unprotected) header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256\n header.s=key1 header.b=ASFMiDvy;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=2600:3c0a:e001:db::12fc:5321; helo=sea.lore.kernel.org;\n envelope-from=linux-cifs+bounces-10633-incoming=patchwork.ozlabs.org@vger.kernel.org;\n receiver=patchwork.ozlabs.org)","smtp.subspace.kernel.org;\n\tdkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev\n header.b=\"ASFMiDvy\"","smtp.subspace.kernel.org;\n arc=none smtp.client-ip=91.218.175.178","smtp.subspace.kernel.org;\n dmarc=pass (p=none dis=none) header.from=linux.dev","smtp.subspace.kernel.org;\n spf=pass smtp.mailfrom=linux.dev"],"Received":["from sea.lore.kernel.org (sea.lore.kernel.org\n [IPv6:2600:3c0a:e001:db::12fc:5321])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fmkgM0Rcjz1yCs\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 03 Apr 2026 01:26:23 +1100 (AEDT)","from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby sea.lore.kernel.org (Postfix) with ESMTP id 84E8030A164A\n\tfor <incoming@patchwork.ozlabs.org>; Thu,  2 Apr 2026 14:19:45 +0000 (UTC)","from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id 0EC893E557D;\n\tThu,  2 Apr 2026 14:19:45 +0000 (UTC)","from out-178.mta0.migadu.com (out-178.mta0.migadu.com\n [91.218.175.178])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby smtp.subspace.kernel.org (Postfix) with ESMTPS id 3AAC63DD510\n\tfor <linux-cifs@vger.kernel.org>; Thu,  2 Apr 2026 14:19:42 +0000 (UTC)"],"ARC-Seal":"i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1775139584; cv=none;\n b=GB5mmrM2ZRfej7DxjKW3tYuUIT8IWjbKanhk1qbWeSxE/lWRtK3JMhi2qeTshJlwT6ffQRqe7XvOofBb1TFjWF/XVCC91YJlmUEvSfBN2Qp+s/S2zGt61gjQhpLyTln2TKiWTbpwP0EyhH/itPYMLL7vSfDnyYbsnfV84HJvsDc=","ARC-Message-Signature":"i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1775139584; c=relaxed/simple;\n\tbh=BnHpjpqiEySw6avpX4qyduo3FtzWBVBfD0VjWGkZiAM=;\n\th=From:To:Cc:Subject:Date:Message-ID:MIME-Version;\n b=E41U9/9oFgNUMMurhy18g/NG7d28ovUWzXIggQdLDXWNHfWPAml5+vt7XgdAje396miPnZyeRVt+rdZU4SWk1/SRFhMdUrWbKyKlRYcPFVvx8PnjFxskqUnV5J1gwmCz0UEOdliXNC7CZROy4qawSfPHla5cm316pq3mzoP1R9w=","ARC-Authentication-Results":"i=1; smtp.subspace.kernel.org;\n dmarc=pass (p=none dis=none) header.from=linux.dev;\n spf=pass smtp.mailfrom=linux.dev;\n dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev\n header.b=ASFMiDvy; arc=none smtp.client-ip=91.218.175.178","X-Report-Abuse":"Please report any abuse attempt to abuse@migadu.com and\n include these headers.","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1;\n\tt=1775139580;\n\th=from:from:reply-to:subject:subject:date:date:message-id:message-id:\n\t to:to:cc:cc:mime-version:mime-version:\n\t content-transfer-encoding:content-transfer-encoding;\n\tbh=GA26MpNK1PLvK311ka2IkW6uD6ecxoXEcBSK+/lNejQ=;\n\tb=ASFMiDvy94lJa0fTCTQhczpTfj5ed3KGlcY01+E/pR78OsEFTNlSrEbC/+1W9kiLHtmJVf\n\tXOlfSUzctht4VusZq0/HWA+zz9LfvosCubz5pbG/YBjwCr0wm/nThpALzHIb7FpZIjmMw7\n\tcyQgsCHJH32od6dGlz/gsbJ6z2Ggk4Q=","From":"huiwen.he@linux.dev","To":"smfrench@gmail.com,\n\tlinkinjeon@kernel.org,\n\tdhowells@redhat.com,\n\tchenxiaosong@kylinos.cn,\n\tchenxiaosong@chenxiaosong.com,\n\ttangyouling@kylinos.cn","Cc":"linux-cifs@vger.kernel.org,\n\tHuiwen He <hehuiwen@kylinos.cn>","Subject":"[PATCH v3 00/13] smb: improve search speed of SMB1 maperror","Date":"Thu,  2 Apr 2026 14:18:26 +0000","Message-ID":"<20260402141839.461257-1-huiwen.he@linux.dev>","Precedence":"bulk","X-Mailing-List":"linux-cifs@vger.kernel.org","List-Id":"<linux-cifs.vger.kernel.org>","List-Subscribe":"<mailto:linux-cifs+subscribe@vger.kernel.org>","List-Unsubscribe":"<mailto:linux-cifs+unsubscribe@vger.kernel.org>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","X-Migadu-Flow":"FLOW_OUT"},"content":"From: Huiwen He <hehuiwen@kylinos.cn>\n\nv2->v3:\n  - All test cases passed for v3, please see ChenXiaoSong's blog: https://chenxiaosong.com/en/smb1maperror-test.html\n  - Patch #01: Correct the SMB1 mapping  NT_STATUS_OBJECT_NAME_INVALID \n  - Patch #02 #10: gen_smb1_mapping: Enhance regex robustness to cover mixed-case prefixes (e.g., ErrNotALink), and match exact filenames to prevent mapping outputs to incorrect files.\n  - Patch #06: Add `__init` to `DEFINE_CHECK_SORT_FUNC`\n  - Patch #07: Use `KUNIT_ASSERT_NOT_NULL`\n  - Add patch #08: Move ERRnetlogonNotStarted to DOS error class\n\nv2: https://lore.kernel.org/linux-cifs/20260401072912.355072-1-huiwen.he@linux.dev/\n\nWhen searching for the last element, the comparison counts are shown in the table below:\n\n+--------------------+--------+--------+\n|                    |Before  |After   |\n|                    |Patchset|Patchset|\n+--------------------+--------+--------+\n| ntstatus_to_dos_map|   533  |    9   |\n+--------------------+--------+--------+\n|mapping_table_ERRDOS|    34  |    5   |\n+--------------------+--------+--------+\n|mapping_table_ERRSRV|    37  |    5   |\n+--------------------+--------+--------+\n\nThe following patches from v1 have already been merged into the mainline:\n  - a71a4aab4834 smb/client: add parentheses to NT error code definitions containing bitwise OR operator\n  - a9adafd40165 smb/client: add 4 NT error code definitions\n  - 98def4eb0244 smb/server: remove unused nterr.h\n  - 9f99caa8950a smb/client: fix NT_STATUS_UNABLE_TO_FREE_VM value\n  - b2b50fca34da smb/client: fix NT_STATUS_DEVICE_DOOR_OPEN value\n  - a1237c203f17 smb/client: fix NT_STATUS_NO_DATA_DETECTED value\n\nHuiwen He (9):\n  smb/client: annotate nterr.h with DOS error codes\n  smb/client: autogenerate SMB1 NT status to DOS error mapping\n  smb/client: replace nt_errs with ntstatus_to_dos_map\n  smb/client: refactor ntstatus_to_dos() to return mapping entry\n  smb/client: use binary search for NT status to DOS mapping\n  smb/client: move ERRnetlogonNotStarted to DOS error class\n  smb/client: annotate smberr.h with POSIX error codes\n  smb/client: autogenerate SMB1 DOS/SRV to POSIX error mapping\n  smb/client: use binary search for SMB1 DOS/SRV error mapping\n\nYouling Tang (4):\n  smb/client: check if ntstatus_to_dos_map is sorted\n  smb/client: introduce KUnit test to check ntstatus_to_dos_map search\n  smb/client: check if SMB1 DOS/SRV error mapping arrays are sorted\n  smb/client: introduce KUnit tests to check DOS/SRV err mapping search\n\n fs/smb/client/.gitignore          |    3 +\n fs/smb/client/Kconfig             |   11 +\n fs/smb/client/Makefile            |   25 +-\n fs/smb/client/cifsfs.c            |    6 +\n fs/smb/client/gen_smb1_mapping    |  112 +++\n fs/smb/client/nterr.c             |  704 -------------------\n fs/smb/client/nterr.h             | 1082 +++++++++++++++--------------\n fs/smb/client/smb1maperror.c      |  873 +++++------------------\n fs/smb/client/smb1maperror_test.c |   83 +++\n fs/smb/client/smb1proto.h         |    9 +\n fs/smb/client/smberr.h            |  415 +++++++----\n 11 files changed, 1235 insertions(+), 2088 deletions(-)\n create mode 100644 fs/smb/client/gen_smb1_mapping\n delete mode 100644 fs/smb/client/nterr.c\n create mode 100644 fs/smb/client/smb1maperror_test.c"}