Re: [PATCH] nvme: honor the volatile write cache enable state
From: Erwan Velu
Date: Mon Nov 30 2026 - 12:10:33 EST
[...]
> There's just a gap with the multipath head: if you start up with WCE
> cleared, then turn it on, the head isn't updated to indicate flush
> limits. Let's get that fixed, then I'll queue this up.
Hi Keith,
Back to this, I'll work on a v2.
Before I do, I want to be sure I fix the right gap. With a single
controller, my understanding is that the head does pick up the change:
the Set Features triggers a rescan that we wait for, nvme_update_ns_info()
commits BLK_FEAT_WRITE_CACHE | BLK_FEAT_FUA on the path, then stacks it
on the head with queue_limits_stack_bdev(), and blk_stack_limits()
inherits both flags through BLK_FEAT_INHERIT_MASK.
The gap I can see is with several controllers in the subsystem: the
Set Features only refreshes the controller it was sent to. The other
controllers keep WCE cleared, so their paths stay write-through. The head
is write-back, but a flush or FUA write routed through one of those
paths has REQ_PREFLUSH/REQ_FUA stripped by submit_bio_noacct(), so it
never reaches the device.
There is also the opposite direction: since stacking only ORs the
inherited features, once the head is write-back it stays write-back
after WCE is cleared. It is harmless for data integrity, but the head
keeps reporting a write-back cache.
Is the multi-controller case what you had in mind? If so, for v2 I plan
to refresh the WCE state and rescan every controller of the subsystem
after a successful Set Features, waiting for the rescans when the cache
gets enabled. Should I also recompute the head write cache features from
all the paths, so that clearing WCE is reflected on the head as well?
I'd like to be sure I understand your point before going further.
Erwan,