Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp443071pxb; Wed, 22 Sep 2021 05:48:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwZ5fTvQ+wpm7ZIVTKoizZ05wwdXwHA+zxDrN2y8pSkbx/pih9s3LM9SRrER0bT8mmRmaHM X-Received: by 2002:a17:906:3157:: with SMTP id e23mr41661938eje.29.1632314902430; Wed, 22 Sep 2021 05:48:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632314902; cv=none; d=google.com; s=arc-20160816; b=f2WUNK07McF0YpT1vLn7IAK9J0ND1/LjA9VYcEOeoPxEvfzHvvj3PDEMOkkeKR2RYm cUoJ9rzw160lEIOxGFftdKh6ahJELjdKxcTWsIjNybWHevo+U3DewH6X+kXFYinUPQnL lKixStNJZHoQjwOrMjLvcS9/MFWEAq+QpSmtyKSeQmwkab1ZHm5FcqxQ2yne7XSqwsy0 VTzYz7+jjcDe29s5JaLO5WEPOFCXPkekWwNC1poPvNCGsPkzh7W8uK1N5PfZdQ/uxUzP vG52UQKCWb3Ij2g6astBS65ssk2GmLiGCWbxlIDLGfrxKgUX+HiOKGR/VciV9YdzdQ1l MN0g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=X5FPjv50CQe7LY9hs01hFGG0AzrLladPLVPj0VhpdlY=; b=tyWab796epUktFvIq9dvswU6qjmg2A7uoRPHszda7WPEozy20NIFLyqrCWGJ1zOgq1 sdupcXwk3rtHZ9bNBGnf/zBtkVMcDNBDCZF1QGpp9/jrrBXoWbmcPbGL81+oxuZA7Kjy ZutCIfqbKeehsey7uPCF/uoHRxiK1oQcD0ya9JBx719b8CP/QS3hNptBTcSnHii8OtAp vq5P6R1v9Jc8N2mQYlWbF53SI6YCfFWUivOtgEQP61eUSCdy00m8+R/EHeAYUEjEdn6c vWuy9f/XMZDumO/ZiHMaHsz6Nzdlsjo8LbEM93rHJZST98ewsc9rtg47q8srHZqLaaRg RFkQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g19si2551579ejm.44.2021.09.22.05.47.57; Wed, 22 Sep 2021 05:48:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236021AbhIVMsJ (ORCPT + 99 others); Wed, 22 Sep 2021 08:48:09 -0400 Received: from mail.kernel.org ([198.145.29.99]:50826 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235227AbhIVMsI (ORCPT ); Wed, 22 Sep 2021 08:48:08 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 5732660F13; Wed, 22 Sep 2021 12:46:36 +0000 (UTC) Date: Wed, 22 Sep 2021 14:46:34 +0200 From: Christian Brauner To: Mike Christie Cc: hdanton@sina.com, hch@infradead.org, stefanha@redhat.com, jasowang@redhat.com, mst@redhat.com, sgarzare@redhat.com, virtualization@lists.linux-foundation.org, axboe@kernel.dk, linux-kernel@vger.kernel.org Subject: Re: [PATCH V2 4/9] fork: add option to not clone or dup files Message-ID: <20210922124634.zodjcbvksdkhjrym@wittgenstein> References: <20210921215218.89844-1-michael.christie@oracle.com> <20210921215218.89844-5-michael.christie@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20210921215218.89844-5-michael.christie@oracle.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 Ok, Acked-by: Christian Brauner