From: Ben Gras Date: Thu, 31 May 2007 12:20:09 +0000 (+0000) Subject: improve FS process bookkeeping; fixes bug where vfs tries to e.g. send X-Git-Tag: v3.1.3a^2~4 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/zpipe.c?a=commitdiff_plain;h=af78f809eee3ba13f2d0263113dab61daf7ce891;p=minix.git improve FS process bookkeeping; fixes bug where vfs tries to e.g. send stime messages to NONE of an unmounted filesystem. --- diff --git a/servers/vfs/main.c b/servers/vfs/main.c index 47018444c..5c9746864 100644 --- a/servers/vfs/main.c +++ b/servers/vfs/main.c @@ -319,8 +319,10 @@ PRIVATE void init_root() last_login_fs_e = NONE; /* Initialize vmnt table */ - for (vmp = &vmnt[0]; vmp < &vmnt[NR_MNTS]; ++vmp) + for (vmp = &vmnt[0]; vmp < &vmnt[NR_MNTS]; ++vmp) { vmp->m_dev = NO_DEV; + vmp->m_fs_e = NONE; + } vmp = &vmnt[0]; @@ -411,7 +413,7 @@ PRIVATE void service_pm() /* Send new time for all FS processes */ for (vmp = &vmnt[0]; vmp < &vmnt[NR_MNTS]; ++vmp) { - if (vmp->m_fs_e) + if (vmp->m_fs_e != NONE) req_stime(vmp->m_fs_e, boottime); } /* No need to report status to PM */ diff --git a/servers/vfs/time.c b/servers/vfs/time.c index 806fee9a2..2799e0fbe 100644 --- a/servers/vfs/time.c +++ b/servers/vfs/time.c @@ -72,7 +72,7 @@ PUBLIC int do_stime() /* Send new time for all FS processes */ for (vmp = &vmnt[0]; vmp < &vmnt[NR_MNTS]; ++vmp) { - if (vmp->m_fs_e) req_stime(vmp->m_fs_e, boottime); + if (vmp->m_fs_e != NONE) req_stime(vmp->m_fs_e, boottime); } return OK; diff --git a/servers/vfs/vmnt.c b/servers/vfs/vmnt.c index 9b92743b0..868d53d85 100644 --- a/servers/vfs/vmnt.c +++ b/servers/vfs/vmnt.c @@ -3,6 +3,8 @@ * Jul 2006 (Balazs Gerofi) */ +#include + #include "fs.h" #include "vmnt.h" @@ -27,6 +29,8 @@ PUBLIC struct vmnt *get_free_vmnt(short *index) PUBLIC struct vmnt *find_vmnt(int fs_e) { struct vmnt *vp; + if(fs_e == NONE) + panic(__FILE__, "find_vmnt: find for NONE", NO_NUM); for (vp = &vmnt[0]; vp < &vmnt[NR_MNTS]; ++vp) { if (vp->m_fs_e == fs_e) return vp; }