{
  "slug": "cache-flush",
  "term": "Storage cache flush",
  "aliases": [
    "write cache flush",
    "REQ_PREFLUSH"
  ],
  "definition": "A storage cache flush requests persistence of writes buffered in the addressed storage stack, with its coverage and ordering defined by that interface.",
  "note": "In the Linux block layer, REQ_PREFLUSH makes previously completed writes persistent before an accompanying I/O starts; it can also be issued without a data payload. REQ_FUA instead covers persistence of the write carrying FUA before its completion, and both flags may be combined. This block-level operation does not submit data still held only in an application buffer or establish multi-file transaction atomicity. Device-mapper layers must propagate the required persistence semantics.\n\nSCSI SYNCHRONIZE CACHE with IMMED=1 acknowledges validation before synchronization completes. SYNC_PROG=00 offers no pollable progress sense; silence is not completion evidence. Modes 01 and 10 report progress with NO SENSE and NOT READY respectively; mode 10 also rejects commands needing occupied resources, except specified discovery commands. Unsupported IMMED=1 is rejected. [scsi-immed-manual]\n\nIn Hesela's eight isolated Linux v6.12 function controls, FILEIO and IBLOCK each returned GOOD before an injected backend error when IMMED was set; non-immediate error controls reported CHECK CONDITION. All helper return values were zero. These are stubbed function observations, not device I/O, later deferred-error reporting or crash-survival tests. The separate sd_sync_cache initiator helper leaves IMMED clear. [scsi-immed-fileio] [scsi-immed-iblock] [scsi-immed-replay] [scsi-immed-sd]\n\nFor SYNCHRONIZE CACHE (10), zero NUMBER OF BLOCKS covers the supplied LBA through the medium's end, not no blocks. Linux v6.12 IBLOCK flushes the whole cache, so a narrow requested range does not imply less backend work. [scsi-immed-manual] [scsi-immed-iblock]",
  "status": "shipping",
  "advantages": [
    {
      "text": "Provides a persistence boundary for earlier completed writes in a stack that honors the request.",
      "citationIds": [
        "linux-cache"
      ]
    }
  ],
  "limitations": [
    {
      "text": "A successful lower-layer flush does not certify an application's complete recovery protocol.",
      "citationIds": [
        "linux-cache",
        "hesela-stability"
      ]
    },
    {
      "text": "Early acknowledgement and a quiet progress channel do not certify completed synchronization; IMMED and the device's supported reporting mode matter.",
      "citationIds": [
        "scsi-immed-manual"
      ]
    },
    {
      "text": "SYNCHRONIZE CACHE may complete with data in non-volatile cache, not yet on the medium, and does not require cache eviction.",
      "citationIds": [
        "scsi-immed-manual"
      ]
    }
  ],
  "related": [
    "force-unit-access",
    "write-back-cache",
    "write-through-cache",
    "fsync",
    "persistence-ordering",
    "scsi-deferred-error",
    "nvme-volatile-write-cache",
    "cache-barrier",
    "clwb",
    "clflushopt",
    "horae"
  ],
  "supersedes": [],
  "supersededBy": [],
  "firstSeen": null,
  "lastSeen": null,
  "citations": [
    {
      "id": "linux-cache",
      "title": "Linux kernel documentation. Explicit volatile write back cache control: REQ_PREFLUSH and REQ_FUA.",
      "url": "https://docs.kernel.org/block/writeback_cache_control.html",
      "accessed": "2026-10-12"
    },
    {
      "id": "dm-cache",
      "title": "Linux kernel documentation. Device-mapper cache: operating modes and on-disk metadata.",
      "url": "https://docs.kernel.org/admin-guide/device-mapper/cache.html",
      "accessed": "2026-10-12"
    },
    {
      "id": "hesela-stability",
      "title": "NFS stable writes: what COMMIT, flush and FUA actually promise",
      "url": "https://hesela.com/analyses/nfs-stable-writes-flush-fua/",
      "accessed": "2026-10-12"
    },
    {
      "id": "scsi-immed-manual",
      "title": "Seagate SCSI Commands Reference Manual Rev. L (November 2020), section 3.55, Tables 214-215: IMMED and SYNC_PROG.",
      "url": "https://www.seagate.com/files/staticfiles/support/docs/manual/Interface%20manuals/100293068L.pdf#page=241",
      "accessed": "2026-11-07"
    },
    {
      "id": "scsi-immed-fileio",
      "title": "Linux v6.12 pinned source: fd_execute_sync_cache, FILEIO status and fsync ordering.",
      "url": "https://github.com/torvalds/linux/blob/adc218676eef25575469234709c2d87185ca223a/drivers/target/target_core_file.c#L382",
      "accessed": "2026-11-04"
    },
    {
      "id": "scsi-immed-iblock",
      "title": "Linux v6.12 pinned source: iblock_end_io_flush and iblock_execute_sync_cache.",
      "url": "https://github.com/torvalds/linux/blob/adc218676eef25575469234709c2d87185ca223a/drivers/target/target_core_iblock.c#L398",
      "accessed": "2026-11-05"
    },
    {
      "id": "scsi-immed-sd",
      "title": "Linux v6.12 pinned source: sd_sync_cache leaves IMMED clear.",
      "url": "https://github.com/torvalds/linux/blob/adc218676eef25575469234709c2d87185ca223a/drivers/scsi/sd.c#L1778",
      "accessed": "2026-11-04"
    },
    {
      "id": "scsi-immed-replay",
      "title": "Hesela: eight isolated-function SCSI IMMED observations; injected outcomes, not device I/O.",
      "url": "https://hesela.dev/research/scsi-immed/observations.json",
      "accessed": "2026-11-04"
    }
  ],
  "updated": "2026-11-29",
  "provenance": [
    "The SYNC_PROG mode comparison follows Seagate Rev. L (2020), section 3.55 and Table 215; it is not a measurement of a drive default. [scsi-immed-manual]",
    "Range semantics are a manual/source comparison, not an additional device experiment or latency measurement. [scsi-immed-manual] [scsi-immed-iblock]"
  ]
}
