setgroups check int > NGROUPS, so negative would fail; minor cleanup
[unix-history] / usr / src / sys / kern / vfs_cluster.c
index 66605d6..d65f9af 100644 (file)
@@ -2,25 +2,16 @@
  * Copyright (c) 1982, 1986, 1989 Regents of the University of California.
  * All rights reserved.
  *
  * Copyright (c) 1982, 1986, 1989 Regents of the University of California.
  * All rights reserved.
  *
- * Redistribution and use in source and binary forms are permitted
- * provided that the above copyright notice and this paragraph are
- * duplicated in all such forms and that any documentation,
- * advertising materials, and other materials related to such
- * distribution and use acknowledge that the software was developed
- * by the University of California, Berkeley.  The name of the
- * University may not be used to endorse or promote products derived
- * from this software without specific prior written permission.
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+ * %sccs.include.redist.c%
  *
  *
- *     @(#)vfs_cluster.c       7.24 (Berkeley) %G%
+ *     @(#)vfs_cluster.c       7.30 (Berkeley) %G%
  */
 
 #include "param.h"
 #include "user.h"
 #include "buf.h"
 #include "vnode.h"
  */
 
 #include "param.h"
 #include "user.h"
 #include "buf.h"
 #include "vnode.h"
+#include "specdev.h"
 #include "mount.h"
 #include "trace.h"
 #include "ucred.h"
 #include "mount.h"
 #include "trace.h"
 #include "ucred.h"
@@ -346,20 +337,6 @@ getblk(vp, blkno, size)
 
        if (size > MAXBSIZE)
                panic("getblk: size too big");
 
        if (size > MAXBSIZE)
                panic("getblk: size too big");
-       /*
-        * To prevent overflow of 32-bit ints when converting block
-        * numbers to byte offsets, blknos > 2^32 / DEV_BSIZE are set
-        * to the maximum number that can be converted to a byte offset
-        * without overflow. This is historic code; what bug it fixed,
-        * or whether it is still a reasonable thing to do is open to
-        * dispute. mkm 9/85
-        *
-        * Make it a panic to see if it ever really happens. mkm 11/89
-        */
-       if ((unsigned)blkno >= 1 << (sizeof(int)*NBBY-DEV_BSHIFT)) {
-               panic("getblk: blkno too big");
-               blkno = 1 << ((sizeof(int)*NBBY-DEV_BSHIFT) + 1);
-       }
        /*
         * Search the cache for the block.  If we hit, but
         * the buffer is in use for i/o, then we wait until
        /*
         * Search the cache for the block.  If we hit, but
         * the buffer is in use for i/o, then we wait until
@@ -570,15 +547,17 @@ mntflushbuf(mountp, flags)
        int flags;
 {
        register struct vnode *vp;
        int flags;
 {
        register struct vnode *vp;
-       struct vnode *nvp;
 
 
+       if ((mountp->mnt_flag & MNT_MPBUSY) == 0)
+               panic("mntflushbuf: not busy");
 loop:
 loop:
-       for (vp = mountp->m_mounth; vp; vp = nvp) {
-               nvp = vp->v_mountf;
+       for (vp = mountp->mnt_mounth; vp; vp = vp->v_mountf) {
                if (vget(vp))
                        goto loop;
                vflushbuf(vp, flags);
                vput(vp);
                if (vget(vp))
                        goto loop;
                vflushbuf(vp, flags);
                vput(vp);
+               if (vp->v_mount != mountp)
+                       goto loop;
        }
 }
 
        }
 }
 
@@ -646,16 +625,18 @@ mntinvalbuf(mountp)
        struct mount *mountp;
 {
        register struct vnode *vp;
        struct mount *mountp;
 {
        register struct vnode *vp;
-       struct vnode *nvp;
        int dirty = 0;
 
        int dirty = 0;
 
+       if ((mountp->mnt_flag & MNT_MPBUSY) == 0)
+               panic("mntinvalbuf: not busy");
 loop:
 loop:
-       for (vp = mountp->m_mounth; vp; vp = nvp) {
-               nvp = vp->v_mountf;
+       for (vp = mountp->mnt_mounth; vp; vp = vp->v_mountf) {
                if (vget(vp))
                        goto loop;
                dirty += vinvalbuf(vp, 1);
                vput(vp);
                if (vget(vp))
                        goto loop;
                dirty += vinvalbuf(vp, 1);
                vput(vp);
+               if (vp->v_mount != mountp)
+                       goto loop;
        }
        return (dirty);
 }
        }
        return (dirty);
 }