From: Stefan Metzmacher Date: Wed, 29 Jun 2022 15:02:32 +0000 (+0200) Subject: s3:vfs_fileid: also handle 'fsname_nodirs' via fileid_is_nolock_inode() X-Git-Tag: tevent-0.13.0~200 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=48403b0ebba2d0d8372cfa0d4ad6d418b7bc07a6;p=thirdparty%2Fsamba.git s3:vfs_fileid: also handle 'fsname_nodirs' via fileid_is_nolock_inode() This means we'll be able to provide the 'nolock' feature for all directories also with other algorithms than 'fsname' in future. Signed-off-by: Stefan Metzmacher Reviewed-by: Ralph Boehme --- diff --git a/source3/modules/vfs_fileid.c b/source3/modules/vfs_fileid.c index ff1432c8457..c491320c253 100644 --- a/source3/modules/vfs_fileid.c +++ b/source3/modules/vfs_fileid.c @@ -51,6 +51,7 @@ struct fileid_handle_data { unsigned num_mount_entries; struct fileid_mount_entry *mount_entries; struct { + bool force_all_dirs; uint64_t extid; size_t num_inodes; struct fileid_nolock_inode *inodes; @@ -276,6 +277,10 @@ static bool fileid_is_nolock_inode(struct fileid_handle_data *data, { size_t i; + if (S_ISDIR(sbuf->st_ex_mode) && data->nolock.force_all_dirs) { + return true; + } + /* * We could make this a binary search over an sorted array, * but for now we keep things simple. @@ -356,18 +361,6 @@ static uint64_t fileid_mapping_nolock_extid(uint64_t max_slots) return id; } -/* a device mapping using a fsname for files and hostname for dirs */ -static struct file_id fileid_mapping_fsname_nodirs( - struct fileid_handle_data *data, - const SMB_STRUCT_STAT *sbuf) -{ - if (S_ISDIR(sbuf->st_ex_mode)) { - return fileid_mapping_hostname(data, sbuf); - } - - return fileid_mapping_fsname(data, sbuf); -} - /* device mapping functions using a fsid */ static uint64_t fileid_device_mapping_fsid(struct fileid_handle_data *data, const SMB_STRUCT_STAT *sbuf) @@ -503,7 +496,8 @@ static int fileid_connect(struct vfs_handle_struct *handle, if (strcmp("fsname", algorithm) == 0) { data->mapping_fn = fileid_mapping_fsname; } else if (strcmp("fsname_nodirs", algorithm) == 0) { - data->mapping_fn = fileid_mapping_fsname_nodirs; + data->mapping_fn = fileid_mapping_fsname; + data->nolock.force_all_dirs = true; } else if (strcmp("fsid", algorithm) == 0) { data->mapping_fn = fileid_mapping_fsid; } else if (strcmp("hostname", algorithm) == 0) {