Bug #5759


statd: SM_NOTIFY should use previous hostname for mon_name

Added by Marcel Telka over 7 years ago.

nfs - NFS server and client
Start date:
Due date:
% Done:


Estimated time:
Gerrit CR:


Assume you have two machines: A and B.

The machine A (the lockd on the machine A) wants to monitor the machine B, so it calls SM_MON with mon_name=B. The statd on A now monitors the machine B. Similarly, lockd at machine B calls SM_MON to its local statd with mon_name=A.

Under normal conditions, when the statd on machine B detects the status change (machine reboot, for example), it will notify the machine A that the status of machine B changed. This is done using the SM_NOTIFY call from machine B to machine A, with mon_name=B.

After the reboot, the statd prepares the list of its own hostnames (the host_name global variable is populated) using the merge_hosts() and merge_ips() functions. This list is used later for the SM_NOTIFY calls.

The problem could happen in a case, when the identity of machine B after the reboot is different (for example we changed the machine's hostname to B1, including the IP address). Now, after the reboot, statd will add B1 to the host_name global variable, but not B (since after the reboot this instance of statd have no clue that the previous hostname of this machine was B). The B1 will be also used in the SM_NOTIFY call as mon_name. So, statd will notify the machine A that the machine B1 changed its state.

The machine A will look into the internal database for B1, but it won't be able to find B1 there, since the machine A is monitoring B, not B1, so basically, the received SM_NOTIFY from machine B1 (nee B) will be ignored by A, and lockd at A won't be notified that B rebooted. This might cause the inconsistencies with the NLM locking (stale locks, for example).

To fix this issue, once the statd receives the SM_MON request, it should store all the current machine names (and addresses) on the stable storage for future notifications. When needed (after the reboot, SM_SIMU_CRASH, etc), the statd should load the list of previous hostnames from the stable storage and use this list for the SM_NOTIFY calls.

No data to display


Also available in: Atom PDF