I’d run into a strange problem that made working with Emacs really painful. Any time I edited a file with Emacs on my CIFS mounted drive on Ubuntu 22.04, I’d see:
Unlocking file: Invalid argument
… when I opened it. Then, when I tried to save, I’d get a message that the save failed. I couldn’t exit Emacs, even when I said to abandon changes. (The changes themselves got saved successfully.) I could kill with a SIGTERM, but that left the file locked so I couldn’t edit it again.
I tried rebuilding Emacs from source. Same issue. I suspect there’s a problem with CIFS file locking everywhere on Ubuntu, not just Emacs. Some day I’ll turf the Ubuntu built-in CIFS and go back to Samba. In the meantime, sometimes all you have is a rock when you want to pound in a nail. Adding:
;; Something weird going on with file locking on CIFS. Disable it.
(setq create-lockfiles nil)
to my ~/.emacs solved the problem.