1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-24 21:34:56 +03:00
Commit Graph

3997 Commits

Author SHA1 Message Date
Christof Schmitt
3224eb8fcf vfs_default: Rename kernel_flock to filesystem_sharemode
Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2021-09-21 18:47:38 +00:00
Christof Schmitt
4209e42ab1 vfs_streams_xattr: Rename kernel_flock to filesystem_sharemode
Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2021-09-21 18:47:38 +00:00
Christof Schmitt
b63ee5c739 vfs_gpfs: Rename kernel_flock to filesystem_sharemode
Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2021-09-21 18:47:38 +00:00
Christof Schmitt
272fce3cbd vfs_time_audit: Fix message for fcntl VFS call
Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2021-09-21 18:47:38 +00:00
Christof Schmitt
f3bd312ad9 vfs_time_audit: Rename kernel_flock to filesystem_sharemode
Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2021-09-21 18:47:38 +00:00
Christof Schmitt
0bd1df93fc vfs_glusterfs: Rename kernel_flock to filesystem_sharemode
Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2021-09-21 18:47:38 +00:00
Christof Schmitt
0ac9dfd267 vfs_ceph: Rename kernel_flock to filesystem_sharemode
Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2021-09-21 18:47:38 +00:00
Christof Schmitt
ad87998ab4 vfs_full_audit: Rename kernel_flock to filesystem_sharemode
Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2021-09-21 18:47:38 +00:00
Christof Schmitt
c794e77381 VFS: Rename kernel_flock to filesystem_sharemode
With the removal of the call to flock LOCK_MAND, the only remaining use
of this VFS path is to register sharemodes with specific file systems.
Rename the VFS call to reflect that this is no longer related to flock.

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2021-09-21 18:47:38 +00:00
Christof Schmitt
f3b5733df7 profile: Remove syscall_kernel_flock profiling
This no longer calls flock, so it should not be part of the system call
profiling.

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2021-09-21 18:47:38 +00:00
Christof Schmitt
e1398c34b2 vfs_default: Return ENOTSUP for sharemodes flock call
Remove the call to kernel_flock, as this function will be deleted.
Have the function return ENOTSUP to indicate that this is not supported
by default (without a file-system specific VFS module).

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2021-09-14 23:14:36 +00:00
Christof Schmitt
5488a242fb vfs_gpfs: Remove call to kernel_flock
The function kernel_flock will be deleted.

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2021-09-14 23:14:36 +00:00
Christof Schmitt
facd6e01bd vfs_gpfs: Update comment in vfs_gpfs_kernel_flock
The function kernel_flock will be deleted, drop the reference to it.

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2021-09-14 23:14:36 +00:00
Ralph Boehme
ed35fce4fe vfs_btrfs: fix btrfs_fget_compression()
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14790
RB: vfs_btrfs compression support broken

Reported-by: noel.kuntze@thermi.consulting

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Fri Sep 10 18:16:18 UTC 2021 on sn-devel-184
2021-09-10 18:16:18 +00:00
Ralph Boehme
fead05a455 vfs_gpfs: deal with pathrefs fsps in smbd_gpfs_set_times()
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14771

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Christof Schmitt <cs@samba.org>

Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Thu Aug 26 20:08:51 UTC 2021 on sn-devel-184
2021-08-26 20:08:51 +00:00
Ralph Boehme
1bbdb81899 vfs_gpfs: remove ENOSYS fallback from vfs_gpfs_fntimes()
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14771

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Christof Schmitt <cs@samba.org>
2021-08-26 19:18:31 +00:00
Ralph Boehme
9a237e168a vfs_gpfs: pass fsp to smbd_gpfs_set_times()
No change in behaviour. Prepares for dealing with pathref fsps in
smbd_gpfs_set_times().

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14771

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Christof Schmitt <cs@samba.org>
2021-08-26 19:18:31 +00:00
Ralph Boehme
443608ee81 vfs_gpfs: deal with pathref fsps in vfs_gpfs_fntimes()
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14771

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Christof Schmitt <cs@samba.org>
2021-08-26 19:18:31 +00:00
Ralph Boehme
882a466ea5 vfs_gpfs: add sys_proc_fd_path() fallback to vfs_gpfs_fset_dos_attributes()
gpfs_set_winattrs() is a modifying operation, my expectation thus is that it is
not allowed on pathref (O_PATH) handles even though a recent Linux kernel commit
44a3b87444058b2cb055092cdebc63858707bf66 allowed calling utimensat() on pathref
handles.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14771
RN: Some VFS operations on pathref (O_PATH) handles fail on GPFS

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Christof Schmitt <cs@samba.org>
2021-08-26 19:18:31 +00:00
Ralph Boehme
3679f54f17 vfs_gpfs: remove ENOSYS fallback from vfs_gpfs_fset_dos_attributes()
This API call has existed for a long time, so we can safely assume that this
always works.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14771

