]> andersk Git - moira.git/blobdiff - gen/nfs.dc
Diane Delgado's changes for a fixed table-locking order
[moira.git] / gen / nfs.dc
index 36683030be03a29c611fe521da156eef7afd75c4..8e9e0ddbf0f6f177b267c91b54dcf547e7864538 100644 (file)
@@ -88,6 +88,15 @@ int do_nfs()
     machs = sq_create();
     lists = sq_create();
 
+    /* Get Locks */
+    EXEC SQL SELECT modtime INTO :listname FROM imembers WHERE list_id = 0;
+    EXEC SQL SELECT modtime INTO :listname FROM filesys WHERE filsys_id = 0;
+    EXEC SQL SELECT modtime INTO :listname FROM users WHERE users_id = 0;
+    EXEC SQL SELECT modtime INTO :listname FROM machine where mach_id=0;
+    EXEC SQL SELECT modtime INTO :listname FROM list WHERE list_id = 0;
+    EXEC SQL SELECT serverhosts INTO :listname FROM machine where mach_id=0;
+
+
     /* The following is declarative, not executed,
      * and so is dependent on where it is in the file,
      * not in the order of execution of statements.
@@ -119,7 +128,10 @@ int do_nfs()
 
 
 /* Make all of the credentials lists that will be needed.  Returns 0 if
- * no files were actually changed */
+ * no files were actually changed 
+ *
+ * The caller is responsible for acquiring locks on imembers, users, list
+ */
 
 int do_lists(lists)
 struct save_queue *lists;
@@ -146,9 +158,6 @@ struct save_queue *lists;
     }
     */
 
-    /* get locks */
-    EXEC SQL SELECT modtime INTO :lname FROM list WHERE list_id = 0;
-    EXEC SQL SELECT modtime INTO :lname FROM users WHERE users_id = 0;
 
     /* build the list of everyone, and store it in a file whose name
      * corresponds to the empty list.
@@ -313,6 +322,8 @@ do_everyone()
 
 /* Now do each of the servers, linking the credentials list file and 
  * compiling the quota and dirs files.
+ *
+ * Caller is responsible for acquiring locks on machine, filesys, users
  */
 
 int do_machs(machs)
@@ -329,10 +340,6 @@ struct save_queue *machs;
 
     fprintf(stderr, "Building machine files\n");
 
-    /* acquire locks on machines & filesystems */
-    EXEC SQL SELECT modtime INTO :listname FROM users WHERE users_id = 0;
-    EXEC SQL SELECT modtime INTO :listname FROM machine WHERE mach_id = 0;
-    EXEC SQL SELECT modtime INTO :listname FROM filesys WHERE filsys_id = 0;
 
     machines = create_hash(100);
     while (sq_get_data(machs, &machname)) {
This page took 0.043587 seconds and 4 git commands to generate.