'blk_update_request: critical target error, dev dm-X, sector xyz' messages at the time of booting with WRITE SAME failures

Solution Verified - Updated

Environment

  • Red Hat Enterprise Linux 8
  • Red Hat Enterprise Linux 7

Issue

  • blk_update_request: critical target error messages seen at the time of booting.

    Mar 27 13:34:28 hostname kernel: blk_update_request: critical target error, dev dm-0, sector 6769416
    Mar 27 13:34:28 hostname kernel: dm-3: WRITE SAME failed. Manually zeroing.
    

Resolution

  • Configure udev rule to avoid the mentioned messages.

    # cat /etc/udev/rules.d/99-write_same.rules
    ACTION=="add|change", SUBSYSTEM=="scsi_disk", ATTR{max_write_same_blocks}="0"
    

    If the issue is at the time of booting, no further action is required. Else reload the udev rules with

    #/sbin/udevadm control --reload-rules
    #/sbin/udevadm trigger --type=devices --action=change
    

    For more details on configuring udev rules, see What is udev and how do you write custom udev rules in RHEL7 ?

Root Cause

It is seen that when a storage device rejects a WRITE SAME command we will disable write same functionality for the device and return -EREMOTEIO to the block layer.

"block/blk-core.c"
-------------------

bool blk_update_request(struct request *req, int error, unsigned int nr_bytes)
{
        int total_bytes;

        trace_block_rq_complete(req->q, req, nr_bytes);

        if (!req->bio)
                return false;

[.... ]
        if (req->cmd_type == REQ_TYPE_FS)
                req->errors = 0;

        if (error && req->cmd_type == REQ_TYPE_FS &&
            !(req->cmd_flags & REQ_QUIET)) {
                char *error_type;

                switch (error) {
                case -ENOLINK:
                        error_type = "recoverable transport";
                        break;
                case -EREMOTEIO:
                        error_type = "critical target";
                        break;
                case -EBADE:
                        error_type = "critical nexus";
                        break;
                case -ENOSPC:
                        error_type = "critical space allocation";
                        break;
                case -ENODATA:
                        error_type = "critical medium";
                        break;
                case -EIO:
                default:
                        error_type = "I/O";
                        break;
                }
                printk_ratelimited(KERN_ERR "%s: %s error, dev %s, sector %llu\n",
                                   __func__, error_type, req->rq_disk ?
                                   req->rq_disk->disk_name : "?",
                                   (unsigned long long)blk_rq_pos(req));

        }
Category
Tags

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.