From e1459a237948c2c9b7da94e4ba0acc79b1cd8eca Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Wed, 7 Jan 2009 10:39:34 +0000 Subject: Several fixes to our use of splice The splice manpage explicitly requires loff_t as offset. Copy "offset" there. Probably not required, but I wanted to make sure it's as required. Splice blocks with large buffers. For me it worked with 16k and blocked with 32k and beyond. It would be nice to see a clarification in the manpage of splice for this behaviour. Splice if used with an offset increments the offset. From the manpage this was at least not entirely obvious :-) I haven't yet activated this (try_splice_call ist still false by default), it needs more testing. Volker --- source3/lib/recvfile.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/source3/lib/recvfile.c b/source3/lib/recvfile.c index c9710a7ebe..ea01596421 100644 --- a/source3/lib/recvfile.c +++ b/source3/lib/recvfile.c @@ -148,6 +148,7 @@ ssize_t sys_recvfile(int fromfd, static int pipefd[2] = { -1, -1 }; static bool try_splice_call = false; size_t total_written = 0; + loff_t splice_offset = offset; DEBUG(10,("sys_recvfile: from = %d, to = %d, " "offset=%.0f, count = %lu\n", @@ -180,7 +181,8 @@ ssize_t sys_recvfile(int fromfd, while (count > 0) { int nread, to_write; - nread = splice(fromfd, NULL, pipefd[1], NULL, count, 0); + nread = splice(fromfd, NULL, pipefd[1], NULL, + MIN(count, 16384), SPLICE_F_MOVE); if (nread == -1) { if (errno == EINTR) { continue; @@ -197,12 +199,12 @@ ssize_t sys_recvfile(int fromfd, to_write = nread; while (to_write > 0) { int thistime; - thistime = splice(pipefd[0], NULL, tofd, &offset, - to_write, 0); + thistime = splice(pipefd[0], NULL, tofd, + &splice_offset, to_write, + SPLICE_F_MOVE); if (thistime == -1) { goto done; } - offset += thistime; to_write -= thistime; } -- cgit From 00a401aa3e7598f69244de5bad57b5dc6d64e369 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Wed, 7 Jan 2009 17:15:47 +0100 Subject: Remove unused struct CLI_POLICY_HND --- source3/winbindd/winbindd.h | 7 ------- 1 file changed, 7 deletions(-) diff --git a/source3/winbindd/winbindd.h b/source3/winbindd/winbindd.h index d8e6ec4c7f..5ebbb72cf5 100644 --- a/source3/winbindd/winbindd.h +++ b/source3/winbindd/winbindd.h @@ -333,13 +333,6 @@ struct winbindd_methods { DOM_SID **dom_sids); }; -/* Used to glue a policy handle and cli_state together */ - -typedef struct { - struct cli_state *cli; - POLICY_HND pol; -} CLI_POLICY_HND; - /* Filled out by IDMAP backends */ struct winbindd_idmap_methods { /* Called when backend is first loaded */ -- cgit From 45c67ff244a4a40b8fd099b3cbdc135a527c30eb Mon Sep 17 00:00:00 2001 From: boyang Date: Wed, 7 Jan 2009 11:02:04 -0800 Subject: refresh sequence number as soon as possible when domain->sequence_number == -1 or domain->last_status is not ok. --- source3/winbindd/winbindd_cache.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/source3/winbindd/winbindd_cache.c b/source3/winbindd/winbindd_cache.c index 1ae7966bc3..863852e837 100644 --- a/source3/winbindd/winbindd_cache.c +++ b/source3/winbindd/winbindd_cache.c @@ -486,7 +486,9 @@ static void refresh_sequence_number(struct winbindd_domain *domain, bool force) time_diff = t - domain->last_seq_check; /* see if we have to refetch the domain sequence number */ - if (!force && (time_diff < cache_time)) { + if (!force && (time_diff < cache_time) && + (domain->sequence_number != DOM_SEQUENCE_NONE) && + NT_STATUS_IS_OK(domain->last_status)) { DEBUG(10, ("refresh_sequence_number: %s time ok\n", domain->name)); goto done; } @@ -495,8 +497,11 @@ static void refresh_sequence_number(struct winbindd_domain *domain, bool force) /* this will update the timestamp as well */ status = fetch_cache_seqnum( domain, t ); - if ( NT_STATUS_IS_OK(status) ) - goto done; + if (NT_STATUS_IS_OK(status) && + (domain->sequence_number != DOM_SEQUENCE_NONE) && + NT_STATUS_IS_OK(domain->last_status)) { + goto done; + } /* important! make sure that we know if this is a native mode domain or not. And that we can contact it. */ -- cgit