INN commit: trunk (3 files)

INN Commit rra at isc.org
Sat Jun 20 14:10:08 UTC 2015


    Date: Saturday, June 20, 2015 @ 07:10:08
  Author: iulius
Revision: 9902

Destroy buffindexed's semaphore as well as its shared memory segment

buffindexed deletes its shared memory segment when there are no more
users (i.e. when shm_nattch==0), but it fails to delete the semaphore
at the same time.

"make check" no longer leaks semaphores.

  % ./buffindexed.t

  cant create semaphore using ov-tmp/buffer: No space left on device
  failed to create semaphore for ov-tmp/buffer
  buffindexed: ovinitdisks: cant create shmem for ov-tmp/buffer len 16384: No space left on device
  Opening the overview database failed, cannot continue

Thanks to Richard Kettlewell for the patch.

Modified:
  trunk/doc/pod/news.pod
  trunk/storage/buffindexed/buffindexed.c
  trunk/storage/buffindexed/shmem.c

-----------------------------------+
 doc/pod/news.pod                  |    5 +++++
 storage/buffindexed/buffindexed.c |    2 +-
 storage/buffindexed/shmem.c       |    4 ++++
 3 files changed, 10 insertions(+), 1 deletion(-)

Modified: doc/pod/news.pod
===================================================================
--- doc/pod/news.pod	2015-06-14 15:31:12 UTC (rev 9901)
+++ doc/pod/news.pod	2015-06-20 14:10:08 UTC (rev 9902)
@@ -161,6 +161,11 @@
 
 =item *
 
+Fixed a leak of semaphores when using buffindexed.  Thanks to Richard
+Kettlewell for having fixed the issue.
+
+=item *
+
 Building with Libtool is no longer optional.  The B<--enable-libtool>
 option to B<configure> has been removed.
 

Modified: storage/buffindexed/buffindexed.c
===================================================================
--- storage/buffindexed/buffindexed.c	2015-06-14 15:31:12 UTC (rev 9901)
+++ storage/buffindexed/buffindexed.c	2015-06-20 14:10:08 UTC (rev 9902)
@@ -7,7 +7,7 @@
 ** Buffindexed using shared memory on ovbuff by Sang-yong Suh
 **
 ** During the recent discussions in inn-workers, Alex Kiernan found
-** that INN LockRange() is not working for MMAPed file.  This explains
+** that inn_lock_range() is not working for MMAPed file.  This explains
 ** why buffindexed has long outstanding bugs such as "could not MMAP...".
 **
 ** This version corrects the file locking error by using shared memory.

Modified: storage/buffindexed/shmem.c
===================================================================
--- storage/buffindexed/shmem.c	2015-06-14 15:31:12 UTC (rev 9901)
+++ storage/buffindexed/shmem.c	2015-06-20 14:10:08 UTC (rev 9902)
@@ -264,6 +264,10 @@
             syswarn("cant delete shmid %d", this->shmid);
         else
             debug("shmid %d deleted", this->shmid);
+        /* Delete the semaphore too */
+        if (semctl(this->semap, 0, IPC_RMID, NULL) < 0) {
+            syswarn("can't remove semaphore %d", this->semap);
+        }
     }
     free( this );
 }



More information about the inn-committers mailing list