]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
vfs_gpfs: deal with pathrefs fsps in smbd_gpfs_set_times()
authorRalph Boehme <slow@samba.org>
Thu, 5 Aug 2021 10:08:00 +0000 (12:08 +0200)
committerRalph Boehme <slow@samba.org>
Thu, 26 Aug 2021 20:08:51 +0000 (20:08 +0000)
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

source3/modules/vfs_gpfs.c

index 1f5fdadc9c50cdabf5a270a424113f61e9a98371..4d1cfa6075acbb4c93232bcd6678018dcebd1c33 100644 (file)
@@ -1732,13 +1732,45 @@ static int smbd_gpfs_set_times(struct files_struct *fsp,
                return 0;
        }
 
-       rc = gpfswrap_set_times(fsp_get_io_fd(fsp), flags, gpfs_times);
-       if (rc != 0) {
-               DBG_WARNING("gpfs_set_times() returned with error %s for %s\n",
-                           strerror(errno),
-                           fsp_str_dbg(fsp));
+       if (!fsp->fsp_flags.is_pathref) {
+               rc = gpfswrap_set_times(fsp_get_io_fd(fsp), flags, gpfs_times);
+               if (rc != 0) {
+                       DBG_WARNING("gpfs_set_times(%s) failed: %s\n",
+                                   fsp_str_dbg(fsp), strerror(errno));
+               }
+               return rc;
        }
 
+
+       if (fsp->fsp_flags.have_proc_fds) {
+               int fd = fsp_get_pathref_fd(fsp);
+               const char *p = NULL;
+               char buf[PATH_MAX];
+
+               p = sys_proc_fd_path(fd, buf, sizeof(buf));
+               if (p == NULL) {
+                       return -1;
+               }
+
+               rc = gpfswrap_set_times_path(buf, flags, gpfs_times);
+               if (rc != 0) {
+                       DBG_WARNING("gpfs_set_times_path(%s,%s) failed: %s\n",
+                                   fsp_str_dbg(fsp), p, strerror(errno));
+               }
+               return rc;
+       }
+
+       /*
+        * This is no longer a handle based call.
+        */
+
+       rc = gpfswrap_set_times_path(fsp->fsp_name->base_name,
+                                    flags,
+                                    gpfs_times);
+       if (rc != 0) {
+               DBG_WARNING("gpfs_set_times_path(%s) failed: %s\n",
+                           fsp_str_dbg(fsp), strerror(errno));
+       }
        return rc;
 }