tdf#55004 Fix backup copy creation for files on mounted samba shares
authorKevin Ottens <kevin.ottens@enioka.com>
Fri, 2 Feb 2024 14:39:36 +0000 (15:39 +0100)
committerRene Engelhard <rene@debian.org>
Tue, 18 Mar 2025 17:53:50 +0000 (18:53 +0100)
commit37d5c8e3da0e2d758df5aae2849d3528665dedbc
tree897f204c498aa4fab08e90d9423a54b20247f244
parent472745e2f05d0bd374b6c05a1d2d1a2274c5a6e9
tdf#55004 Fix backup copy creation for files on mounted samba shares

There is an unfortunate interaction between file locking and backup
creation at save time.

openFilePath has logic to lock a file when opening. This goes through
fcntl to set a write lock on the file. Later on, when the user wants to
save changes, a backup copy might be created (very likely now since this
is the defaults in the settings). To create this backup, the file is
opened again for reading. Unfortunately this open call fails due to the
lock (even though it is a write lock).

This commit changes the behavior. osl_file_adjustLockFlags now checks if
the file is on a mounted samba share. If that's the case we force the
osl_File_OpenFlag_NoLock flag. No issue is then exhibited at backup
creation, allowing the save to proceed properly.

Change-Id: Ieab252f9f68598834e13339fc5fcea440f0a4c2f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162935
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
Gbp-Pq: Name Fix-backup-copy-creation-for-files-on-mounted-samba-shares.diff
sal/osl/unx/file.cxx