1
0
mirror of https://github.com/samba-team/samba.git synced 2025-03-09 08:58:35 +03:00

vfs_gpfs: use handle based gpfswrap_get_winattrs()

Fixes detecting offline flag for files in snapshot – no idea if this is
actually expected.

Replaces path based gpfswrap_get_winattrs_path() with handle based version
gpfswrap_get_winattrs(). When dealing with files in snapshots fsp->fsp_name
points to the active dataset, which will cause ENOENT failures if files are
deleted there any only present in the snapshot.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Christof Schmitt <cs@samba.org>
This commit is contained in:
Ralph Boehme 2022-05-17 16:32:23 +02:00 committed by Jeremy Allison
parent 9172c5ff6a
commit 8ae672f955

View File

@ -1878,7 +1878,7 @@ static int vfs_gpfs_ftruncate(vfs_handle_struct *handle, files_struct *fsp,
} }
static bool vfs_gpfs_is_offline(struct vfs_handle_struct *handle, static bool vfs_gpfs_is_offline(struct vfs_handle_struct *handle,
const struct smb_filename *fname, struct files_struct *fsp,
SMB_STRUCT_STAT *sbuf) SMB_STRUCT_STAT *sbuf)
{ {
struct gpfs_winattr attrs; struct gpfs_winattr attrs;
@ -1893,17 +1893,17 @@ static bool vfs_gpfs_is_offline(struct vfs_handle_struct *handle,
return false; return false;
} }
ret = gpfswrap_get_winattrs_path(fname->base_name, &attrs); ret = gpfswrap_get_winattrs(fsp_get_pathref_fd(fsp), &attrs);
if (ret == -1) { if (ret == -1) {
return false; return false;
} }
if ((attrs.winAttrs & GPFS_WINATTR_OFFLINE) != 0) { if ((attrs.winAttrs & GPFS_WINATTR_OFFLINE) != 0) {
DBG_DEBUG("%s is offline\n", fname->base_name); DBG_DEBUG("%s is offline\n", fsp_str_dbg(fsp));
return true; return true;
} }
DBG_DEBUG("%s is online\n", fname->base_name); DBG_DEBUG("%s is online\n", fsp_str_dbg(fsp));
return false; return false;
} }
@ -1917,7 +1917,7 @@ static bool vfs_gpfs_fsp_is_offline(struct vfs_handle_struct *handle,
/* /*
* Something bad happened, always ask. * Something bad happened, always ask.
*/ */
return vfs_gpfs_is_offline(handle, fsp->fsp_name, return vfs_gpfs_is_offline(handle, fsp,
&fsp->fsp_name->st); &fsp->fsp_name->st);
} }
@ -1925,7 +1925,7 @@ static bool vfs_gpfs_fsp_is_offline(struct vfs_handle_struct *handle,
/* /*
* As long as it's offline, ask. * As long as it's offline, ask.
*/ */
ext->offline = vfs_gpfs_is_offline(handle, fsp->fsp_name, ext->offline = vfs_gpfs_is_offline(handle, fsp,
&fsp->fsp_name->st); &fsp->fsp_name->st);
} }