Auto location of domain controllers.

Jeremy Allison jallison at cthulhu.engr.sgi.com
Fri Oct 8 23:18:16 GMT 1999


kenneth topp wrote:
> 
> Also, we are on a 32node subnet (snm: 255.255.255.224) and we have a weird
> symptom, where this machine on the second domain (now using "net use" to
> identify themselves as a regular domain as the trust didn't work) doesn't
> see anything on the drives if the internet connection goes down.  The
> machine can add files, but doesn't see anything listed in the shares
> The log for that machine spits out a lot of :
> 
> [1999/10/05 15:43:07, 0] smbd/dir.c:dptr_create(453)
>   dptr_create: returned 0: Error - all new dirptrs in use ?

I finally got beaten with a great big clue stick and have
found and fixed this problem :-).

The fix will be in 2.0.6, but if you need it now, here's
the diff against 2.0.5a.

Regards,

	Jeremy Allison,
	Samba Team.

------------------------cut here-------------------------
--- /usr/people/jallison/tmp/samba-2.0.5a/source/smbd/dir.c	Tue Jul 20 18:25:20
1999
+++ smbd/dir.c	Fri Oct  8 11:20:54 1999
@@ -357,7 +357,7 @@
  finished with that one.
 ****************************************************************************/
 
-static void dptr_old_close_oldest(void)
+static void dptr_close_oldest(BOOL old)
 {
   dptr_struct *dptr;
 
@@ -373,12 +373,14 @@
   }
 
   /*
-   * Close the oldest oldhandle dnum (ie. 1 < dnum < 256) that
-   * does not have expect_close set.
+   * If 'old' is true, close the oldest oldhandle dnum (ie. 1 < dnum < 256)
that
+   * does not have expect_close set. If 'old' is false, close
+   * one of the new dnum handles.
    */
 
   for(; dptr; dptr = dptr->prev) {
-    if (dptr->dnum < 256 && !dptr->expect_close) {
+    if ((old && (dptr->dnum < 256) && !dptr->expect_close) ||
+        (!old && (dptr->dnum > 255))) {
       dptr_close_internal(dptr);
       return;
     }
@@ -429,7 +431,7 @@
        * finished with that one.
        */
 
-      dptr_old_close_oldest();
+      dptr_close_oldest(True);
 
       /* Now try again... */
       dptr->dnum = bitmap_find(dptr_bmap, 0);
@@ -450,9 +452,24 @@
     dptr->dnum = bitmap_find(dptr_bmap, 255);
 
     if(dptr->dnum == -1 || dptr->dnum < 255) {
-      DEBUG(0,("dptr_create: returned %d: Error - all new dirptrs in use ?\n",
dptr->dnum));
-      free((char *)dptr);
-      return -1;
+
+      /*
+       * Try and close the oldest handle close in the hope that
+       * the client has finished with that one. This will only
+       * happen in the case of the Win98 client bug where it leaks
+       * directory handles.
+       */
+
+      dptr_close_oldest(False);
+
+      /* Now try again... */
+      dptr->dnum = bitmap_find(dptr_bmap, 255);
+
+      if(dptr->dnum == -1 || dptr->dnum < 255) {
+        DEBUG(0,("dptr_create: returned %d: Error - all new dirptrs in use
?\n", dptr->dnum));
+        free((char *)dptr);
+        return -1;
+      }
     }
   }
 
------------------------end patch------------------------

-- 
--------------------------------------------------------
Buying an operating system without source is like buying
a self-assembly Space Shuttle with no instructions.
--------------------------------------------------------


More information about the samba mailing list