[Cbe-oss-dev] [PATCH] axonram: 1st version

Christoph Hellwig hch at lst.de
Fri Feb 16 04:43:31 EST 2007


On Wed, Feb 14, 2007 at 11:26:34PM +0100, Maxim Shchetynin wrote:
> > > +     return file->f_pos = offset;
> > > +}
> >
> > Do we need some locking here?
> 
> We already have it. Character device is opened with a write lock.

But when you fork or dup you get two processes that my access a single
struct file in parallel without going through open a second time.

Note that takin a lock in open and only releasing it on close is not
considered very nice and won't work with the mutex code we should
be using.  To do what you're doing you prbably want an atomic bitop
as exclusion.  Then again is there a good reason to only allow one
opener?  Note that you'll get multiple acces anyway if someone uses
the block device not and a filesystem ontop of it at the same time.



More information about the cbe-oss-dev mailing list