Page 1 of 1
Files appear locked on NAS using both AFP and SMB
Posted: Mon Mar 07, 2022 2:47 pm
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
Re: Files appear locked on NAS using both AFP and SMB
Posted: Tue Mar 08, 2022 12:24 am
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?
Re: Files appear locked on NAS using both AFP and SMB
Posted: Tue Mar 08, 2022 2:09 pm
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.
Re: Files appear locked on NAS using both AFP and SMB
Posted: Tue Mar 08, 2022 3:12 pm
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.
Re: Files appear locked on NAS using both AFP and SMB
Posted: Tue Mar 08, 2022 5:05 pm
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.
Re: Files appear locked on NAS using both AFP and SMB
Posted: Tue Mar 08, 2022 8:56 pm
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
)
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].
Re: Files appear locked on NAS using both AFP and SMB
Posted: Tue Mar 08, 2022 11:05 pm
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.