]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3-vfs_fruit: add 'fruit:veto_localized' option
authorGünther Deschner <gd@samba.org>
Mon, 24 Oct 2022 13:42:54 +0000 (15:42 +0200)
committerGünther Deschner <gd@samba.org>
Thu, 14 Aug 2025 11:08:11 +0000 (11:08 +0000)
This new boolean option allows to automatically treat ".localized" as
vetoed files. Any attempts to access a ".localized" file or directory
will result in an access failure. MacOS tries to check for the presence
of such a file to check for the need of localized name display in
directory listings or checks for .localized directories containing name
translations).  In large directory listings, typically half of the
compound SMB2 queries are done for ".localized", causing a significant
performance impact in particular with clustered filesystems.

More information can be found here:
https://developer.apple.com/library/archive/documentation/FileManagement/Conceptual/FileSystemAdvancedPT/LocalizingtheNameofaDirectory/LocalizingtheNameofaDirectory.html

Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Günther Deschner <gd@samba.org>
Autobuild-Date(master): Thu Aug 14 11:08:11 UTC 2025 on atb-devel-224

docs-xml/manpages/vfs_fruit.8.xml
source3/modules/vfs_fruit.c

index 9e27030b660170ed051a0099e30dc07ec5d1e281..037fe611c4e026432375a1f426f06897337f753b 100644 (file)
            </listitem>
          </varlistentry>
 
+         <varlistentry>
+           <term>fruit:veto_localized = yes | no</term>
+           <listitem>
+
+             <para>When <parameter>fruit:veto_localized</parameter> is set to
+             <parameter>yes</parameter>, vfs_fruit will automatically veto any
+             attempts to access the <emphasis>.localized</emphasis> file or directory.
+             These can be created in order to let Mac OS provide localized
+             translations for folder names (typically for localized versions
+             of <emphasis>Desktop</emphasis>, <emphasis>Music</emphasis>, etc.).
+             When very large directories are listed a Mac client might do queries for
+             the presence of the .localized file for each and every entry in that
+             directory listing. In combination with clustered filesystems this might
+             have a significant impact on the overal directory listing performance.
+             When potential folder name translation is not desired this option allows
+             to avoid the additional network overhead by not letting the server go
+             down to the filesystem layer for any queries.</para>
+             <para>The default is <emphasis>no</emphasis>.</para>
+
+            </listitem>
+         </varlistentry>
        </variablelist>
 </refsect1>
 
index 1b72eeec534ba9a093351e2443f6340ab9438193..6f12c3c5d3ee9d1b8233b58391f6fadf14823da8 100644 (file)
@@ -136,6 +136,7 @@ struct fruit_config_data {
        bool wipe_intentionally_left_blank_rfork;
        bool delete_empty_adfiles;
        bool validate_afpinfo;
+       bool veto_localized;
 
        /*
         * Additional options, all enabled by default,
@@ -378,6 +379,10 @@ static int init_fruit_config(vfs_handle_struct *handle)
                SNUM(handle->conn), FRUIT_PARAM_TYPE_NAME,
                "validate_afpinfo", true);
 
+       config->veto_localized = lp_parm_bool(
+               SNUM(handle->conn), FRUIT_PARAM_TYPE_NAME,
+               "veto_localized", false);
+
        SMB_VFS_HANDLE_SET_DATA(handle, config,
                                NULL, struct fruit_config_data,
                                return -1);
@@ -1364,6 +1369,26 @@ static int fruit_connect(vfs_handle_struct *handle,
                TALLOC_FREE(list);
        }
 
+       if (config->veto_localized) {
+               list = lp_veto_files(talloc_tos(), lp_sub, SNUM(handle->conn));
+
+               if (list) {
+                       newlist = talloc_asprintf(
+                               list,
+                               "%s/.localized/",
+                               list);
+                       lp_do_parameter(SNUM(handle->conn),
+                                       "veto files",
+                                       newlist);
+               } else {
+                       lp_do_parameter(SNUM(handle->conn),
+                                       "veto files",
+                                       "/.localized/");
+               }
+
+               TALLOC_FREE(list);
+       }
+
        if (config->encoding == FRUIT_ENC_NATIVE) {
                lp_do_parameter(SNUM(handle->conn),
                                "catia:mappings",