longhorn / longhorn

Cloud-Native distributed storage built on and for Kubernetes
https://longhorn.io
Apache License 2.0
6.09k stars 595 forks source link

[IMPROVEMENT] Investigate if we can disable advertising the `write_same` capability because Longhorn tgt doesn't support it #6876

Open PhanLe1010 opened 1 year ago

PhanLe1010 commented 1 year ago

Is your improvement request related to a feature? Please describe (👍 if you like this request)

Even though longhorn tgt doesn't implement the operation (codes), the created Longhorn block device somehow still advertises that capability:

root@phan-v406-dt-pool2-e5bcaaa3-bxtvt:~# sg_vpd /dev/longhorn/testvol -p lbpv
Logical block provisioning VPD page (SBC):
  Unmap command supported (LBPU): 1
  Write same (16) with unmap bit supported (LBPWS): 1
  Write same (10) with unmap bit supported (LBPWS10): 1
  Logical block provisioning read zeros (LBPRZ): 1
  Anchored LBAs supported (ANC_SUP): 0
  Threshold exponent: 0 [threshold sets not supported]
  Descriptor present (DP): 0
  Minimum percentage: 0 [not reported]
  Provisioning type: 2 (thin provisioned)
  Threshold percentage: 0 [percentages not supported]

From old kernel perspective (< v4.12), it chooses write_same over unmap (when we advertise both) which causes the problem https://github.com/longhorn/longhorn/issues/6854

Investigate if we can disable advertising the write_same capability for Longhorn device

Additional context

https://github.com/longhorn/website/pull/784#discussion_r1355912219

Longhorn version >= v1.4.0

innobead commented 1 year ago

cc @derekbit @shuo-wu

shuo-wu commented 1 year ago

It seems that write_same related operations are not listed in the longhorn supported op list, I am not sure why SCSI INQUIRY gives such an output...

On the other hand, based on the explanation of write_same, this cmd is similar to unmap. Can we implement it (for old kernels)? On some tgt vendors like rdwr will do punching-hole for this operation.