DAX data corruption for mmaped and written files

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

yesterday I have been stress-testing mmap code with my new fault locking
patches and I have found a data corruption issue when file is written both
via mmap and standard write(2). The problem is following:

CPU1					CPU2
dax_io()				dax_fault()
  get_block() - allocates block
  ...					  get_block() - finds allocated block
					    - zeroes it inside fs
					  fault completese

  if (buffer_unwritten(bh) || buffer_new(bh)) -> new buffer
    dax_new_buf() -> zeroes buffer which may
		     overwrite user data

In some cases the race can also go the other way around and we lose data
written by write.

So either we need to do the zeroing inside fs also for write(2) path (but
that would essentially mean we would write the block twice for each
allocating write) or we would need dax_io() to also use radix tree locking
to serialize against page faults (in the same way page cache does this with
page lock). Any opinion on what would be better?

								Honza
-- 
Jan Kara <jack@xxxxxxxx>
SUSE Labs, CR
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux