fsdax: unshare: zero destination if srcmap is HOLE or UNWRITTEN
authorShiyang Ruan <ruansy.fnst@fujitsu.com>
Wed, 22 Mar 2023 11:11:09 +0000 (11:11 +0000)
committerAndrew Morton <akpm@linux-foundation.org>
Tue, 28 Mar 2023 22:24:32 +0000 (15:24 -0700)
commit13dd4e04625f600e5affb1b3f0b6c35268ab839b
tree15cb27ec4c1c76c3e3cb832f483d2990a460065e
parentf478b9987cc8236b412d9f2afc958d3e15a7cf85
fsdax: unshare: zero destination if srcmap is HOLE or UNWRITTEN

unshare copies data from source to destination.  But if the source is
HOLE or UNWRITTEN extents, we should zero the destination, otherwise
the HOLE or UNWRITTEN part will be user-visible old data of the new
allocated extent.

Found by running generic/649 while mounting with -o dax=always on pmem.

Link: https://lkml.kernel.org/r/1679483469-2-1-git-send-email-ruansy.fnst@fujitsu.com
Fixes: d984648e428b ("fsdax,xfs: port unshare to fsdax")
Signed-off-by: Shiyang Ruan <ruansy.fnst@fujitsu.com>
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: Darrick J. Wong <djwong@kernel.org>
Cc: Jan Kara <jack@suse.cz>
Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
Cc: Alistair Popple <apopple@nvidia.com>
Cc: Jason Gunthorpe <jgg@nvidia.com>
Cc: John Hubbard <jhubbard@nvidia.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
fs/dax.c