Re: [PATCH V2 4/9] fork: add option to not clone or dup files

From: Christian Brauner
Date: Wed Sep 22 2021 - 08:46:41 EST


On Tue, Sep 21, 2021 at 04:52:13PM -0500, Mike Christie wrote:
> Each vhost device gets a thread that is used to perform IO and management
> operations. Instead of a thread that is accessing a device, the thread is
> part of the device, so when it calls the kernel_worker() function added in
> the next patch we can't dup or clone the parent's files/FDS because it would
> do an extra increment on ourself.
>
> Later, when we do:
>
> Qemu process exits:
> do_exit -> exit_files -> put_files_struct -> close_files
>
> we would leak the device's resources because of that extra refcount
> on the fd or file_struct.
>
> This patch adds a no_files option so these worker threads can prevent
> taking an extra refcount on themselves.
>
> Signed-off-by: Mike Christie <michael.christie@xxxxxxxxxx>

Ok,
Acked-by: Christian Brauner <christian.brauner@xxxxxxxxxx>