cifs backport is current
Jeremy Allison
jra at samba.org
Tue Jul 17 00:52:46 GMT 2007
On Mon, Jul 16, 2007 at 04:03:01PM -0500, Steve French wrote:
> More testing with SAMBA_3_2.
>
> cthon basic subtests fail on cleaning up symlinks (posix unlink
> problem, see previous note)
> cthon "special" subtests fail on open/unlink test (have not debugged this
> yet)
> cthon general tests work (yeah!)
> cthon locking tests crash samba see below level 10 log
Here's the fix - will be in 3.0.25c. Problem was an optimization
introduced to not read the locking tdb on file close for Windows
locks if we know there were none on the file - for POSIX locks
you can't count of course as one unlock can unlock many locked
regions. Fix attached.
Jeremy
-------------- next part --------------
Index: locking/locking.c
===================================================================
--- locking/locking.c (revision 23905)
+++ locking/locking.c (working copy)
@@ -41,6 +41,8 @@
#undef DBGC_CLASS
#define DBGC_CLASS DBGC_LOCKING
+#define NO_LOCKING_COUNT (-1)
+
/* the locking database handle */
static TDB_CONTEXT *tdb;
@@ -224,11 +226,19 @@
blocking_lock,
plock_pid);
- /* blocking ie. pending, locks also count here,
- * as this is an efficiency counter to avoid checking
- * the lock db. on close. JRA. */
+ if (lock_flav == WINDOWS_LOCK &&
+ fsp->current_lock_count != NO_LOCKING_COUNT) {
+ /* blocking ie. pending, locks also count here,
+ * as this is an efficiency counter to avoid checking
+ * the lock db. on close. JRA. */
- fsp->current_lock_count++;
+ fsp->current_lock_count++;
+ } else {
+ /* Notice that this has had a POSIX lock request.
+ * We can't count locks after this so forget them.
+ */
+ fsp->current_lock_count = NO_LOCKING_COUNT;
+ }
return br_lck;
}
@@ -276,8 +286,11 @@
return NT_STATUS_RANGE_NOT_LOCKED;
}
- SMB_ASSERT(fsp->current_lock_count > 0);
- fsp->current_lock_count--;
+ if (lock_flav == WINDOWS_LOCK &&
+ fsp->current_lock_count != NO_LOCKING_COUNT) {
+ SMB_ASSERT(fsp->current_lock_count > 0);
+ fsp->current_lock_count--;
+ }
return NT_STATUS_OK;
}
@@ -326,8 +339,11 @@
return NT_STATUS_DOS(ERRDOS, ERRcancelviolation);
}
- SMB_ASSERT(fsp->current_lock_count > 0);
- fsp->current_lock_count--;
+ if (lock_flav == WINDOWS_LOCK &&
+ fsp->current_lock_count != NO_LOCKING_COUNT) {
+ SMB_ASSERT(fsp->current_lock_count > 0);
+ fsp->current_lock_count--;
+ }
return NT_STATUS_OK;
}
More information about the samba-technical
mailing list