5.3-RELEASE TODO

Alfred Perlstein alfred at freebsd.org
Fri Oct 1 07:49:08 PDT 2004


* Scott Long <scottl at FreeBSD.org> [041001 07:33] wrote:
> Alfred Perlstein wrote:
> >>|                  |             |                | The LOR reported in  |
> >>|                  |             |                | PR kern/55175 needs  |
> >>| filedesc LOR     | Not done    | --             | to be fixed.         |
> >>|                  |             |                | Filedesc locking     |
> >>|                  |             |                | needs to be heavily  |
> >>|                  |             |                | reviewed in general. |
> >
> >
> >Oy this thing... :)
> >
> >The only thing blocking this was that we need to access the filedesc
> >as the process shuts down for nfs locks, Darwin has a workaround that
> >I'll see if i can incorporate.
> >
> 
> Is this one still actually a problem?  I haven't seen anyone complain
> about it in months.

Yes. :)

in kern_descript.c:fdfree() we have this:

	/*
	 * We are the last reference to the structure, so we can
	 * safely assume it will not change out from under us.
	 */
	FILEDESC_UNLOCK(fdp);
	fpp = fdp->fd_ofiles;
	for (i = fdp->fd_lastfile; i-- >= 0; fpp++) {
		if (*fpp)
			(void) closef(*fpp, td);
	}

	/* XXX This should happen earlier. */
	mtx_lock(&fdesc_mtx);
	td->td_proc->p_fd = NULL;
	mtx_unlock(&fdesc_mtx);

Basically we have an unlocked access to the filedesc here.

The "should happen earlier" refers to swapping the order of these
two code blocks, but we can not because NFS locking currently
requires that the filedesc be around until the very last file is
released.

I may be able to merge a fix from Darwin for this, but I'm waiting
on an A-OK for it.

-- 
- Alfred Perlstein
- Research Engineering Development Inc.
- email: bright at mu.org cell: 408-480-4684


More information about the freebsd-current mailing list