Skip to contentSkip to conversation

Samsung T5 SSD: "Synchronize Cache(10) failed" on removal

DISCUSSION Jonathan Woithe 2 participants 4 messages Sep 9, 2023 – Sep 10, 2023 USB

lore
Share & tools
lore
#0 lore raw

Hi all

Recently I became aware that my system reports a "Synchronize Cache(10) failed" error whenever a Samsung T5 500 GB SSD is unplugged:

     sd 11:0:0:0: [sdg] Synchronizing SCSI cache
     sd 11:0:0:0: [sdg] Synchronize Cache(10) failed: Result: hostbyte=0x07
                  driverbyte=DRIVER_OK

Occasionally the "hostbyte" is 0x01 instead of 0x07. I don't think this is a new problem since it's been occuring possibly since I started using the T5 in early 2021. A second Samsung T5 (a 250 GB model) triggers the same messages when removed.

To produce the failure message it is necessary to simply connect the drive and then remove it. Mounting a filesystem from the drive is not required. The Linux system does not auto-mount these drives.

I have seen the problem under kernels 5.15.38, 5.15.72, 5.15.117 and 6.1.52.

The T5 uses uas by default. I have tried forcing the use of usb-storage with

options usb-storage quirks=04e8:61f5:u

This binds the device to usb-storage instead of uas (according to dmesg) but the error is still reported on removal.

I guess the fundamental question is whether this error is significant in any way. If it's of no consequence then I'll happily ignore it and move on.

If on the other hand it' is something best fixed, please let me know how I can assist with this.

The device is reported by lsusb as

Bus 004 Device 004: ID 04e8:61f5 Samsung Electronics Co., Ltd Portable SSD T5

The verbose lsusb output is included at the end of this post[1].

The "Synchronize Cache(10) failed" message is seen regardless of what USB sockets the drive is connected to:

* Front panel USB2 [Intel Corporation 82801JI (ICH10 Family) USB2 EHCI]
* Rear panel USB2 [Intel Corporation 82801JI (ICH10 Family) USB2 EHCI]
* PCIe USB3 [ASMedia Technology Inc. ASM1142 USB 3.1 Host Controller]
* PCIe USB-C [ASMedia Technology Inc. ASM1142 USB 3.1 Host Controller]

The mainboard has no onboard USB3 or USB-C sockets. These are provided by a PCIe card.

The Samsung T5 drive does not appear to be adversely affected by the error report - I have not yet experienced any data loss.

I am seeing the same "Synchronize Cache(10) failed" on other machines which have different hardware. I can dig the hardware details up if that would be useful.

Regards
jonathan

[1] Samsung T5 "lsusb -v" output follows.

Bus 004 Device 004: ID 04e8:61f5 Samsung Electronics Co., Ltd Portable SSD T5 Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 3.10

  bDeviceClass            0 
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0         9
  idVendor           0x04e8 Samsung Electronics Co., Ltd
  idProduct          0x61f5 Portable SSD T5
  bcdDevice            1.00
  iManufacturer           2 Samsung
  iProduct                3 Portable SSD T5
  iSerial                 1 1234568370EF
  bNumConfigurations      1

Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength 0x0079
bNumInterfaces 1
bConfigurationValue 1
iConfiguration 0
bmAttributes 0x80
(Bus Powered)
MaxPower 896mA
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 2
bInterfaceClass 8 Mass Storage
bInterfaceSubClass 6 SCSI
bInterfaceProtocol 80 Bulk-Only
iInterface 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81 EP 1 IN
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0400 1x 1024 bytes
bInterval 0
bMaxBurst 15
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x02 EP 2 OUT
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0400 1x 1024 bytes
bInterval 0
bMaxBurst 15
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 1
bNumEndpoints 4
bInterfaceClass 8 Mass Storage
bInterfaceSubClass 6 SCSI
bInterfaceProtocol 98
iInterface 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81 EP 1 IN
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0400 1x 1024 bytes
bInterval 0
bMaxBurst 15
MaxStreams 32
Data-in pipe (0x03)
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x02 EP 2 OUT
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0400 1x 1024 bytes
bInterval 0
bMaxBurst 15
MaxStreams 32
Data-out pipe (0x04)
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x83 EP 3 IN
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0400 1x 1024 bytes
bInterval 0
bMaxBurst 15
MaxStreams 32
Status pipe (0x02)
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x04 EP 4 OUT
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0400 1x 1024 bytes
bInterval 0
bMaxBurst 0
Command pipe (0x01)
Binary Object Store Descriptor:
bLength 5
bDescriptorType 15
wTotalLength 0x002a
bNumDeviceCaps 3
USB 2.0 Extension Device Capability:
bLength 7
bDescriptorType 16
bDevCapabilityType 2
bmAttributes 0x0000f41e
BESL Link Power Management (LPM) Supported
BESL value 1024 us
Deep BESL value 61440 us
SuperSpeed USB Device Capability:
bLength 10
bDescriptorType 16
bDevCapabilityType 3
bmAttributes 0x00
wSpeedsSupported 0x000e
Device can operate at Full Speed (12Mbps)
Device can operate at High Speed (480Mbps)
Device can operate at SuperSpeed (5Gbps)
bFunctionalitySupport 1
Lowest fully-functional device speed is Full Speed (12Mbps)
bU1DevExitLat 10 micro seconds
bU2DevExitLat 2047 micro seconds
SuperSpeedPlus USB Device Capability:

    bLength                20
    bDescriptorType        16
    bDevCapabilityType     10

