vfs_gpfs: Change lease helper function to only provide mapping
authorChristof Schmitt <cs@samba.org>
Thu, 16 Jan 2020 19:17:46 +0000 (12:17 -0700)
committerJeremy Allison <jra@samba.org>
Tue, 21 Jan 2020 22:08:41 +0000 (22:08 +0000)
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>
source3/modules/vfs_gpfs.c

index 240b6839d0bfc5b20e99e3ef425ad44826d4099f..f41e5d41f48ae905aa03496c5544fc4f2e649238 100644 (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();
        }