From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Subject: Re: fio server/client disconnect bug From: Jens Axboe References: <47cd0e78-d881-a776-7f2d-c292b35e8211@kernel.dk> <5d0275d2-889e-314e-63bd-240d326beb47@kernel.dk> <33d87376-bbd9-69d9-83e0-120d93bd843d@kernel.dk> <7ea6910f-dc7b-d141-432e-62c2ee9f16ee@kernel.dk> <4f5b0878-83fc-a224-e6b0-06896cd2155b@kernel.dk> <590553ff-0e9c-b679-1bcc-be9ae3a840ef@kernel.dk> <027c68c5-549d-8b4e-f606-84f8b321eb04@kernel.dk> Message-ID: <920b95c9-070a-b3ba-1da3-8b28cf9a82d9@kernel.dk> Date: Wed, 21 Mar 2018 13:10:09 -0600 MIME-Version: 1.0 In-Reply-To: <027c68c5-549d-8b4e-f606-84f8b321eb04@kernel.dk> Content-Type: text/plain; charset=windows-1252 Content-Language: en-US Content-Transfer-Encoding: 7bit To: Jeff Furlong , "fio@vger.kernel.org" List-ID: On 3/21/18 1:03 PM, Jens Axboe wrote: > Shoot, I think I see what it is. Some commands we punt to out-of-line > sending, others we do inline. STOP/QUIT are inline, whereas the ts/gs/du > are not. So we could potentially have a situation where we queue up the > ts/gs/du, but then process the STOP/QUIT first. If we do that, then we > don't get any output... > > Let me think about this for a bit, and see what I can come up with. Can you try with this? Can be improved to have the thread signal us, but it should be a rare occurrence and a 1ms stall from this context isn't a concern. diff --git a/server.c b/server.c index 65d4484edae5..52bcf7bf44c6 100644 --- a/server.c +++ b/server.c @@ -551,9 +551,15 @@ static void fio_net_queue_entry(struct sk_entry *entry) { struct sk_out *sk_out = pthread_getspecific(sk_out_key); - if (entry->flags & SK_F_INLINE) + if (entry->flags & SK_F_INLINE) { + /* + * Honor ordering - if the out-of-line queue isn't empty, + * wait for it to drain before proceeding. + */ + while (!flist_empty(&sk_out->list)) + usleep(1000); handle_sk_entry(sk_out, entry); - else { + } else { sk_lock(sk_out); flist_add_tail(&entry->list, &sk_out->list); sk_unlock(sk_out); -- Jens Axboe