The branch, master has been updated via d0db0f0 docs: Update vfs_gpfs manpage for the removed fileset quota check via ad54184 vfs_gpfs: Remove vfs_gpfs_get_quotas via dd029e6 vfs_gpfs: Remove check for fileset quota from 13a2011 Change all uses of uint16/uint32/uint64 to uintXX_t in smb.h.
https://git.samba.org/?p=samba.git;a=shortlog;h=master - Log ----------------------------------------------------------------- commit d0db0f01f7495342705fb03dff7164f33d593f23 Author: Christof Schmitt <c...@samba.org> Date: Tue Apr 7 13:43:41 2015 -0700 docs: Update vfs_gpfs manpage for the removed fileset quota check Signed-off-by: Christof Schmitt <c...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> Autobuild-User(master): Jeremy Allison <j...@samba.org> Autobuild-Date(master): Fri Apr 17 03:26:34 CEST 2015 on sn-devel-104 commit ad54184925cda3f16d59dd04c3883b0331d046da Author: Christof Schmitt <c...@samba.org> Date: Mon Apr 6 15:07:59 2015 -0700 vfs_gpfs: Remove vfs_gpfs_get_quotas Call get_gpfs_quota directly from vfs_gpfs_disk_free_quota to get user and group quotas. Signed-off-by: Christof Schmitt <c...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit dd029e6c6f57e94fc7151c645ce67295a85a2c28 Author: Christof Schmitt <c...@samba.org> Date: Mon Apr 6 14:56:11 2015 -0700 vfs_gpfs: Remove check for fileset quota Querying the fileset id requires additional GPFS API calls and also opening a directory, which might have other side effects. A better option would be configuring the file system with --filesetdf, then the fileset quota is automatically reflected in the free space information reported from gpfs. Signed-off-by: Christof Schmitt <c...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> ----------------------------------------------------------------------- Summary of changes: docs-xml/manpages/vfs_gpfs.8.xml | 10 ++-- source3/modules/vfs_gpfs.c | 113 ++++----------------------------------- 2 files changed, 16 insertions(+), 107 deletions(-) Changeset truncated at 500 lines: diff --git a/docs-xml/manpages/vfs_gpfs.8.xml b/docs-xml/manpages/vfs_gpfs.8.xml index 21865c4..c67aedc 100644 --- a/docs-xml/manpages/vfs_gpfs.8.xml +++ b/docs-xml/manpages/vfs_gpfs.8.xml @@ -281,10 +281,12 @@ Adjust reporting of the size and free space of a share according to quotas. If this setting is "yes", a request for size and free space will also evaluate the - user quota of the user requesting the data, the group - quota of the primary group of the user and the fileset - quota for the fileset containing the top level - directory of the share. + user quota of the user requesting the data and the + group quota of the primary group of the user. Fileset + quotas are not queried, since GPFS already provides + the option --dfreequota to reflect the fileset quota + in the free space query. Please use that option to + include fileset quotas in the reported disk space. </para> <para> diff --git a/source3/modules/vfs_gpfs.c b/source3/modules/vfs_gpfs.c index 2044a0e..aa07060 100644 --- a/source3/modules/vfs_gpfs.c +++ b/source3/modules/vfs_gpfs.c @@ -2045,50 +2045,6 @@ static int vfs_gpfs_connect(struct vfs_handle_struct *handle, return 0; } -static int get_gpfs_fset_id(const char *pathname, int *fset_id) -{ - int err, fd, errno_fcntl; - - struct { - gpfsFcntlHeader_t hdr; - gpfsGetFilesetName_t fsn; - } arg; - - arg.hdr.totalLength = sizeof(arg); - arg.hdr.fcntlVersion = GPFS_FCNTL_CURRENT_VERSION; - arg.hdr.fcntlReserved = 0; - arg.fsn.structLen = sizeof(arg.fsn); - arg.fsn.structType = GPFS_FCNTL_GET_FILESETNAME; - - fd = open(pathname, O_RDONLY); - if (fd == -1) { - DEBUG(1, ("Could not open %s: %s\n", - pathname, strerror(errno))); - return fd; - } - - err = gpfswrap_fcntl(fd, &arg); - errno_fcntl = errno; - close(fd); - - if (err) { - errno = errno_fcntl; - if (errno != ENOSYS) { - DEBUG(1, ("GPFS_FCNTL_GET_FILESETNAME for %s failed: " - "%s\n", pathname, strerror(errno))); - } - return err; - } - - err = gpfswrap_getfilesetid(discard_const_p(char, pathname), - arg.fsn.buffer, fset_id); - if (err && errno != ENOSYS) { - DEBUG(1, ("gpfs_getfilesetid for %s failed: %s\n", - pathname, strerror(errno))); - } - return err; -} - static int get_gpfs_quota(const char *pathname, int type, int id, struct gpfs_quotaInfo *qi) { @@ -2116,56 +2072,6 @@ static int get_gpfs_quota(const char *pathname, int type, int id, return ret; } -static int vfs_gpfs_get_quotas(const char *path, uid_t uid, gid_t gid, - int *fset_id, - struct gpfs_quotaInfo *qi_user, - struct gpfs_quotaInfo *qi_group, - struct gpfs_quotaInfo *qi_fset) -{ - int err; - char *dir_path; - bool b; - - /* - * We want to always use the directory to get the fileset id, - * because files might have a share mode. We also do not want - * to get the parent directory when there is already a - * directory to avoid stepping in a different fileset. The - * path passed here is currently either "." or a filename, so - * this is ok. The proper solution would be having a way to - * query the fileset id without opening the file. - */ - b = parent_dirname(talloc_tos(), path, &dir_path, NULL); - if (!b) { - errno = ENOMEM; - return -1; - } - - DEBUG(10, ("path %s, directory %s\n", path, dir_path)); - - err = get_gpfs_fset_id(dir_path, fset_id); - if (err) { - return err; - } - - err = get_gpfs_quota(path, GPFS_USRQUOTA, uid, qi_user); - if (err) { - return err; - } - - err = get_gpfs_quota(path, GPFS_GRPQUOTA, gid, qi_group); - if (err) { - return err; - } - - err = get_gpfs_quota(path, GPFS_FILESETQUOTA, *fset_id, qi_fset); - if (err) { - return err; - } - - return 0; -} - static void vfs_gpfs_disk_free_quota(struct gpfs_quotaInfo qi, time_t cur_time, uint64_t *dfree, uint64_t *dsize) { @@ -2210,9 +2116,9 @@ static uint64_t vfs_gpfs_disk_free(vfs_handle_struct *handle, const char *path, uint64_t *dfree, uint64_t *dsize) { struct security_unix_token *utok; - struct gpfs_quotaInfo qi_user, qi_group, qi_fset; + struct gpfs_quotaInfo qi_user, qi_group; struct gpfs_config_data *config; - int err, fset_id; + int err; time_t cur_time; SMB_VFS_HANDLE_GET_DATA(handle, config, struct gpfs_config_data, @@ -2236,8 +2142,14 @@ static uint64_t vfs_gpfs_disk_free(vfs_handle_struct *handle, const char *path, (unsigned long long)*dfree, (unsigned long long)*dsize)); utok = handle->conn->session_info->unix_token; - err = vfs_gpfs_get_quotas(path, utok->uid, utok->gid, &fset_id, - &qi_user, &qi_group, &qi_fset); + + err = get_gpfs_quota(path, GPFS_USRQUOTA, utok->uid, &qi_user); + if (err) { + return SMB_VFS_NEXT_DISK_FREE(handle, path, + bsize, dfree, dsize); + } + + err = get_gpfs_quota(path, GPFS_GRPQUOTA, utok->gid, &qi_group); if (err) { return SMB_VFS_NEXT_DISK_FREE(handle, path, bsize, dfree, dsize); @@ -2249,11 +2161,6 @@ static uint64_t vfs_gpfs_disk_free(vfs_handle_struct *handle, const char *path, vfs_gpfs_disk_free_quota(qi_user, cur_time, dfree, dsize); vfs_gpfs_disk_free_quota(qi_group, cur_time, dfree, dsize); - /* Id 0 indicates the default quota, not an actual quota */ - if (fset_id != 0) { - vfs_gpfs_disk_free_quota(qi_fset, cur_time, dfree, dsize); - } - disk_norm(bsize, dfree, dsize); return *dfree; } -- Samba Shared Repository