Changeset 429 for trunk/server/source3/smbd/server.c
- Timestamp:
- Apr 9, 2010, 3:51:41 PM (15 years ago)
- Location:
- trunk/server
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/server
-
Property svn:mergeinfo
set to
/vendor/3.5.2 merged eligible /vendor/current merged eligible
-
Property svn:mergeinfo
set to
-
trunk/server/source3/smbd/server.c
r414 r429 220 220 } 221 221 222 /* 223 at most every smbd:cleanuptime seconds (default 20), we scan the BRL 224 and locking database for entries to cleanup. As a side effect this 225 also cleans up dead entries in the connections database (due to the 226 traversal in message_send_all() 227 228 Using a timer for this prevents a flood of traversals when a large 229 number of clients disconnect at the same time (perhaps due to a 230 network outage). 231 */ 232 233 static void cleanup_timeout_fn(struct event_context *event_ctx, 234 struct timed_event *te, 235 struct timeval now, 236 void *private_data) 237 { 238 struct timed_event **cleanup_te = (struct timed_event **)private_data; 239 240 DEBUG(1,("Cleaning up brl and lock database after unclean shutdown\n")); 241 message_send_all(smbd_messaging_context(), MSG_SMB_UNLOCK, NULL, 0, NULL); 242 messaging_send_buf(smbd_messaging_context(), procid_self(), 243 MSG_SMB_BRL_VALIDATE, NULL, 0); 244 /* mark the cleanup as having been done */ 245 (*cleanup_te) = NULL; 246 } 247 222 248 static void remove_child_pid(pid_t pid, bool unclean_shutdown) 223 249 { 224 250 struct child_pid *child; 251 static struct timed_event *cleanup_te; 225 252 226 253 if (unclean_shutdown) { 227 /* a child terminated uncleanly so tickle all processes to see 228 if they can grab any of the pending locks 229 */ 230 DEBUG(3,(__location__ " Unclean shutdown of pid %u\n", (unsigned int)pid)); 231 messaging_send_buf(smbd_messaging_context(), procid_self(), 232 MSG_SMB_BRL_VALIDATE, NULL, 0); 233 message_send_all(smbd_messaging_context(), 234 MSG_SMB_UNLOCK, NULL, 0, NULL); 254 /* a child terminated uncleanly so tickle all 255 processes to see if they can grab any of the 256 pending locks 257 */ 258 DEBUG(3,(__location__ " Unclean shutdown of pid %u\n", 259 (unsigned int)pid)); 260 if (!cleanup_te) { 261 /* call the cleanup timer, but not too often */ 262 int cleanup_time = lp_parm_int(-1, "smbd", "cleanuptime", 20); 263 cleanup_te = event_add_timed(smbd_event_context(), NULL, 264 timeval_current_ofs(cleanup_time, 0), 265 cleanup_timeout_fn, 266 &cleanup_te); 267 DEBUG(1,("Scheduled cleanup of brl and lock database after unclean shutdown\n")); 268 } 235 269 } 236 270 … … 1048 1082 gain_root_group_privilege(); 1049 1083 1050 /*1051 * Ensure we have CAP_KILL capability set on Linux,1052 * where we need this to communicate with threads.1053 * This is inherited by new threads, but not by new1054 * processes across exec().1055 */1056 set_effective_capability(KILL_CAPABILITY);1057 1058 1084 fault_setup((void (*)(void *))exit_server_fault); 1059 1085 dump_core_setup("smbd"); … … 1281 1307 1282 1308 TALLOC_FREE(frame); 1309 /* make sure we always have a valid stackframe */ 1310 frame = talloc_stackframe(); 1283 1311 1284 1312 smbd_parent_loop(parent); 1285 1313 1286 1314 exit_server_cleanly(NULL); 1315 TALLOC_FREE(frame); 1287 1316 return(0); 1288 1317 }
Note:
See TracChangeset
for help on using the changeset viewer.