[<prev] [next>] [day] [month] [year] [list]
Date: Fri, 26 Sep 2008 10:41:54 -0400
From: Theodore Tso <tytso@....edu>
To: 홍신 shin hong <hongshin@...il.com>
Cc: Jan Kara <jack@...e.cz>, linux-ext4@...r.kernel.org
Subject: Re: a question for i_inode's i_size in ext2
On Fri, Sep 26, 2008 at 01:52:13PM +0900, 홍신 shin hong wrote:
> Thank you for the answering.
>
> In ext2, it seems to me that inode's i_size field can be accessed without
> holding i_mutex
> nor thorugh i_size_read function.
>
> For example, in ext2_update_inode() can be invoked without holding
> i_mutex.
> However, it freely access i_size field.
>
> Are these accesses can race with each others?
>
ext2_update_inode() is responsible for writing the contents of the
inode to disk. So it simply saves the current version of the object
to persistent storage. If the inode happens to be in the middle of
being modified, the inode will be redirtied (the rule for modifying
objects like inodes is you modify them first, *then* set the dirty bit
after you are done modifying the object). So if another kernel thread
is in the middle of updating the object, it's not a big deal; the
updated version of the inode will get written to disk later.
Ext2 has no guarantees about filesystem consistency after a crash (you
have to run fsck after a crash), so this is OK.
- Ted
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists