/** * @brief Check if lease is valid * * The caller must hold cid_mutex. * * @param[in] clientid Record to check lease for. * * @return 1 if lease is valid, 0 if not. * */ bool valid_lease(nfs_client_id_t *clientid) { unsigned int valid; valid = _valid_lease(clientid); if (isFullDebug(COMPONENT_CLIENTID)) { char str[HASHTABLE_DISPLAY_STRLEN]; display_client_id_rec(clientid, str); LogFullDebug(COMPONENT_CLIENTID, "Check Lease %s (Valid=%s %u seconds left)", str, valid ? "YES" : "NO", valid); } return valid != 0; }
/** * * reserve_lease_lock: Check if lease is valid and reserve it and retain cid_mutex. * * Check if lease is valid and reserve it and retain cid_mutex. * * Lease reservation prevents any other thread from expiring the lease. Caller * must call update lease to release the reservation. * * @param pclientid [IN] clientid record to check lease for. * * @return 1 if lease is valid, 0 if not. * */ int reserve_lease(nfs_client_id_t * pclientid) { unsigned int valid; valid = _valid_lease(pclientid); if(valid != 0) pclientid->cid_lease_reservations++; if(isFullDebug(COMPONENT_CLIENTID)) { char str[HASHTABLE_DISPLAY_STRLEN]; display_client_id_rec(pclientid, str); LogFullDebug(COMPONENT_CLIENTID, "Reserve Lease %s (Valid=%s %u seconds left)", str, valid ? "YES" : "NO", valid); } return valid != 0; }