target: fix DPO and FUA bit checks
Drivers may override the WCE flag, in which case the DPOFUA flag in MODE SENSE might differ from the check used to reject invalid FUA bits in sbc_check_dpofua. Also now that we reject invalid FUA bits early there is no need to duplicate the same buggy check down in the fileio code. As the DPOFUA flag controls th support for FUA bits on read and write commands as well as DPO key off all the checks off a single helper, and deprecate the emulate_dpo and emulate_fua_read attributs. This fixes various failures in the libiscsi testsuite. Personally I'd prefer to also remove the emulate_fua_write attribute as there is no good reason to disable it, but I'll leave that for a separate discussion. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
This commit is contained in:
committed by
Nicholas Bellinger
parent
c04a6091c9
commit
814e5b4518
@ -738,14 +738,15 @@ static int
|
||||
sbc_check_dpofua(struct se_device *dev, struct se_cmd *cmd, unsigned char *cdb)
|
||||
{
|
||||
if (cdb[1] & 0x10) {
|
||||
if (!dev->dev_attrib.emulate_dpo) {
|
||||
/* see explanation in spc_emulate_modesense */
|
||||
if (!target_check_fua(dev)) {
|
||||
pr_err("Got CDB: 0x%02x with DPO bit set, but device"
|
||||
" does not advertise support for DPO\n", cdb[0]);
|
||||
return -EINVAL;
|
||||
}
|
||||
}
|
||||
if (cdb[1] & 0x8) {
|
||||
if (!dev->dev_attrib.emulate_fua_write || !se_dev_check_wce(dev)) {
|
||||
if (!target_check_fua(dev)) {
|
||||
pr_err("Got CDB: 0x%02x with FUA bit set, but device"
|
||||
" does not advertise support for FUA write\n",
|
||||
cdb[0]);
|
||||
|
Reference in New Issue
Block a user