]> Zhao Yanbai Git Server - minix.git/commitdiff
added some code to debug why filesystems won't unmount
authorBen Gras <ben@minix3.org>
Thu, 11 Dec 2008 14:45:31 +0000 (14:45 +0000)
committerBen Gras <ben@minix3.org>
Thu, 11 Dec 2008 14:45:31 +0000 (14:45 +0000)
servers/vfs/mount.c

index a7135d20a354e8788135bbd11438f94932b680c2..7448fa3cd1ff4249b0029b83978e1234038847e7 100644 (file)
@@ -316,6 +316,7 @@ PRIVATE int mount_fs(endpoint_t fs_e)
       vmp->m_root_node = root_node;
       root_node->v_ref_count++;
       vmp->m_mounted_on = root_node;
+
       root_dev = dev;
       ROOT_FS_E = fs_e;
 
@@ -326,17 +327,19 @@ PRIVATE int mount_fs(endpoint_t fs_e)
 
           if (tfp->fp_rd == NULL)
               panic("fs", "do_mount: null rootdir", i);
+          if (tfp->fp_wd == NULL)
+              panic("fs", "do_mount: null workdir", i);
+
           put_vnode(tfp->fp_rd);
           dup_vnode(root_node);
           tfp->fp_rd = root_node;
 
-          if (tfp->fp_wd == NULL)
-              panic("fs", "do_mount: null workdir", i);
           put_vnode(tfp->fp_wd);
           dup_vnode(root_node);
           tfp->fp_wd = root_node;
       }
 
+
       return(OK);
   }
 
@@ -421,6 +424,30 @@ Dev_t dev;
   count = 0;
   for (vp = &vnode[0]; vp < &vnode[NR_VNODES]; vp++) {
       if (vp->v_ref_count > 0 && vp->v_dev == dev) {
+
+#if 1
+       int i;
+               struct fproc *tfp;
+         printf("unmount: vnode %d in use %d times\n",
+               vp->v_inode_nr, vp->v_ref_count);
+             for (i= 0, tfp= fproc; i<NR_PROCS; i++, tfp++) {
+               int n;
+                  if (tfp->fp_pid == PID_FREE)
+                              continue;
+               if(tfp->fp_wd == vp)
+                       printf("\tvnode %d: wd of pid %d\n",
+                               vp->v_inode_nr, tfp->fp_pid);
+               if(tfp->fp_rd == vp)
+                       printf("\tvnode %d: rd of pid %d\n",
+                               vp->v_inode_nr, tfp->fp_pid);
+               for(n = 0; n < OPEN_MAX; n++) {
+                       if(tfp->fp_filp[n] && tfp->fp_filp[n]->filp_vno == vp)
+                               printf("\tvnode %d: fd %d of pid %d\n",
+                                       vp->v_inode_nr, n, tfp->fp_pid);
+               }
+             }
+#endif
+
           count += vp->v_ref_count;
       }
   }