summaryrefslogtreecommitdiff
path: root/source3/smbd
diff options
context:
space:
mode:
authorVolker Lendecke <vlendec@samba.org>2001-08-21 01:25:45 +0000
committerVolker Lendecke <vlendec@samba.org>2001-08-21 01:25:45 +0000
commite6a6dee0272a170848d3b9c177bf3839214d0a20 (patch)
tree14651e28b84aad5e44fa5f4b265ac7c266b543c4 /source3/smbd
parentc786a4d89a3c4b7f2c6fdf0762e835ad7edbd664 (diff)
downloadsamba-e6a6dee0272a170848d3b9c177bf3839214d0a20.tar.gz
samba-e6a6dee0272a170848d3b9c177bf3839214d0a20.tar.bz2
samba-e6a6dee0272a170848d3b9c177bf3839214d0a20.zip
This is Jeremy pretending to be Volker, 'cos the
link from Seattle is having problems. I've added 3 things here to work on the fcntl spin problem. 1). Check *all* tdb return codes... :-). 2). If we're asking ourselves to break an oplock, and we can't find a fsp pointer that matches the entry, this is a *logic bug* and we should abort and panic so someone with gdb can pick up the pieces. 3). After we've broken an oplock, ensure that the entry itself has been removed, and if not remove it ourselves. This should not be neccessary in a correctly working environmen,t, but will provide an added layer of robustness in error situations. 4). I hate german keyboards :-) :-). Jeremy. (This used to be commit 1c94fa80646f9e31377fbb41332fe4780f550cab)
Diffstat (limited to 'source3/smbd')
-rw-r--r--source3/smbd/open.c10
-rw-r--r--source3/smbd/oplock.c13
2 files changed, 23 insertions, 0 deletions
diff --git a/source3/smbd/open.c b/source3/smbd/open.c
index a32e032921..143aa934a6 100644
--- a/source3/smbd/open.c
+++ b/source3/smbd/open.c
@@ -464,6 +464,7 @@ static int open_mode_check(connection_struct *conn, const char *fname, SMB_DEV_T
*/
do {
+ share_mode_entry broken_entry;
broke_oplock = False;
*p_all_current_opens_are_level_II = True;
@@ -506,6 +507,7 @@ dev = %x, inode = %.0f\n", old_shares[i].op_type, fname, (unsigned int)dev, (dou
}
broke_oplock = True;
+ broken_entry = *share_entry;
break;
} else if (!LEVEL_II_OPLOCK_TYPE(share_entry->op_type)) {
@@ -525,6 +527,14 @@ dev = %x, inode = %.0f\n", old_shares[i].op_type, fname, (unsigned int)dev, (dou
if(broke_oplock) {
free((char *)old_shares);
+ if (del_share_entry(dev, inode, &broken_entry, NULL) == -1) {
+ DEBUG(0,("open_mode_check: cannot delete entry when breaking oplock (%x) on file %s, \
+dev = %x, inode = %.0f\n", broken_entry.op_type, fname, (unsigned int)dev, (double)inode));
+ errno = EACCES;
+ unix_ERR_class = ERRDOS;
+ unix_ERR_code = ERRbadshare;
+ return -1;
+ }
num_share_modes = get_share_modes(conn, dev, inode, &old_shares);
oplock_contention_count++;
}
diff --git a/source3/smbd/oplock.c b/source3/smbd/oplock.c
index cc2581375e..4bc8fce698 100644
--- a/source3/smbd/oplock.c
+++ b/source3/smbd/oplock.c
@@ -903,6 +903,19 @@ should be %d\n", (int)pid, share_entry->op_port, global_oplock_port));
DEBUG(5,("request_oplock_break: breaking our own oplock\n"));
+#if 1 /* JRA PARANOIA TEST.... */
+ {
+ files_struct *fsp = file_find_dit(dev, inode, &share_entry->time);
+ if (!fsp) {
+ DEBUG(0,("request_oplock_break: PANIC : breaking our own oplock requested for \
+dev = %x, inode = %.0f, tv_sec = %x, tv_usec = %x and no fsp found !\n",
+ (unsigned int)dev, (double)inode, (int)share_entry->time.tv_sec,
+ (int)share_entry->time.tv_usec ));
+ smb_panic("request_oplock_break: no fsp found for our own oplock\n");
+ }
+ }
+#endif /* END JRA PARANOIA TEST... */
+
/* Call oplock break direct. */
return oplock_break(dev, inode, &share_entry->time, True);
}