1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-23 09:57:40 +03:00

vfs_gpfs: Change lease helper function to only provide mapping

The set_gpfs_lease function first maps the lease argument to the GPFS
version and then issues the API call. Change this to only do the mapping
in the helper function.

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
Christof Schmitt 2020-01-16 12:17:46 -07:00 committed by Jeremy Allison
parent 96252a0ec4
commit 4958478278

View File

@ -219,7 +219,7 @@ static int vfs_gpfs_close(vfs_handle_struct *handle, files_struct *fsp)
return SMB_VFS_NEXT_CLOSE(handle, fsp);
}
static int set_gpfs_lease(int fd, int leasetype)
static int lease_type_to_gpfs(int leasetype)
{
int gpfs_type = GPFS_LEASE_NONE;
@ -230,7 +230,7 @@ static int set_gpfs_lease(int fd, int leasetype)
gpfs_type = GPFS_LEASE_WRITE;
}
return gpfswrap_set_lease(fd, gpfs_type);
return gpfs_type;
}
static int vfs_gpfs_setlease(vfs_handle_struct *handle,
@ -252,12 +252,14 @@ static int vfs_gpfs_setlease(vfs_handle_struct *handle,
}
if (config->leases) {
int gpfs_lease_type = lease_type_to_gpfs(leasetype);
/*
* Ensure the lease owner is root to allow
* correct delivery of lease-break signals.
*/
become_root();
ret = set_gpfs_lease(fsp->fh->fd,leasetype);
ret = gpfswrap_set_lease(fsp->fh->fd, gpfs_lease_type);
unbecome_root();
}