1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-15 10:17:20 +00:00
freebsd/sys/coda
Poul-Henning Kamp e3c5a7a4dd When we traverse the vnodes on a mountpoint we need to look out for
our cached 'next vnode' being removed from this mountpoint.  If we
find that it was recycled, we restart our traversal from the start
of the list.

Code to do that is in all local disk filesystems (and a few other
places) and looks roughly like this:

		MNT_ILOCK(mp);
	loop:
		for (vp = TAILQ_FIRST(&mp...);
		    (vp = nvp) != NULL;
		    nvp = TAILQ_NEXT(vp,...)) {
			if (vp->v_mount != mp)
				goto loop;
			MNT_IUNLOCK(mp);
			...
			MNT_ILOCK(mp);
		}
		MNT_IUNLOCK(mp);

The code which takes vnodes off a mountpoint looks like this:

	MNT_ILOCK(vp->v_mount);
	...
	TAILQ_REMOVE(&vp->v_mount->mnt_nvnodelist, vp, v_nmntvnodes);
	...
	MNT_IUNLOCK(vp->v_mount);
	...
	vp->v_mount = something;

(Take a moment and try to spot the locking error before you read on.)

On a SMP system, one CPU could have removed nvp from our mountlist
but not yet gotten to assign a new value to vp->v_mount while another
CPU simultaneously get to the top of the traversal loop where it
finds that (vp->v_mount != mp) is not true despite the fact that
the vnode has indeed been removed from our mountpoint.

Fix:

Introduce the macro MNT_VNODE_FOREACH() to traverse the list of
vnodes on a mountpoint while taking into account that vnodes may
be removed from the list as we go.  This saves approx 65 lines of
duplicated code.

Split the insmntque() which potentially moves a vnode from one mount
point to another into delmntque() and insmntque() which does just
what the names say.

Fix delmntque() to set vp->v_mount to NULL while holding the
mountpoint lock.
2004-07-04 08:52:35 +00:00
..
00READ
cnode.h Do the dreaded s/dev_t/struct cdev */ 2004-06-16 09:47:26 +00:00
coda_fbsd.c Second half of the dev_t cleanup. 2004-06-17 17:16:53 +00:00
coda_io.h More s/file system/filesystem/g 2002-05-16 21:28:32 +00:00
coda_kernel.h
coda_namecache.c Add support for the Coda 6.x venus<->kernel interface. This extends 2003-09-07 07:43:10 +00:00
coda_namecache.h Add support for the Coda 6.x venus<->kernel interface. This extends 2003-09-07 07:43:10 +00:00
coda_opstats.h
coda_pioctl.h More s/file system/filesystem/g 2002-05-16 21:28:32 +00:00
coda_psdev.c Do the dreaded s/dev_t/struct cdev */ 2004-06-16 09:47:26 +00:00
coda_psdev.h Do the dreaded s/dev_t/struct cdev */ 2004-06-16 09:47:26 +00:00
coda_subr.c When we traverse the vnodes on a mountpoint we need to look out for 2004-07-04 08:52:35 +00:00
coda_subr.h Add support for the Coda 6.x venus<->kernel interface. This extends 2003-09-07 07:43:10 +00:00
coda_venus.c Second half of the dev_t cleanup. 2004-06-17 17:16:53 +00:00
coda_venus.h Do the dreaded s/dev_t/struct cdev */ 2004-06-16 09:47:26 +00:00
coda_vfsops.c Do the dreaded s/dev_t/struct cdev */ 2004-06-16 09:47:26 +00:00
coda_vfsops.h Add support for the Coda 6.x venus<->kernel interface. This extends 2003-09-07 07:43:10 +00:00
coda_vnops.c Do the dreaded s/dev_t/struct cdev */ 2004-06-16 09:47:26 +00:00
coda_vnops.h Do the dreaded s/dev_t/struct cdev */ 2004-06-16 09:47:26 +00:00
coda.h Second half of the dev_t cleanup. 2004-06-17 17:16:53 +00:00
README More s/file system/filesystem/g 2002-05-16 21:28:32 +00:00
TODO

$FreeBSD$

                Announcing the Availability of the
                        Coda Distributed
                           Filesystem
                              for
                         BSD Unix Systems

        Coda is a distributed filesystem like NFS and AFS.  It is
freely available, like NFS.  But it functions much like AFS in being a
"stateful" filesystem.  Coda and AFS cache files on your local
machine to improve performance.  But Coda goes a step further than AFS
by letting you access the cached files when there is no available
network, viz. disconnected laptops and network outages.  In Coda, both
the client and server are outside the kernel which makes them easier
to experiment with.

To get more information on Coda, I would like to refer people to
        http://www.coda.cs.cmu.edu
There is a wealth of documents, papers, and theses there.  There is
also a good introduction to the Coda File System in
        http://www.coda.cs.cmu.edu/ljpaper/lj.html

Coda was originally developed as an academic prototype/testbed.  It is
being polished and rewritten where necessary.  Coda is a work in
progress and does have bugs.  It is, though, very usable.  Our
interest is in making Coda available to as many people as possible and
to have Coda evolve and flourish.

The bulk of the Coda filesystem code supports the Coda client
program, the Coda server program and the utilities needed by both.
All these programs are unix programs and can run equally well on any
Unix platform.  Our main development thrust is improving these
programs.  There is a small part of Coda that deals with the kernel to
filesystem interface.  This code is OS specific (but should not be
platform specific).

Coda is currently available for several OS's and platforms:
        Freebsd-2.2.5: i386
        Freebsd-2.2.6: i386
	Freebsd -current: i386
        linux 2.0: i386 & sparc
        linux 2.1: i386 & sparc
        NetBSD 1.3: i386
	NetBSD -current: i386
The relevant sources, binaries, and docs can be found in
        ftp://ftp.coda.cs.cmu.edu/pub/coda/

We intend to come out with new Coda releases often, not daily.  We
don't want to slight any OS/platform not mentioned above.  We are just
limited in our resources as to what we can support internally.  We
will be happy to integrate OpenBSD support as well as other OS
support.  Also, adding platform support should be relatively easy and
we can discuss this.  The only difficulty is that Coda has a light weight
process package.  It does some manipulations in assembler which would
have to be redone for a different platform.

There are several mailing lists @coda.cs.cmu.edu that discuss coda:
coda-announce and linux-coda.  We are going to revise linux-coda to be
OS neutral, since it is mainly Coda we want to discuss.  We appreciate
comments, feedback, bug reports, bug fixes, enhancements, etc.