Skip to contentSkip to conversation

Samba and kernel oplocks

DISCUSSION Stephen Lee 6 participants 13 messages Aug 27, 2002 – Sep 11, 2002

lore
Share & tools
lore
#0 lore raw

Hi,

I am running a Foxpro application under Dosemu 1.1.3.2 (xdosemu) with the keyboard patches and things seem to be running smoothly. Problems occur when some users access the same Foxpro db files via Samba 2.2.4. Files locked under Dosemu/Foxpro are not locked when accessed by Samba. Some of the samba config settings include:

kernel oplocks = yes
locking = Yes
oplocks = Yes
level2 oplocks = Yes
oplock contention limit = 2
posix locking = Yes
strict locking = No

This is a Redhat 7.2 systems running kernel 2.4.18. What else do I need to configure to get Dosemu file locks recognized by Samba?

Thanks,
Stephen

#1 lore raw

I have a similar problem here but using CLIPPER not FoxPro. I received some messages to upgrade kernel and Samba. I made it and I've just tested (yesterday), but did not solve my problem. Windows workstations still can't see locks made by dosemu. And dosemu also can't see windows locks.

Just to confirm, I am using:
kernel 2.4.19
samba 2.2.5
dosemu 1.1.3

I thing problem is not only samba because nfs also have problem. I have two Linux workstations and when I lock record in one of them, the other one can't see this lock.

Like you I'm waiting for a solution to this problem.

bye,
Anderson Pereira Ataides

Em Terça 27 Agosto 2002 19:55, Stephen Lee escreveu:

Quoted 19 lines

Hi,

I am running a Foxpro application under Dosemu 1.1.3.2 (xdosemu) with the keyboard patches and things seem to be running smoothly. Problems occur when some users access the same Foxpro db files via Samba 2.2.4. Files locked under Dosemu/Foxpro are not locked when accessed by Samba. Some of the samba config settings include:

kernel oplocks = yes
locking = Yes
oplocks = Yes
level2 oplocks = Yes
oplock contention limit = 2
posix locking = Yes
strict locking = No

This is a Redhat 7.2 systems running kernel 2.4.18. What else do I need to configure to get Dosemu file locks recognized by Samba?

Quoted 8 lines

Thanks,
Stephen

-
To unsubscribe from this list: send the line "unsubscribe linux-msdos" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

-
To unsubscribe from this list: send the line "unsubscribe linux-msdos" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#2 lore raw
Quoted 10 lines · Anderson Pereira Ataides

I have a similar problem here but using CLIPPER not FoxPro. I received some messages to upgrade kernel and Samba. I made it and I've just tested (yesterday), but did not solve my problem. Windows workstations still can't see locks made by dosemu. And dosemu also can't see windows locks.

Just to confirm, I am using:
kernel 2.4.19
samba 2.2.5
dosemu 1.1.3

Quoted 8 lines

I thing problem is not only samba because nfs also have problem. I have two Linux workstations and when I lock record in one of them, the other one can't see this lock.

Like you I'm waiting for a solution to this problem.

bye,
Anderson Pereira Ataides

The patch sent by Bart did not work in my case either. I wonder if this problem was introduced in the 1.1.3 branch or also exists in the 1.0.2 stable series as well?

Stephen

#3 lore raw
In reply to Anderson Pereira Ataides
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

Anderson Pereira Ataides writes:

Anderson> I thing problem is not only samba because nfs also have Anderson> problem. I have two Linux workstations and when I lock Anderson> record in one of them, the other one can't see this lock.

Anderson> Like you I'm waiting for a solution to this problem.

Well, I'm just try locks with samba, and it seems work. oplocks = no in smb.conf and this hack to mfs.c

dosext/mfs/mfs.c renamed from dosext/mfs/mfs.c.orig +5 -0
@@ -3823,11 +3823,16 @@
 			the top two bits are set. Shift the top ones by two bits. This
 			still allows OLE2 apps to operate, but should stop lockd from
 			dieing */
+#if 0
 		if ((larg.l_start & mask) != 0)
 			larg.l_start = (larg.l_start & ~mask) | ((larg.l_start & mask) >> 2);
+#else
+		larg.l_start &= 0x7fffffff;
+#endif
 		ret = fcntl (fd,F_SETLK,&larg);
 		Debug0((dbg_fd, "lock fd=%x rc=%x type=%x whence=%x start=%lx, len=%lx\n",
 			fd, ret, larg.l_type, larg.l_whence, larg.l_start,larg.l_len));
+		if (ret == -1) SETWORD(&(state->eax), ACCESS_DENIED);
 		return ret != -1 ? TRUE : FALSE;
 	}
     break;

