samba-cvs.cvs
[Top] [All Lists]

svn commit: samba r13798 - in trunk/source/locking: .

Subject: svn commit: samba r13798 - in trunk/source/locking: .
From:
Date: Thu, 2 Mar 2006 22:58:50 +0000 GMT
Author: jra
Date: 2006-03-02 22:58:50 +0000 (Thu, 02 Mar 2006)
New Revision: 13798

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=13798

Log:
Acutally remember to copy new locks into the lock array.
This helps :-). Now back to passing locktest again for
Windows locks.
Jeremy.

Modified:
   trunk/source/locking/brlock.c
   trunk/source/locking/locking.c


Changeset:
Modified: trunk/source/locking/brlock.c
===================================================================
--- trunk/source/locking/brlock.c       2006-03-02 21:43:40 UTC (rev 13797)
+++ trunk/source/locking/brlock.c       2006-03-02 22:58:50 UTC (rev 13798)
@@ -311,8 +311,10 @@
        if (!tp) {
                return NT_STATUS_NO_MEMORY;
        } else {
+               locks = (struct lock_struct *)tp;
+               memcpy(&locks[br_lck->num_locks], plock, sizeof(struct 
lock_struct));
                br_lck->num_locks += 1;
-               br_lck->lock_data = (void *)tp;
+               br_lck->lock_data = (void *)locks;
                br_lck->modified = True;
        }
 
@@ -715,6 +717,22 @@
        return 0;
 }
 
+static void print_lock_struct(unsigned int i, struct lock_struct *pls)
+{
+       DEBUG(10,("[%u]: smbpid = %u, tid = %u, pid = %u, ",
+                       i,
+                       (unsigned int)pls->context.smbpid,
+                       (unsigned int)pls->context.tid,
+                       (unsigned int)procid_to_pid(&pls->context.pid) ));
+       
+       DEBUG(10,("start = %.0f, size = %.0f, fnum = %d, %s %s\n",
+               (double)pls->start,
+               (double)pls->size,
+               pls->fnum,
+               lock_type_name(pls->lock_type),
+               lock_flav_name(pls->lock_flav) ));
+}
+
 /*******************************************************************
  Fetch a set of byte range lock data from the database.
  Leave the record locked.
@@ -748,5 +766,15 @@
        br_lck->lock_data = (void *)data.dptr;
        br_lck->num_locks = data.dsize / sizeof(struct lock_struct);
 
+       if (DEBUGLEVEL >= 10) {
+               unsigned int i;
+               struct lock_struct *locks = (struct lock_struct 
*)br_lck->lock_data;
+               DEBUG(10,("brl_get_locks: %u current locks on dev=%.0f, 
inode=%.0f\n",
+                       br_lck->num_locks,
+                       (double)fsp->dev, (double)fsp->inode ));
+               for( i = 0; i < br_lck->num_locks; i++) {
+                       print_lock_struct(i, &locks[i]);
+               }
+       }
        return br_lck;
 }

Modified: trunk/source/locking/locking.c
===================================================================
--- trunk/source/locking/locking.c      2006-03-02 21:43:40 UTC (rev 13797)
+++ trunk/source/locking/locking.c      2006-03-02 22:58:50 UTC (rev 13798)
@@ -48,12 +48,21 @@
  Debugging aids :-).
 ****************************************************************************/
 
-static const char *lock_type_name(enum brl_type lock_type)
+const char *lock_type_name(enum brl_type lock_type)
 {
-       return (lock_type == READ_LOCK) ? "READ" : "WRITE";
+       switch (lock_type) {
+               case READ_LOCK:
+                       return "READ";
+               case WRITE_LOCK:
+                       return "WRITE";
+               case PENDING_LOCK:
+                       return "PENDING";
+               default:
+                       return "other";
+       }
 }
 
-static const char *lock_flav_name(enum brl_flavour lock_flav)
+const char *lock_flav_name(enum brl_flavour lock_flav)
 {
        return (lock_flav == WINDOWS_LOCK) ? "WINDOWS_LOCK" : "POSIX_LOCK";
 }
@@ -112,10 +121,10 @@
                TALLOC_FREE(br_lck);
        }
 
-       DEBUG(10,("is_locked: flavour = %s brl start=%.0f len=%.0f %s for file 
%s\n",
+       DEBUG(10,("is_locked: flavour = %s brl start=%.0f len=%.0f %s for fnum 
%d file %s\n",
                        lock_flav_name(lock_flav),
                        (double)offset, (double)count, ret ? "locked" : 
"unlocked",
-                       fsp->fsp_name ));
+                       fsp->fnum, fsp->fsp_name ));
 
        /*
         * There is no lock held by an SMB daemon, check to
@@ -126,9 +135,9 @@
        if(!ret && lp_posix_locking(snum) && (lock_flav == WINDOWS_LOCK)) {
                ret = is_posix_locked(fsp, offset, count, lock_type);
 
-               DEBUG(10,("is_locked: posix start=%.0f len=%.0f %s for file 
%s\n",
+               DEBUG(10,("is_locked: posix start=%.0f len=%.0f %s for fnum %d 
file %s\n",
                                (double)offset, (double)count, ret ? "locked" : 
"unlocked",
-                               fsp->fsp_name ));
+                               fsp->fnum, fsp->fsp_name ));
        }
 
        return ret;
@@ -155,9 +164,9 @@
 
        /* NOTE! 0 byte long ranges ARE allowed and should be stored  */
 
-       DEBUG(10,("do_lock: lock flavour %s lock type %s start=%.0f len=%.0f 
requested for file %s\n",
+       DEBUG(10,("do_lock: lock flavour %s lock type %s start=%.0f len=%.0f 
requested for fnum %d file %s\n",
                lock_flav_name(lock_flav), lock_type_name(lock_type),
-               (double)offset, (double)count, fsp->fsp_name ));
+               (double)offset, (double)count, fsp->fnum, fsp->fsp_name ));
 
        if (!OPEN_FSP(fsp) || !fsp->can_lock) {
                return status;
@@ -304,8 +313,8 @@
                return NT_STATUS_INVALID_HANDLE;
        }
        
-       DEBUG(10,("do_unlock: unlock start=%.0f len=%.0f requested for file 
%s\n",
-                 (double)offset, (double)count, fsp->fsp_name ));
+       DEBUG(10,("do_unlock: unlock start=%.0f len=%.0f requested for fnum %d 
file %s\n",
+                 (double)offset, (double)count, fsp->fnum, fsp->fsp_name ));
 
        /*
         * Remove the existing lock record from the tdb lockdb

<Prev in Thread] Current Thread [Next in Thread>
  • svn commit: samba r13798 - in trunk/source/locking: ., jra <=