This brings much more flexibility compared to:
- 'fsname_norootdir', 'fsname_norootdir_ext',
which only allow the nolock behavior for the share root
- 'fileid:nolockinode', which only gets a single inode number,
and ignores the devide id completely.
You can specify path names, which are relative to the shareroot
or absolute.
These names are only evaluated at SMB_VFS_CONNECT() time,
where they are converted into devide and inode pairs.
It means they are completely ignored if the path doesn't
exist yet, or is replaced by a new inode later.
This allows:
- 'fileid:algorithm = fsname_norootdir'
to be replaced by:
'fileid:algorithm = fsname' (the default)
'fileid:nolock_paths = .'
- 'fileid:algorithm = fsname_norootdir_ext'
to be replaced by:
'fileid:algorithm = fsname' (the default)
'fileid:nolock_paths = .'
'fileid:nolock_max_slots =
18446744073709551615'
And 'fileid:nolockinode =
1234567' and be replaced by
'fileid:nolock_paths = Very/Contended/Path' or
'fileid:nolock_paths = . Very/Contended/Path1 /data/conteded.dir',
if the share root and two additional inodes should be handled
by the 'nolock' behavior.
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
ino_t nolockinode;
uint64_t max_slots = 0;
bool rootdir_nolock = false;
+ const char **nolock_paths = NULL;
+ size_t i;
int saved_errno;
int ret = SMB_VFS_NEXT_CONNECT(handle, service, user);
}
}
+ nolock_paths = lp_parm_string_list(SNUM(handle->conn), "fileid", "nolock_paths", NULL);
+ for (i = 0; nolock_paths != NULL && nolock_paths[i] != NULL; i++) {
+ SMB_STRUCT_STAT tmpsbuf;
+
+ ret = get_connectpath_ino(handle, nolock_paths[i], &tmpsbuf);
+ if (ret == -1 && errno == ENOENT) {
+ DBG_ERR("ignoring non existing nolock_paths[%zu]='%s'\n",
+ i, nolock_paths[i]);
+ continue;
+ }
+ if (ret != 0) {
+ saved_errno = errno;
+ SMB_VFS_NEXT_DISCONNECT(handle);
+ errno = saved_errno;
+ return -1;
+ }
+
+ ret = fileid_add_nolock_inode(data, &tmpsbuf);
+ if (ret != 0) {
+ saved_errno = errno;
+ SMB_VFS_NEXT_DISCONNECT(handle);
+ errno = saved_errno;
+ return -1;
+ }
+ DBG_DEBUG("Adding nolock_paths[%zu]='%s'\n",
+ i, nolock_paths[i]);
+ }
+
SMB_VFS_HANDLE_SET_DATA(handle, data, NULL,
struct fileid_handle_data,
return -1);