I have this SSD:
$ lsscsi --verbose 9
[9:0:0:0] disk ATA Samsung SSD 860 4B6Q /dev/sdb
dir: /sys/bus/scsi/devices/9:0:0:0 [/sys/devices/pci0000:00/0000:00:01.3/0000:01:00.2/0000:02:06.0/0000:07:00.0/ata10/host9/target9:0:0/9:0:0:0]
It generally works fine, but every Monday at 00:00 local time it glitches. If the computer is turned on and running Ubuntu 18.04 at 00:00, then every disk access is failing for a few minutes, and then it restores to normal. Kernel messages look like this:
[33597.552222] ata10.00: exception Emask 0x0 SAct 0x438c0 SErr 0x0 action 0x6 frozen
[33597.552228] ata10.00: failed command: WRITE FPDMA QUEUED
[33597.552236] ata10.00: cmd 61/68:30:b0:a0:7d/01:00:05:00:00/40 tag 6 ncq dma 184320 out
res 40/00:01:00:4f:c2/00:00:00:00:00/00 Emask 0x4 (timeout)
[33597.552239] ata10.00: status: { DRDY }
[33597.552294] ata10: hard resetting link
[33598.028219] ata10: SATA link up 6.0 Gbps (SStatus 133 SControl 300)
[33598.028480] ata10.00: supports DRM functions and may not be fully accessible
[33598.030650] ata10.00: supports DRM functions and may not be fully accessible
[33598.032509] ata10.00: configured for UDMA/133
[33598.032534] sd 9:0:0:0: [sdb] tag#12 FAILED Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
[33598.032538] sd 9:0:0:0: [sdb] tag#12 Sense Key : Illegal Request [current]
[33598.032541] sd 9:0:0:0: [sdb] tag#12 Add. Sense: Unaligned write command
[33598.032544] sd 9:0:0:0: [sdb] tag#12 CDB: Read(10) 28 00 01 15 57 88 00 00 38 00
[33598.032548] blk_update_request: I/O error, dev sdb, sector 18175880 op 0x0:(READ) flags 0x80700 phys_seg 1 prio class 0
[33598.032559] ata10: EH complete
[33598.032642] ata10.00: Enabling discard_zeroes_data
This message sequence repeats 4 times with 30 second interval, and after that it's back to normal.
If the computer is turned off at 00:00, then the problem is observed when it's turned on for the first time on Monday. GRUB loads fine from the same disk, but when Ubuntu starts loading, it seems the disk stops working, and the startup hangs. After hitting reset, it starts up normally.
What can cause such weird behavior?