in reply to NFS File Locking

I am wondering if this is a known problem and if there is a preferred way to work around this.

The workaround (in the scenario where you are unlinking a worked-upon file) would be to lock a file other than the one on which you are operating. All your workers should be attempting to lock $lock_file_name and only once the lock is achieved should they even begin to look at $file_name and operate on it. This allows operations such as creation and deletion of the object file which could otherwise be troublesome.

All that said, it does still sound a bit like an XY Problem perhaps along the lines of that to which brother InfiniteSilence alludes.


🦛

Replies are listed 'Best First'.
Re^2: NFS File Locking
by Fletch (Bishop) on Apr 09, 2026 at 14:03 UTC

    Prossibly completely irrelevant, but: I want to say that folk wisdom was to use a directory as lock when attempting to do any sort of locking over NFS as operations on those were a bit more robust pre nfsv4. I haven't tried to do locking on anything on NFS in anger in aeons so YMMV, contents may have settled during shipping, yadda yadda.

    The cake is a lie.
    The cake is a lie.
    The cake is a lie.