On Mon, Jun 23, 2014 at 01:28:18AM +0000, Mateusz Guzik wrote:
> +     KASSERT(fdp->fd_refcnt == 1, ("the fdtable should not be shared"));
>       FILEDESC_XLOCK(fdp);
This  is at least weird.  Not incorrect, but the code now looks strange.
The fd_refcnt == 1 assert just states the circumstances of the code which
currently calls the functions.  Would the functions become incorrect or
destructive if there are other references to the filedescriptor table ?

In case you argument is that refcnt == 1 must hold to prevent the parallel
modifications of the descriptor table, which would invalidate the checks
and actions of the functions, then XLOCK is not needed (similar to your
earlier commit).

Note that kern_execve() is executed with the process single-threaded,
which, together with statement fd_refcnt == 1 must prevent the parallel
modifications.

Attachment: pgpEHUZWui4zg.pgp
Description: PGP signature

Reply via email to