Skip to contentSkip to conversation

problem about dlm posix file lock (sorry for missing subjuct)

Cluster-devel David Teigland 2 participants 2 messages Oct 13, 2015 – Oct 14, 2015 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw
Quoted 4 lines · Zhen Ren

It expects alarm timeout to send SIGALRM, and wake up the sleep process, as "man fcntl" says: "If a signal is caught while waiting, then the call is interrupted and (after the signal handler has returned) returns immediately (with return value -1 and errno set to EINTR".

Hi, thanks for investigating this. Have you verified that SIGALRM interrupts the process on a local fs? Is it any signal? Is this causing problems for a real program?

Quoted 4 lines

dlm_posix_lock -> wait_event_killable
And wait_event_killable will put process into "TASK_KILLABLE" state which's like "UNINTERRUPTABLE" but can be waked up by fatal signals. I did some tests, SIGTERM can did it, but SIGALRM cannot.

Perhaps we should replace that wait_event_killable with wait_event_interruptible. Could you recompile with that change and see if it does what you want?

Quoted 2 lines

Did this go against posix file lock semanteme? Any hints would be very appreciated! I can provide any infos as I can if needed;-)

Posix locks on a cluster file system are always going to behave somewhat differently than a local fs, but this may be a case where the difference can be easily avoided with the change above. Changing the behavior after so long is a slightly concerning, though.

Dave

#2 lore raw

[Cluster-devel] problem about dlm posix file lock (sorry for missing subject)

Hi Divad,

Please see comments in lines;-)

David Teigland <[email protected]> write?

Quoted 10 lines
Quoted 6 lines · Zhen Ren

It expects alarm timeout to send SIGALRM, and wake up the sleep process, as "man fcntl" says: "If a signal is caught while waiting, then the call is interrupted and (after the signal handler has returned) returns immediately (with return value -1 and errno set to EINTR".

Hi, thanks for investigating this. Have you verified that SIGALRM interrupts the process on a local fs? Is it any signal? Is this causing problems for a real program?

Yeah,I tried on ext4. Two processes fcntl the same file with F_SETLKW in F_WRLCK mode. The second blocked process can be interrupted by SIGALRM.

Also, for ocfs2, on local node did the same as ext4, SIGALRM works! And I noticed that the status of the blocked process on multiple nodes was "Dl",but was "D+" on local ocfs2. Don't know if it matters. It's some odd.

Quoted 9 lines
Quoted 5 lines

dlm_posix_lock -> wait_event_killable
And wait_event_killable will put process into "TASK_KILLABLE" state which's like "UNINTERRUPTABLE" but can be waked up by fatal signals. I did some tests, SIGTERM can did it, but SIGALRM cannot.

Perhaps we should replace that wait_event_killable with wait_event_interruptible. Could you recompile with that change and see if it does what you want?

OK,I'll try;-)

Quoted 8 lines
Quoted 3 lines

Did this go against posix file lock semanteme? Any hints would be very appreciated! I can provide any infos as I can if needed;-)

Posix locks on a cluster file system are always going to behave somewhat differently than a local fs, but this may be a case where the difference can be easily avoided with the change above. Changing the behavior after so long is a slightly concerning, though.

Yeah, more test after change, ensure no unexpected effects.

thanks,
Eric

Quoted 3 lines

Dave