Pair-Programmed-With: Christof Schmitt <cs@samba.org>
Signed-off-by: Ralph Boehme <slow@samba.org>
Signed-off-by: Christof Schmitt <cs@samba.org>
2021-08-26 19:18:31 +00:00
Ralph Boehme
fde1b98143 vfs_gpfs: add path based fallback for gpfswrap_fstat_x() on pathref handles
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14771

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Christof Schmitt <cs@samba.org>
2021-08-26 19:18:31 +00:00
Ralph Boehme
730f8c49a9 vfs_gpfs: check for O_PATH support in gpfswrap_fstat_x()
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14771

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Christof Schmitt <cs@samba.org>
2021-08-26 19:18:31 +00:00
Ralph Boehme
1a3ac7a940 vfs_gpfs: make vfs_gpfs_connect() a no-op on IPC shares
We don't ever expect any filesystem IO operations to be called on an IPC shares,
so there's no need to initialize the module here.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14771

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Christof Schmitt <cs@samba.org>
2021-08-26 19:18:31 +00:00
Stefan Metzmacher
070dce224b vfs_gpfs: don't check for struct gpfs_config_data in vfs_gpfs_[l]stat()
This is unused and the config object won't be avilable for IPC$ anymore with the
next commit.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14771

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Christof Schmitt <cs@samba.org>
2021-08-26 19:18:31 +00:00
Ralph Boehme
145e739c44 vfs_gpfs: call SMB_VFS_NEXT_CONNECT() before running some module initialization code
No change in behaviour. Prepares for a subsequent commit that checks for IPC shares.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14771

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Christof Schmitt <cs@samba.org>
2021-08-26 19:18:31 +00:00
Jeremy Allison
649f544ab2 s3: VFS: streams_depot: Allow "streams directory" outside of share path to work again.
As we're dealing with absolute paths here, we just need
to temporarily replace the connectpath whilst enumerating
streams.

Remove knownfail file.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14760

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <noel.power@suse.com>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Thu Aug 19 17:04:44 UTC 2021 on sn-devel-184
2021-08-19 17:04:44 +00:00
Jeremy Allison
1e3232006d s3: VFS: vfs_streams_depot: Factor out the code that gets the absolute stream rootdir into a function.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14760

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <noel.power@suse.com>
2021-08-19 16:14:30 +00:00
Ralph Boehme
c25f72f401 vfs_default: detect EOPNOTSUPP and ENOSYS errors from copy_file_range()
When building in a RHEL 7 container on a RHEL 8 host, the current configure
check will detect a working SYS_copy_file_range() syscall.

Later when the resulting smbd binary is run in a RHEL 7 container on a RHEL
7 (vs 8 on the build host) host, SYS_copy_file_range() will fail with
EOPNOTSUPP.

Since the kernel support for copy_file_range() included a fallback in case
filesystems didn't implement it, the caching of copy_file_range() support can be
made a global via the static try_copy_file_range bool, there's no need to deal
with per-fileystem behaviour differences. For the curious: SYS_copy_file_range()
appeared in Linux 4.5, fallback code being vfs_copy_file_range() ->
do_splice_direct().

On current kernels the fallback function is generic_copy_file_range() (which
still calls do_splice_direct()) called from the filesystem backends directly or
from vfs_copy_file_range() -> do_copy_file_range().

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14795

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2021-08-13 10:57:31 +00:00
David Gajewski
069d23f0a7 s3: VFS: solarisacl: Fix compile error (missed variable rename).
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14773

