From 6689499488b15ce996c91bc72048e92e765c5eee Mon Sep 17 00:00:00 2001 From: Uri Simchoni Date: Sun, 10 Jan 2016 20:28:57 +0200 Subject: [PATCH] vfs_gpfs: make sure get_quota does not return bogus values add implementation of get_quota_fn to vfs_gpfs. The implemetation returns ENOSYS for the case of user and group quota, to make sure the default VFS does not accidentally succeed (and return wrong values which would alter the disk-free calculation) For other quota types the function calls the underlying VFS as before. Signed-off-by: Uri Simchoni Reviewed-by: Volker Lendecke --- source3/modules/vfs_gpfs.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/source3/modules/vfs_gpfs.c b/source3/modules/vfs_gpfs.c index 47bbb9d70fc..2216d1d15db 100644 --- a/source3/modules/vfs_gpfs.c +++ b/source3/modules/vfs_gpfs.c @@ -2207,6 +2207,30 @@ static uint64_t vfs_gpfs_disk_free(vfs_handle_struct *handle, const char *path, return *dfree / 2; } +static int vfs_gpfs_get_quota(vfs_handle_struct *handle, const char *path, + enum SMB_QUOTA_TYPE qtype, unid_t id, + SMB_DISK_QUOTA *dq) +{ + switch(qtype) { + /* + * User/group quota are being used for disk-free + * determination, which in this module is done directly + * by the disk-free function. It's important that this + * module does not return wrong quota values by mistake, + * which would modify the correct values set by disk-free. + * User/group quota are also being used for processing + * NT_TRANSACT_GET_USER_QUOTA in smb1 protocol, which is + * currently not supported by this module. + */ + case SMB_USER_QUOTA_TYPE: + case SMB_GROUP_QUOTA_TYPE: + errno = ENOSYS; + return -1; + default: + return SMB_VFS_NEXT_GET_QUOTA(handle, path, qtype, id, dq); + } +} + static uint32_t vfs_gpfs_capabilities(struct vfs_handle_struct *handle, enum timestamp_set_resolution *p_ts_res) { @@ -2445,6 +2469,7 @@ static ssize_t vfs_gpfs_pwrite_recv(struct tevent_req *req, int *err) static struct vfs_fn_pointers vfs_gpfs_fns = { .connect_fn = vfs_gpfs_connect, .disk_free_fn = vfs_gpfs_disk_free, + .get_quota_fn = vfs_gpfs_get_quota, .fs_capabilities_fn = vfs_gpfs_capabilities, .kernel_flock_fn = vfs_gpfs_kernel_flock, .linux_setlease_fn = vfs_gpfs_setlease, -- 2.11.4.GIT