target/file: Fix UNMAP with DIF protection support
authorAkinobu Mita <akinobu.mita@gmail.com>
Mon, 13 Apr 2015 14:21:58 +0000 (23:21 +0900)
committerSasha Levin <sasha.levin@oracle.com>
Sun, 17 May 2015 23:12:12 +0000 (19:12 -0400)
commit606105af942168c1ba9424d0c9378a23ceab52f3
treecdb2aa971dd302f7b3179660e1c6e33fce528809
parentcc75f2514d4f9f4bac0a59f855d914ac2957a623
target/file: Fix UNMAP with DIF protection support

[ Upstream commit 64d240b721b21e266ffde645ec965c3b6d1c551f ]

When UNMAP command is issued with DIF protection support enabled,
the protection info for the unmapped region is remain unchanged.
So READ command for the region causes data integrity failure.

This fixes it by invalidating protection info for the unmapped region
by filling with 0xff pattern.  This change also adds helper function
fd_do_prot_fill() in order to reduce code duplication with existing
fd_format_prot().

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Reviewed-by: Sagi Grimberg <sagig@mellanox.com>
Reviewed-by: "Martin K. Petersen" <martin.petersen@oracle.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: "James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>
Cc: <stable@vger.kernel.org> # v3.14+
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
drivers/target/target_core_file.c