I don't understand that bit magic, maybe this won't work with nfs or something else.

Signature · 1 line
  Sergey Suleymanov
#4 lore raw
Quoted 13 lines · Sergey Suleymanov

Well, I'm just try locks with samba, and it seems work. oplocks = no in smb.conf and this hack to mfs.c

dosext/mfs/mfs.c renamed from dosext/mfs/mfs.c.orig +1 -0
@@ -3823,11 +3823,16 @@
 			the top two bits are set. Shift the top ones by two bits. This
 			still allows OLE2 apps to operate, but should stop lockd from
 			dieing */
+#if 0
 		if ((larg.l_start & mask) != 0)
 			larg.l_start = (larg.l_start & ~mask) | ((larg.l_start & mask) >> 2);

dosext/mfs/mfs.c line 3838

Quoted 10 lines
dosext/mfs/mfs.c renamed from dosext/mfs/mfs.c.orig +4 -0
+#else
+		larg.l_start &= 0x7fffffff;
+#endif
 		ret = fcntl (fd,F_SETLK,&larg);
 		Debug0((dbg_fd, "lock fd=%x rc=%x type=%x whence=%x start=%lx, len=%lx\n",
 			fd, ret, larg.l_type, larg.l_whence, larg.l_start,larg.l_len));
+		if (ret == -1) SETWORD(&(state->eax), ACCESS_DENIED);
 		return ret != -1 ? TRUE : FALSE;
 	}
     break;

Which version of Dosemu is the above patch applied against? 1.1.3 or 1.1.3.2. I am using 1.1.3.2 with the keybard patches.

Thanks,
Stephen

#5 lore raw
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

Stephen Lee writes:

Stephen> Which version of Dosemu is the above patch applied against? Stephen> 1.1.3 or 1.1.3.2. I am using 1.1.3.2 with the keybard Stephen> patches.

        1.1.3.2.
Signature · 1 line
  Sergey Suleymanov
#6 lore raw
In reply to Sergey Suleymanov
Quoted 21 lines · Sergey Suleymanov
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

Anderson Pereira Ataides writes:

Anderson> I thing problem is not only samba because nfs also have Anderson> problem. I have two Linux workstations and when I lock Anderson> record in one of them, the other one can't see this lock.

Anderson> Like you I'm waiting for a solution to this problem.

Well, I'm just try locks with samba, and it seems work. oplocks = no in smb.conf and this hack to mfs.c

dosext/mfs/mfs.c renamed from dosext/mfs/mfs.c.orig +1 -0
@@ -3823,11 +3823,16 @@
 			the top two bits are set. Shift the top ones by two bits. This
 			still allows OLE2 apps to operate, but should stop lockd from
 			dieing */
+#if 0
 		if ((larg.l_start & mask) != 0)
 			larg.l_start = (larg.l_start & ~mask) | ((larg.l_start & mask) >> 2);

dosext/mfs/mfs.c line 3838

Quoted 10 lines
dosext/mfs/mfs.c renamed from dosext/mfs/mfs.c.orig +4 -0
+#else
+		larg.l_start &= 0x7fffffff;
+#endif
 		ret = fcntl (fd,F_SETLK,&larg);
 		Debug0((dbg_fd, "lock fd=%x rc=%x type=%x whence=%x start=%lx, len=%lx\n",
 			fd, ret, larg.l_type, larg.l_whence, larg.l_start,larg.l_len));
+		if (ret == -1) SETWORD(&(state->eax), ACCESS_DENIED);
 		return ret != -1 ? TRUE : FALSE;
 	}
     break;

I copied your diff into a file and ran "patch -p0 < diff_file" and got:

patching file src/dosext/mfs/mfs.c
Hunk #1 FAILED at 3823.
1 out of 1 hunk FAILED -- saving rejects to file
src/dosext/mfs/mfs.c.rej

I don't know much about patching but it appears that the prepatch status of my 1.1.3.2 mfs.c is different compared to yours. The line containing "the top two bits are set. Shift the top ones by two bits." in my version of mfs.c resides at line 3789.

Thanks for your help.
Stephen

#7 lore raw
Quoted 4 lines · Stephen Lee

I don't know much about patching but it appears that the prepatch status of my 1.1.3.2 mfs.c is different compared to yours. The line containing "the top two bits are set. Shift the top ones by two bits." in my version of mfs.c resides at line 3789.

Take look at the reject file. Patch is quite smart and will usually pass if only the line numbers fail. It could just be whitespace (spaces, tabs); that can happen if you copy paste using the mouse. In that case you could also try the -l option of patch.

Bart

#8 lore raw
Quoted 7 lines · Bart Oldeman
Quoted 4 lines · Stephen Lee

I don't know much about patching but it appears that the prepatch status of my 1.1.3.2 mfs.c is different compared to yours. The line containing "the top two bits are set. Shift the top ones by two bits." in my version of mfs.c resides at line 3789.

Quoted 5 lines

Take look at the reject file. Patch is quite smart and will usually pass if only the line numbers fail. It could just be whitespace (spaces, tabs); that can happen if you copy paste using the mouse. In that case you could also try the -l option of patch.

The same failed result with the -l option. I'm pretty sure the line numbers do not match. Since the patch only inserts 5 lines, I simply inserted them myself.

Stephen

#9 lore raw

Re: Samba and kernel oplocks - Solved.

In reply to Sergey Suleymanov
Quoted 31 lines · Sergey Suleymanov
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

Anderson Pereira Ataides writes:

Anderson> I thing problem is not only samba because nfs also have Anderson> problem. I have two Linux workstations and when I lock Anderson> record in one of them, the other one can't see this lock.

Anderson> Like you I'm waiting for a solution to this problem.

Well, I'm just try locks with samba, and it seems work. oplocks = no in smb.conf and this hack to mfs.c

dosext/mfs/mfs.c renamed from dosext/mfs/mfs.c.orig +5 -0
@@ -3823,11 +3823,16 @@
 			the top two bits are set. Shift the top ones by two bits. This
 			still allows OLE2 apps to operate, but should stop lockd from
 			dieing */
+#if 0
 		if ((larg.l_start & mask) != 0)
 			larg.l_start = (larg.l_start & ~mask) | ((larg.l_start & mask) >> 2);
+#else
+		larg.l_start &= 0x7fffffff;
+#endif
 		ret = fcntl (fd,F_SETLK,&larg);
 		Debug0((dbg_fd, "lock fd=%x rc=%x type=%x whence=%x start=%lx, len=%lx\n",
 			fd, ret, larg.l_type, larg.l_whence, larg.l_start,larg.l_len));
+		if (ret == -1) SETWORD(&(state->eax), ACCESS_DENIED);
 		return ret != -1 ? TRUE : FALSE;
 	}
     break;
Quoted 3 lines

I don't understand that bit magic, maybe this won't work with nfs or something else.

I'm happy to say that the above patch allows Foxpro/Dosemu file locks to be recognized by Samba 2.2.4. This means I can run the Foxpro application via Dosemu and under MSDOS/Win98/Samba simultaneously! The only issue I had with the above patch is that the line numbers did not match my version of Dosemu 1.1.3.2 with keyboard patches. I had to insert the lines manually.

Now onto stress testing to ensure the changes do not affect Dosemu stability.

Thanks Sergey!

Stephen

#10 lore raw

Re: Samba and kernel oplocks - Solved????

Hi,
I've been following this thread in the hope that it would help with a similar problem that I've been experiencing. Alas it doesn't help.

The scenario:
I am running a dos app from a shared samba directory on a linux server with both windows and dosemu clients.

The problem:
When the dosemu clients start the app first, the windows clients get the following message:-
Cannot access the file "N:\DATA\EQUITY\EQUITY.EXE".
Make sure the file is a valid program and that it is not in use by
another program.

When the windows clients start the app first, the dosemu clients don't have a problem accessing the program or the data.

I've applied the patch to dosemu from the previous posts on this thread with to dosemu 1.1.3 and am using the current version of samba. EQUITY.EXE is a clarion 2.1 based dos app that has been in use for years on all networks tested.

Any ideas?

Yours,
Uwe.

Quoted 56 lines · Stephen Lee
Quoted 31 lines · Sergey Suleymanov
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

Anderson Pereira Ataides writes:

Anderson> I thing problem is not only samba because nfs also have Anderson> problem. I have two Linux workstations and when I lock Anderson> record in one of them, the other one can't see this lock.

Anderson> Like you I'm waiting for a solution to this problem.

Well, I'm just try locks with samba, and it seems work. oplocks = no in smb.conf and this hack to mfs.c

dosext/mfs/mfs.c renamed from dosext/mfs/mfs.c.orig +5 -0
@@ -3823,11 +3823,16 @@
 			the top two bits are set. Shift the top ones by two bits. This
 			still allows OLE2 apps to operate, but should stop lockd from
 			dieing */
+#if 0
 		if ((larg.l_start & mask) != 0)
 			larg.l_start = (larg.l_start & ~mask) | ((larg.l_start & mask) >> 2);
+#else
+		larg.l_start &= 0x7fffffff;
+#endif
 		ret = fcntl (fd,F_SETLK,&larg);
 		Debug0((dbg_fd, "lock fd=%x rc=%x type=%x whence=%x start=%lx, len=%lx\n",
 			fd, ret, larg.l_type, larg.l_whence, larg.l_start,larg.l_len));
+		if (ret == -1) SETWORD(&(state->eax), ACCESS_DENIED);
 		return ret != -1 ? TRUE : FALSE;
 	}
     break;
Quoted 3 lines

I don't understand that bit magic, maybe this won't work with nfs or something else.

I'm happy to say that the above patch allows Foxpro/Dosemu file locks to be recognized by Samba 2.2.4. This means I can run the Foxpro application via Dosemu and under MSDOS/Win98/Samba simultaneously! The only issue I had with the above patch is that the line numbers did not match my version of Dosemu 1.1.3.2 with keyboard patches. I had to insert the lines manually.

Now onto stress testing to ensure the changes do not affect Dosemu stability.

Thanks Sergey!

Stephen

-
To unsubscribe from this list: send the line "unsubscribe linux-msdos" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#11 lore raw

Re: Samba and kernel oplocks - Smbmount

In reply to Stephen Lee
Quoted 16 lines · Stephen Lee

Hi,

I am running a Foxpro application under Dosemu 1.1.3.2 (xdosemu) with the keyboard patches and things seem to be running smoothly. Problems occur when some users access the same Foxpro db files via Samba 2.2.4. Files locked under Dosemu/Foxpro are not locked when accessed by Samba. Some of the samba config settings include:

kernel oplocks = yes
locking = Yes
oplocks = Yes
level2 oplocks = Yes
oplock contention limit = 2
posix locking = Yes
strict locking = No

Quoted 2 lines

This is a Redhat 7.2 systems running kernel 2.4.18. What else do I need to configure to get Dosemu file locks recognized by Samba?

Just for kicks, I tried to access the Foxpro db files via an smb share using smbmount. Instead of pointing $_hdimage to the Drdos/Foxpro directory directly, I pointed it to a directory mounted to the smb share containing the Drdos/Foxpro files. The idea was to make Dosemu use the Samba file locking system. Well...Dosemu runs and Foxpro starts but the whole process is REALLY slow. So slow that I didn't have the patience to test whether the file locking problem was fixed. It's not eating up cpu cycles either (according to top).

Has anyone tried to access smb shares from Dosemu and if yes how did you do it?

Thanks,
Stephen

#12 lore raw

Re: Samba and kernel oplocks - Smbmount

I'm accessing Samba shares with Dosemu 1.0.2 and 1.0.2.1. File locking works flawlessly and with simultaneous access by Window$ clients.

I mount the Samba share with

mount -t smbfs //SERVER/SHARE /mnt/MOUNTPOINT -o credentials=CREDENTIALS_FILE,workgroup=WORKGROUP,rw,gid=GID,fmask=770

and then, within Dosemu

lredir F: linux\fs/mnt/MOUNTPOINT

(Of course, all the stuff in capitals needs to be substituted correspondingly).

Works fine.

Oscar

Quoted 32 lines · Stephen Lee
Quoted 16 lines · Stephen Lee

Hi,

I am running a Foxpro application under Dosemu 1.1.3.2 (xdosemu) with the keyboard patches and things seem to be running smoothly. Problems occur when some users access the same Foxpro db files via Samba 2.2.4. Files locked under Dosemu/Foxpro are not locked when accessed by Samba. Some of the samba config settings include:

kernel oplocks = yes
locking = Yes
oplocks = Yes
level2 oplocks = Yes
oplock contention limit = 2
posix locking = Yes
strict locking = No

Quoted 2 lines

This is a Redhat 7.2 systems running kernel 2.4.18. What else do I need to configure to get Dosemu file locks recognized by Samba?

Just for kicks, I tried to access the Foxpro db files via an smb share using smbmount. Instead of pointing $_hdimage to the Drdos/Foxpro directory directly, I pointed it to a directory mounted to the smb share containing the Drdos/Foxpro files. The idea was to make Dosemu use the Samba file locking system. Well...Dosemu runs and Foxpro starts but the whole process is REALLY slow. So slow that I didn't have the patience to test whether the file locking problem was fixed. It's not eating up cpu cycles either (according to top).

Has anyone tried to access smb shares from Dosemu and if yes how did you do it?

Quoted 8 lines

Thanks,
Stephen

-
To unsubscribe from this list: send the line "unsubscribe linux-msdos" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

-
To unsubscribe from this list: send the line "unsubscribe linux-msdos" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html