mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Stuart Hayes <stuart.w.hayes@gmail.com>
To: "Martin K . Petersen" <martin.petersen@oracle.com>,
	linux-scsi@vger.kernel.org, target-devel@vger.kernel.org,
	linux-kernel@vger.kernel.org
Cc: Stuart.Hayes@dell.com, Stuart Hayes <stuart.w.hayes@gmail.com>
Subject: [PATCH v2] scsi: target: Allow FUA if no write cache enabled
Date: Tue,  9 Jun 2026 15:21:56 -0500	[thread overview]
Message-ID: <20260609202156.90700-1-stuart.w.hayes@gmail.com> (raw)

Modify target code to ignore FUA bit in commands to targets with no write
cache enabled.

Without this patch, accesses with FUA set will be rejected, even though
they always go directly to the media when there's no write cache.

This is needed because EDK2 FAT filesystem code sets the FUA bit when
writing, regardless of whether the device advertises support of DPOFUA. If
a UEFI pre-boot write fails, the filesystem can become inaccessible until a
reboot.  This can cause linux installs to iSCSI to be unbootable, because
some systems have firmware that will try to write a file in a
vendor-specific directory under /boot/EFI (such as /boot/EFI/Dell) before
attempting to boot to a UEFI boot entry pointing to a file in the FAT
filesystem.

Signed-off-by: Stuart Hayes <stuart.w.hayes@gmail.com>
---
v1->v2:
	- change to only ignore FUA bit set when no write cache is
	  enabled, instead of advertising DPOFUA support
---
 drivers/target/target_core_sbc.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/target/target_core_sbc.c b/drivers/target/target_core_sbc.c
index 21f5cb86d70c..ffd2b6c9bd23 100644
--- a/drivers/target/target_core_sbc.c
+++ b/drivers/target/target_core_sbc.c
@@ -754,6 +754,12 @@ sbc_check_dpofua(struct se_device *dev, struct se_cmd *cmd, unsigned char *cdb)
 	}
 	if (cdb[1] & 0x8) {
 		if (!target_check_fua(dev)) {
+			/*
+			 * Silently ignore FUA if there's no write cache.
+			 */
+			if (!target_check_wce(dev))
+				return 0;
+
 			pr_err("Got CDB: 0x%02x with FUA bit set, but device"
 			       " does not advertise support for FUA write\n",
 			       cdb[0]);
-- 
2.47.3


             reply	other threads:[~2026-06-09 20:22 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-09 20:21 Stuart Hayes [this message]
  -- strict thread matches above, loose matches on Subject: below --
2026-04-28 20:39 Stuart Hayes
2026-04-30 15:43 ` Martin K. Petersen
2026-06-01 15:11   ` stuart hayes

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260609202156.90700-1-stuart.w.hayes@gmail.com \
    --to=stuart.w.hayes@gmail.com \
    --cc=Stuart.Hayes@dell.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=target-devel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®