From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qt1-f174.google.com (mail-qt1-f174.google.com [209.85.160.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 390EA40DFC9 for ; Mon, 18 May 2026 12:40:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.174 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779108037; cv=none; b=OptK83jvO1VgM6WLwvdYJxfNLCll0lMAaE7KoJbdCw06JBo6jCIaeKghmCYu7yKcVZcR/zdG/gjzRz5zZN4X8wpW7qK1DjU2BIAehVYOn6CnMObhAcksZBJkGMnIBTWsDkDD70jKPNZ8Xa+PwRJiHKU73Thsg5v3c02Yia2cDrU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779108037; c=relaxed/simple; bh=Fcger998KmiM5M3zfbPZJbW9Kx+LwemmFdwhPnDUlkE=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=RlAP1kL70AIbFHVuufXGScd17Djq+H05+HUqZpMTE08CjW0HEmTC0QIfU5Vkkw7T7cWBsI4JQHgXJvQwkBG6+MLLDpzg4gdwF3mgLzlPyEo2WdYXxEjx7wwHAlAE0SRdxxDnq/GWQ6ibp8ayJfKdPVw36rd116UGRCggKu+7f+U= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=soleen.com; spf=pass smtp.mailfrom=soleen.com; dkim=pass (2048-bit key) header.d=soleen.com header.i=@soleen.com header.b=b8lAJ7gH; arc=none smtp.client-ip=209.85.160.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=soleen.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=soleen.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=soleen.com header.i=@soleen.com header.b="b8lAJ7gH" Received: by mail-qt1-f174.google.com with SMTP id d75a77b69052e-5164dafcf97so26637391cf.2 for ; Mon, 18 May 2026 05:40:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=soleen.com; s=google; t=1779108035; x=1779712835; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=HcUcaIPN/g+niFeOM76G8kvjbFhqNOUQJ3E0GM4bRDQ=; b=b8lAJ7gHe1MuorzdDtd8mz6SgZr1XHM9kHaPlsn11PiCUF1/GSkZe0t6AL6tV5NqQx Sk/sdj1cl0ALcYanrD2hWfFtEtdUdbKnaji41LUXDpyrgiaDTfYz+throem4U1YVZSdN kDYBkDMy+N2jJyqDNGcQSADmNnUaftYuMPA/0H6eYicy9mmDgO9APSxvFlLOJ1m5aMec 6OldtLhg/mNNr6Q0uQo43ybqRqNJ4+TZx7UbnM4VtBC1d7u3s5PletsHvAPDEtNJzdwh kMpmRC5u+ooELVXtoJKuQtyV7Lhiv6h0hbH6IoukEi0oHL2Cm9ogGOp7nX1DbPIISy9S POog== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779108035; x=1779712835; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=HcUcaIPN/g+niFeOM76G8kvjbFhqNOUQJ3E0GM4bRDQ=; b=GETvI8u0RtmKRmc6pVDc0CnaZ+5XJg2OFqLbLbf2vyfLizmWBuIaO3GPSmfHpRcwKc nUmjSr1SxoOkqS2lA+cNtj4450Jhw25P9V0dYTsUBx8O7PTrsyTFMLRdPMtqkY8Kz8yS KLqkJWJiTeBEIWjzmv1FYGmPJodPL3f63X7pjdE9xElglCo+oi6A34qDzI5vC8wtp/bg 1HYd3ZYOf62eDOlVqF/qYjMNm7lC4cO75LfxhIXW6HHRLPKJHPOrPOLK7T7r/nDotKiD 7ZgNzG9hT56B001q5+Y0l9vmE6840oJtbJagEYQdAzolqHlGmz3hUaXBJDwj5YDc1k+G 5ZCw== X-Forwarded-Encrypted: i=1; AFNElJ+yUT2sMTM/oieaUc385m9dwego0PqTYg2fv0U9SlVJAKKyjQsFeOW8MWePTH0LGlEHxvT2+y4T6RWLoeQ=@vger.kernel.org X-Gm-Message-State: AOJu0Yw+eEGQzI9DjUV6wmsGp1/5WkRWozlE2L9lE9KfqWnzUacs6dJx RNy+YFeQAhCR2k6Jx/2sFWBfRp+seHkRQCRRr1Lzf0y7anX0jIx6TMVYirgUeHyNO5A= X-Gm-Gg: Acq92OG6e7zWefpF4cUkxozBR9qJWw0C5gMmTJB+tJzro3iKYVKkYBgAx3BdnYdIIDI lSsG+EwcT6yLjjq/8PM9J5U19Rs7186jlspbMccIryjWnr1rb1sTUQPzRckMlAKxGErQUtR7wlO AS7esWzXMfuhuM4y91Bae0Tqz8SeUxMoBse/PgfxqihBBMoxX1647qWz9nxtojuN4uVJprmuYm/ G2MSjqCT4C05aUIQEWM0fivhdP7pINjbKO6SutOWswwzpD7O0vpV3lApwJaxtnFFVf07nWrh/KN j1a1tgXnYwaq7c3PZ0KGj7PWnQHULNDg+LdVJ0ezOUONyJUQQVzuCevMcaxNWHRTaAYfjlhJArw yGtQARwKais6xiCeg+eodcSo/R4bGnus0KyjJ6t3MhvT96I3UVX+d0shN1xN0Y+Sieu1l3alJ4N KudZSaUq5a0GfTWyipB4G2rhQ99txmppm1n5odU2n/nZgL38EFW6Q= X-Received: by 2002:a05:622a:5a9b:b0:50f:d5c0:7f38 with SMTP id d75a77b69052e-5165a0ccb68mr197726121cf.34.1779108034984; Mon, 18 May 2026 05:40:34 -0700 (PDT) Received: from plex ([71.181.43.54]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-51645688bd9sm129855651cf.6.2026.05.18.05.40.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 May 2026 05:40:34 -0700 (PDT) Date: Mon, 18 May 2026 12:40:33 +0000 From: Pasha Tatashin To: Mike Rapoport Cc: Pasha Tatashin , 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: On 05-18 11:40, Mike Rapoport wrote: > 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() Done. Thank you for review. Pasha > > > - 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.