linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Pasha Tatashin <pasha.tatashin@soleen.com>
To: Samiullah Khawaja <skhawaja@google.com>
Cc: rppt@kernel.org, akpm@linux-foundation.org, linux-mm@kvack.org,
	 linux-kernel@vger.kernel.org, dmatlack@google.com,
	pratyush@kernel.org
Subject: Re: [PATCH v2 2/8] liveupdate: Protect FLB lists with rwsem
Date: Thu, 19 Mar 2026 21:04:20 -0400	[thread overview]
Message-ID: <CA+CK2bDONAnry0n9qOsR7GSDTw4Xw3g4ZugRPwXD+NdMx7rpsQ@mail.gmail.com> (raw)
In-Reply-To: <abyQJ_9xDg6GrU4X@google.com>

> >@@ -355,6 +363,9 @@ int liveupdate_register_flb(struct liveupdate_file_handler *fh,
> >       if (!luo_session_quiesce())
> >               return -EBUSY;
> >
> >+      guard(rwsem_write)(&luo_flb_lock);
> >+      guard(rwsem_write)(&ACCESS_PRIVATE(fh, flb_lock));
>
> Since FLBs are linked with file handlers and the file_handler can be
> unregistered/registered while this is running, should the luo_file_lock
> write be taken here? I think maybe we don't need a separate luo_flb_lock

Hi Sami,

Yes, thank you for catching this. I thought we were safe since we are
taking fh->flb_lock, but you are correct. I am going to do what you
suggested below and use a single luo_registration_lock for both FLB
and File Handler registrations. Reads will also be shared; this will
simplify locking.

Pasha

> and the luo_file_lock should provide enough protection if we acquire it
> here, as a file_handler is supposed to be registered first and then flb
> needs to be registered against it?
>
> Maybe we can have one luo_register_lock?
> >+
> >       /* Check that this FLB is not already linked to this file handler */
> >       err = -EEXIST;
> >       list_for_each_entry(iter, flb_list, list) {
> >@@ -444,6 +455,9 @@ int liveupdate_unregister_flb(struct liveupdate_file_handler *fh,
> >       if (!luo_session_quiesce())
> >               return -EBUSY;
> >
> >+      guard(rwsem_write)(&luo_flb_lock);
> >+      guard(rwsem_write)(&ACCESS_PRIVATE(fh, flb_lock));
> >+
> >       /* Find and remove the link from the file handler's list */
> >       list_for_each_entry(iter, flb_list, list) {
> >               if (iter->flb == flb) {
> >@@ -638,6 +652,8 @@ void luo_flb_serialize(void)
> >       struct liveupdate_flb *gflb;
> >       int i = 0;
> >
> >+      guard(rwsem_read)(&luo_flb_lock);
> >+
> >       list_private_for_each_entry(gflb, &luo_flb_global.list, private.list) {
> >               struct luo_flb_private *private = luo_flb_get_private(gflb);
> >
> >--
> >2.53.0.851.ga537e3e6e9-goog
> >
> >


  reply	other threads:[~2026-03-20  1:05 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-18 14:16 [PATCH v2 0/8] liveupdate: Fix module unloading and unregister API Pasha Tatashin
2026-03-18 14:16 ` [PATCH v2 1/8] liveupdate: Protect file handler list with rwsem Pasha Tatashin
2026-03-22 13:13   ` Mike Rapoport
2026-03-22 14:23     ` Pasha Tatashin
2026-03-18 14:16 ` [PATCH v2 2/8] liveupdate: Protect FLB lists " Pasha Tatashin
2026-03-20  0:21   ` Samiullah Khawaja
2026-03-20  1:04     ` Pasha Tatashin [this message]
2026-03-18 14:16 ` [PATCH v2 3/8] liveupdate: Remove file handler module refcounting Pasha Tatashin
2026-03-24 21:15   ` David Matlack
2026-03-24 21:23   ` David Matlack
2026-03-25  2:49     ` Pasha Tatashin
2026-03-25 13:14       ` David Matlack
2026-03-25 13:43         ` Pasha Tatashin
2026-03-18 14:16 ` [PATCH v2 4/8] liveupdate: Defer FLB module refcounting to active sessions Pasha Tatashin
2026-03-18 14:16 ` [PATCH v2 5/8] liveupdate: Remove luo_session_quiesce() Pasha Tatashin
2026-03-18 14:16 ` [PATCH v2 6/8] liveupdate: Auto unregister FLBs on file handler unregistration Pasha Tatashin
2026-03-18 14:16 ` [PATCH v2 7/8] liveupdate: Remove liveupdate_test_unregister() Pasha Tatashin
2026-03-18 14:16 ` [PATCH v2 8/8] liveupdate: Make unregister functions return void Pasha Tatashin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CA+CK2bDONAnry0n9qOsR7GSDTw4Xw3g4ZugRPwXD+NdMx7rpsQ@mail.gmail.com \
    --to=pasha.tatashin@soleen.com \
    --cc=akpm@linux-foundation.org \
    --cc=dmatlack@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=pratyush@kernel.org \
    --cc=rppt@kernel.org \
    --cc=skhawaja@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox