Skip to contentSkip to conversation

Some tests with lock

DISCUSSION Anderson Pereira Ataides 3 participants 4 messages Feb 11, 2003 – Feb 13, 2003

lore
Share & tools
lore
#0 lore raw

I made some tests here and want to share my results with you.

My configuration is:
distro: Conectiva 7.0
Kernel: 2.4.18 (compiled)
Samba: 2.2.7a (compiled)
dosemu 1.1.4.9 (compiled)

Used dbu and a simple clipper program with following source:

Quoted 5 lines

USE DBFFILE SHARED
IF !RLOCK()
ALERT('LOCKING CODE WORKED')
ENDIF
INKEY(0)

Test 1: Two dosemu sessions in same linux box accessing local filesystem DBU
When I open a file in a dosemu session, the second one makes dbu show a red warning dialog saying Open error (Dos error 5), and show trhee options:
Quit, Retry and Default. If I choose Default, dbu gives me expected result:
does not abort, show only name of file and display this message: No active field list in current select area.
SIMPLE PROGRAM
Worked fine. No error messages and second dosemu session saw lock made by first one.

Test 2: dosemu accessing local filesystem and Windows workstation DBU
dosemu and Windows open file without problem and without any error. That is wrong because dbu opens file exclusive and once opened it could not open same file again.
SIMPLE PROGRAM
Worked fine. Both windows and Linux could see each other lock.

Test 3: Two dosemu session, one accessing local filesystem and other smbfs DBU
Worked same way as Test 2
SIMPLE PROGRAM
Failed. Both did not see lock made by the other and could lock again.

Test 4: Two dosemu sessions accessing both smbfs
DBU
Worked same way as Test 2
SIMPLE PROGRAM
Worked fine. Both dosemu session could see locks made by other.

Test 5: dosemu acessing smfs and Windows
DBU
Same way as Test 2. But something really wrong happened here. I quit dbu from dosemu and Windows still sees file as locked.
SIMPLE PROGRAM
Failed. Windows and dosemu did not see lock made by the other and could lock again.

Hope my results can help you. I could not test nfs, because my other Linux boxes are using kernel 2.2 and for now I can not upgrade them.

[]s
Anderson Pereira Ataides

#1 lore raw
Quoted 7 lines · Anderson Pereira Ataides

Test 1: Two dosemu sessions in same linux box accessing local filesystem DBU
When I open a file in a dosemu session, the second one makes dbu show a red warning dialog saying Open error (Dos error 5), and show trhee options:
Quit, Retry and Default. If I choose Default, dbu gives me expected result:
does not abort, show only name of file and display this message: No active field list in current select area.

You could produce -D+Dd a log for this case and send to me privately. You could also try 1.1.4.13 and see if that makes a difference.

Quoted 5 lines

Test 2: dosemu accessing local filesystem and Windows workstation DBU
dosemu and Windows open file without problem and without any error. That is wrong because dbu opens file exclusive and once opened it could not open same file again.

here you could have to look into your Samba settings, and also see what lsof says about the file when it's opened by the Windows client.

Quoted 5 lines

Test 4: Two dosemu sessions accessing both smbfs
DBU
Worked same way as Test 2
SIMPLE PROGRAM
Worked fine. Both dosemu session could see locks made by other.

it would be worth to make a log for this case too so they can be compared.

Note however, that if your two DOSEMU sessions are on the same host (what I suspect from your writing) they might be able to see each others locks because these locks go through the Linux kernel VFS (virtual file system) instead of travelling through smbfs.

What I suspect here is that some locks are kept in the VFS whereas others are not and that's what makes the difference for DBU.

Bart

#2 lore raw

Maybe DENY_NONE must apply some lock too?

It's very bad when some session may opens file with DENY_ALL and there are few other sessions with DENY_NONE at the same time.

Signature · 1 line
  Sergey Suleymanov
#3 lore raw
Quoted 6 lines · Sergey Suleymanov

Maybe DENY_NONE must apply some lock too?

It's very bad when some session may opens file with DENY_ALL and there are few other sessions with DENY_NONE at the same time.

it's problematic -- if DENY_NONE would apply a shared (read) lock then other processes cannot apply exclusive locks anymore.

However, according to the table in RBIL, if a file is opened using DENY_NONE, then another program can still open it using DENY_READ in write only mode -- which would cause DOSEMU to apply an exclusive (write) lock, which is not possible.

So I thought the best way is to have DENY_DONE just to do what it says:
"deny nothing".

well you can compare the tables in mfs.c -- the goal is to have them as similar as possible, but DOSEMU should never deny an open when real DOS would allow it (N's can be Y's but not the other way around).

Bart