Signed-off-by: David Gajewski <dgajews@math.utoledo.edu>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>

Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Fri Aug  6 17:19:57 UTC 2021 on sn-devel-184
2021-08-06 17:19:57 +00:00
Jeremy Allison
4f093ae6c9 s3: VFS: ceph. Fix enumerating directories. dirfsp->fh->fd != AT_FDCWD in this case.
Same as the fix for glusterfs.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14766

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>

Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Thu Aug  5 06:15:14 UTC 2021 on sn-devel-184
2021-08-05 06:15:14 +00:00
Jeremy Allison
447c9380dc s3: VFS: default. In vfswrap_getxattrat_do_async() always use the pathref fsp.
This is always called via a path that mandates
smb_fname->fsp is valid.

https://bugzilla.samba.org/show_bug.cgi?id=14758

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>

Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Thu Jul 15 05:48:05 UTC 2021 on sn-devel-184
2021-07-15 05:48:04 +00:00
Jeremy Allison
2b4062b4a1 s3: VFS: default. In vfswrap_getxattrat_do_sync() always use the pathref fsp.
This is always called via a path that mandates
smb_fname->fsp is valid.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14758

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2021-07-15 05:02:30 +00:00
Jeremy Allison
24dc3ca67a s3: VFS: default: Add 'handle' member to struct vfswrap_getxattrat_state
Not yet used.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14758

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2021-07-15 05:02:30 +00:00
Jeremy Allison
e0b327f2eb s3: VFS: default: Move vfswrap_fgetxattr() before the async versions.
We want to re-use this and don't want to have to add forward
declarations.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14758

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2021-07-15 05:02:30 +00:00
Jeremy Allison
6e7ffa8da3 s3: tests: Our tests for "smbd async dosmode = yes" haven't been working correctly as the parameter has been set incorrectly.
If must be "smbd async dosmode", not "smbd:async dosmode"

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14758

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2021-07-15 05:02:30 +00:00
Jeremy Allison
e168a95c1b s3: VFS: Update status of SMB_VFS_READ_DFS_PATHAT.
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>

Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Wed Jul 14 08:58:30 UTC 2021 on sn-devel-184
2021-07-14 08:58:29 +00:00
Jeremy Allison
165d0998c7 s3: VFS: time_audit. In smb_time_audit_read_dfs_pathat(), cope with relative pathnames.
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2021-07-14 08:09:31 +00:00
Jeremy Allison
84070c3e8d s3: VFS: shadow_copy2. In shadow_copy2_read_dfs_pathat(), cope with relative pathnames.
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2021-07-14 08:09:31 +00:00
Jeremy Allison
a3664ca2e0 s3: VFS: glusterfs. In vfs_gluster_read_dfs_pathat(), cope with relative pathnames.
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2021-07-14 08:09:31 +00:00
Jeremy Allison
288eec969e s3: VFS: full_audit. In smb_full_audit_read_dfs_pathat(), cope with relative pathnames.
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2021-07-14 08:09:31 +00:00
Jeremy Allison
43970634cf s3: VFS: ceph: In cephwrap_read_dfs_pathat(), cope with relative pathnames.
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2021-07-14 08:09:31 +00:00
Jeremy Allison
ac0ff0e1fe s3: VFS: cap: Fix cap_read_dfs_pathat() to cope with relative paths.
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2021-07-14 08:09:31 +00:00
Jeremy Allison
4da6a9f4e6 s3: VFS: default. In vfswrap_read_dfs_pathat(), cope with relative pathnames.
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2021-07-14 08:09:31 +00:00
Jeremy Allison
9fa5e171b9 s3: VFS: default. In vfswrap_read_dfs_pathat() use sys_fstatat().
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2021-07-14 08:09:31 +00:00
Jeremy Allison
106beab5bf s2: VFS: default. Fix vfswrap_read_dfs_pathat() to use fsp_get_pathref_fd() not fsp_get_io_fd().
We don't need an io fd here, and we only get away
with it as we have the assert above:

SMB_ASSERT(dirfsp == dirfsp->conn->cwd_fsp);