bmAttributes 0x00000001
Sublink Speed Attribute count 1
Sublink Speed ID count 0
wFunctionalitySupport 0x1100
bmSublinkSpeedAttr[0] 0x000a4030
Speed Attribute ID: 0 10Gb/s Symmetric RX SuperSpeedPlus
bmSublinkSpeedAttr[1] 0x000a40b0
Speed Attribute ID: 0 10Gb/s Symmetric TX SuperSpeedPlus
Device Status: 0x0000
(Bus Powered)

#1 lore raw
Quoted 23 lines · Jonathan Woithe

Hi all

Recently I became aware that my system reports a "Synchronize Cache(10) failed" error whenever a Samsung T5 500 GB SSD is unplugged:

     sd 11:0:0:0: [sdg] Synchronizing SCSI cache
     sd 11:0:0:0: [sdg] Synchronize Cache(10) failed: Result: hostbyte=0x07
                  driverbyte=DRIVER_OK

Occasionally the "hostbyte" is 0x01 instead of 0x07. I don't think this is a new problem since it's been occuring possibly since I started using the T5 in early 2021. A second Samsung T5 (a 250 GB model) triggers the same messages when removed.

To produce the failure message it is necessary to simply connect the drive and then remove it. Mounting a filesystem from the drive is not required. The Linux system does not auto-mount these drives.

I have seen the problem under kernels 5.15.38, 5.15.72, 5.15.117 and 6.1.52.

The T5 uses uas by default. I have tried forcing the use of usb-storage with

Quoted 7 lines

options usb-storage quirks=04e8:61f5:u

This binds the device to usb-storage instead of uas (according to dmesg) but the error is still reported on removal.

I guess the fundamental question is whether this error is significant in any way. If it's of no consequence then I'll happily ignore it and move on.

The significance is this: When you remove a drive from the system, the kernel tries to make sure that any data sent to the drive and still in the drive's cache gets safely written out to permanent storage. It does this by sending a SYNCHRONIZE CACHE command to the drive. Of course, if you haven't written anything to the drive then there will be no data to synchronize. Also, if you unmounted a filesystem on the drive just before removing it then there will be no data to synchronize, because unmounting automatically performs a SYNCHRONIZE CACHE. In either case, failure of the command will have no bad effects.

The reason the error message shows up at all is that the kernel doesn't know you're removing the drive until the USB cable gets unplugged. And by then, it's too late to send anything to the drive -- the attempted command fails because the computer obviously can't communicate with a device that has been unplugged.

Quoted 2 lines

If on the other hand it' is something best fixed, please let me know how I can assist with this.

The most likely situation where this would indicate a real problem would be if you had mounted a filesystem on the drive, written some data, and then unplugged it without unmounting first. If you haven't done that then you don't have to worry about anything.

