westerndigitalcorporation / zenfs

ZenFS is a storage backend for RocksDB that enables support for ZNS SSDs and SMR HDDs.
GNU General Public License v2.0
238 stars 87 forks source link

zenfs: Do not Repair() when the mount is read-only mode. #237

Closed aravind-wdc closed 1 year ago

aravind-wdc commented 1 year ago

Observed that when heavy workloads are running(like sysbench) on zenfs, commands like "zenfs df/list" would error out with below error log. "Unexexpeted extent length while recovering".

When mounted in read-only mode, the process mounting it is understood to not make any changes to the filesystem. So it is better to do a repair() when the process has the intent to write data/metadata (write mode mount). Also when mounted in read-only mode(by say zenfs list), there could be write happening by RocksDB which can alter the data/metadata state and doing a repair at that time in a read-only mount state is also not warranted.

So do repair when mounted with write permission.

Signed-off-by: Aravind Ramesh aravind.ramesh@wdc.com

metaspace commented 1 year ago

On a related note, we might not want to repair without asking the user first?

yhr commented 1 year ago

@metaspace : I think we do want automatic repair (the inline extent format sort of requires us to do it). The repair() function might not be well-named. If we discover metadata inconsistencies we should enable some sort of user-agreed-best effort data-salvage mode, but we don't have any of that yet.