Re: 2.4.20pre5aa1

From: Andrea Arcangeli (andrea@suse.de)
Date: Thu Sep 05 2002 - 13:41:25 EST


On Thu, Sep 05, 2002 at 06:09:04PM +0100, Christoph Hellwig wrote:
> On Thu, Sep 05, 2002 at 06:53:07PM +0200, Andrea Arcangeli wrote:
> > btw, even if xfs is applied before the inode_read_write-atomic, please
> > make sure xfs will learn using the i_size_read when out of the semaphore
> > and i_size_write too. I know the locking is different there but I doubt
> > you're just managing the i_size without races.
>
> XFS always has the XFS i_lock around accessing it. Either in read mode
> or in write mode for updates (the lock is a so-called mrlock which
> basically as a rwsem with a few subtile differences).
>
> Anyway most acceses i_size in the new code are done by the generic
> code now as XFS calls it internally. Take a look at the update I sent
> you a few seconds ago :)

maybe I'm overlooking something but after a short read it seems you have
no lock in do_truncate->setattr like for all the other fs, so the
vmtruncate can run under reads and the i_size can change under you and
in turn you must always read it with i_size_read using asm, like all the
other fs, if you're not holding the i_sem (and you certainly aren't
holding the i_sem that frequently, you don't even for writes). this
because i_sem is the only lock/sem hold by truncate. Infact I'm unsure
how you serialize the i_size writes of truncate against the ones from
writes, that seems problematic too, the i_size could get a value past
the last block allocated (in turn corrupting the fs). Please double
check that I'm wrong, thanks.

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



This archive was generated by hypermail 2b29 : Sat Sep 07 2002 - 22:00:26 EST