summaryrefslogtreecommitdiff
path: root/source3/locking
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2001-10-20 21:59:34 +0000
committerJeremy Allison <jra@samba.org>2001-10-20 21:59:34 +0000
commit88b55f47b4914f7d390939e4394ec3edd42be91f (patch)
tree3153cf9871570a55fe1476b6ad45d9c5b6c72846 /source3/locking
parente5868e1f57c1de537a7385a81d23671a727af5f5 (diff)
downloadsamba-88b55f47b4914f7d390939e4394ec3edd42be91f.tar.gz
samba-88b55f47b4914f7d390939e4394ec3edd42be91f.tar.bz2
samba-88b55f47b4914f7d390939e4394ec3edd42be91f.zip
Move from timestamp to gen count file id's for finding oplocked files
in a tdb. Jeremy. (This used to be commit 058ae6b58f61ef46013dd076af3a84de5fbaaab1)
Diffstat (limited to 'source3/locking')
-rw-r--r--source3/locking/locking.c25
1 files changed, 19 insertions, 6 deletions
diff --git a/source3/locking/locking.c b/source3/locking/locking.c
index ca57bd6b8f..b551d8c6d6 100644
--- a/source3/locking/locking.c
+++ b/source3/locking/locking.c
@@ -349,10 +349,6 @@ static TDB_DATA locking_key_fsp(files_struct *fsp)
return locking_key(fsp->dev, fsp->inode);
}
-#ifndef LOCK_SHARE_ENTRY_SPIN_COUNT
-#define LOCK_SHARE_ENTRY_SPIN_COUNT 100
-#endif
-
/*******************************************************************
Lock a hash bucket entry.
******************************************************************/
@@ -436,6 +432,9 @@ static void fill_share_mode(char *p, files_struct *fsp, uint16 port, uint16 op_t
e->op_port = port;
e->op_type = op_type;
memcpy(x, &fsp->open_time, sizeof(struct timeval));
+ e->share_file_id = fsp->file_id;
+ e->dev = fsp->dev;
+ e->inode = fsp->inode;
}
/*******************************************************************
@@ -445,10 +444,24 @@ static void fill_share_mode(char *p, files_struct *fsp, uint16 port, uint16 op_t
BOOL share_modes_identical( share_mode_entry *e1, share_mode_entry *e2)
{
+#if 1 /* JRA PARANOIA TEST - REMOVE LATER */
+ if (e1->pid == e2->pid &&
+ e1->share_file_id == e2->share_file_id &&
+ e1->dev == e2->dev &&
+ e1->inode == e2->inode &&
+ (e1->share_mode & ~DELETE_ON_CLOSE_FLAG) != (e2->share_mode & ~DELETE_ON_CLOSE_FLAG)) {
+ DEBUG(0,("PANIC: share_modes_identical: share_mode missmatch (e1 = %u, e2 = %u). Logic error.\n",
+ (unsigned int)(e1->share_mode & ~DELETE_ON_CLOSE_FLAG),
+ (unsigned int)(e2->share_mode & ~DELETE_ON_CLOSE_FLAG) ));
+ smb_panic("PANIC: share_modes_identical logic error.\n");
+ }
+#endif
+
return (e1->pid == e2->pid &&
(e1->share_mode & ~DELETE_ON_CLOSE_FLAG) == (e2->share_mode & ~DELETE_ON_CLOSE_FLAG) &&
- e1->time.tv_sec == e2->time.tv_sec &&
- e1->time.tv_usec == e2->time.tv_usec );
+ e1->dev == e2->dev &&
+ e1->inode == e2->inode &&
+ e1->share_file_id == e2->share_file_id );
}
/*******************************************************************