On Thu, 8 Feb 2007 16:20:12 +0300 Alexey Dobriyan <[email protected]> wrote:
> +again:
> spin_lock(&proc_subdir_lock);
> for (p = &parent->subdir; *p; p=&(*p)->next ) {
> if (!proc_match(len, fn, *p))
> continue;
> de = *p;
> +
> + /*
> + * Stop accepting new readers/writers. If you're dynamically
> + * allocating ->proc_fops, save a pointer somewhere.
> + */
> + spin_lock(&de->pde_unload_lock);
> + de->proc_fops = NULL;
> + /* Wait until all readers/writers are done. */
> + if (de->pde_users > 0) {
> + spin_unlock(&de->pde_unload_lock);
> + spin_unlock(&proc_subdir_lock);
> + schedule();
> + goto again;
> + }
> + spin_unlock(&de->pde_unload_lock);
aergh. This will devolve into busy-wait-until-we-expire-our-timeslice.
Would be nicer to do this with a wait_for_completion().
I guess it doesn't happen very often - if another process happens to
be in the middle or a read or write syscall to that /proc file.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Stuff]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
[Linux Resources]