This will be removed next.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2021-07-14 08:09:31 +00:00
Jeremy Allison
cc6e433b1b s3: VFS: default. Fix vfswrap_readdir() to use sys_fstatat().
Change struct stat st -> SMB_STRUCT_STAT st
and just copy the struct on success, as sys_fstatat()
already does the init_stat_ex_from_stat() for us.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2021-07-14 08:09:31 +00:00
Ralph Boehme
f66d3621f5 s3: expect fstatat() and dirfd()
FreeBSD, AIX and Solaris all have this.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2021-07-14 08:09:31 +00:00
Ralph Boehme
c7d6745858 vfs_shadow_copy2: ensure we call convert_sbuf() in shadow_copy2_*stat() on already converted paths with absolute path
shadow_copy2_strip_snapshot() will happily return without modifying the passed
timestamp=0 if the path is already converted and refers to an object in a
snapshot, eg (first debug line from extra debugging patch [1]):

[10 2021/07/02 08:19:28.811424 pid=738290 ../../source3/modules/vfs_shadow_copy2.c:1303 shadow_copy2_fstat]
  shadow_copy2_fstat: fsp [test.txt {@GMT-2000.01.02-03.04.05}]
[10 2021/07/02 08:19:28.811449 pid=738290 ../../source3/modules/vfs_shadow_copy2.c:607 _shadow_copy2_strip_snapshot_internal]
  _shadow_copy2_strip_snapshot_internal: [from shadow_copy2_fstat()] Path 'test.txt {@GMT-2000.01.02-03.04.05}'
[10 2021/07/02 08:19:28.811474 pid=738290 ../../source3/modules/vfs_shadow_copy2.c:619 _shadow_copy2_strip_snapshot_internal]
  _shadow_copy2_strip_snapshot_internal: abs path '/gpfs0/smb_snapshots2/filesetone/.snapshots/@GMT-2000.01.02-03.04.05/test.txt'
[10 2021/07/02 08:19:28.811496 pid=738290 ../../source3/modules/vfs_shadow_copy2.c:1924 shadow_copy2_snapshot_to_gmt]
  shadow_copy2_snapshot_to_gmt: match @GMT-%Y.%m.%d-%H.%M.%S: @GMT-2000.01.02-03.04.05
[10 2021/07/02 08:19:28.811536 pid=738290 ../../source3/modules/vfs_shadow_copy2.c:566 check_for_converted_path]
  check_for_converted_path: path |/gpfs0/smb_snapshots2/filesetone/.snapshots/@GMT-2000.01.02-03.04.05/test.txt| is already converted. connect path = |/gpfs0/smb_snapshots2/filesetone/.snapshots/@GMT-2000.01.02-03.04.05|

As check_for_converted_path() detects an "already converted path",
_shadow_copy2_strip_snapshot_internal() just returns without modifying the value
of the timestamp.

By using shadow_copy2_strip_snapshot_converted() instead of
shadow_copy2_strip_snapshot() we can check if the path is in fact referring to a
VSS object by checking the "converted" bool.

An alternative way would have been directly checking fsp->fsp_name->twrp != 0,
but that would be a new semantic in the module, I'll leave this excersize for
the future when we clean up the usage of shadow_copy2_strip_snapshot() in the
whole module.

This change also switches to using the absolute paths in both place where
convert_sbuf() is called.

[1]
@@ -1309,8 +1348,16 @@ static int shadow_copy2_fstat(vfs_handle_struct *handle, files_struct *fsp,
                saved_errno = errno;
        }

+       DBG_DEBUG("fsp [%s]\n", fsp_str_dbg(fsp));

RN: vfs_shadow_copy2 fixinodes not correctly updating inode numbers
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14756

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2021-07-14 08:09:31 +00:00
Jeremy Allison
40cf129abb s3: VFS: streams_xattr: In streams_xattr_stat() use synthetic_pathref() with basename
Remove my poor imitation of synthetic_pathref(), just call the real thing.

We need to go through the full VFS stack here to get
the ino correct to get the fsp handle.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14756

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2021-07-14 08:09:31 +00:00
Jeremy Allison
03e36502f4 s3: VFS: fruit. In ad_get_meta_fsp(), we only need a handle on the base file, not the stream.
We'll be calling SMB_VFS_FGETXATTR() on the base fsp anyway.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14756

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2021-07-14 08:09:31 +00:00