K 10 svn:author V 2 ae K 8 svn:date V 27 2016-11-20T11:12:42.280951Z K 7 svn:log V 691 Change locking used by key_flush_spd(). First of we acquire SPTREE_RLOCK() and check all security policies for expiration. If expired SP isn't found, just release the lock and return. When expired SP is found, we acquire extra reference for this SP and link it into drainq using special drainq LIST_ENTRY in struct secpolicy. When all expired SPs will be linked, we acquire SPTREE_WLOCK() and unlink all SPs from ths SPDB and idhash. If SP has spstate != IPSEC_SPSTATE_ALIVE, we skip such SP, since it can be already unlinked (before we acquired wlock). Then we release SPTREE_WLOCK and call key_spdexpire() for each SP. Now we can release extra reference and last reference for each SP. END