secondary.c (212899) | secondary.c (213007) |
---|---|
1/*- 2 * Copyright (c) 2009-2010 The FreeBSD Foundation 3 * Copyright (c) 2010 Pawel Jakub Dawidek <pjd@FreeBSD.org> 4 * All rights reserved. 5 * 6 * This software was developed by Pawel Jakub Dawidek under sponsorship from 7 * the FreeBSD Foundation. 8 * --- 15 unchanged lines hidden (view full) --- 24 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28 * SUCH DAMAGE. 29 */ 30 31#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2009-2010 The FreeBSD Foundation 3 * Copyright (c) 2010 Pawel Jakub Dawidek <pjd@FreeBSD.org> 4 * All rights reserved. 5 * 6 * This software was developed by Pawel Jakub Dawidek under sponsorship from 7 * the FreeBSD Foundation. 8 * --- 15 unchanged lines hidden (view full) --- 24 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28 * SUCH DAMAGE. 29 */ 30 31#include <sys/cdefs.h> |
32__FBSDID("$FreeBSD: head/sbin/hastd/secondary.c 212899 2010-09-20 13:23:43Z pjd $"); | 32__FBSDID("$FreeBSD: head/sbin/hastd/secondary.c 213007 2010-09-22 19:03:11Z pjd $"); |
33 34#include <sys/param.h> 35#include <sys/time.h> 36#include <sys/bio.h> 37#include <sys/disk.h> 38#include <sys/stat.h> 39 40#include <assert.h> --- 347 unchanged lines hidden (view full) --- 388 389 /* Error in setting timeout is not critical, but why should it fail? */ 390 if (proto_timeout(res->hr_remotein, 0) < 0) 391 pjdlog_errno(LOG_WARNING, "Unable to set connection timeout"); 392 if (proto_timeout(res->hr_remoteout, res->hr_timeout) < 0) 393 pjdlog_errno(LOG_WARNING, "Unable to set connection timeout"); 394 395 init_local(res); | 33 34#include <sys/param.h> 35#include <sys/time.h> 36#include <sys/bio.h> 37#include <sys/disk.h> 38#include <sys/stat.h> 39 40#include <assert.h> --- 347 unchanged lines hidden (view full) --- 388 389 /* Error in setting timeout is not critical, but why should it fail? */ 390 if (proto_timeout(res->hr_remotein, 0) < 0) 391 pjdlog_errno(LOG_WARNING, "Unable to set connection timeout"); 392 if (proto_timeout(res->hr_remoteout, res->hr_timeout) < 0) 393 pjdlog_errno(LOG_WARNING, "Unable to set connection timeout"); 394 395 init_local(res); |
396 init_remote(res, nvin); | |
397 init_environment(); | 396 init_environment(); |
397 398 /* 399 * Create the control thread before sending any event to the parent, 400 * as we can deadlock when parent sends control request to worker, 401 * but worker has no control thread started yet, so parent waits. 402 * In the meantime worker sends an event to the parent, but parent 403 * is unable to handle the event, because it waits for control 404 * request response. 405 */ 406 error = pthread_create(&td, NULL, ctrl_thread, res); 407 assert(error == 0); 408 409 init_remote(res, nvin); |
|
398 event_send(res, EVENT_CONNECT); 399 400 error = pthread_create(&td, NULL, recv_thread, res); 401 assert(error == 0); 402 error = pthread_create(&td, NULL, disk_thread, res); 403 assert(error == 0); | 410 event_send(res, EVENT_CONNECT); 411 412 error = pthread_create(&td, NULL, recv_thread, res); 413 assert(error == 0); 414 error = pthread_create(&td, NULL, disk_thread, res); 415 assert(error == 0); |
404 error = pthread_create(&td, NULL, send_thread, res); 405 assert(error == 0); 406 (void)ctrl_thread(res); | 416 (void)send_thread(res); |
407} 408 409static void 410reqlog(int loglevel, int debuglevel, int error, struct hio *hio, const char *fmt, ...) 411{ 412 char msg[1024]; 413 va_list ap; 414 int len; --- 324 unchanged lines hidden --- | 417} 418 419static void 420reqlog(int loglevel, int debuglevel, int error, struct hio *hio, const char *fmt, ...) 421{ 422 char msg[1024]; 423 va_list ap; 424 int len; --- 324 unchanged lines hidden --- |