Messages in this thread | | | Date | Tue, 17 Apr 2001 14:09:28 +0100 | From | "Stephen C. Tweedie" <> | Subject | Re: generic_osync_inode/ext2_fsync_inode still not safe |
| |
Hi,
On Sat, Apr 14, 2001 at 07:24:42AM -0300, Marcelo Tosatti wrote: > > As described earlier, code which wants to write an inode cannot rely on > the I_DIRTY bits (on inode->i_state) being clean to guarantee that the > inode and its dirty pages, if any, are safely synced on disk.
Indeed --- for all such structures, including pages, buffer_heads and inodes, you can only assume that the object is safely on disk if you have checked both the dirty bit AND the locked bit. If you find it locked but clean, then a writeout may be in progress, so you need to do a wait_on_* to be really sure that the write has completed.
> The reason for that is sync_one() --- it cleans the I_DIRTY bits of an > inode, sets the I_LOCK and starts a writeout.
As long as it is setting the I_LOCK bit, then that's fine.
> The easy and safe fix is to simply remove the I_DIRTY_* checks from > generic_osync_inode and ext2_fsync_inode. Easy but slow. Another fix would > be to make sync_one() unconditionally synchronous... slow.
Just make the *sync functions look for the locked bit and do a wait on the inode if it is locked.
Cheers, Stephen - 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/
| |