From 2f2872b335018a7fa4b61193f2e6404bef8864ed 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 the below mainline patch - https://review.gluster.org/#/c/glusterfs/+/21391 Change-Id: I3320ddf235cc82fad561e13b9457ebd64db6c76b updates: #350 Signed-off-by: Soumya Koduri --- api/src/glfs.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'api/src/glfs.h') diff --git a/api/src/glfs.h b/api/src/glfs.h index b54e050c9ed..ba57244f87f 100644 --- a/api/src/glfs.h +++ b/api/src/glfs.h @@ -1036,6 +1036,7 @@ glfs_upcall_get_fs(glfs_upcall_t *arg) __THROW enum glfs_upcall_reason { GLFS_UPCALL_EVENT_NULL = 0, GLFS_UPCALL_INODE_INVALIDATE, /* invalidate cache entry */ + GLFS_UPCALL_RECALL_LEASE, /* recall lease */ }; typedef enum glfs_upcall_reason glfs_upcall_reason_t; @@ -1055,6 +1056,7 @@ glfs_upcall_get_reason(glfs_upcall_t *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. @@ -1088,6 +1090,7 @@ typedef void (*glfs_upcall_cbk)(glfs_upcall_t *up_arg, void *data); * List of upcall events supported by gluster/gfapi */ #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 */ /* @@ -1112,7 +1115,8 @@ typedef void (*glfs_upcall_cbk)(glfs_upcall_t *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 in case of any upcall received * @data: Any opaque pointer provided by caller which shall be using while @@ -1146,7 +1150,8 @@ glfs_upcall_register(glfs_t *fs, uint32_t event_list, glfs_upcall_cbk cbk, * * @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 @@ -1157,6 +1162,7 @@ glfs_upcall_unregister(glfs_t *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