Errors when running sudo -u www-data php occ files:scan --all --repair

Hey,

have you tried this: Search results for '"is locked"' - ownCloud Central

which leads me to this: File is locked - how to unlock.

From what i have read in the past you could avoid such locking situations by configuring redis for file locking.