]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
vfs_gpfs: Simplify vfs_gpfs_fset_dos_attributes
authorChristof Schmitt <cs@samba.org>
Tue, 4 Feb 2025 20:35:29 +0000 (13:35 -0700)
committerJule Anger <janger@samba.org>
Thu, 6 Feb 2025 11:24:41 +0000 (11:24 +0000)
The gpfs_set_winattrs API call accepts O_PATH descriptors since GPFS
5.1.2, so switch to fsp_get_pathref_fd and remove the fallback logic.

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
source3/modules/vfs_gpfs.c

index 5b11a811e1e0beb7c778e50eedf41b47d9d1e401..326949635343c982e964d84994adedda24cb7b25 100644 (file)
@@ -1512,41 +1512,9 @@ static NTSTATUS vfs_gpfs_fset_dos_attributes(struct vfs_handle_struct *handle,
 
        attrs.winAttrs = vfs_gpfs_dosmode_to_winattrs(dosmode);
 
-       if (!fsp->fsp_flags.is_pathref) {
-               ret = gpfswrap_set_winattrs(fsp_get_io_fd(fsp),
-                                           GPFS_WINATTR_SET_ATTRS, &attrs);
-               if (ret == -1) {
-                       DBG_WARNING("Setting winattrs failed for %s: %s\n",
-                                   fsp_str_dbg(fsp), strerror(errno));
-                       return map_nt_error_from_unix(errno);
-               }
-               return NT_STATUS_OK;
-       }
-
-       if (fsp->fsp_flags.have_proc_fds) {
-               int fd = fsp_get_pathref_fd(fsp);
-               struct sys_proc_fd_path_buf buf;
-
-               ret = gpfswrap_set_winattrs_path(sys_proc_fd_path(fd, &buf),
-                                                GPFS_WINATTR_SET_ATTRS,
-                                                &attrs);
-               if (ret == -1) {
-                       DBG_WARNING("Setting winattrs failed for "
-                                   "[%s][%s]: %s\n",
-                                   buf.buf,
-                                   fsp_str_dbg(fsp),
-                                   strerror(errno));
-                       return map_nt_error_from_unix(errno);
-               }
-               return NT_STATUS_OK;
-       }
-
-       /*
-        * This is no longer a handle based call.
-        */
-       ret = gpfswrap_set_winattrs_path(fsp->fsp_name->base_name,
-                                        GPFS_WINATTR_SET_ATTRS,
-                                        &attrs);
+       ret = gpfswrap_set_winattrs(fsp_get_pathref_fd(fsp),
+                                   GPFS_WINATTR_SET_ATTRS,
+                                   &attrs);
        if (ret == -1) {
                DBG_WARNING("Setting winattrs failed for [%s]: %s\n",
                            fsp_str_dbg(fsp), strerror(errno));