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 812AD3C5540 for ; Mon, 18 May 2026 08:40:17 +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=1779093617; cv=none; b=RO96glHbCif9+u+aeXwhQs9OOk/VndTl7NbLpw5Egzmw0udxRN3MOktkbKpPLq/GJLI5XhpSBalywwrkTILtR3F/9JdThplbVsks6RJBQnHlGZHPDGWtfLdrDKAeZKvQmtkIoG8j+2g1AlerYPcY9WiYS9nSOawYRAbgpzEnQYA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779093617; c=relaxed/simple; bh=em2YNNKzh+qd+JnX5KScyjFt+cTn9m/viRNbzTHO3e0=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=LVKYp/rLakkDct6MVLrZEYzBxeMreSGwrJAaG43vnkScAZroTyYWOfAcXjX8XLR9clpBz1yfqK66Ev9GCZZcDvFnFT46BG2sum3EmnW8OUtupQa8HmD9z9MCLJD3XulkUafLKi2H6AIEMD84y0VwC9pTiGFnhQ7oMuvfEKoztvs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=kjwE1D9H; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="kjwE1D9H" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 43080C2BCF5; Mon, 18 May 2026 08:40:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1779093617; bh=em2YNNKzh+qd+JnX5KScyjFt+cTn9m/viRNbzTHO3e0=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=kjwE1D9H0PsOXihBotrkvLZSSYUSvqty0q6+lnA7F0RlbDn74gA08plwiqxadnJLA KyzE4NxF9dwWdxmHZTQWr/PQGu6HqbXqFuRFzNYCsRnVLX4tJgOfvQbnIfOpsTYdhf r1iEPUIQ+RW3Hs0Cq6xwuRNTbyoMlTKPktrFJT9idse5DYkyFC/Y9gYQmsPAPvE+qJ 2PeTGPs1ABg/JZYjHS9czpYj8Y7VdSc1Bu14ka9H5F+BJNnNwxmlfX2JrdLtcBuFNW MbGR4JSfb+x8tDB0+HfqdE/XH+wg0WgrppetlAtgXXjJIPrNYCB4WK2idXH/X0/hKi LbaKzR1iIWmCw== Date: Mon, 18 May 2026 11:40:08 +0300 From: Mike Rapoport To: Pasha Tatashin Cc: sourabhjain@linux.ibm.com, jbouron@amazon.com, akpm@linux-foundation.org, bhe@redhat.com, linux-kernel@vger.kernel.org, dan.carpenter@linaro.org, liaoyuanhong@vivo.com, rafael.j.wysocki@intel.com, piliu@redhat.com, kexec@lists.infradead.org, pratyush@kernel.org, skhawaja@google.com, graf@amazon.com, mario.limonciello@amd.com Subject: Re: [PATCH v4 3/5] liveupdate: block session mutations during reboot Message-ID: References: <20260517192650.1019314-1-pasha.tatashin@soleen.com> <20260517192650.1019314-4-pasha.tatashin@soleen.com> 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-Disposition: inline In-Reply-To: <20260517192650.1019314-4-pasha.tatashin@soleen.com> On Sun, May 17, 2026 at 07:26:48PM +0000, Pasha Tatashin wrote: > During the reboot() syscall, user processes may still be running > concurrently and attempting to mutate sessions (e.g., creating, > retrieving, or releasing sessions). To prevent this, introduce > luo_session_serialize_rwsem to synchronize mutations with the > serialization process. > > All session mutation operations (create, retrieve, release, ioctl) take > the read lock. The serialization process (luo_session_serialize) takes > the write lock and holds it indefinitely on success. This effectively > freezes the LUO session subsystem during the transition to the new > kernel. If serialization fails, the lock is released to allow recovery. > > Fixes: 0153094d03df ("liveupdate: luo_session: add sessions support") > Reported-by: Oskar Gerlicz Kowalczuk > Signed-off-by: Pasha Tatashin > --- > kernel/liveupdate/luo_session.c | 27 ++++++++++++++++++++++++--- > 1 file changed, 24 insertions(+), 3 deletions(-) > > diff --git a/kernel/liveupdate/luo_session.c b/kernel/liveupdate/luo_session.c > index 59b37d17db6b..6099213275d8 100644 > --- a/kernel/liveupdate/luo_session.c > +++ b/kernel/liveupdate/luo_session.c > @@ -385,9 +394,12 @@ int luo_session_create(const char *name, struct file **filep) > struct luo_session *session; > int err; > > + down_read(&luo_session_serialize_rwsem); > session = luo_session_alloc(name); We can alloc outside the lock, will make error handling simpler. sashiko complains about mixing down_read() with scoped_guard(), for this function it would make sense to use plain mutex_{lock,unlock} around luo_session_getfile() > - if (IS_ERR(session)) > - return PTR_ERR(session); > + if (IS_ERR(session)) { > + err = PTR_ERR(session); > + goto err_unlock; > + } > > err = luo_session_insert(&luo_session_global.outgoing, session); > if (err) > @@ -398,12 +410,16 @@ int luo_session_create(const char *name, struct file **filep) > if (err) > goto err_remove; > > + up_read(&luo_session_serialize_rwsem); > + > return 0; > > err_remove: > luo_session_remove(&luo_session_global.outgoing, session); > err_free: > luo_session_free(session); > +err_unlock: > + up_read(&luo_session_serialize_rwsem); > > return err; > } -- Sincerely yours, Mike.