From fa4710bb8fbc852971d763d8727e3755436ea9c8 Mon Sep 17 00:00:00 2001 From: Soumya Koduri Date: Wed, 10 Oct 2018 21:37:07 +0530 Subject: gfapi: Bug fixes in leases processing code-path This patch fixes below issues in gfapi lease code-path * 'glfs_setfsleasid' should allow NULL input to be able to reset leaseid * Applications should be allowed to (un)register for upcall notifications of type GLFS_EVENT_LEASE_RECALL * APIs added to read contents of GLFS_EVENT_LEASE_RECALL argument which is of type "struct glfs_upcall_lease" This is backport of below mainline path - https://review.gluster.org/#/c/glusterfs/+/21391 Change-Id: I3320ddf235cc82fad561e13b9457ebd64db6c76b updates: #350 Signed-off-by: Soumya Koduri --- api/src/glfs.h | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'api/src/glfs.h') diff --git a/api/src/glfs.h b/api/src/glfs.h index 16eae642906..dd6142757d6 100644 --- a/api/src/glfs.h +++ b/api/src/glfs.h @@ -960,7 +960,8 @@ glfs_upcall_get_fs (struct glfs_upcall *arg) __THROW enum glfs_upcall_reason { GLFS_UPCALL_EVENT_NULL = 0, - GLFS_UPCALL_INODE_INVALIDATE, /* invalidate cache entry */ + GLFS_UPCALL_INODE_INVALIDATE, /* invalidate cache entry */ + GLFS_UPCALL_RECALL_LEASE, /* recall lease */ }; enum glfs_upcall_reason @@ -980,6 +981,7 @@ glfs_upcall_get_reason (struct glfs_upcall *arg) __THROW * ========================================================== * GLFS_UPCALL_EVENT_NULL - NULL * GLFS_UPCALL_INODE_INVALIDATE - struct glfs_upcall_inode + * GLFS_UPCALL_RECALL_LEASE - struct glfs_upcall_lease * * After processing upcall event, glfs_free() should be called on the * glfs_upcall. @@ -1012,8 +1014,9 @@ typedef void (*glfs_upcall_cbk) (struct glfs_upcall *up_arg, void *data); /* * List of upcall events supported by gluster/gfapi */ -#define GLFS_EVENT_INODE_INVALIDATE 0x00000001 /* invalidate cache entry */ -#define GLFS_EVENT_ANY 0xffffffff /* for all the above events */ +#define GLFS_EVENT_INODE_INVALIDATE 0x00000001 /* invalidate cache entry */ +#define GLFS_EVENT_RECALL_LEASE 0x00000002 /* Recall lease */ +#define GLFS_EVENT_ANY 0xffffffff /* for all the above events */ /* * SYNOPSIS @@ -1037,7 +1040,8 @@ typedef void (*glfs_upcall_cbk) (struct glfs_upcall *up_arg, void *data); * * @event_list: List of upcall events to be registered. * Current available values are: - * - GFAPI_UPCALL_INODE_INVALIDATE + * - GLFS_EVENT_INODE_INVALIDATE + * - GLFS_EVENT_RECALL_LEASE * * @cbk: The cbk routine to be invoked incase of any upcall received * @data: Any opaque pointer provided by caller which shall be using while @@ -1071,7 +1075,8 @@ glfs_upcall_register (struct glfs *fs, uint32_t event_list, * * @event_list: List of upcall events to be unregistered. * Current available values are: - * - GFAPI_UPCALL_INODE_INVALIDATE + * - GLFS_EVENT_INODE_INVALIDATE + * - GLFS_EVENT_RECALL_LEASE * RETURN VALUE: * >0: SUCCESS (value contains the events successfully unregistered) * -1: FAILURE @@ -1082,6 +1087,7 @@ glfs_upcall_unregister (struct glfs *fs, uint32_t event_list) __THROW /* Lease Types */ enum glfs_lease_types { + GLFS_LEASE_NONE = 0, GLFS_RD_LEASE = 1, GLFS_RW_LEASE = 2, }; -- cgit