diff options
-rw-r--r-- | drivers/target/target_core_device.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/drivers/target/target_core_device.c b/drivers/target/target_core_device.c index 58f49ff69b14..37449bdd62f6 100644 --- a/drivers/target/target_core_device.c +++ b/drivers/target/target_core_device.c | |||
@@ -767,6 +767,16 @@ int se_dev_set_emulate_fua_write(struct se_device *dev, int flag) | |||
767 | pr_err("Illegal value %d\n", flag); | 767 | pr_err("Illegal value %d\n", flag); |
768 | return -EINVAL; | 768 | return -EINVAL; |
769 | } | 769 | } |
770 | if (flag && | ||
771 | dev->transport->get_write_cache) { | ||
772 | pr_err("emulate_fua_write not supported for this device\n"); | ||
773 | return -EINVAL; | ||
774 | } | ||
775 | if (dev->export_count) { | ||
776 | pr_err("emulate_fua_write cannot be changed with active" | ||
777 | " exports: %d\n", dev->export_count); | ||
778 | return -EINVAL; | ||
779 | } | ||
770 | dev->dev_attrib.emulate_fua_write = flag; | 780 | dev->dev_attrib.emulate_fua_write = flag; |
771 | pr_debug("dev[%p]: SE Device Forced Unit Access WRITEs: %d\n", | 781 | pr_debug("dev[%p]: SE Device Forced Unit Access WRITEs: %d\n", |
772 | dev, dev->dev_attrib.emulate_fua_write); | 782 | dev, dev->dev_attrib.emulate_fua_write); |
@@ -801,7 +811,11 @@ int se_dev_set_emulate_write_cache(struct se_device *dev, int flag) | |||
801 | pr_err("emulate_write_cache not supported for this device\n"); | 811 | pr_err("emulate_write_cache not supported for this device\n"); |
802 | return -EINVAL; | 812 | return -EINVAL; |
803 | } | 813 | } |
804 | 814 | if (dev->export_count) { | |
815 | pr_err("emulate_write_cache cannot be changed with active" | ||
816 | " exports: %d\n", dev->export_count); | ||
817 | return -EINVAL; | ||
818 | } | ||
805 | dev->dev_attrib.emulate_write_cache = flag; | 819 | dev->dev_attrib.emulate_write_cache = flag; |
806 | pr_debug("dev[%p]: SE Device WRITE_CACHE_EMULATION flag: %d\n", | 820 | pr_debug("dev[%p]: SE Device WRITE_CACHE_EMULATION flag: %d\n", |
807 | dev, dev->dev_attrib.emulate_write_cache); | 821 | dev, dev->dev_attrib.emulate_write_cache); |