Re: closefd: closes a file of any process

©[@ÄØÿ¿8þÿ¿Andreas Schwab (uaca@alumni.uv.es)
Tue, 27 Jun 2000 17:42:30 +0200


Hi Tigran!

On Tue, Jun 27, 2000 at 02:24:09PM +0100, Tigran Aivazian wrote:
> On Tue, 27 Jun 2000 uaca@alumni.uv.es wrote:
> > __but__ filp calls locs_wake_up_blocks __always__ with wait = 0
> >
> > so it seems there is no a problem here
>
> well spotted! Ok then, I agree the Linux locks implementation is not as
> broken as I thought :)

I hope you also agree with me that lock_kernel() is enoght to protect the
files_struct on a 2.2.x kernel

> Amazing that nobody noticed this before. Ok, next problem - how do you
> synchronize this non-current do_close() with the possibility of the
> process being between
>
> file = fget(fd);
> ...
> fput(file);

In 2.2.x kernels seems that all functions that use these construction use
lock_kernel(), so it seems my module is correct now? remember is for 2.2.x
(please check the new version at the same URL)

In 2.3.x kernels... Is very different fget|fput has they own locks...

> ? You can add a rw semaphore to struct file, being taken read inside fget
> and write in (only non-current!) do_close but that means such do_close can
> potentially be blocked forever (if someone is doing a read() that can
> block forever, e.g. on /proc/kmsg). So, we may need interruptible
> read-write semaphores?
>
> What think ye?

let me think on it...

regards
Ulisses

Debian/GNU Linux: a dream come true
-----------------------------------------------------------------------------
"Computers are useless. They can only give answers." Pablo Picasso

---> Visita http://www.valux.org/ para saber acerca de la <---
---> Asociación Valenciana de Usuarios de Linux <---

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/