Zhou Zheng Sheng has posted comments on this change.

Change subject: Catching exceptions in daemon adapter
......................................................................


Patch Set 5:

(1 comment)

....................................................
File init/sysvinit/vdsmd.init.in
Line 75: acquire_lock() {
Line 76:     # todo: add additional flock on free fd
Line 77:     if [ -f "$LOCK_FILE" ]; then
Line 78:         return 1
Line 79:     fi
No, I think Alon's pseudo lock example is different with current acquire_lock 
design. 

acquire_lock() and release_lock() is to protect the starting, stopping, pid, 
and the daemon process all together. After finish starting daemon process, we 
do not release_lock(), we release_lock() only when the daemon process is 
killed. This approach assumes the daemon process never dies, or when it dies, 
the lockfile must be deleted automatically. I think this mechanism is 
problematic from the design. The assumption is too strong.

From my understanding, Alon's pseudo lock is not to protect the deamon, it's 
just to protect the atomicity for start() and stop() respectively. Which means 
the following.

locked_start(){
  (
    flock 9 
    start  # check the liveness of the pid file and start daemon  
  ) 9>lockfile
}

locked_stop(){
  (
    flock 9 
    stop  # check the liveness of pid file and stop daemon
  ) 9>lockfile
}

This lockfile is not related to /var/lock/subsys/vdsmd. The flock on the 
lockfile is released automatically when start is done, same for flock on stop. 
It assumes when start() is done, the daemon process has either written the pid 
or it fails to start. In this way we allow only one script to access the pid 
and start/stop the daemon process, so that we protect simultaneously stop, 
start, restart. The assumption here is much weaker and easy to implement.
Line 80:     touch "$LOCK_FILE"
Line 81:     trap cleanup SIGINT SIGHUP SIGTERM
Line 82: }
Line 83: 


-- 
To view, visit http://gerrit.ovirt.org/18810
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: Ib515b01f06331d744b40236af5a1b12a16c37871
Gerrit-PatchSet: 5
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Yaniv Bronhaim <[email protected]>
Gerrit-Reviewer: Alon Bar-Lev <[email protected]>
Gerrit-Reviewer: Dan Kenigsberg <[email protected]>
Gerrit-Reviewer: Yaniv Bronhaim <[email protected]>
Gerrit-Reviewer: Zhou Zheng Sheng <[email protected]>
Gerrit-Reviewer: oVirt Jenkins CI Server
Gerrit-HasComments: Yes
_______________________________________________
vdsm-patches mailing list
[email protected]
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches

Reply via email to