<div class="zcontentRow"><p style="font-size:14px;font-family:arial;">I'm sorry about many v1 patches posted. I fix some syntax errors in all v2 patches, </p><p style="font-size:14px;font-family:arial;">and should note the changes in these patches. I will learn more about posting patch</p><p style="font-size:14px;font-family:arial;">correctly. </p><p style="font-size:14px;font-family:arial;">Thanks John.</p><p style="font-size:14px;font-family:arial;"><br></p><p style="font-size:14px;font-family:arial;">---<br></p><p style="font-size:14px;font-family:arial;">Best wishes,</p><p style="font-size:14px;font-family:arial;">Wang Yechao</p><p style="font-size:14px;font-family:arial;"><br></p><div class="zMailSign" unonamech="王业超10154425" unonameen="wang yechao10154425"></div><div class="zMailFrom"></div><div><div class="zhistoryRow" style="display:block"><div class="zhistoryDes" style="width: 100%; height: 28px; line-height: 28px; background-color: #E0E5E9; color: #1388FF; text-align: center;" language-data="HistoryOrgTxt">原始邮件</div><div id="zwriteHistoryContainer"><div class="control-group zhistoryPanel"><div class="zhistoryHeader" style="padding: 8px; background-color: #F5F6F8;"><div><strong language-data="HistorySenderTxt">发件人:</strong><span class="zreadUserName">JohnFerlan <jferlan@redhat.com></span></div><div><strong language-data="HistoryTOTxt">收件人:</strong><span class="zreadUserName" style="display: inline;">王业超10154425;</span><span class="zreadUserName" style="display: inline;">libvir-list@redhat.com <libvir-list@redhat.com></span></div><div><strong language-data="HistoryDateTxt">日 期 :</strong><span class="">2018年09月14日 23:49</span></div><div><strong language-data="HistorySubjectTxt">主 题 :</strong><span class="zreadTitle"><strong>Re: [libvirt] [PATCH v2] nwfilter: fix deadlock when nwfilter reload</strong></span></div></div><div class="zhistoryContent"><div><br><br>On 09/13/2018 07:15 AM, Wang Yechao wrote:<br>> user run "firewalld-cmd --reload"<br>> nwfilterStateReload called in main thread<br>> step 1. virRWLockWrite(&updateLock)<br>> step 2. virNWFilterLoadAllConfigs<br>> step 3. virRWLockUnlock(&updateLock);<br>> <br>> lauch a vm: qemuDomainCreateXML runs in other thread<br>> step 1. virRWLockRead(&updateLock);<br>> step 2. qemuProcessStart<br>> step 3. qemuProcessWaitForMonitor<br>> step 4. ...<br>> step 5  virRWLockUnlock(&updateLock);<br>> <br>> if nwfilterStateReload called in the middle of step 1 and step 5 of<br>> qemuDomainCreateXML, it can't get the updateLock and then block the event_loop,<br>> so event_loop can't handle the qemu-monitor messages, cause deadlock<br>> <br>> move nwfilterStateReload into thread to fix this problem.<br>> <br>> Signed-off-by: Wang Yechao <wang.yechao255@zte.com.cn><br>> Reviewed-by: Wang Yi <wang.yi59@zte.com.cn><br>> ---<br>>  src/nwfilter/nwfilter_driver.c | 10 +++++++++-<br>>  1 file changed, 9 insertions(+), 1 deletion(-)<br>> <br><br>Couple of "administrative" comments - since you were a new contributor<br>to libvir-list - you just needed to be a bit more patient w/r/t getting<br>your patches on this list, as described here:<br><br>https://libvirt.org/hacking.html<br><br>"If everything went well, your patch should show up on the libvir-list<br>archives in a matter of minutes; if you still can't find it on there<br>after an hour or so, you should double-check your setup. Note that your<br>very first post to the mailing list will be subject to moderation, and<br>it's not uncommon for that to take around a day.<br>"<br><br>OK so that hopefully helps explain why there were many v1's posted<br><br>Then when you repost a few days later with something that's changed, you<br>need to change to using v2.  In the postings on Sept 11 it seems you've<br>change the R-By email address. That's important enough to note...<br><br>Then when you posted as v2, it probably should have been v3 and a note<br>added why you changed from VIR_ERROR to VIR_WARN<br><br>For each of these addition versions after the "---" (above):<br><br>   1. Add a pointer to the previous posting from the archives<br>   2. Briefly describe the differences in the changes<br><br>So, after all that...  This seemed really familiar... and it was:<br><br>See:<br><br>https://www.redhat.com/archives/libvir-list/2017-October/msg01351.html<br><br>and follow-ups:<br><br>https://www.redhat.com/archives/libvir-list/2017-December/msg00198.html<br>https://www.redhat.com/archives/libvir-list/2017-December/msg00227.html<br><br>However, that followup was essentially dropped. So this code once again<br>resurrects the same questions that I had back then.<br><br>Not that I don't think this should be done in some form, the question<br>becomes how much "care" needs to be taken to ensure we don't have<br>multiple threads running.<br><br>John<br><br>BTW: Whether you were aware of Nikolay's patch or not, I think some<br>attribution could be made even though it was the same solution.<br><br><br>> diff --git a/src/nwfilter/nwfilter_driver.c b/src/nwfilter/nwfilter_driver.c<br>> index 1ee5162..ab85072 100644<br>> --- a/src/nwfilter/nwfilter_driver.c<br>> +++ b/src/nwfilter/nwfilter_driver.c<br>> @@ -80,18 +80,26 @@ static void nwfilterDriverUnlock(void)<br>>  }<br>>  <br>>  #if HAVE_FIREWALLD<br>> +static void nwfilterReloadThread(void *opaque ATTRIBUTE_UNUSED)<br>> +{<br>> +    nwfilterStateReload();<br>> +}<br>>  <br>>  static DBusHandlerResult<br>>  nwfilterFirewalldDBusFilter(DBusConnection *connection ATTRIBUTE_UNUSED,<br>>                              DBusMessage *message,<br>>                              void *user_data ATTRIBUTE_UNUSED)<br>>  {<br>> +    virThread thread;<br>> +<br>>      if (dbus_message_is_signal(message, DBUS_INTERFACE_DBUS,<br>>                                 "NameOwnerChanged") ||<br>>          dbus_message_is_signal(message, "org.fedoraproject.FirewallD1",<br>>                                 "Reloaded")) {<br>>          VIR_DEBUG("Reload in nwfilter_driver because of firewalld.");<br>> -        nwfilterStateReload();<br>> +<br>> +        if (virThreadCreate(&thread, false, nwfilterReloadThread, NULL) < 0)<br>> +            VIR_WARN("create nwfilterReloadThread failed.");<br>>      }<br>>  <br>>      return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;<br>> </div></div></div></div></div></div><p><br></p></div>