diff options
author | Günther Deschner <gd@samba.org> | 2018-12-18 17:20:29 +0100 |
---|---|---|
committer | Karolin Seeger <kseeger@samba.org> | 2019-01-14 10:20:19 +0100 |
commit | c5e171f72e5fa873873c3727f61d55ecf2f1639e (patch) | |
tree | 466fbadcc213e2f44fc6af23d496c301bf01eedd /source3/modules | |
parent | 8dc1d8c431add361fa20853f98746fb137b24d14 (diff) | |
download | samba-c5e171f72e5fa873873c3727f61d55ecf2f1639e.tar.gz |
s3-vfs-streams_xattr: add close call
https://bugzilla.samba.org/show_bug.cgi?id=13725
We cannot always rely on vfs_default to close the fake fds. This mostly is
relevant when used with another non-local VFS filesystem module such as
gluster.
Guenther
Signed-off-by: Günther Deschner <gd@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Thu Dec 20 07:18:20 CET 2018 on sn-devel-144
(cherry picked from commit 1b263ed631c86bf4117c9388fce3fa1f24cea4c9)
Diffstat (limited to 'source3/modules')
-rw-r--r-- | source3/modules/vfs_streams_xattr.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/source3/modules/vfs_streams_xattr.c b/source3/modules/vfs_streams_xattr.c index 7f930d96d6b..907451e639e 100644 --- a/source3/modules/vfs_streams_xattr.c +++ b/source3/modules/vfs_streams_xattr.c @@ -544,6 +544,31 @@ static int streams_xattr_open(vfs_handle_struct *handle, return -1; } +static int streams_xattr_close(vfs_handle_struct *handle, + files_struct *fsp) +{ + int ret; + int fd; + + fd = fsp->fh->fd; + + DBG_DEBUG("streams_xattr_close called [%s] fd [%d]\n", + smb_fname_str_dbg(fsp->fsp_name), fd); + + if (!is_ntfs_stream_smb_fname(fsp->fsp_name)) { + return SMB_VFS_NEXT_CLOSE(handle, fsp); + } + + if (is_ntfs_default_stream_smb_fname(fsp->fsp_name)) { + return SMB_VFS_NEXT_CLOSE(handle, fsp); + } + + ret = close(fd); + fsp->fh->fd = -1; + + return ret; +} + static int streams_xattr_unlink(vfs_handle_struct *handle, const struct smb_filename *smb_fname) { @@ -1669,6 +1694,7 @@ static struct vfs_fn_pointers vfs_streams_xattr_fns = { .fs_capabilities_fn = streams_xattr_fs_capabilities, .connect_fn = streams_xattr_connect, .open_fn = streams_xattr_open, + .close_fn = streams_xattr_close, .stat_fn = streams_xattr_stat, .fstat_fn = streams_xattr_fstat, .lstat_fn = streams_xattr_lstat, |