From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 448CB34028D for ; Fri, 27 Mar 2026 17:14:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774631694; cv=none; b=rHsg/g9j3OtwiznAo6AYL23Pa8713HwXqEHLy15m2q1FNfT4hRUKgN5rMpxAknn3hgydpfcNrfuJnM7mGwncGqOnlhuZ1hFoQy7jxXT5qN27+58s32L39tRWNueVN2qcOEpDRfdMSO/URd0w7dnIeoQGqhLkXuKKdYhZi+L/yD4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774631694; c=relaxed/simple; bh=Svg7iepPXn0m1m7+3rVpJxfIlKO/FRjQeoIGNYLvQnM=; h=Date:From:To:Cc:Subject:Message-Id:In-Reply-To:References: Mime-Version:Content-Type; b=P51SvpEo5Mvg4iiFu3+bR9da5Jc7MTFCAczPOgiO/aDtRq254yPSHF/E+DCmsQHWNRxa8x/Os4TP1cJuvcNZUArQlCSORfuJbOqu25pPlq34WweIYMsL57AQ/msq3hQmbRlpedPmx1tcviTVartcD311c0lpeEHHEQfI7XPSols= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b=vE8oNNh3; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b="vE8oNNh3" Received: by smtp.kernel.org (Postfix) with ESMTPSA id AB704C2BC9E; Fri, 27 Mar 2026 17:14:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1774631693; bh=Svg7iepPXn0m1m7+3rVpJxfIlKO/FRjQeoIGNYLvQnM=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=vE8oNNh3iB8xYd1eepih/lmZ4QquBz9eEAkAUIl/YXkJmmDpw1AozOYgh1w3uoCdd QsjKJbpSTEgGWF5ughy2EZBsEtrGlkpACtXK6uU5eoR9nXA1XcqUCabVfrmhZ6UBE7 gWW1kaUaG63jUK3JpVQBlPF6w2+rCLfNmPCS9igU= Date: Fri, 27 Mar 2026 10:14:53 -0700 From: Andrew Morton To: Pasha Tatashin Cc: rppt@kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, dmatlack@google.com, pratyush@kernel.org, skhawaja@google.com Subject: Re: [PATCH v3 10/10] liveupdate: Defer file handler module refcounting to active sessions Message-Id: <20260327101453.dc4961b803cf74d43d477dfd@linux-foundation.org> In-Reply-To: <20260327033335.696621-11-pasha.tatashin@soleen.com> References: <20260327033335.696621-1-pasha.tatashin@soleen.com> <20260327033335.696621-11-pasha.tatashin@soleen.com> X-Mailer: Sylpheed 3.8.0beta1 (GTK+ 2.24.33; x86_64-pc-linux-gnu) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Fri, 27 Mar 2026 03:33:34 +0000 Pasha Tatashin wrote: > Stop pinning modules indefinitely upon file handler registration. > Instead, dynamically increment the module reference count only when a > live update session actively uses the file handler (e.g., during > preservation or deserialization), and release it when the session ends. > > This allows modules providing live update handlers to be gracefully > unloaded when no live update is in progress. > > ... > > @@ -322,6 +323,8 @@ int luo_preserve_file(struct luo_file_set *file_set, u64 token, int fd) > kfree(luo_file); > err_flb_unpreserve: > luo_flb_file_unpreserve(fh); > +err_module_put: > + module_put(fh->ops->owner); > err_free_files_mem: > luo_free_files_mem(file_set); > err_fput: This didn't anticipate your "liveupdate: prevent double management of files". I resolved it thusly: err_kfree: kfree(luo_file); err_flb_unpreserve: luo_flb_file_unpreserve(fh); err_erase_xa: xa_erase(&luo_preserved_files, luo_get_id(fh, file)); err_module_put: module_put(fh->ops->owner); err_free_files_mem: luo_free_files_mem(file_set); err_fput: fput(file); return err; }