diff mbox series

[ovs-dev] vlog: Destroy async_append first then close log_fd.

Message ID 20240515032821.26843-1-hepeng.0320@bytedance.com
State Accepted
Commit 90cd797da196edc817a9733a1c2e0c019ca2e845
Delegated to: Simon Horman
Headers show
Series [ovs-dev] vlog: Destroy async_append first then close log_fd. | expand

Checks

Context Check Description
ovsrobot/apply-robot success apply and check: success
ovsrobot/github-robot-_Build_and_Test success github build: passed
ovsrobot/intel-ovs-compilation success test: success

Commit Message

hepeng May 15, 2024, 3:28 a.m. UTC
From: Peng He <hepeng.0320@bytedance.com>

async_append stores log_fd, it should be destructed before log_fd
is closed.

Signed-off-by: Peng He <hepeng.0320@bytedance.com>
---
 lib/vlog.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Simon Horman May 15, 2024, 4:01 p.m. UTC | #1
On Wed, May 15, 2024 at 11:28:21AM +0800, hepeng via dev wrote:
> From: Peng He <hepeng.0320@bytedance.com>
> 
> async_append stores log_fd, it should be destructed before log_fd
> is closed.
> 
> Signed-off-by: Peng He <hepeng.0320@bytedance.com>

Acked-by: Simon Horman <horms@ovn.org>
Ilya Maximets May 17, 2024, 3:42 p.m. UTC | #2
On 5/15/24 18:01, Simon Horman wrote:
> On Wed, May 15, 2024 at 11:28:21AM +0800, hepeng via dev wrote:
>> From: Peng He <hepeng.0320@bytedance.com>
>>
>> async_append stores log_fd, it should be destructed before log_fd
>> is closed.
>>
>> Signed-off-by: Peng He <hepeng.0320@bytedance.com>
> 
> Acked-by: Simon Horman <horms@ovn.org>
> 

Applied to main and backported down to 2.17.

Thanks!

Best regards, Ilya Maximets.
diff mbox series

Patch

diff --git a/lib/vlog.c b/lib/vlog.c
index e78c785f7..59b524b09 100644
--- a/lib/vlog.c
+++ b/lib/vlog.c
@@ -411,10 +411,10 @@  vlog_set_log_file__(char *new_log_file_name)
 
     /* Close old log file, if any. */
     ovs_mutex_lock(&log_file_mutex);
+    async_append_destroy(log_writer);
     if (log_fd >= 0) {
         close(log_fd);
     }
-    async_append_destroy(log_writer);
     free(log_file_name);
 
     /* Install new log file. */