Files appear locked on NAS using both AFP and SMB

Discuss setup / installation issues - Add a spell checker, Language pack?
Post Reply
XeataOne
Posts: 6
Joined: Mon Mar 07, 2022 2:01 pm

Files appear locked on NAS using both AFP and SMB

Post by XeataOne »

I have users on MAC, Windows and Linux all sharing files on a NAS. If the NAS share has both AFP and SMB enabled then there are locking issues between the platforms. This locking happens with both Apache OpenOffice and Microsoft Office documents.

i.e.
* Windows user saves .docx on share using SMB
* Mac user opens .docx on share using AFP - gets error "locked by unknown user"

Solution: Choose one file protocol (SMB) which is available on all platforms and remove the AFP protocol from the share. For users personal shares, they can use the protocol of their choosing - but must be aware that file locking may be an issue with users on other platforms.

Request for Clarification:
I am hoping for feedback on this solution; why is this a problem? I am unclear on how this lock is being maintained when no .lock files are present yet the files remain locked
Last edited by floris v on Mon Mar 07, 2022 9:47 pm, edited 1 time in total.
Reason: Removed solved tag and icon to keep discussion open, floris v
OpenOffice 4 on MacOS
User avatar
Zizi64
Volunteer
Posts: 11422
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: Files appear locked on NAS using both AFP and SMB

Post by Zizi64 »

i.e.
* Windows user saves .docx on share using SMB
* Mac user opens .docx on share using AFP - gets error "locked by unknown user"
Have you tried it with ODF type files?
Tibor Kovacs, Hungary; LO7.5.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
XeataOne
Posts: 6
Joined: Mon Mar 07, 2022 2:01 pm

Re: Files appear locked on NAS using both AFP and SMB

Post by XeataOne »

Zizi64 wrote:Have you tried it with ODF type files?
Yes, when the Windows computer creates an .odf the same problem occurs. The NAS supports both SMB and AFP and I am able to rapidly switch between them on my Mac so I just created a new .odf on a windows PC and could then edit it on my MAC using SMB, then I switched the share on MAC to AFP and the lock occurred. I switched the MAC share back to SMB and the problem vanished.

I do not understand Microsoft's Opportunistic Locking well enough to know if it could be the source of the problem.
OpenOffice 4 on MacOS
User avatar
Zizi64
Volunteer
Posts: 11422
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: Files appear locked on NAS using both AFP and SMB

Post by Zizi64 »

We have SMB on our Nas4Free server, and it works with various versions of Windows and Linux (Ubuntu), but we have not any MAC, therefore I can not try it.
Tibor Kovacs, Hungary; LO7.5.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
XeataOne
Posts: 6
Joined: Mon Mar 07, 2022 2:01 pm

Re: Files appear locked on NAS using both AFP and SMB

Post by XeataOne »

I think that until someone has an actual AFP explanation, the right answer is simply to use SMB when both Mac and Windows users are sharing.

Until we understand the underlying issue, I don't think we can expect the devs to solve the problem. Hopefully someone with expert-level Mac file system knowledge sees this and can shed some light on the mystery.

But I am happy to call the original problem solved.
OpenOffice 4 on MacOS
John_Ha
Volunteer
Posts: 9584
Joined: Fri Sep 18, 2009 5:51 pm
Location: UK

Re: Files appear locked on NAS using both AFP and SMB

Post by John_Ha »

XeataOne wrote:I have users on MAC, Windows and Linux all sharing files on a NAS. If the NAS share has both AFP and SMB enabled then there are locking issues between the platforms. This locking happens with both Apache OpenOffice and Microsoft Office documents.
So it looks like it is a NAS share problem for accessing shared files and not a problem specific to AOO or MS Office. You will probably be better asking on a NAS / AFP / SMB forum, not the AOO forum.
XeataOne wrote: * Windows user saves .docx on share using SMB
* Mac user opens .docx on share using AFP - gets error "locked by unknown user"
Please describe in baby steps exactly what users are doing and what happens. (nb - as may be obvious, I know nothing about AFP or SMB so am applying basic diagnostic principles :super:)

For example: Is it "Windows User 1 is editing fred.docx and saves fred.docx. User 1 keeps fred.docx open for editing. Mac User 2 now opens fred.docx and gets error 'locked by unknown user'"? If so, that looks correct to me because User 1 still has fred.docx open and any edits made by User 2 to fred.docx will clash with any edits made by User 1. In principle the "locked by unknown user" error message is received whenever you attempt to open a file which is already open by another user - ie a lock file is detected.

However if it is "Windows User 1 is editing fred.docx and saves fred.docx. User 1 then closes fred.docx (which deletes the lock file). Mac User 2 then opens fred.docx and gets error 'locked by unknown user'" then that looks wrong. Is there a delay is deleting the lock file? It is known that AOO can take up to 30 seconds to complete the write of metadata and files when using a NAS. Is there a delay is AFP and SMB communicating? What happens if User 2 delays by 1 or 2 or even 10 minutes to allow things to settle down?

See Issue 107558 - A hidden step while writing OOo files?
A hidden step while writing files?
We observed, that OpenOffice is saving files in two steps:
The first step is shown by the blue “file saving” bar - Let me call it “preparing the file for storage”
The second step is usually invisible - Let me call it „writing the file“.
On a pc there is only a small time between closing the blue bar and writing the file to the hdd, you hardly notice it. If you have a slow network and a very large file, it will be measurable
...
The worst result ... [on a network] was 150 seconds [delay] for 100MB [file].
LO 6.4.4.2, Windows 10 Home 64 bit

See the Writer Guide, the Writer FAQ, the Writer Tutorials and Writer for students.

Remember: Always save your Writer files as .odt files. - see here for the many reasons why.
XeataOne
Posts: 6
Joined: Mon Mar 07, 2022 2:01 pm

Re: Files appear locked on NAS using both AFP and SMB

Post by XeataOne »

John_Ha wrote: So it looks like it is a NAS share problem for accessing shared files and not a problem specific to AOO or MS Office. You will probably be better asking on a NAS / AFP / SMB forum, not the AOO forum.
I originally posted this with the word [SOLVED] as a prefix because I am answering a question many are asking: why won't my OO documents open when I am using a NAS share. The reason I posted under "troubleshooting" is because this is a troubleshooting solution. Someone removed the [SOLVED] at some point, I am unclear as to whom or why.

I closed my solution with a request for someone with more experience to outline the technical details as to why my solution was necessary.

But to confirm your questions: No, these are files that are saved by WindowsUser to a NAS, days or years later, MACINTOSH user (if he is using AFP) will be unable unable to write these files which are locked by "Unknown User". If MACINTOSH user simply switches his access to the NAS to SMB from AFP, the error is corrected: hence the word "[SOLVED]" in the original title.

I consider this problem resolved for anyone using AFP and SMB on a single share to access OO. This is aimed at EDUCATING OO users who may be experiencing difficulty and not finding solutions.
OpenOffice 4 on MacOS
Post Reply