On the other hand, if you would like to get rid of those annoying error messages, you can do so by telling the kernel that the drive is about to be removed before you unplug it. You do this by writing to the "remove" attribute file in the USB device's sysfs device directory; this is the equivalent of using the "Safely remove a device" button in Windows. Some GUIs may provide an easy-to-use mechanism for doing this, such as an "eject" selection on a device menu.

Alan Stern

#2 lore raw

Hi Alan

Quoted 7 lines · Alan Stern
Quoted 2 lines

If on the other hand it' is something best fixed, please let me know how I can assist with this.

The most likely situation where this would indicate a real problem would be if you had mounted a filesystem on the drive, written some data, and then unplugged it without unmounting first. If you haven't done that then you don't have to worry about anything.

Thanks for confirming this. The scenarios I've outlined all involve drives which have definitely been unmounted before they were unplugged. Thus, so long as the unmount has been done then this error can be ignored.

I guess what drew my attention to the message is that USB flash drives do not show the "Synchronize Cache(10) failed" error when unplugged. I guess the different behaviour may be the result of varying caching arrangements (or other low level structural details) across the devices.

Quoted 7 lines

On the other hand, if you would like to get rid of those annoying error messages, you can do so by telling the kernel that the drive is about to be removed before you unplug it. You do this by writing to the "remove" attribute file in the USB device's sysfs device directory; this is the equivalent of using the "Safely remove a device" button in Windows. Some GUIs may provide an easy-to-use mechanism for doing this, such as an "eject" selection on a device menu.

I've noticed separate "Eject" and "Unmount" items under various desktop environments and always wondered why they were separated. Thanks for providing the missing information. I personally run a very simple window manager (fvwm2) so don't get device menus. If the message gets to me I'll look into arranging for the sysfs attribute write. However, knowing now that it's essentially a quirk of the way the device interacts with the subsystem I will be happy to simply leave things as they are.

Thank you again for taking the time to respond.

Regards
jonathan

#3 lore raw
Quoted 6 lines · Jonathan Woithe

Hi Alan

Quoted 3 lines · Alan Stern
Quoted 2 lines

If on the other hand it' is something best fixed, please let me know how I can assist with this.

Quoted 8 lines
Quoted 4 lines

The most likely situation where this would indicate a real problem would be if you had mounted a filesystem on the drive, written some data, and then unplugged it without unmounting first. If you haven't done that then you don't have to worry about anything.

Thanks for confirming this. The scenarios I've outlined all involve drives which have definitely been unmounted before they were unplugged. Thus, so long as the unmount has been done then this error can be ignored.

In principle you can write to a drive without mounting it first. Perhaps the most common examples are creating/modifying a partition table, doing a filesystem repair, or copying an OS install image. Then there wouldn't be an unmount to automatically synchronize the cache.

However, I believe the partitioning and repair utilities do their own cache synchronization, so again it's not an issue in those cases. Mostly it's just necessary to be careful about your own raw-disk accesses -- something most of us very rarely do.

Quoted 4 lines

I guess what drew my attention to the message is that USB flash drives do not show the "Synchronize Cache(10) failed" error when unplugged. I guess the different behaviour may be the result of varying caching arrangements (or other low level structural details) across the devices.

Yes. Most likely the flash drives don't claim to have caches, so the kernel doesn't try to issue a SYNCHRONIZE CACHE command.

Quoted 16 lines
Quoted 7 lines

On the other hand, if you would like to get rid of those annoying error messages, you can do so by telling the kernel that the drive is about to be removed before you unplug it. You do this by writing to the "remove" attribute file in the USB device's sysfs device directory; this is the equivalent of using the "Safely remove a device" button in Windows. Some GUIs may provide an easy-to-use mechanism for doing this, such as an "eject" selection on a device menu.

I've noticed separate "Eject" and "Unmount" items under various desktop environments and always wondered why they were separated. Thanks for providing the missing information. I personally run a very simple window manager (fvwm2) so don't get device menus. If the message gets to me I'll look into arranging for the sysfs attribute write. However, knowing now that it's essentially a quirk of the way the device interacts with the subsystem I will be happy to simply leave things as they are.

Quoted 1 line

Thank you again for taking the time to respond.

You're welcome.

Alan Stern