Rev 615: merged locking change from volker in http://samba.org/~tridge/3_0-ctdb

tridge at samba.org tridge at samba.org
Thu Sep 6 02:27:41 GMT 2007


------------------------------------------------------------
revno: 615
revision-id: tridge at samba.org-20070906022740-3ez37h3zwu1vafnm
parent: tridge at samba.org-20070905020246-yy3om8ebmwrhumf6
committer: Andrew Tridgell <tridge at samba.org>
branch nick: s3-ctdb-tridge
timestamp: Thu 2007-09-06 12:27:40 +1000
message:
  merged locking change from volker
modified:
  source/smbd/blocking.c         blocking.c-20070210173807-1wjifrbwaz6xnmgl-994
=== modified file 'source/smbd/blocking.c'
--- a/source/smbd/blocking.c	2007-05-18 14:17:31 +0000
+++ b/source/smbd/blocking.c	2007-09-06 02:27:40 +0000
@@ -689,34 +689,6 @@
 		DEBUG(5,("process_blocking_lock_queue: examining pending lock fnum = %d for file %s\n",
 			fsp->fnum, fsp->fsp_name ));
 
-		if (!timeval_is_zero(&blr->expire_time) && timeval_compare(&blr->expire_time, &tv_curr) <= 0) {
-			struct byte_range_lock *br_lck = brl_get_locks(NULL, fsp);
-
-			/*
-			 * Lock expired - throw away all previously
-			 * obtained locks and return lock error.
-			 */
-
-			if (br_lck) {
-				DEBUG(5,("process_blocking_lock_queue: pending lock fnum = %d for file %s timed out.\n",
-					fsp->fnum, fsp->fsp_name ));
-
-				brl_lock_cancel(br_lck,
-					blr->lock_pid,
-					procid_self(),
-					blr->offset,
-					blr->count,
-					blr->lock_flav);
-				TALLOC_FREE(br_lck);
-			}
-
-			blocking_lock_reply_error(blr,NT_STATUS_FILE_LOCK_CONFLICT);
-			DLIST_REMOVE(blocking_lock_queue, blr);
-			free_blocking_lock_record(blr);
-			recalc_timeout = True;
-			continue;
-		}
-
 		if(!change_to_user(conn,vuid)) {
 			struct byte_range_lock *br_lck = brl_get_locks(NULL, fsp);
 
@@ -790,8 +762,43 @@
 			DLIST_REMOVE(blocking_lock_queue, blr);
 			free_blocking_lock_record(blr);
 			recalc_timeout = True;
+			change_to_root_user();
+			continue;
 		}
+
 		change_to_root_user();
+
+		/*
+		 * We couldn't get the locks for this record on the list.
+		 * If the time has expired, return a lock error.
+		 */
+
+		if (!timeval_is_zero(&blr->expire_time) && timeval_compare(&blr->expire_time, &tv_curr) <= 0) {
+			struct byte_range_lock *br_lck = brl_get_locks(NULL, fsp);
+
+			/*
+			 * Lock expired - throw away all previously
+			 * obtained locks and return lock error.
+			 */
+
+			if (br_lck) {
+				DEBUG(5,("process_blocking_lock_queue: pending lock fnum = %d for file %s timed out.\n",
+					fsp->fnum, fsp->fsp_name ));
+
+				brl_lock_cancel(br_lck,
+					blr->lock_pid,
+					procid_self(),
+					blr->offset,
+					blr->count,
+					blr->lock_flav);
+				TALLOC_FREE(br_lck);
+			}
+
+			blocking_lock_reply_error(blr,NT_STATUS_FILE_LOCK_CONFLICT);
+			DLIST_REMOVE(blocking_lock_queue, blr);
+			free_blocking_lock_record(blr);
+			recalc_timeout = True;
+		}
 	}
 
 	if (recalc_timeout) {



More information about the samba-cvs mailing list