gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r488 - in GNUnet: . src/applications/fs/lib src/application


From: grothoff
Subject: [GNUnet-SVN] r488 - in GNUnet: . src/applications/fs/lib src/applications/fs/module src/transports
Date: Sat, 26 Mar 2005 09:54:14 -0800 (PST)

Author: grothoff
Date: 2005-03-26 09:54:10 -0800 (Sat, 26 Mar 2005)
New Revision: 488

Modified:
   GNUnet/src/applications/fs/lib/check.conf
   GNUnet/src/applications/fs/module/ondemand.c
   GNUnet/src/transports/http.c
   GNUnet/todo
Log:
fixing deadlock

Modified: GNUnet/src/applications/fs/lib/check.conf
===================================================================
--- GNUnet/src/applications/fs/lib/check.conf   2005-03-25 22:29:51 UTC (rev 
487)
+++ GNUnet/src/applications/fs/lib/check.conf   2005-03-26 17:54:10 UTC (rev 
488)
@@ -6,7 +6,7 @@
 [GNUNETD]
 VALGRIND        = 300
 HELOEXPIRES     = 60
-LOGLEVEL        = NOTHING
+LOGLEVEL        = WARNING 
 LOGFILE         = $GNUNETD_HOME/logs
 KEEPLOG         = 0
 PIDFILE         = $GNUNETD_HOME/gnunetd.pid

Modified: GNUnet/src/applications/fs/module/ondemand.c
===================================================================
--- GNUnet/src/applications/fs/module/ondemand.c        2005-03-25 22:29:51 UTC 
(rev 487)
+++ GNUnet/src/applications/fs/module/ondemand.c        2005-03-26 17:54:10 UTC 
(rev 488)
@@ -229,7 +229,50 @@
   return ret;
 }
 
+struct adJ {
+  Datastore_ServiceAPI * datastore;
+  Datastore_Value  * dbv;
+  HashCode512 query;
+};
+
+static void asyncDelJob(struct adJ * job) {
+  job->datastore->del(&job->query,
+                     job->dbv);
+  FREE(job->dbv);
+  FREE(job);
+}
+
 /**
+ * Delete the query that still references the unavailable file.  This
+ * must be done asynchronously since we are in the "get" iterator and
+ * a del operation during "get" would deadlock!
+ */
+static void asyncDelete(Datastore_ServiceAPI * datastore,
+                       const Datastore_Value * dbv,
+                       const HashCode512 * query) {
+  struct adJ * job;
+  EncName enc;
+
+  job = MALLOC(sizeof(struct adJ));
+  job->datastore = datastore;
+  job->query = *query;
+  job->dbv = MALLOC(ntohl(dbv->size));
+  memcpy(job->dbv,
+        dbv,
+        ntohl(dbv->size));
+  hash2enc(query,
+          &enc);
+  LOG(LOG_DEBUG,
+      _("Indexed file disappeared, deleting block for query '%s'\n"),
+      &enc);
+  /* schedule for "immediate" execution */
+  addCronJob((CronJob) &asyncDelJob,
+            0, 
+            0, 
+            job);
+}
+
+/**
  * A query on the datastore resulted in the on-demand
  * block dbv.  On-demand encode the block and return
  * the resulting DSV in enc.  If the on-demand
@@ -272,11 +315,8 @@
 
     /* Is the symlink there? */
     if (LSTAT(fn, &linkStat) == -1) {
-      /* No, we have deleted it previously.
-         Now delete the query that still references the unavailable file. */
-      datastore->del(query, dbv);
-    }
-    else {
+      asyncDelete(datastore, dbv, query);
+    } else {
       /* For how long has the file been unavailable? */
       hash2enc(&odb->fileId,
               &enc);
@@ -310,7 +350,7 @@
                ofn);
          }
          FREE(ofn);
-          datastore->del(query, dbv);
+         asyncDelete(datastore, dbv, query);
           stateUnlinkFromDB(unavail_key);
           UNLINK(fn);
         }

Modified: GNUnet/src/transports/http.c
===================================================================
--- GNUnet/src/transports/http.c        2005-03-25 22:29:51 UTC (rev 487)
+++ GNUnet/src/transports/http.c        2005-03-26 17:54:10 UTC (rev 488)
@@ -948,7 +948,7 @@
                     httpSession->wsize - 5,
                     "http://%u.%u.%u.%u:%u";,
                     PRIP(ntohl(httpSession->hostIP)),
-                    ntohs(httpSession->hostPort)) + 5;
+                    ntohs(httpSession->hostPort)) + 5;
     } else {
       len = 5;
     }

Modified: GNUnet/todo
===================================================================
--- GNUnet/todo 2005-03-25 22:29:51 UTC (rev 487)
+++ GNUnet/todo 2005-03-26 17:54:10 UTC (rev 488)
@@ -1,5 +1,8 @@
 0.7.0pre1 [4'05] (aka "preview"):
 TESTING / TESTCASES:
+- FSLIB:
+  * Nils's symlink "improvements" broke the code, fslibtest fails
+    (first bug, a deadlock due to synchronous del has been fixed)
 - multi-peer: (see sessiontest.c and tbenchtest.c for templates)
   * gap
   * dht / gnunet-dht-join and gnunet-dht-query





reply via email to

[Prev in Thread] Current Thread [Next in Thread]