TrueNAS-12.0-U2 - NFS Mounts locking

ude6

Dabbler
Joined
Aug 2, 2017
Messages
37
Hi all,
I have updated my System to TrueNAS-12.0-U2 and I have the feeling that the NFS locking mechanism has changed?
Since the update I have trouble to fire up mysql/MariaDB databases residing on NFS shares and running on OpenSuse Linux nodes.

I keep getting errors about files not beeing able to exclusively locking:

Code:
[ERROR] mysqld: Can't lock aria control file '/home/server/mysql/aria_log_control' for exclusive use, error: 5. Will retry for 30 seconds


This was working under 12.0 and before without problems. I mitigated the problem by mounting with "nolocking".

But it would be great if anyone could point me to the change.

Thanks
ude6
 

Patrick M. Hausen

Hall of Famer
Joined
Nov 25, 2013
Messages
7,776
4xglrc.jpg
 

ude6

Dabbler
Joined
Aug 2, 2017
Messages
37
It also fails for any other simple file locking...The db is just an example
 

Patrick M. Hausen

Hall of Famer
Joined
Nov 25, 2013
Messages
7,776
Long and more serious answer:

NFS has such a bad reputation for buggy locking that common sysadmin wisdom is that running anything that requires locking over NFS will lead to disaster. Plus, mail servers and databases do make certain guarantees with respect to the data. When they say they wrote something to disk, the data is on the disk. But for this to work local file system semantics are mandatory. I would recommend against that setup. And, yes, it "worked" before. I read that. You were lucky.
 

Samuel Tai

Never underestimate your own stupidity
Moderator
Joined
Apr 24, 2020
Messages
5,399
To second @Patrick M. Hausen, NFS has a long and well-deserved reputation for lock instability, both in v3 and v4. It may work in your setup for long stretches of time, and then break for no apparent reason.

I switched to using local locks, but even these aren't fully reliable. If your NFS share is primarily read, with only occasional writes, then local locks work OK. To enable local locks, set a sysctl tunable in System->Tunables of vfs.nfsd.enable_locallocks=1. Then add local_lock=all to your NFS mount options.
 

Samuel Tai

Never underestimate your own stupidity
Moderator
Joined
Apr 24, 2020
Messages
5,399
Note that local locks assume the client is the only client for that share. If you have multiple clients to the same NFS share, then local locks won't work, as each client will be unaware of the others' local locks. Local locks are just that: local. The client manages locking on the client side, instead of the server on the server side.
 

ude6

Dabbler
Joined
Aug 2, 2017
Messages
37
That is fine for me. There is only one path to access these files.
Thanks again. Will try tonight.
 
Top