s3:vfs_fileid: also imply the generic nolock logic to the legacy 'hostname' algorithm
authorStefan Metzmacher <metze@samba.org>
Wed, 29 Jun 2022 15:06:12 +0000 (17:06 +0200)
committerRalph Boehme <slow@samba.org>
Tue, 5 Jul 2022 15:09:35 +0000 (15:09 +0000)
That way the file_id.extid is consistenly filled for all cases
where we deliberately break lock coherency.

This will simplify further changes and give administrators more
flexibility.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
source3/modules/vfs_fileid.c

index c491320c253ed8860faf2d6defdff9f1975d779c..9ef0d6919df90cda1f1397772ca9df71f07b7f8f 100644 (file)
@@ -51,6 +51,7 @@ struct fileid_handle_data {
        unsigned num_mount_entries;
        struct fileid_mount_entry *mount_entries;
        struct {
+               bool force_all_inodes;
                bool force_all_dirs;
                uint64_t extid;
                size_t num_inodes;
@@ -277,6 +278,10 @@ static bool fileid_is_nolock_inode(struct fileid_handle_data *data,
 {
        size_t i;
 
+       if (data->nolock.force_all_inodes) {
+               return true;
+       }
+
        if (S_ISDIR(sbuf->st_ex_mode) && data->nolock.force_all_dirs) {
                return true;
        }
@@ -502,6 +507,7 @@ static int fileid_connect(struct vfs_handle_struct *handle,
                data->mapping_fn = fileid_mapping_fsid;
        } else if (strcmp("hostname", algorithm) == 0) {
                data->mapping_fn = fileid_mapping_hostname;
+               data->nolock.force_all_inodes = true;
        } else if (strcmp("fsname_norootdir", algorithm) == 0) {
                data->mapping_fn = fileid_mapping_fsname;
                rootdir_nolock = true;