[SCM] Samba Shared Repository - branch master updated
Jeremy Allison
jra at samba.org
Fri Jun 3 21:54:01 UTC 2022
The branch, master has been updated
via 3bd753983c8 lib/util/gpfswrap: remove unused gpfswrap_get_winattrs_path()
via 8ae672f955b vfs_gpfs: use handle based gpfswrap_get_winattrs()
via 9172c5ff6a4 lib/util/gpfswrap: remove unused gpfswrap_getacl()
via a0dc4c90265 vfs_gpfs: finally: use gpfswrap_fgetacl() instead of gpfswrap_getacl()
via d373ff3c01c lib/util/gpfswrap: add gpfswrap_fgetacl()
via 1b2c70f4d16 vfs_gpfs: pass fsp to gpfs_getacl_with_capability()
via ac458648aa3 vfs_gpfs: pass fsp to vfs_gpfs_getacl()
via 3764be70319 vfs_gpfs: use fsp in gpfsacl_get_posix_acl()
via c26efe0c23b vfs_gpfs: pass fsp to gpfsacl_get_posix_acl()
via 5f4625a2859 vfs_gpfs: pass fsp to gpfs_get_nfs4_acl()
via ad06d806831 vfs_gpfs: pass fsp to gpfsacl_emu_chmod()
via a0f7ced6100 vfs_gpfs: indentation and README.Coding fixes
from ac16351ff5a s3:printing: Start samba-bgqd as soon as possible
https://git.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 3bd753983c8dac33b483affa859984b7e3350d65
Author: Ralph Boehme <slow at samba.org>
Date: Tue May 17 16:52:21 2022 +0200
lib/util/gpfswrap: remove unused gpfswrap_get_winattrs_path()
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15069
Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Christof Schmitt <cs at samba.org>
Autobuild-User(master): Jeremy Allison <jra at samba.org>
Autobuild-Date(master): Fri Jun 3 21:53:31 UTC 2022 on sn-devel-184
commit 8ae672f955bf07bb97f38b7d2f965f14e8315e9e
Author: Ralph Boehme <slow at samba.org>
Date: Tue May 17 16:32:23 2022 +0200
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 at samba.org>
Reviewed-by: Christof Schmitt <cs at samba.org>
commit 9172c5ff6a419e4daef451564650d4a3ce96bfae
Author: Ralph Boehme <slow at samba.org>
Date: Tue May 17 16:27:58 2022 +0200
lib/util/gpfswrap: remove unused gpfswrap_getacl()
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15069
Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Christof Schmitt <cs at samba.org>
commit a0dc4c9026519c949070dc001e7addad7c7d35ce
Author: Ralph Boehme <slow at samba.org>
Date: Tue May 17 16:02:10 2022 +0200
vfs_gpfs: finally: use gpfswrap_fgetacl() instead of gpfswrap_getacl()
Replaces path based gpfswrap_getacl() with handle based version
gpfswrap_fgetacl(). 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:
[2022/05/06 11:32:55.233435, 4, pid=12962, effective(1460548, 273710), real(1460548, 0)]
calling open_file with flags=0x0 flags2=0x800 mode=0644, access_mask = 0x80, open_access_mask = 0x80
[2022/05/06 11:32:55.233460, 10, pid=12962, effective(1460548, 273710), real(1460548, 0), class=vfs]
gpfs_get_nfs4_acl invoked for dir/subdir/file.txt
[2022/05/06 11:32:55.233495, 5, pid=12962, effective(1460548, 273710), real(1460548, 0), class=vfs]
smbd_gpfs_getacl failed with No such file or directory
[2022/05/06 11:32:55.233521, 9, pid=12962, effective(1460548, 273710), real(1460548, 0), class=vfs]
gpfs_getacl failed for dir/subdir/file.txt with No such file or directory
[2022/05/06 11:32:55.233546, 10, pid=12962, effective(1460548, 273710), real(1460548, 0)]
smbd_check_access_rights_fsp: Could not get acl on dir/subdir/file.txt {@GMT-2022.05.04-11.58.53}: NT_STATUS_OBJECT_NAME_NOT_FOUND
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15069
Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Christof Schmitt <cs at samba.org>
commit d373ff3c01c2c50cd539b78494c0673974a0f046
Author: Ralph Boehme <slow at samba.org>
Date: Tue May 17 15:43:39 2022 +0200
lib/util/gpfswrap: add gpfswrap_fgetacl()
Adds handle based version of gpfswrap_getacl().
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15069
Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Christof Schmitt <cs at samba.org>
commit 1b2c70f4d16e48998c9c8bc9e22ee8eb3c0ad53e
Author: Ralph Boehme <slow at samba.org>
Date: Tue May 17 16:01:48 2022 +0200
vfs_gpfs: pass fsp to gpfs_getacl_with_capability()
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15069
Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Christof Schmitt <cs at samba.org>
commit ac458648aa3f557b7f137f7efa88806f7cb0da71
Author: Ralph Boehme <slow at samba.org>
Date: Tue May 17 15:35:26 2022 +0200
vfs_gpfs: pass fsp to vfs_gpfs_getacl()
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15069
Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Christof Schmitt <cs at samba.org>
commit 3764be70319d8e953a6205649fecaed06c93dbc8
Author: Ralph Boehme <slow at samba.org>
Date: Tue May 17 15:34:35 2022 +0200
vfs_gpfs: use fsp in gpfsacl_get_posix_acl()
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15069
Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Christof Schmitt <cs at samba.org>
commit c26efe0c23b426c4a1e7073b040da85df6f1ea61
Author: Ralph Boehme <slow at samba.org>
Date: Tue May 17 15:32:24 2022 +0200
vfs_gpfs: pass fsp to gpfsacl_get_posix_acl()
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15069
Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Christof Schmitt <cs at samba.org>
commit 5f4625a2859bf622ea2034e5bbf63f9959e58b78
Author: Ralph Boehme <slow at samba.org>
Date: Tue May 17 15:25:35 2022 +0200
vfs_gpfs: pass fsp to gpfs_get_nfs4_acl()
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15069
Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Christof Schmitt <cs at samba.org>
commit ad06d806831c80a1169468d18b3e59b239a5ba77
Author: Ralph Boehme <slow at samba.org>
Date: Tue May 17 15:17:34 2022 +0200
vfs_gpfs: pass fsp to gpfsacl_emu_chmod()
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15069
Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Christof Schmitt <cs at samba.org>
commit a0f7ced610013cad145ff14cedcfbb5388d1ea4f
Author: Ralph Boehme <slow at samba.org>
Date: Tue May 17 14:47:03 2022 +0200
vfs_gpfs: indentation and README.Coding fixes
Best viewed with git show -w.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15069
Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Christof Schmitt <cs at samba.org>
-----------------------------------------------------------------------
Summary of changes:
lib/util/gpfswrap.c | 24 +++----------
lib/util/gpfswrap.h | 4 +--
source3/modules/vfs_gpfs.c | 89 +++++++++++++++++++++++++---------------------
3 files changed, 54 insertions(+), 63 deletions(-)
Changeset truncated at 500 lines:
diff --git a/lib/util/gpfswrap.c b/lib/util/gpfswrap.c
index 5cf6d2148e7..d05358e141e 100644
--- a/lib/util/gpfswrap.c
+++ b/lib/util/gpfswrap.c
@@ -23,7 +23,7 @@
static int (*gpfs_set_share_fn)(int fd, unsigned int allow, unsigned int deny);
static int (*gpfs_set_lease_fn)(int fd, unsigned int type);
-static int (*gpfs_getacl_fn)(const char *pathname, int flags, void *acl);
+static int (*gpfs_fgetacl_fn)(int fd, int flags, void *acl);
static int (*gpfs_putacl_fn)(const char *pathname, int flags, void *acl);
static int (*gpfs_get_realfilename_path_fn)(const char *pathname,
char *filenamep,
@@ -33,8 +33,6 @@ static int (*gpfs_set_winattrs_path_fn)(const char *pathname,
struct gpfs_winattr *attrs);
static int (*gpfs_set_winattrs_fn)(int fd, int flags,
struct gpfs_winattr *attrs);
-static int (*gpfs_get_winattrs_path_fn)(const char *pathname,
- struct gpfs_winattr *attrs);
static int (*gpfs_get_winattrs_fn)(int fd, struct gpfs_winattr *attrs);
static int (*gpfs_ftruncate_fn)(int fd, gpfs_off64_t length);
static int (*gpfs_lib_init_fn)(int flags);
@@ -70,12 +68,11 @@ int gpfswrap_init(void)
gpfs_set_share_fn = dlsym(l, "gpfs_set_share");
gpfs_set_lease_fn = dlsym(l, "gpfs_set_lease");
- gpfs_getacl_fn = dlsym(l, "gpfs_getacl");
+ gpfs_fgetacl_fn = dlsym(l, "gpfs_getacl_fd");
gpfs_putacl_fn = dlsym(l, "gpfs_putacl");
gpfs_get_realfilename_path_fn = dlsym(l, "gpfs_get_realfilename_path");
gpfs_set_winattrs_path_fn = dlsym(l, "gpfs_set_winattrs_path");
gpfs_set_winattrs_fn = dlsym(l, "gpfs_set_winattrs");
- gpfs_get_winattrs_path_fn = dlsym(l, "gpfs_get_winattrs_path");
gpfs_get_winattrs_fn = dlsym(l, "gpfs_get_winattrs");
gpfs_ftruncate_fn = dlsym(l, "gpfs_ftruncate");
gpfs_lib_init_fn = dlsym(l, "gpfs_lib_init");
@@ -112,14 +109,14 @@ int gpfswrap_set_lease(int fd, unsigned int type)
return gpfs_set_lease_fn(fd, type);
}
-int gpfswrap_getacl(const char *pathname, int flags, void *acl)
+int gpfswrap_fgetacl(int fd, int flags, void *acl)
{
- if (gpfs_getacl_fn == NULL) {
+ if (gpfs_fgetacl_fn == NULL) {
errno = ENOSYS;
return -1;
}
- return gpfs_getacl_fn(pathname, flags, acl);
+ return gpfs_fgetacl_fn(fd, flags, acl);
}
int gpfswrap_putacl(const char *pathname, int flags, void *acl)
@@ -166,17 +163,6 @@ int gpfswrap_set_winattrs(int fd, int flags, struct gpfs_winattr *attrs)
return gpfs_set_winattrs_fn(fd, flags, attrs);
}
-int gpfswrap_get_winattrs_path(const char *pathname,
- struct gpfs_winattr *attrs)
-{
- if (gpfs_get_winattrs_path_fn == NULL) {
- errno = ENOSYS;
- return -1;
- }
-
- return gpfs_get_winattrs_path_fn(pathname, attrs);
-}
-
int gpfswrap_get_winattrs(int fd, struct gpfs_winattr *attrs)
{
if (gpfs_get_winattrs_fn == NULL) {
diff --git a/lib/util/gpfswrap.h b/lib/util/gpfswrap.h
index 764cf686d2e..1e74496c060 100644
--- a/lib/util/gpfswrap.h
+++ b/lib/util/gpfswrap.h
@@ -29,7 +29,7 @@
int gpfswrap_init(void);
int gpfswrap_set_share(int fd, unsigned int allow, unsigned int deny);
int gpfswrap_set_lease(int fd, unsigned int type);
-int gpfswrap_getacl(const char *pathname, int flags, void *acl);
+int gpfswrap_fgetacl(int fd, int flags, void *acl);
int gpfswrap_putacl(const char *pathname, int flags, void *acl);
int gpfswrap_get_realfilename_path(const char *pathname,
char *filenamep,
@@ -38,8 +38,6 @@ int gpfswrap_set_winattrs_path(const char *pathname,
int flags,
struct gpfs_winattr *attrs);
int gpfswrap_set_winattrs(int fd, int flags, struct gpfs_winattr *attrs);
-int gpfswrap_get_winattrs_path(const char *pathname,
- struct gpfs_winattr *attrs);
int gpfswrap_get_winattrs(int fd, struct gpfs_winattr *attrs);
int gpfswrap_ftruncate(int fd, gpfs_off64_t length);
int gpfswrap_lib_init(int flags);
diff --git a/source3/modules/vfs_gpfs.c b/source3/modules/vfs_gpfs.c
index 43c625c3290..ca1a9a39479 100644
--- a/source3/modules/vfs_gpfs.c
+++ b/source3/modules/vfs_gpfs.c
@@ -423,13 +423,15 @@ static void gpfs_dumpacl(int level, struct gpfs_acl *gacl)
}
}
-static int gpfs_getacl_with_capability(const char *fname, int flags, void *buf)
+static int gpfs_getacl_with_capability(struct files_struct *fsp,
+ int flags,
+ void *buf)
{
int ret, saved_errno;
set_effective_capability(DAC_OVERRIDE_CAPABILITY);
- ret = gpfswrap_getacl(fname, flags, buf);
+ ret = gpfswrap_fgetacl(fsp_get_pathref_fd(fsp), flags, buf);
saved_errno = errno;
drop_effective_capability(DAC_OVERRIDE_CAPABILITY);
@@ -448,11 +450,11 @@ static int gpfs_getacl_with_capability(const char *fname, int flags, void *buf)
*
*/
static void *vfs_gpfs_getacl(TALLOC_CTX *mem_ctx,
- const char *fname,
+ struct files_struct *fsp,
const bool raw,
const gpfs_aclType_t type)
{
-
+ const char *fname = fsp->fsp_name->base_name;
void *aclbuf;
size_t size = 512;
int ret, flags;
@@ -488,13 +490,13 @@ again:
*len = size;
if (use_capability) {
- ret = gpfs_getacl_with_capability(fname, flags, aclbuf);
+ ret = gpfs_getacl_with_capability(fsp, flags, aclbuf);
} else {
- ret = gpfswrap_getacl(fname, flags, aclbuf);
+ ret = gpfswrap_fgetacl(fsp_get_pathref_fd(fsp), flags, aclbuf);
if ((ret != 0) && (errno == EACCES)) {
DBG_DEBUG("Retry with DAC capability for %s\n", fname);
use_capability = true;
- ret = gpfs_getacl_with_capability(fname, flags, aclbuf);
+ ret = gpfs_getacl_with_capability(fsp, flags, aclbuf);
}
}
@@ -529,15 +531,17 @@ again:
* On failure returns -1 if there is system (GPFS) error, check errno.
* Returns 0 on success
*/
-static int gpfs_get_nfs4_acl(TALLOC_CTX *mem_ctx, const char *fname,
+static int gpfs_get_nfs4_acl(TALLOC_CTX *mem_ctx,
+ struct files_struct *fsp,
struct SMB4ACL_T **ppacl)
{
+ const char *fname = fsp->fsp_name->base_name;
gpfs_aclCount_t i;
struct gpfs_acl *gacl = NULL;
DEBUG(10, ("gpfs_get_nfs4_acl invoked for %s\n", fname));
/* Get the ACL */
- gacl = (struct gpfs_acl*) vfs_gpfs_getacl(talloc_tos(), fname,
+ gacl = (struct gpfs_acl*) vfs_gpfs_getacl(talloc_tos(), fsp,
false, 0);
if (gacl == NULL) {
DEBUG(9, ("gpfs_getacl failed for %s with %s\n",
@@ -650,7 +654,7 @@ static NTSTATUS gpfsacl_fget_nt_acl(vfs_handle_struct *handle,
return status;
}
- result = gpfs_get_nfs4_acl(frame, fsp->fsp_name->base_name, &pacl);
+ result = gpfs_get_nfs4_acl(frame, fsp, &pacl);
if (result == 0) {
status = smb_fget_nt_acl_nfs4(fsp, &config->nfs4_params,
@@ -829,7 +833,7 @@ static NTSTATUS gpfsacl_set_nt_acl_internal(vfs_handle_struct *handle, files_str
NTSTATUS result = NT_STATUS_ACCESS_DENIED;
acl = (struct gpfs_acl*) vfs_gpfs_getacl(talloc_tos(),
- fsp->fsp_name->base_name,
+ fsp,
false, 0);
if (acl == NULL) {
return map_nt_error_from_unix(errno);
@@ -948,17 +952,18 @@ static SMB_ACL_T gpfs2smb_acl(const struct gpfs_acl *pacl, TALLOC_CTX *mem_ctx)
return result;
}
-static SMB_ACL_T gpfsacl_get_posix_acl(const char *path, gpfs_aclType_t type,
+static SMB_ACL_T gpfsacl_get_posix_acl(struct files_struct *fsp,
+ gpfs_aclType_t type,
TALLOC_CTX *mem_ctx)
{
struct gpfs_acl *pacl;
SMB_ACL_T result = NULL;
- pacl = vfs_gpfs_getacl(talloc_tos(), path, false, type);
+ pacl = vfs_gpfs_getacl(talloc_tos(), fsp, false, type);
if (pacl == NULL) {
- DEBUG(10, ("vfs_gpfs_getacl failed for %s with %s\n",
- path, strerror(errno)));
+ DBG_DEBUG("vfs_gpfs_getacl failed for %s with %s\n",
+ fsp_str_dbg(fsp), strerror(errno));
if (errno == 0) {
errno = EINVAL;
}
@@ -1019,8 +1024,7 @@ static SMB_ACL_T gpfsacl_sys_acl_get_fd(vfs_handle_struct *handle,
DEBUG(0, ("Got invalid type: %d\n", type));
smb_panic("exiting");
}
- return gpfsacl_get_posix_acl(fsp->fsp_name->base_name,
- gpfs_type, mem_ctx);
+ return gpfsacl_get_posix_acl(fsp, gpfs_type, mem_ctx);
}
static int gpfsacl_sys_acl_blob_get_fd(vfs_handle_struct *handle,
@@ -1045,7 +1049,7 @@ static int gpfsacl_sys_acl_blob_get_fd(vfs_handle_struct *handle,
errno = 0;
acl = (struct gpfs_opaque_acl *) vfs_gpfs_getacl(mem_ctx,
- fsp->fsp_name->base_name,
+ fsp,
true,
GPFS_ACL_TYPE_NFS4);
@@ -1263,9 +1267,11 @@ static uint32_t gpfsacl_mask_filter(uint32_t aceType, uint32_t aceMask, uint32_t
}
static int gpfsacl_emu_chmod(vfs_handle_struct *handle,
- const struct smb_filename *fname, mode_t mode)
+ struct files_struct *fsp,
+ mode_t mode)
{
- char *path = fname->base_name;
+ struct smb_filename *fname = fsp->fsp_name;
+ char *path = fsp->fsp_name->base_name;
struct SMB4ACL_T *pacl = NULL;
int result;
bool haveAllowEntry[SMB_ACE4_WHO_EVERYONE + 1] = {False, False, False, False};
@@ -1276,7 +1282,7 @@ static int gpfsacl_emu_chmod(vfs_handle_struct *handle,
DEBUG(10, ("gpfsacl_emu_chmod invoked for %s mode %o\n", path, mode));
- result = gpfs_get_nfs4_acl(frame, path, &pacl);
+ result = gpfs_get_nfs4_acl(frame, fsp, &pacl);
if (result) {
TALLOC_FREE(frame);
return result;
@@ -1365,23 +1371,24 @@ static int gpfsacl_emu_chmod(vfs_handle_struct *handle,
static int vfs_gpfs_fchmod(vfs_handle_struct *handle, files_struct *fsp, mode_t mode)
{
- SMB_STRUCT_STAT st;
- int rc;
+ SMB_STRUCT_STAT st;
+ int rc;
- if (SMB_VFS_NEXT_FSTAT(handle, fsp, &st) != 0) {
- return -1;
- }
+ rc = SMB_VFS_NEXT_FSTAT(handle, fsp, &st);
+ if (rc != 0) {
+ return -1;
+ }
- /* avoid chmod() if possible, to preserve acls */
- if ((st.st_ex_mode & ~S_IFMT) == mode) {
- return 0;
- }
+ /* avoid chmod() if possible, to preserve acls */
+ if ((st.st_ex_mode & ~S_IFMT) == mode) {
+ return 0;
+ }
- rc = gpfsacl_emu_chmod(handle, fsp->fsp_name,
- mode);
- if (rc == 1)
- return SMB_VFS_NEXT_FCHMOD(handle, fsp, mode);
- return rc;
+ rc = gpfsacl_emu_chmod(handle, fsp, mode);
+ if (rc == 1) {
+ return SMB_VFS_NEXT_FCHMOD(handle, fsp, mode);
+ }
+ return rc;
}
static uint32_t vfs_gpfs_winattrs_to_dosmode(unsigned int winattrs)
@@ -1871,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,
- const struct smb_filename *fname,
+ struct files_struct *fsp,
SMB_STRUCT_STAT *sbuf)
{
struct gpfs_winattr attrs;
@@ -1886,17 +1893,17 @@ static bool vfs_gpfs_is_offline(struct vfs_handle_struct *handle,
return false;
}
- ret = gpfswrap_get_winattrs_path(fname->base_name, &attrs);
+ ret = gpfswrap_get_winattrs(fsp_get_pathref_fd(fsp), &attrs);
if (ret == -1) {
return false;
}
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;
}
- DBG_DEBUG("%s is online\n", fname->base_name);
+ DBG_DEBUG("%s is online\n", fsp_str_dbg(fsp));
return false;
}
@@ -1910,7 +1917,7 @@ static bool vfs_gpfs_fsp_is_offline(struct vfs_handle_struct *handle,
/*
* 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);
}
@@ -1918,7 +1925,7 @@ static bool vfs_gpfs_fsp_is_offline(struct vfs_handle_struct *handle,
/*
* 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);
}
--
Samba Shared Repository
More information about the samba-cvs
mailing list