From: Ralph Boehme Date: Thu, 5 Aug 2021 10:08:00 +0000 (+0200) Subject: vfs_gpfs: deal with pathrefs fsps in smbd_gpfs_set_times() X-Git-Tag: ldb-2.5.0~822 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fead05a45556993b80a84fe9bb07b10debb4ae62;p=thirdparty%2Fsamba.git 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 Reviewed-by: Christof Schmitt Autobuild-User(master): Ralph Böhme Autobuild-Date(master): Thu Aug 26 20:08:51 UTC 2021 on sn-devel-184 --- diff --git a/source3/modules/vfs_gpfs.c b/source3/modules/vfs_gpfs.c index 1f5fdadc9c5..4d1cfa6075a 100644 --- a/source3/modules/vfs_gpfs.c +++ b/source3/modules/vfs_gpfs.c @@ -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; }