From nobody Mon Apr 6 18:24:24 2026 Received: from mail-yx1-f44.google.com (mail-yx1-f44.google.com [74.125.224.44]) (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 4AC253DA7F8 for ; Wed, 18 Mar 2026 14:16:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.224.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773843419; cv=none; b=hEawPnDmXQ+EmQUiGXp3rqXrQ7jZ+dFuyiVI4KCjW9hjc7p1u/dmIbkRLLWuAIZmXJQr3bvtnjNsztgbI8nCbmhcjHY1nfLtzrlgT9fT9ucrDqTQUInU4h6cucYabWlnsbWlHDQzUiiwOpE2uoRDASEm6EKafFkc3hmJGd0nGqk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773843419; c=relaxed/simple; bh=y4zQEtLWwPUjJBuJnMG9ipPgnd1TGVtuadyV/PXw3kM=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=lcIixop9xYC7ReoNsoVE2/fqrOorzbDR5x0MEg5y4IbAe8gZ+npb2/BLxwQYkcoGYsgE/sIthMYtQpDBa+Bjq1fhTKueWOOQhHvvFdOby6mc4E2IwX92O+U9Vtr60ew4ytDmqngo5Dkjj4k8S9DvwvHv0ZAwlUH/300kJvGQaU8= 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=BlvtI83w; arc=none smtp.client-ip=74.125.224.44 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="BlvtI83w" Received: by mail-yx1-f44.google.com with SMTP id 956f58d0204a3-64c9ebd1369so6912422d50.1 for ; Wed, 18 Mar 2026 07:16:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=soleen.com; s=google; t=1773843417; x=1774448217; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=4+V1BCFfyUcKpfQV+w/+N7aUNd6NuLnsp5FVuX7GX7E=; b=BlvtI83w9ofBpmXXOd+n/BIf720L90BhY8ewwJIT0gb1j6k+lMuLlLE9A6VUsMAVCi CIocKR5sK2UxuATBYbEMTuduEp9y0Z/R8xMgI50nzZr49zniVl9T5BdE1YP4ZoeUjMdy 2dC92slg5HFOAGOfDGZBr2LDOHPAiGKcnjJ7iCHa6DMRg/JDuy0FhQquzo0JeTo6ijs2 h4tdbTVSnWxfxXSdyzQjyGAvDvGhHEfNHYQHpR0Tuzu1gZl57z5rz+kd3GUQAiGcT42h EGW07/4wREa/V/JTgP5zwtkFff1+HgSLRoYXIQ6th2RwO0LUFcXR/N+GvLxyFALmt9ED R2mQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1773843417; x=1774448217; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=4+V1BCFfyUcKpfQV+w/+N7aUNd6NuLnsp5FVuX7GX7E=; b=QgzOKjy3hEmq/Una/1GjsdLKlqX7cTuKmWY3Z8LglMN0UBwd23DrvavtLclrYsqoIr OnoaEQ45GddBQQEf9Tx/+HnA7kXgAc79/W3MCFl8nM7lojwQkBhhICv4whWwJrEABvfP zxFa4/p15LL1Eisu2KoLdkmkklQv3kP18ym0lOfBZRtbR+yueAfwOZuSkGW8P2VkauX5 XmPrOXreOS0rUPH5X+gLQxxheiBd/8kueOyUVwO5TNJrJYARnBobC/NiU7IGcM7Wn5ZG rNGhA6mHiMrIiT5qZ1EZ7kD3/s/AkyBIGdrC9DWd5mQxdpxf1yLp0vwSJjKoja4IRQtQ PilQ== X-Forwarded-Encrypted: i=1; AJvYcCXjWPapvA4n4w9qsAYQ4ODTHpkA3quzjS7tuS8laQuLEKWOhZXTB5aslrgtd2GMBBHa1YPDfcSockEGJQY=@vger.kernel.org X-Gm-Message-State: AOJu0Ywn0xgjCx03huGR5hroN+AIryscZ8Gn5gENtxUCBltypbLzn+D7 yw5GBjQpOd92Imz4/L0iwUl7DsGrtJQX9HKoYW7GVlBAId4LZp8LhshQUCCtXUtFWx0= X-Gm-Gg: ATEYQzwVZ35lswX+7xEvRw7xxUWwBrrOiYXWgCwJ9B41ZGoaGfG33VrFyyJi0v2mWl4 MIpmxuaeYChEcv3mJLue3LCw9xILpkH9vJbBuY9kFNMAAHPkeFSnFtV2dpzrUC0AtvL8ykayqLF 433zuAx2yQ8vSoIkXx7pVajKWri171KAiiFpBmENwV38+pThNabNACwbo25JjhsZcBwowZreL8H 8oF+Jo2hnlamlz5KjGmRHBEZ1Ra+BbbLgOLv4LrSrfhHTmtoCKJFiT/ImoWS1k9i+OuhukHFMQZ ENjwbdkFk5cXp2IMTVLEi5Sr0PUqQMhTf8ZF4jKVun6KDSs5nYyeogKOBgwR20XnNyERXvSpi1+ ygOl3uDfoTJVXlM29JvajoQ4+bXqJh5UbUwPk7f1KFDkqHMNTL9jjye5zZJlnoW34tVj/21ViUR s1nrXXgK5WgnQwVpHcN9LVLOJQ822cBT1nyJFysBI+TJsiYC1/Qq3bcue2RfQ6Fs0BIfeW91SOW 1vYBNS8p0FB51FnfKTX8ZarBq9g6AvfHHOu63SrwcCdyT7Izg== X-Received: by 2002:a05:690e:b49:b0:64a:d6b4:1e90 with SMTP id 956f58d0204a3-64e9184fe10mr3640996d50.79.1773843417014; Wed, 18 Mar 2026 07:16:57 -0700 (PDT) Received: from soleen.c.googlers.com.com (57.233.150.34.bc.googleusercontent.com. [34.150.233.57]) by smtp.gmail.com with ESMTPSA id 956f58d0204a3-64e91be0e91sm1672028d50.15.2026.03.18.07.16.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Mar 2026 07:16:56 -0700 (PDT) From: Pasha Tatashin To: rppt@kernel.org, akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, pasha.tatashin@soleen.com, dmatlack@google.com, pratyush@kernel.org Subject: [PATCH v2 1/8] liveupdate: Protect file handler list with rwsem Date: Wed, 18 Mar 2026 10:16:39 -0400 Message-ID: <20260318141637.1870220-11-pasha.tatashin@soleen.com> X-Mailer: git-send-email 2.53.0.851.ga537e3e6e9-goog In-Reply-To: <20260318141637.1870220-10-pasha.tatashin@soleen.com> References: <20260318141637.1870220-10-pasha.tatashin@soleen.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=3964; i=pasha.tatashin@soleen.com; h=from:subject; bh=y4zQEtLWwPUjJBuJnMG9ipPgnd1TGVtuadyV/PXw3kM=; b=owEBbQKS/ZANAwAKAbt3KEzbc3reAcsmYgBpurPHexu5NubYp4ky/9rJqctDslv7e0bZpiVBP geJyNZcDy+JAjMEAAEKAB0WIQRBMaqT7LRvGvB/NmK7dyhM23N63gUCabqzxwAKCRC7dyhM23N6 3ncQEACgbfKyhS2517kV+J7FpHssgHj7Rygm8NrV8N5J7SOsbyW+HRGFXlgKDnhQDtPBudPIBVZ OE9cMlTY9fosxPgbImZkFWE+vlmF+QqifXjZefrELyzf3tCUSjtjtZekaG0bnMYhV9C+hrY6Nzx sW8PqqvojO/K9gv2VwiRxxQeOAKIszRGmN5LTSspgWzuF5naOjpcmm1rCxOF+JiAIFV/hwoiTuU gjjmBJ5g399kqOVojt7HYwJNfaGZWNr2sN+4M2kGj96qrHywiiqMmrrSGGFGxF35IBS3Ig1adwv x/pSGDuIuMbRIRzKFG9dUrkH5zRZ996/ity7qUWlvMV2NwbLksAhBk2HHwNaRc8M7MMajozxXcu TTtlRs6NW32cyUeFto+jL2cvy/QTqsMLhdI5AlXfeeGg841aS/RkXrqzv6I2GfuC0Tye58sBqSq 0sD9FO8rjs2BFk3/vvHC+eW9Sp+4cHdKUmzWZbMdNVm/lsxr1IORJ+KX1Uze1bUZygyw/fwxVlJ PPtA91LH8LHevlsl788x/UwHy333pjf5Gnsh+e65Zo32G+JgZRu07M13ezaKwedNnUbc3UBbrSK 2Oa63/ineiN0LroMqW6BzWWaBs3OpxlfVE3q0s/El8aZZ/IFvsehoYInkOCYPVGqy4DjaxpgxNI L++MONdyV7GQ6+g== X-Developer-Key: i=pasha.tatashin@soleen.com; a=openpgp; fpr=CAAAB722DD22A081F0D49F35633A6A993D43B569 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Because liveupdate file handlers will no longer hold a module reference when registered, we must ensure that the access to the handler list is protected against concurrent module unloading. Signed-off-by: Pasha Tatashin --- kernel/liveupdate/luo_file.c | 61 +++++++++++++++++++++--------------- 1 file changed, 35 insertions(+), 26 deletions(-) diff --git a/kernel/liveupdate/luo_file.c b/kernel/liveupdate/luo_file.c index 5acee4174bf0..6a0ae29c6a24 100644 --- a/kernel/liveupdate/luo_file.c +++ b/kernel/liveupdate/luo_file.c @@ -112,6 +112,7 @@ #include #include "luo_internal.h" =20 +static DECLARE_RWSEM(luo_file_handler_lock); static LIST_HEAD(luo_file_handler_list); =20 /* 2 4K pages, give space for 128 files per file_set */ @@ -277,10 +278,12 @@ int luo_preserve_file(struct luo_file_set *file_set, = u64 token, int fd) goto err_fput; =20 err =3D -ENOENT; - list_private_for_each_entry(fh, &luo_file_handler_list, list) { - if (fh->ops->can_preserve(fh, file)) { - err =3D 0; - break; + scoped_guard(rwsem_read, &luo_file_handler_lock) { + list_private_for_each_entry(fh, &luo_file_handler_list, list) { + if (fh->ops->can_preserve(fh, file)) { + err =3D 0; + break; + } } } =20 @@ -777,10 +780,12 @@ int luo_file_deserialize(struct luo_file_set *file_se= t, bool handler_found =3D false; struct luo_file *luo_file; =20 - list_private_for_each_entry(fh, &luo_file_handler_list, list) { - if (!strcmp(fh->compatible, file_ser[i].compatible)) { - handler_found =3D true; - break; + scoped_guard(rwsem_read, &luo_file_handler_lock) { + list_private_for_each_entry(fh, &luo_file_handler_list, list) { + if (!strcmp(fh->compatible, file_ser[i].compatible)) { + handler_found =3D true; + break; + } } } =20 @@ -850,25 +855,27 @@ int liveupdate_register_file_handler(struct liveupdat= e_file_handler *fh) if (!luo_session_quiesce()) return -EBUSY; =20 - /* Check for duplicate compatible strings */ - list_private_for_each_entry(fh_iter, &luo_file_handler_list, list) { - if (!strcmp(fh_iter->compatible, fh->compatible)) { - pr_err("File handler registration failed: Compatible string '%s' alread= y registered.\n", - fh->compatible); - err =3D -EEXIST; + scoped_guard(rwsem_write, &luo_file_handler_lock) { + /* Check for duplicate compatible strings */ + list_private_for_each_entry(fh_iter, &luo_file_handler_list, list) { + if (!strcmp(fh_iter->compatible, fh->compatible)) { + pr_err("File handler registration failed: Compatible string '%s' alrea= dy registered.\n", + fh->compatible); + err =3D -EEXIST; + goto err_resume; + } + } + + /* Pin the module implementing the handler */ + if (!try_module_get(fh->ops->owner)) { + err =3D -EAGAIN; goto err_resume; } - } =20 - /* Pin the module implementing the handler */ - if (!try_module_get(fh->ops->owner)) { - err =3D -EAGAIN; - goto err_resume; + INIT_LIST_HEAD(&ACCESS_PRIVATE(fh, flb_list)); + INIT_LIST_HEAD(&ACCESS_PRIVATE(fh, list)); + list_add_tail(&ACCESS_PRIVATE(fh, list), &luo_file_handler_list); } - - INIT_LIST_HEAD(&ACCESS_PRIVATE(fh, flb_list)); - INIT_LIST_HEAD(&ACCESS_PRIVATE(fh, list)); - list_add_tail(&ACCESS_PRIVATE(fh, list), &luo_file_handler_list); luo_session_resume(); =20 liveupdate_test_register(fh); @@ -909,10 +916,12 @@ int liveupdate_unregister_file_handler(struct liveupd= ate_file_handler *fh) if (!luo_session_quiesce()) goto err_register; =20 - if (!list_empty(&ACCESS_PRIVATE(fh, flb_list))) - goto err_resume; + scoped_guard(rwsem_write, &luo_file_handler_lock) { + if (!list_empty(&ACCESS_PRIVATE(fh, flb_list))) + goto err_resume; =20 - list_del(&ACCESS_PRIVATE(fh, list)); + list_del(&ACCESS_PRIVATE(fh, list)); + } module_put(fh->ops->owner); luo_session_resume(); =20 --=20 2.53.0.851.ga537e3e6e9-goog From nobody Mon Apr 6 18:24:24 2026 Received: from mail-yx1-f47.google.com (mail-yx1-f47.google.com [74.125.224.47]) (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 2DC603DB626 for ; Wed, 18 Mar 2026 14:16:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.224.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773843420; cv=none; b=ZkRNK4G7jQZ9o3p8DqiaJXAzN6U0L+Dze8Dp8eoZKIyTX3oCyaJUDVfseAC34+1DxzhkGDb7swUFt7MKfuM7b7uCugwHZhaj0+k8up/dKr+3qetmzRBLi5t3dLggzgLKjncfCjIQ5VXXqmEsAINwN2mWOpC7gL3xcNYdhMoU7wE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773843420; c=relaxed/simple; bh=dkjsJaF9zS233/cIv2JZuqCsRBtr9t9nThiFjC9QTdU=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=PO0UfYaySHs522OFORyl62OyETbEzQD6oy/tLxbSdfRgynvlj1/Gx6wfWKInQni7bg3EyaOdKOVsNjGmxn27GtVMb8NO5tThvppo/6wXeO9TBY/b99lrzxdHdV8HCBJYCk8o+IA+tQGLmV0Oj9JhR/cau6i1qU6cizjvya6rGio= 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=c7f7JMoe; arc=none smtp.client-ip=74.125.224.47 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="c7f7JMoe" Received: by mail-yx1-f47.google.com with SMTP id 956f58d0204a3-64ad9fabd08so7932045d50.2 for ; Wed, 18 Mar 2026 07:16:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=soleen.com; s=google; t=1773843418; x=1774448218; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=iae6YsWSZF4NEuA9NS1+GhS3bfxbm2onYFzq2DhQW14=; b=c7f7JMoeSF4gMOpDsZkwZvkfC3K1rxgrEoMyNgpu+TMHwO69XFkrfEIhl/dSpA0cJx 344BpZrfTLk9eUXTDQlHO/his+HWqh82sKwvhZvNujt+uGQgYN8pQ5y5fyn3Bu6quyzQ 5FAKTalgPpybAs1ag/7w5g1x0rpfCIQ8bT1X2DVtt584MvwL2B0q4YP6y6fzEUTyPgLL QUnDbLxjGKaHixc3fe5AwzQR1HifOr1xXSg7c/U9Ipw0d9r3SGjxwgmx/LYw+n2Xc/YR +z/qSOMTEw7CLodgvENwAMDwO/BfFae8mjb57sTBEQVRQwA0szBhbOcrgjMCjAKJLIir bbqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1773843418; x=1774448218; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=iae6YsWSZF4NEuA9NS1+GhS3bfxbm2onYFzq2DhQW14=; b=mwoo65L/4Nc7ExhOYPLSy0CLUJ90svQDgBu+cIPbCyLAA8lQzTe8BrER97OojshndC y9Mb11GmSKMtVodMBv5Lvwh0ek+cey+TWh2RjF7w52patRQnkClMa7P/Lquwh39UvOKK eD7lR9sMRtSsJz3rqaE6l9CtEhfesQCaGPBLaHVm3fy5Q4MF/X5eBZetI6QTwqF4Hajt PXaPW0hQa0IKIO1FpRrJV0BIjv85xBxq0RwAktmHh85gFkaI8Sl2GcIr94Me3L3wAdmA Ml4LmcdNNwNE4YnTN+l3FlA5ONqUdCBRX9vncAmzSVI6hp6xTv85Xj7IO/Y6DnrrxZQM VE4Q== X-Forwarded-Encrypted: i=1; AJvYcCXBw+ixLepVv37kuZu7YIA+ooh3CcYzDEv4JVayP3qUWre3zkhtosCUN4VKU0s/MdeEls9ZEIbfh7IDiLU=@vger.kernel.org X-Gm-Message-State: AOJu0YxjavoPd5G4jDuUlU/ZcudFk9a6ZsS21cUGuGdTCdX0Xwy9nCz4 jRyWmnJ0eaYnci/xLPw/W/TcmeEpiGB5LU/JgziTThkOyoOf6IrH/MPzW9qBXrZ3EUj1zXiQ4w/ vZkm6 X-Gm-Gg: ATEYQzzZsS7JQvaN7I5nOtrUkcIP+V5FQjCRSw68CBR8yIL0X5jJEahaDNs08XbLe4v O63Rr+N/8kDkw8KCb+/MgdVvGEyQ+eI4xJnGRRMowUelGyth/CcsJjHn1AmevzGzI3P45hM/IV+ LRQroIQPPkMNMiwbtA+DJTZq55j6qJa/DkMWm92BzdN2eq+3rDaaMecdtHOMaUXb7KuRrrQPskh /TVs++aSeq9cjFATpwrKoMX6fZ3Wlo5/wyTyJMyB83zo6/Ow9704IfVR7C3tl7aNq3nh9DdzYM/ 96wYBfnWxwYHogpD+xKKBHnCLtvO63wlPsa6aaE50r50aut7qG2yvSikTICmi4p09xCGHGtmsQx xKsECJQq6bEGZj/Q063kTryLTuiWBnsarEajgsghK/E4eguV97AV/TuNPI0zJl5HDtJOt868H8+ 1Z5b/Mu0kW1rjK5nfZ0xK5hEhnFKAWjGIW4zQtZlkS7WORFFL/anqE8i7ISH6M2rqsQX6hFFGf8 tLDyrk28IAydDhUcrTiFOOyG4OKhxND2mQ3XvvB/HnkCSE3C2r65eQj1gbk X-Received: by 2002:a05:690e:1a03:b0:649:f272:4e71 with SMTP id 956f58d0204a3-64e915e9af0mr2899384d50.61.1773843417840; Wed, 18 Mar 2026 07:16:57 -0700 (PDT) Received: from soleen.c.googlers.com.com (57.233.150.34.bc.googleusercontent.com. [34.150.233.57]) by smtp.gmail.com with ESMTPSA id 956f58d0204a3-64e91be0e91sm1672028d50.15.2026.03.18.07.16.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Mar 2026 07:16:57 -0700 (PDT) From: Pasha Tatashin To: rppt@kernel.org, akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, pasha.tatashin@soleen.com, dmatlack@google.com, pratyush@kernel.org Subject: [PATCH v2 2/8] liveupdate: Protect FLB lists with rwsem Date: Wed, 18 Mar 2026 10:16:40 -0400 Message-ID: <20260318141637.1870220-12-pasha.tatashin@soleen.com> X-Mailer: git-send-email 2.53.0.851.ga537e3e6e9-goog In-Reply-To: <20260318141637.1870220-10-pasha.tatashin@soleen.com> References: <20260318141637.1870220-10-pasha.tatashin@soleen.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=4697; i=pasha.tatashin@soleen.com; h=from:subject; bh=dkjsJaF9zS233/cIv2JZuqCsRBtr9t9nThiFjC9QTdU=; b=owEBbQKS/ZANAwAKAbt3KEzbc3reAcsmYgBpurPIEf2Hd/j/HyvzxGhdP66f5gdQf18OjzKVY 0RUvUJ6F6uJAjMEAAEKAB0WIQRBMaqT7LRvGvB/NmK7dyhM23N63gUCabqzyAAKCRC7dyhM23N6 3gGLD/44VIJY2e4gFWjXLJ68WeFLVVKrzyz58iPZAdSWRcT/aWoEVdIF4BQIzow+V+IIcH4NY/w Nn/LuiuTU89YdpPeiXb2E5HdyAbL+lDx26BgrQVWW6/mCe4iarCbKAd3OW5Xf7587w7g7+flKYQ zWYVKFpwv/yejr4B7xe+RSc6bpTOM7OM/4Fu2c8uGHW5UqJMiqMq6XYWBFyeg2Pi8Jizr9/5Bbb fOm1BU3MC1nFb352hGrjCfbWinbaSsVqEjRoGKqE3YyZAhSftlXlZkkf0Br82sasckGzKlH8dXt +lYELDGrBrAkBJs7t+3ufEkg+e5ZY8ZSZyeGcDO1oYbOv+N8J98uvHW5wBPxDeeVLOKNqBjiTY9 pCGmfrAIesk6kLVQxW2NeSBHLkfDL5NBSjVWLSjVpMhyDJ1zbt3xycDw0EHKaNrNjsHxZm0asdO kJgdWoIVRxPqYwY1zOEJpTrRMqDCjkGV17YHvVEBoFjG7uFHjCn8HCoVbjcLSDT91WCIsjpQOin WERJJtUiOISYNRkuhQPOYSxvVQvlcbPlGUqjHIKkwranZ/A/Jma3IBdHAIn+3kFoWKhYHcbx3M7 dDxIRtf7lFyjqve2kkaHJn7iNBsoQSu6VG2awJW+fLnAVTKgPbPB/ox3FZOz2A+sWuHt42Mq+Uy /rOdRqhXaQhTBCw== X-Developer-Key: i=pasha.tatashin@soleen.com; a=openpgp; fpr=CAAAB722DD22A081F0D49F35633A6A993D43B569 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Because liveupdate FLB objects will soon drop their persistent module references when registered, list traversals must be protected against concurrent module unloading. Introduce two read-write semaphores to provide this protection: 1. A global luo_flb_lock protects the global registry of FLBs. 2. A per-handler flb_lock protects the handler's specific list of FLB dependencies. Read locks are used during concurrent list traversals (e.g., during preservation and serialization). Write locks are taken during registration and unregistration. When both locks are required, the global luo_flb_lock is strictly acquired before the per-handler flb_lock to prevent deadlocks. Signed-off-by: Pasha Tatashin --- include/linux/liveupdate.h | 3 +++ kernel/liveupdate/luo_file.c | 1 + kernel/liveupdate/luo_flb.c | 16 ++++++++++++++++ 3 files changed, 20 insertions(+) diff --git a/include/linux/liveupdate.h b/include/linux/liveupdate.h index dd11fdc76a5f..8394fb2d8774 100644 --- a/include/linux/liveupdate.h +++ b/include/linux/liveupdate.h @@ -12,6 +12,7 @@ #include #include #include +#include #include #include =20 @@ -107,6 +108,8 @@ struct liveupdate_file_handler { struct list_head __private list; /* A list of FLB dependencies. */ struct list_head __private flb_list; + /* Protects flb_list */ + struct rw_semaphore __private flb_lock; }; =20 /** diff --git a/kernel/liveupdate/luo_file.c b/kernel/liveupdate/luo_file.c index 6a0ae29c6a24..96fdd5790dcc 100644 --- a/kernel/liveupdate/luo_file.c +++ b/kernel/liveupdate/luo_file.c @@ -873,6 +873,7 @@ int liveupdate_register_file_handler(struct liveupdate_= file_handler *fh) } =20 INIT_LIST_HEAD(&ACCESS_PRIVATE(fh, flb_list)); + init_rwsem(&ACCESS_PRIVATE(fh, flb_lock)); INIT_LIST_HEAD(&ACCESS_PRIVATE(fh, list)); list_add_tail(&ACCESS_PRIVATE(fh, list), &luo_file_handler_list); } diff --git a/kernel/liveupdate/luo_flb.c b/kernel/liveupdate/luo_flb.c index f52e8114837e..91910d806d1d 100644 --- a/kernel/liveupdate/luo_flb.c +++ b/kernel/liveupdate/luo_flb.c @@ -49,6 +49,7 @@ #include #include #include +#include #include #include #include "luo_internal.h" @@ -70,6 +71,7 @@ struct luo_flb_global { long count; }; =20 +static DECLARE_RWSEM(luo_flb_lock); static struct luo_flb_global luo_flb_global =3D { .list =3D LIST_HEAD_INIT(luo_flb_global.list), }; @@ -240,6 +242,8 @@ int luo_flb_file_preserve(struct liveupdate_file_handle= r *fh) struct luo_flb_link *iter; int err =3D 0; =20 + guard(rwsem_read)(&ACCESS_PRIVATE(fh, flb_lock)); + list_for_each_entry(iter, flb_list, list) { err =3D luo_flb_file_preserve_one(iter->flb); if (err) @@ -272,6 +276,8 @@ void luo_flb_file_unpreserve(struct liveupdate_file_han= dler *fh) struct list_head *flb_list =3D &ACCESS_PRIVATE(fh, flb_list); struct luo_flb_link *iter; =20 + guard(rwsem_read)(&ACCESS_PRIVATE(fh, flb_lock)); + list_for_each_entry_reverse(iter, flb_list, list) luo_flb_file_unpreserve_one(iter->flb); } @@ -292,6 +298,8 @@ void luo_flb_file_finish(struct liveupdate_file_handler= *fh) struct list_head *flb_list =3D &ACCESS_PRIVATE(fh, flb_list); struct luo_flb_link *iter; =20 + guard(rwsem_read)(&ACCESS_PRIVATE(fh, flb_lock)); + list_for_each_entry_reverse(iter, flb_list, list) luo_flb_file_finish_one(iter->flb); } @@ -355,6 +363,9 @@ int liveupdate_register_flb(struct liveupdate_file_hand= ler *fh, if (!luo_session_quiesce()) return -EBUSY; =20 + guard(rwsem_write)(&luo_flb_lock); + guard(rwsem_write)(&ACCESS_PRIVATE(fh, flb_lock)); + /* Check that this FLB is not already linked to this file handler */ err =3D -EEXIST; list_for_each_entry(iter, flb_list, list) { @@ -444,6 +455,9 @@ int liveupdate_unregister_flb(struct liveupdate_file_ha= ndler *fh, if (!luo_session_quiesce()) return -EBUSY; =20 + 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 =3D=3D flb) { @@ -638,6 +652,8 @@ void luo_flb_serialize(void) struct liveupdate_flb *gflb; int i =3D 0; =20 + guard(rwsem_read)(&luo_flb_lock); + list_private_for_each_entry(gflb, &luo_flb_global.list, private.list) { struct luo_flb_private *private =3D luo_flb_get_private(gflb); =20 --=20 2.53.0.851.ga537e3e6e9-goog From nobody Mon Apr 6 18:24:24 2026 Received: from mail-yx1-f42.google.com (mail-yx1-f42.google.com [74.125.224.42]) (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 A989A3DB65C for ; Wed, 18 Mar 2026 14:17:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.224.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773843422; cv=none; b=EqZaMrpjqbz79qyCAf/y5cDDpRnvJNR9vk3J1tHLFpnOyfNCknxhWEnERXY1jY3e4sqmBdK4RgtGVylw9PMXM8mPFhLJf9J6qho1HimQF7m2Wj5PywbIZiV5hYdAxTiMJj/pkUmpThSiJssIXtBzNjeeo4ydZuVHAoDTarimT0c= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773843422; c=relaxed/simple; bh=Lffv2DnyZxO5nuM/8hkjo+xgENhHOwSyq1ggm1aLDpg=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=qFJZ61X0hRN8RhEnjxL9LrZQVIbz3c2dIsPnvUl5gXsc0JW0+TtPQZDHf+iWhk/+zwZz5ZTigyE+Tz+1bXGFh9CjdpnN3/9m4zOjtBOEvmrvjakq/kzWCa9+UabUyn+B6f93oRG3wK+gagwmGUR7Ohxbv6mVp0WR9E6UaVR5aSg= 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=BqljRrfk; arc=none smtp.client-ip=74.125.224.42 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="BqljRrfk" Received: by mail-yx1-f42.google.com with SMTP id 956f58d0204a3-64e8cdafeffso1474312d50.1 for ; Wed, 18 Mar 2026 07:17:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=soleen.com; s=google; t=1773843420; x=1774448220; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=ubd4lYK9V1coPSt+9iFoac0BiHxALbtZJdQokTSw3pM=; b=BqljRrfkVSRH6TXSDkmKmtdiHkgJy1LYnHcjtVQGonq0BDZHSGQL4jF/K3dfUiq7qC WHeeo1y7tnT+5u2IDFX/EOKFF7vwA82+w9i24PMK7jA/uvtKNlvdNmvetr5q8yxRmqGv +N+k+9+8XVkq9Kgl1a8eW7qeyKeHJUwTm9YDmCbTAfkKSE3Pz4VIGx7yWT+KK0roKlg3 zwiBs+8UAq2EVdFbOIjZkBjK0nCo1k3BpAyJiAMSto2YN+rH+YBbEcALAc3Bb3zIALB8 DKsqEqGyhRgMkuTgLhYLhb7TDfuWE2CKlOEC7DVok6Bjc2zJfAvSm3MQS6MAej9XBbUK Z+wQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1773843420; x=1774448220; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=ubd4lYK9V1coPSt+9iFoac0BiHxALbtZJdQokTSw3pM=; b=PCiLteuY/4MZo2gJH10U6VsppPYBCqp1WqWERf5vfEXaqU7HQyD/ofvNQWPe7xw5lF 2z36BdJo+1bKPX58JImoQWZBgwcQ7EhbhQd77j3vzAZkD92TJvn1+GGjTmEaXIIafeYY 0wkPyh1SpsdrN3MBKDHPtMIauswsVrHar8UHgfwYbTUmFP/skHo+9XzCA4UT5TnkuTNV X4ek1kdCpVFsbQK1pPXJR7h5UVX00CblEJTKhn9wai4UKyVnGnYmC2XR397qQFBWzxbH viluqPm+kV2VLaP2CjovCrZxwmVBEbfeqztoQ1qCf5P2OJN4oMYxcakPhhuvhA7TJk93 zt6A== X-Forwarded-Encrypted: i=1; AJvYcCXvNvCVx1tl0nYwQVq11GtD/rk96SforyEFJn/D2T9ulIvpWkzyelSNgczgeUYfUCbRYYYZhL2HrPPyXc8=@vger.kernel.org X-Gm-Message-State: AOJu0YzMvTMGkifi8OkI1O4emimDZEy44ldtpQVgiDYAwUIgbEywxqpJ CKrwbTbyAMndhXzOjpMEMHleDe4S/YpHXgfk13+lSqxE3YLVU41Yn2oB2LIJ+HDwJLo= X-Gm-Gg: ATEYQzzrEIdOJXOY6e9RlIWb4snJv516ly8/MFeuQdvKwIRv0zUL8FaDRVzb3NADnu+ /mYAKXI8WPMixYfFLjKUNdHs6GX8x6xy0BKjZ69sSeVqz+2/N7c+lnZbtAl2Y2wS/m9r63tEdOc N4P7eEZ93yYjC5JX/0J3h1SnLHe5DjCh2qpXgtG0OnkO2fA5RFtncOQA/1vYqfTbfrXhIwOlQb3 Lz52/C3gHZDOR4CTjudRNyDmdFP3s3uFmgm1uyThEuaDUwVUaHQ8a36VpwR1HRUg+FmzPyg6YyU xPLkcPRaQtby8RepCm1mX1oB5p7B5BVlS+jj2sEV04Xyv0EBZUAv9qqbZWjqERiTVdqkPvp0JzZ uPfFPreUEAcC2v2BZwZ9uNmY6NW6F4H1vd5EE/j1PjuFKYnjfFPRiiU+h1jER2YkUAYoStIEtDU Y9QzzjY4/t4XltMLAWagXqHjmSKV07FxHzdx+xzwJiNVRJh+tqE6N5UOgBY7ANMV1M83qqSgIKD vshqa65fVXqdJePN2VVFZfhs0ysA/5Lp8U= X-Received: by 2002:a53:bd0b:0:b0:649:3875:9200 with SMTP id 956f58d0204a3-64e912ecefamr2553595d50.1.1773843419489; Wed, 18 Mar 2026 07:16:59 -0700 (PDT) Received: from soleen.c.googlers.com.com (57.233.150.34.bc.googleusercontent.com. [34.150.233.57]) by smtp.gmail.com with ESMTPSA id 956f58d0204a3-64e91be0e91sm1672028d50.15.2026.03.18.07.16.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Mar 2026 07:16:58 -0700 (PDT) From: Pasha Tatashin To: rppt@kernel.org, akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, pasha.tatashin@soleen.com, dmatlack@google.com, pratyush@kernel.org Subject: [PATCH v2 3/8] liveupdate: Remove file handler module refcounting Date: Wed, 18 Mar 2026 10:16:41 -0400 Message-ID: <20260318141637.1870220-13-pasha.tatashin@soleen.com> X-Mailer: git-send-email 2.53.0.851.ga537e3e6e9-goog In-Reply-To: <20260318141637.1870220-10-pasha.tatashin@soleen.com> References: <20260318141637.1870220-10-pasha.tatashin@soleen.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=3314; i=pasha.tatashin@soleen.com; h=from:subject; bh=Lffv2DnyZxO5nuM/8hkjo+xgENhHOwSyq1ggm1aLDpg=; b=owEBbQKS/ZANAwAKAbt3KEzbc3reAcsmYgBpurPKh1r+mZq+VPFRX+zQHHctHNNA9pcYeCPjk 6lF1jfleF2JAjMEAAEKAB0WIQRBMaqT7LRvGvB/NmK7dyhM23N63gUCabqzygAKCRC7dyhM23N6 3lTYEACVTFybupdvgSPfd2fCzSR3N2UrbQXZNHejUkbPthks8joN8TV/SNAo22lQP0aZtDZ4m1t O66zZScB9l1jmnV14XgYXm2Vx/oAhvCSKfuB7ilBXB5bc2hS+uwv/uUsfWYVAeiRsi853EpRU+7 3Ey8yY9NDR9WGk32UF2cDiysYUv+fcNvEi9P+8szI1T/l2IU+kb3l+Jo6Tdm+fxvKEJI0N5QVP4 6RM9u0WgPcVbMV2FvsUr5GxKM/UWYqBRwO0eEt/0VQtXFNLPj3t+nWwi8mI4Z2LRsuF5pM6H4Ce sdS/DygdtovOXW1QHA1K/1ULI+TN1VDBA1XL8AHZFdEmvIByLxYRAkqKGzcN7m3DMemmPn5ryur Kty3b35GCRVri/n9X8zwZd73XmAW6qCFay89lFkZ97O17OiFXr5IDtJS8rZNVxE3TlBF41BtgBu w3HgMpreZVak9Q1OcDQzFqYPaxa9Dx2Yf+sL7ulD6wcDtQhVnu3wI8PbaLJDE8inLs4jLs1iGAK mf0AGRrHmwEIi6ytkimFdbZgC8v+GKMdzcqQ5MCmFbOWrcAeXOel3d0LfxkmsH9Ef1UK86Se0rA Uc3LFyCq4vMH7SbFdGYq5VJHI9vDXz8Jf019zHgQOGh/6h3bs8ASlTHB91fa7XtPuhx411vJfy/ 77L6oexIIBV/uyA== X-Developer-Key: i=pasha.tatashin@soleen.com; a=openpgp; fpr=CAAAB722DD22A081F0D49F35633A6A993D43B569 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" File handlers do not need to pin modules indefinitely or during active live update sessions. The VFS 'struct file' pins the file handler's module via f_op->owner during active sessions, making dynamic reference counting unnecessary for handlers. When a file is preserved, the live update core obtains a 'struct file' via fdget(). As long as the file is kept open within the live update session, the module is pinned by the VFS and cannot be unloaded. Similarly, during deserialization, file handlers are matched based on the compatible string. Because the handler list is protected by luo_file_handler_lock, there is no race that requires dynamic module refcounting. Removing these module references ensures that modules implementing file handlers can be unloaded when no longer providing active files. Suggested-by: David Matlack Signed-off-by: Pasha Tatashin --- kernel/liveupdate/luo_file.c | 28 +++++++--------------------- 1 file changed, 7 insertions(+), 21 deletions(-) diff --git a/kernel/liveupdate/luo_file.c b/kernel/liveupdate/luo_file.c index 96fdd5790dcc..b124fd747841 100644 --- a/kernel/liveupdate/luo_file.c +++ b/kernel/liveupdate/luo_file.c @@ -836,7 +836,6 @@ void luo_file_set_destroy(struct luo_file_set *file_set) int liveupdate_register_file_handler(struct liveupdate_file_handler *fh) { struct liveupdate_file_handler *fh_iter; - int err; =20 if (!liveupdate_enabled()) return -EOPNOTSUPP; @@ -861,17 +860,11 @@ int liveupdate_register_file_handler(struct liveupdat= e_file_handler *fh) if (!strcmp(fh_iter->compatible, fh->compatible)) { pr_err("File handler registration failed: Compatible string '%s' alrea= dy registered.\n", fh->compatible); - err =3D -EEXIST; - goto err_resume; + luo_session_resume(); + return -EEXIST; } } =20 - /* Pin the module implementing the handler */ - if (!try_module_get(fh->ops->owner)) { - err =3D -EAGAIN; - goto err_resume; - } - INIT_LIST_HEAD(&ACCESS_PRIVATE(fh, flb_list)); init_rwsem(&ACCESS_PRIVATE(fh, flb_lock)); INIT_LIST_HEAD(&ACCESS_PRIVATE(fh, list)); @@ -882,10 +875,6 @@ int liveupdate_register_file_handler(struct liveupdate= _file_handler *fh) liveupdate_test_register(fh); =20 return 0; - -err_resume: - luo_session_resume(); - return err; } =20 /** @@ -907,8 +896,6 @@ int liveupdate_register_file_handler(struct liveupdate_= file_handler *fh) */ int liveupdate_unregister_file_handler(struct liveupdate_file_handler *fh) { - int err =3D -EBUSY; - if (!liveupdate_enabled()) return -EOPNOTSUPP; =20 @@ -918,19 +905,18 @@ int liveupdate_unregister_file_handler(struct liveupd= ate_file_handler *fh) goto err_register; =20 scoped_guard(rwsem_write, &luo_file_handler_lock) { - if (!list_empty(&ACCESS_PRIVATE(fh, flb_list))) - goto err_resume; + if (!list_empty(&ACCESS_PRIVATE(fh, flb_list))) { + luo_session_resume(); + goto err_register; + } =20 list_del(&ACCESS_PRIVATE(fh, list)); } - module_put(fh->ops->owner); luo_session_resume(); =20 return 0; =20 -err_resume: - luo_session_resume(); err_register: liveupdate_test_register(fh); - return err; + return -EBUSY; } --=20 2.53.0.851.ga537e3e6e9-goog From nobody Mon Apr 6 18:24:24 2026 Received: from mail-yx1-f49.google.com (mail-yx1-f49.google.com [74.125.224.49]) (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 396FF3DBD6D for ; Wed, 18 Mar 2026 14:17:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.224.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773843424; cv=none; b=g09borlcg0TLdmvNz1bQ3V6bx5louofCDJkeryYBcIie6HkhQdVQZ7grt+Rcfu+dU8TOXCXSbFILCft53+XRGIWwduamagjLg/CxTDdrYR9y7xKJsF90Ne3xDCd0+D6IhnSztx04e0KKIDKphX2vTiHJ5I12Cp3FX8tPWxMswRo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773843424; c=relaxed/simple; bh=iR8I+/StaBXxEZV0NdnOtDjxL5dTWNF5Ps57FdSsCf8=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=r72LoXG8kGlKy20VryiWZJl9Oku6/22ihxloKEU3odFy9oJd2Pa7EDO6j4f4x6U8vBExWmNFgeQmb3KMV7Ad9HoutkL6usOnNUd2c11aNHGVRjR9ufNSRMepdzqpHzXRbpVMAprJ9dGLE737Gv8aDUIp2ouAlgftEJidr5Ti6vM= 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=PEDVKODJ; arc=none smtp.client-ip=74.125.224.49 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="PEDVKODJ" Received: by mail-yx1-f49.google.com with SMTP id 956f58d0204a3-64ad79dfb7cso7562556d50.2 for ; Wed, 18 Mar 2026 07:17:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=soleen.com; s=google; t=1773843421; x=1774448221; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=r+VqvYB4/DwM+CB2Xe5IvCpNGUCzC20aSBPm99ZSf4E=; b=PEDVKODJxMOzBF1PASES2Z3Ar7l8jPctmuyc4myFzdn/pX9s1WOHplMMN0f/m0yyou yO/gVMu7S4GfDKJYnQpqhT+M20dsUk7JmZqgK46+pVMYjpeXPvowmMDMSuihQ0E4mYux 77kZHB+G+o/iXrv4rIu4qh4HxMNNV4Kg/iFoks0ukVaZzIPVTq64NKz4/kAeaIE05+fV YNlmnA37QqR7mBpVYBrE+DQtz9dnvtTJ/a5yLpT3yDzWzmnvqJM7rPhFbH521OWFuRky z5fbNL3dRJpOjSVUiwDYtCCYfiLqWmI5JPnMMfqpU3wKxmIMyt6GinC/AHXTGj+K93Q/ rEPA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1773843421; x=1774448221; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=r+VqvYB4/DwM+CB2Xe5IvCpNGUCzC20aSBPm99ZSf4E=; b=V6uCHHL+u/qg+lfPtm5NRa/JOr66IhAHL3FOzs3JveXYyrbBSw7Xxh4LA4rX9Rmo9f hqqVCPS35HpmNyhDJfMyyx3dKe84MbU+QC+keAqjgqzi/9RsT+Lh129suIX00eYedYD+ G1f7FJIddqPkxF297eoPc61D6BTgKyo73j8P7rkaMqFYqcTZdDw8Mi/r0oO9kEn3cJyp rbT5VZjANbjx6KiPv/iHQTDGKiwpTQ5sRYyAmxxtCqeO0Sve9g+JAKDMbmaKMttnS5g8 ovipL0jUC1w7URUyjLYNYrd805gh9izdwZuvmnoOvXWXYW7Rc+vxc5aif8MqAtZUBdZF 6FtA== X-Forwarded-Encrypted: i=1; AJvYcCUueBxLQGBzgtjjaRmYs3N8SBEQpFmvqmD6z8aTUguxJR2wAiXiFdnEeqinvRMvwhV9RWtWmHtvBJCUvNE=@vger.kernel.org X-Gm-Message-State: AOJu0YwTjoe9wMfg3Q9cZgOSL56Q2yhfu91fRtSnrG2JYIsCYFYVuKan VzqX1Y+ql88/rU2eayvBqcu3N6A/2SpaG6OVBvhVLizdLUUiObkAK2hxXcadckHI99c= X-Gm-Gg: ATEYQzwEm5fXKnGAvOEd2NtKkVnDD2EFJb38wXRYgVAgOXgZnfxx7f7uMBrwG9IkkRu DTiLps2pbqRKX8pLG526zKa5mOh0YAWhga06a9ms7W9b9/d00dkK5FCdBKqw8gQiPpyJnFTsHWe JODZ354mVqCdhMvALwi2omDoRZ2/r5AL7t9f3Ok+9na9rVpcEbqKF/Ai22PMAuvN5YwVv26svor QBeGsc/xl9DZMI/geLh+XYRVc2EZqWWUyM+e1PDlmSU9QTVh4nZA9/eCF8iNuB3mcARWEaAMHex 8LCVP2rwar0Q0e5N+hOhLpoQ3nA6izd12MHzetjCMW40wfcVrDiSMP9Olcal/+SLCTpG66i2oZE EpYyyVJ9bsAZPyIz24Y1E8tuLhz1mrYxAvU3MqRd3WBCSydM/rVTGfLS98x6atjHQjG1TRg5cYS H4w4sAje+qwNQDI8IUYBgEj/PupSz2DRwM1b8FP7y6CHzmsvOkQhEWTaGHqnG8Y5DtwSf0GNWXc NpYnk9MdumnnhDBSlKzmJklRuEqkaatlb455dTCl2Utpo9uuw== X-Received: by 2002:a05:690e:4466:b0:64a:e799:1d92 with SMTP id 956f58d0204a3-64e916017c1mr2847774d50.61.1773843420339; Wed, 18 Mar 2026 07:17:00 -0700 (PDT) Received: from soleen.c.googlers.com.com (57.233.150.34.bc.googleusercontent.com. [34.150.233.57]) by smtp.gmail.com with ESMTPSA id 956f58d0204a3-64e91be0e91sm1672028d50.15.2026.03.18.07.16.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Mar 2026 07:16:59 -0700 (PDT) From: Pasha Tatashin To: rppt@kernel.org, akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, pasha.tatashin@soleen.com, dmatlack@google.com, pratyush@kernel.org Subject: [PATCH v2 4/8] liveupdate: Defer FLB module refcounting to active sessions Date: Wed, 18 Mar 2026 10:16:42 -0400 Message-ID: <20260318141637.1870220-14-pasha.tatashin@soleen.com> X-Mailer: git-send-email 2.53.0.851.ga537e3e6e9-goog In-Reply-To: <20260318141637.1870220-10-pasha.tatashin@soleen.com> References: <20260318141637.1870220-10-pasha.tatashin@soleen.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=3373; i=pasha.tatashin@soleen.com; h=from:subject; bh=iR8I+/StaBXxEZV0NdnOtDjxL5dTWNF5Ps57FdSsCf8=; b=owEBbQKS/ZANAwAKAbt3KEzbc3reAcsmYgBpurPLbaFvSonT8zodhVCWfmkfgUrhZ5neWD5Yl lk0n7d4NhSJAjMEAAEKAB0WIQRBMaqT7LRvGvB/NmK7dyhM23N63gUCabqzywAKCRC7dyhM23N6 3vfYEACHkJvJO9RYAfuX2GirFrKaaIB1vkyXHVlN0h/nFzPddsyK5i19XDsQTcvXCge6ahu3UTH QG8HNKcbZjJvx7aDk7SPLi/2X8jNZInKJMQN7qOQJpByfZlf/7EFZkPHlhYp58nXtiHhatYpfiM 1ijBMgNWE7matlz77/Wtwl9Ui2Nm3W/qO/cGQZlOXcS7bDpvv7eJYvtHKwc45M/SUB8j9ZElMMT kab0YWyftiMI2k5iV53LW1maimBM2EqWBDHHzwEFc/q7lX+2aEuZ4U/6dJgO8PfaB8VEVQS6B+U DUKqln4zzhSZmv5w4h8fYJA1lIsYQ2HW5CexIApQwlwC0bsFY+N+FrkFlzgMHTN+YuHiijvSMyx 1p/1y6B6icDeXAdqL2cOJxfiIlS/QqmyuScGvYXzOTvtEzI5fLc/FVAQCVOA+3WWv+VXPqMik8K yGMGAkGLyLMAVhaU+yPZfmYwVJa+28qAv/mmu6s5VTiqKwENAYH3b/y++dUjr0be30fGrs7Pyt3 RQ6HEVxKRgNN0bK8Odx6Z81L5oYtb9gxXR6ZQiJvvEX9hhDo08K22fuT1fBx75a9C/iYz9ZfV3X TEBKUim3pjj6/SLjNedVct0R0tJsvT0hef9EGDz+wj6t5ceKKI7UTNLu+99dPhkBHwNXdh+n2yn CoT+ZEqbfukS3Rw== X-Developer-Key: i=pasha.tatashin@soleen.com; a=openpgp; fpr=CAAAB722DD22A081F0D49F35633A6A993D43B569 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Stop pinning modules indefinitely upon FLB registration. Instead, dynamically take a module reference when the FLB is actively used in a session (e.g., during preserve and retrieve) and release it when the session concludes. This allows modules providing FLB operations to be cleanly unloaded when not in active use by the live update orchestrator. Signed-off-by: Pasha Tatashin --- kernel/liveupdate/luo_flb.c | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/kernel/liveupdate/luo_flb.c b/kernel/liveupdate/luo_flb.c index 91910d806d1d..98336cd23aa5 100644 --- a/kernel/liveupdate/luo_flb.c +++ b/kernel/liveupdate/luo_flb.c @@ -112,10 +112,15 @@ static int luo_flb_file_preserve_one(struct liveupdat= e_flb *flb) struct liveupdate_flb_op_args args =3D {0}; int err; =20 + if (!try_module_get(flb->ops->owner)) + return -ENODEV; + args.flb =3D flb; err =3D flb->ops->preserve(&args); - if (err) + if (err) { + module_put(flb->ops->owner); return err; + } private->outgoing.data =3D args.data; private->outgoing.obj =3D args.obj; } @@ -143,6 +148,7 @@ static void luo_flb_file_unpreserve_one(struct liveupda= te_flb *flb) =20 private->outgoing.data =3D 0; private->outgoing.obj =3D NULL; + module_put(flb->ops->owner); } } } @@ -178,12 +184,17 @@ static int luo_flb_retrieve_one(struct liveupdate_flb= *flb) if (!found) return -ENOENT; =20 + if (!try_module_get(flb->ops->owner)) + return -ENODEV; + args.flb =3D flb; args.data =3D private->incoming.data; =20 err =3D flb->ops->retrieve(&args); - if (err) + if (err) { + module_put(flb->ops->owner); return err; + } =20 private->incoming.obj =3D args.obj; private->incoming.retrieved =3D true; @@ -217,6 +228,7 @@ static void luo_flb_file_finish_one(struct liveupdate_f= lb *flb) private->incoming.data =3D 0; private->incoming.obj =3D NULL; private->incoming.finished =3D true; + module_put(flb->ops->owner); } } } @@ -394,11 +406,6 @@ int liveupdate_register_flb(struct liveupdate_file_han= dler *fh, goto err_resume; } =20 - if (!try_module_get(flb->ops->owner)) { - err =3D -EAGAIN; - goto err_resume; - } - list_add_tail(&private->list, &luo_flb_global.list); luo_flb_global.count++; } @@ -474,12 +481,11 @@ int liveupdate_unregister_flb(struct liveupdate_file_= handler *fh, private->users--; /* * If this is the last file-handler with which we are registred, remove - * from the global list, and relese module reference. + * from the global list. */ if (!private->users) { list_del_init(&private->list); luo_flb_global.count--; - module_put(flb->ops->owner); } =20 luo_session_resume(); @@ -506,7 +512,8 @@ int liveupdate_unregister_flb(struct liveupdate_file_ha= ndler *fh, * * Return: 0 on success, or a negative errno on failure. -ENODATA means no * incoming FLB data, -ENOENT means specific flb not found in the incoming - * data, and -EOPNOTSUPP when live update is disabled or not configured. + * data, -ENODEV if the FLB's module is unloading, and -EOPNOTSUPP when + * live update is disabled or not configured. */ int liveupdate_flb_get_incoming(struct liveupdate_flb *flb, void **objp) { --=20 2.53.0.851.ga537e3e6e9-goog From nobody Mon Apr 6 18:24:24 2026 Received: from mail-yx1-f48.google.com (mail-yx1-f48.google.com [74.125.224.48]) (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 A7AFC3DC4B2 for ; Wed, 18 Mar 2026 14:17:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.224.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773843428; cv=none; b=mrrj6Dgnva7OdZhu9kfQoKkDR0ZTEahfrYvBVloqkNBI4bgvr/SdQlnwXzGZOBmRG2dHR0ADcJALZFott8FInAr4nWqbyhXAQCDXLR0p+/QLd0emfOIx5M3QAAIa0mxkQ5DgeGEQR89hW0avyTAB/hhhBbUB2tb6GVeWQD8VNeE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773843428; c=relaxed/simple; bh=k1U60ogGlFKqcQ2VNpd3YPvxEKZ2keFaPByWtDwKlOE=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=pCP+fwayTRVKXgOfnlleQyN2F8G6PsufuGysU2vHwVGBtfbrwGRy3r3bsBtispksLY/xDnC3jKKBipgG8dc0WTydhV9EetmFlHZSp9rh1unE9ljZtshGAzMreStIQJHvb4A1LK4J/RPkBBDwc5iTI70nZ5G7JufXvMDwih/u67A= 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=h+JsH2uR; arc=none smtp.client-ip=74.125.224.48 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="h+JsH2uR" Received: by mail-yx1-f48.google.com with SMTP id 956f58d0204a3-64ca2b32f46so5451396d50.3 for ; Wed, 18 Mar 2026 07:17:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=soleen.com; s=google; t=1773843422; x=1774448222; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=9grmrBps2hK+s63PftzZmwOuMlZ/QyGcOsJY971KUOk=; b=h+JsH2uRZ7BU6hNPDXUPcO3Jeqy8v4ABlHsP9cEAma7Krb/WtS5ehvxYF2zkkbnK1c fphxqnjQW4FDq/K7jpBQo3TQ3VS234e7vKCPY+dTu6kItogcGNx7TYacCdvc1rwiysZz +ZontvE1WVZl6/fC4EFjRx4Ah/2sJDIIPC0PlRqcusQRAdWxMULj/chcavBlWYINL7Oz HVwUv32ciCgXwbSiEcSe+aXC00ovYSogKo/NkC1r2N0ajMGTGXHSBujTrjjXMB34A3iD u3claQDioQ5ITPSY7BTJsxRCqbzlK0aEGKbo3mSPl4+TW6zw1DT06crDLevLdyuThAS5 BI9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1773843422; x=1774448222; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=9grmrBps2hK+s63PftzZmwOuMlZ/QyGcOsJY971KUOk=; b=YbeCDZjXg8xs/sEQPHPMtNpSo8exhUwsd5gPi2I2jClThGbJMghOljwBMjOPmyEONn QnAtTt5tEyHH6J16aNGZSzJRwOpr3Jy3GIRP2QciWgbgp+9EnYZToEx/rshj8M3ucyZb RNFTqftjf3weXGmg2At0QOfm/GYCQNJphz7qpWDwXgohOy8Nwn+UpdBXtAKSAexQRNcG jn+5IPqoI0vDA0Gj+QFCw5VMvbNls0158TEpWnL/6ZwIbq9siQ9+UJqnXPz6HvMEmUuM tjk3+g/qAU3gCjYKTtppeR+OHbgQ76w3g/UKS9PK+K9pdBGb8xsvy/VbJOjaPaYuzE7j xZtA== X-Forwarded-Encrypted: i=1; AJvYcCW+263W9FE6PSNI28q/fSsLX7ViyXyjqnL+Hr9nzeRJOhBBqWUcnjie2IjhGZ4o2V0I1y4AsfgQ9tb/4NQ=@vger.kernel.org X-Gm-Message-State: AOJu0YzklgVSci1oI9ba8fv255fbo6FqXx/awPTKU18SqxbAARyLh2kI zHed67SvVve09OWKm7epE0DaIrEhJjdzLl8CQYJfaS1LIsYUXJPo9tBTIk/lNgGa008= X-Gm-Gg: ATEYQzzKlWzgvI0qkfqWS5vwDLOvXtmlfdE7bvlywxfQZA/qow8J38VwHQX9vnEaIZa yeXHXlKaOJy5YtbF0dcHhvaNQvrSavUwMg5N/nfJ38SzEWUiwZKkl15TvC73KCk86it3INfNRDe T2mmEeINg2eiELMbb4sidKs0eIphS4W4cSs/R6Be2Mt+5zjAGzvbGYrZ8yCSGqEry5r8L6d0nb5 4XCc5yHxRDeHoVYSvj6Jt6bJGwM6wFCeuKwJGpENHPoEvtDtI5jS7iuvCSbbU48rDljHdAkrspJ joPDyy659nlWyOA5ZdupRcFnAeDFc1Sn7Rvzidq4BLrG6ATBpc4gmdeudSpfU6l1ex/okklvslq 5fodKHPzDQcYJR/pxjLRT07d5DHN6khB6Wqt7W1qZJkv1BBE0ulahAv893pf2sfZBJ+c41joHkd gzRb36av07JKtJo52bSiYiuPNG293sq54WRc4cjOGwLdNF9yIcxx0SpY9t6SW008sJK7rdSh7rt 6efQ9D3zX+OYfBECVyVmO+FOHGovo2f1JgizrVZNuInS/vl3JnyVSlpmwkQ X-Received: by 2002:a53:b6c4:0:b0:64a:d444:48f5 with SMTP id 956f58d0204a3-64e915f5a33mr2644882d50.65.1773843421452; Wed, 18 Mar 2026 07:17:01 -0700 (PDT) Received: from soleen.c.googlers.com.com (57.233.150.34.bc.googleusercontent.com. [34.150.233.57]) by smtp.gmail.com with ESMTPSA id 956f58d0204a3-64e91be0e91sm1672028d50.15.2026.03.18.07.17.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Mar 2026 07:17:00 -0700 (PDT) From: Pasha Tatashin To: rppt@kernel.org, akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, pasha.tatashin@soleen.com, dmatlack@google.com, pratyush@kernel.org Subject: [PATCH v2 5/8] liveupdate: Remove luo_session_quiesce() Date: Wed, 18 Mar 2026 10:16:43 -0400 Message-ID: <20260318141637.1870220-15-pasha.tatashin@soleen.com> X-Mailer: git-send-email 2.53.0.851.ga537e3e6e9-goog In-Reply-To: <20260318141637.1870220-10-pasha.tatashin@soleen.com> References: <20260318141637.1870220-10-pasha.tatashin@soleen.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=8396; i=pasha.tatashin@soleen.com; h=from:subject; bh=k1U60ogGlFKqcQ2VNpd3YPvxEKZ2keFaPByWtDwKlOE=; b=owEBbQKS/ZANAwAKAbt3KEzbc3reAcsmYgBpurPMnXDInX88G54UAYQw0L/MaWlYrn9GAm0fu o0ri6gq5VyJAjMEAAEKAB0WIQRBMaqT7LRvGvB/NmK7dyhM23N63gUCabqzzAAKCRC7dyhM23N6 3gmbD/99nCQV/oK6edHYLGsZT66H9puZFs6qMQEpgTm6zlLogKeyxMRCqK6A7YRthVSDghj74Rh RICG130O8omn6beue1D1lsRqw/DOru4IBblYemY58l3GXqKeSomGocmVRpqWbFfX29GI1JAgHci hsMce4Y0eDpQ3dna8egsI/n2CIsRyxRqpyQrWq3HMoNfh1568mJJySo2QRH27woXqp4wvuR1lqZ 9UWFUFor+y52QT0kSisHxtiPmFrJniJTvMczuurWKHGpLPoEpmFXPtvAWYmRuJNXuAY1f5bU4vN FR86KxDLO62Gsqb4HpU3ZkFF/6oRL1smCrOHSbLfMhc/FP3UetnR5MB8x4iETa64Su0HihhyRPW +H0Xdz60BnYpqdVsWEUcJH0PY7nKgRO26NtwGflBwSfPbUYvlsrVWUNezFluRFeriIwizGwo0Dz qBC3+i/YYbd3Sk0GZbHVBmjrUOKeiQ6pdMN5K/KThiz2+lqZHT0If2i+2PYP4pozzC5tr1ZeSkX 4/iUzzh6EG4THuQLswajM8XwVH/NIHfXheTVqQ1680u6BaFwF0rm+j1tSAghM+Y/YPQxS1OaDrt zk7MUgdHyThGi3mdCJ1/krI2gycuujBF92BxIMNbEkT7qm6H/sjaakPLUY5CN2BDOBsHP65c2Ly exBOBsfe3n4paXw== X-Developer-Key: i=pasha.tatashin@soleen.com; a=openpgp; fpr=CAAAB722DD22A081F0D49F35633A6A993D43B569 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Now that FLB module references are handled dynamically during active sessions, we can safely remove the luo_session_quiesce() and luo_session_resume() mechanism. Signed-off-by: Pasha Tatashin --- kernel/liveupdate/luo_file.c | 21 ++------------- kernel/liveupdate/luo_flb.c | 46 +++++--------------------------- kernel/liveupdate/luo_internal.h | 2 -- kernel/liveupdate/luo_session.c | 44 ------------------------------ 4 files changed, 9 insertions(+), 104 deletions(-) diff --git a/kernel/liveupdate/luo_file.c b/kernel/liveupdate/luo_file.c index b124fd747841..c0ce08d55747 100644 --- a/kernel/liveupdate/luo_file.c +++ b/kernel/liveupdate/luo_file.c @@ -846,21 +846,12 @@ int liveupdate_register_file_handler(struct liveupdat= e_file_handler *fh) return -EINVAL; } =20 - /* - * Ensure the system is quiescent (no active sessions). - * This prevents registering new handlers while sessions are active or - * while deserialization is in progress. - */ - if (!luo_session_quiesce()) - return -EBUSY; - scoped_guard(rwsem_write, &luo_file_handler_lock) { /* Check for duplicate compatible strings */ list_private_for_each_entry(fh_iter, &luo_file_handler_list, list) { if (!strcmp(fh_iter->compatible, fh->compatible)) { pr_err("File handler registration failed: Compatible string '%s' alrea= dy registered.\n", fh->compatible); - luo_session_resume(); return -EEXIST; } } @@ -870,7 +861,6 @@ int liveupdate_register_file_handler(struct liveupdate_= file_handler *fh) INIT_LIST_HEAD(&ACCESS_PRIVATE(fh, list)); list_add_tail(&ACCESS_PRIVATE(fh, list), &luo_file_handler_list); } - luo_session_resume(); =20 liveupdate_test_register(fh); =20 @@ -885,13 +875,12 @@ int liveupdate_register_file_handler(struct liveupdat= e_file_handler *fh) * reverses the operations of liveupdate_register_file_handler(). * * It ensures safe removal by checking that: - * No live update session is currently in progress. * No FLB registered with this file handler. * * If the unregistration fails, the internal test state is reverted. * * Return: 0 Success. -EOPNOTSUPP when live update is not enabled. -EBUSY = A live - * update is in progress, can't quiesce live update or FLB is registred wi= th + * update is in progress, FLB is registred with * this file handler. */ int liveupdate_unregister_file_handler(struct liveupdate_file_handler *fh) @@ -901,18 +890,12 @@ int liveupdate_unregister_file_handler(struct liveupd= ate_file_handler *fh) =20 liveupdate_test_unregister(fh); =20 - if (!luo_session_quiesce()) - goto err_register; - scoped_guard(rwsem_write, &luo_file_handler_lock) { - if (!list_empty(&ACCESS_PRIVATE(fh, flb_list))) { - luo_session_resume(); + if (!list_empty(&ACCESS_PRIVATE(fh, flb_list))) goto err_register; - } =20 list_del(&ACCESS_PRIVATE(fh, list)); } - luo_session_resume(); =20 return 0; =20 diff --git a/kernel/liveupdate/luo_flb.c b/kernel/liveupdate/luo_flb.c index 98336cd23aa5..8bbe11a7286b 100644 --- a/kernel/liveupdate/luo_flb.c +++ b/kernel/liveupdate/luo_flb.c @@ -346,7 +346,6 @@ int liveupdate_register_flb(struct liveupdate_file_hand= ler *fh, struct luo_flb_link *link __free(kfree) =3D NULL; struct liveupdate_flb *gflb; struct luo_flb_link *iter; - int err; =20 if (!liveupdate_enabled()) return -EOPNOTSUPP; @@ -367,22 +366,13 @@ int liveupdate_register_flb(struct liveupdate_file_ha= ndler *fh, if (!link) return -ENOMEM; =20 - /* - * Ensure the system is quiescent (no active sessions). - * This acts as a global lock for registration: no other thread can - * be in this section, and no sessions can be creating/using FDs. - */ - if (!luo_session_quiesce()) - return -EBUSY; - guard(rwsem_write)(&luo_flb_lock); guard(rwsem_write)(&ACCESS_PRIVATE(fh, flb_lock)); =20 /* Check that this FLB is not already linked to this file handler */ - err =3D -EEXIST; list_for_each_entry(iter, flb_list, list) { if (iter->flb =3D=3D flb) - goto err_resume; + return -EEXIST; } =20 /* @@ -390,20 +380,16 @@ int liveupdate_register_flb(struct liveupdate_file_ha= ndler *fh, * is registered */ if (!private->users) { - if (WARN_ON(!list_empty(&private->list))) { - err =3D -EINVAL; - goto err_resume; - } + if (WARN_ON(!list_empty(&private->list))) + return -EINVAL; =20 - if (luo_flb_global.count =3D=3D LUO_FLB_MAX) { - err =3D -ENOSPC; - goto err_resume; - } + if (luo_flb_global.count =3D=3D LUO_FLB_MAX) + return -ENOSPC; =20 /* Check that compatible string is unique in global list */ list_private_for_each_entry(gflb, &luo_flb_global.list, private.list) { if (!strcmp(gflb->compatible, flb->compatible)) - goto err_resume; + return -EEXIST; } =20 list_add_tail(&private->list, &luo_flb_global.list); @@ -414,13 +400,8 @@ int liveupdate_register_flb(struct liveupdate_file_han= dler *fh, private->users++; link->flb =3D flb; list_add_tail(&no_free_ptr(link)->list, flb_list); - luo_session_resume(); =20 return 0; - -err_resume: - luo_session_resume(); - return err; } =20 /** @@ -455,13 +436,6 @@ int liveupdate_unregister_flb(struct liveupdate_file_h= andler *fh, if (!liveupdate_enabled()) return -EOPNOTSUPP; =20 - /* - * Ensure the system is quiescent (no active sessions). - * This acts as a global lock for unregistration. - */ - if (!luo_session_quiesce()) - return -EBUSY; - guard(rwsem_write)(&luo_flb_lock); guard(rwsem_write)(&ACCESS_PRIVATE(fh, flb_lock)); =20 @@ -476,7 +450,7 @@ int liveupdate_unregister_flb(struct liveupdate_file_ha= ndler *fh, } =20 if (err) - goto err_resume; + return err; =20 private->users--; /* @@ -488,13 +462,7 @@ int liveupdate_unregister_flb(struct liveupdate_file_h= andler *fh, luo_flb_global.count--; } =20 - luo_session_resume(); - return 0; - -err_resume: - luo_session_resume(); - return err; } =20 /** diff --git a/kernel/liveupdate/luo_internal.h b/kernel/liveupdate/luo_inter= nal.h index 8083d8739b09..ec949f91c8c1 100644 --- a/kernel/liveupdate/luo_internal.h +++ b/kernel/liveupdate/luo_internal.h @@ -83,8 +83,6 @@ int __init luo_session_setup_outgoing(void *fdt); int __init luo_session_setup_incoming(void *fdt); int luo_session_serialize(void); int luo_session_deserialize(void); -bool luo_session_quiesce(void); -void luo_session_resume(void); =20 int luo_preserve_file(struct luo_file_set *file_set, u64 token, int fd); void luo_file_unpreserve_files(struct luo_file_set *file_set); diff --git a/kernel/liveupdate/luo_session.c b/kernel/liveupdate/luo_sessio= n.c index 783677295640..067ffb54c36a 100644 --- a/kernel/liveupdate/luo_session.c +++ b/kernel/liveupdate/luo_session.c @@ -600,47 +600,3 @@ int luo_session_serialize(void) =20 return err; } - -/** - * luo_session_quiesce - Ensure no active sessions exist and lock session = lists. - * - * Acquires exclusive write locks on both incoming and outgoing session li= sts. - * It then validates no sessions exist in either list. - * - * This mechanism is used during file handler un/registration to ensure th= at no - * sessions are currently using the handler, and no new sessions can be cr= eated - * while un/registration is in progress. - * - * This prevents registering new handlers while sessions are active or - * while deserialization is in progress. - * - * Return: - * true - System is quiescent (0 sessions) and locked. - * false - Active sessions exist. The locks are released internally. - */ -bool luo_session_quiesce(void) -{ - down_write(&luo_session_global.incoming.rwsem); - down_write(&luo_session_global.outgoing.rwsem); - - if (luo_session_global.incoming.count || - luo_session_global.outgoing.count) { - up_write(&luo_session_global.outgoing.rwsem); - up_write(&luo_session_global.incoming.rwsem); - return false; - } - - return true; -} - -/** - * luo_session_resume - Unlock session lists and resume normal activity. - * - * Releases the exclusive locks acquired by a successful call to - * luo_session_quiesce(). - */ -void luo_session_resume(void) -{ - up_write(&luo_session_global.outgoing.rwsem); - up_write(&luo_session_global.incoming.rwsem); -} --=20 2.53.0.851.ga537e3e6e9-goog From nobody Mon Apr 6 18:24:24 2026 Received: from mail-yx1-f46.google.com (mail-yx1-f46.google.com [74.125.224.46]) (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 D86EB3DA7C2 for ; Wed, 18 Mar 2026 14:17:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.224.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773843429; cv=none; b=PwDqrc7yoq9qn+ec41iZC57kGXZZHh8UXh1d1TGIu0n3JPfK5cMrJCLHpFP0+JH+ksqj6HkMHYX/C5PQQ8IEoEJ7i95Afz4X+JEk3Lk4tKf/UoV4wUFkAezdLVSGat7UrEKBpeYKyKWaPEhMoLCpiYxd569Y7n4EFNxGAHC6/tc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773843429; c=relaxed/simple; bh=EalrGmrqwRzzH6yUEQF0bva997eCnPDMp/i8mRFTvIA=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Q9CXEjutWP7SFbJ0SrqopCAp5F+lKxDPpo/WExdLldTw1uoy+ukb/muyYg2o4Q2tP8W1LLeZv0KGy5oXKx8s4f2reUwkWGlhEt8BwByHSMyt/bHla3oKdVdoYty8MWURkGEKpDDuj75/dtUqxZzsuubA2CMV6bZL2eb0h9QKR8s= 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=F0cJ3AJP; arc=none smtp.client-ip=74.125.224.46 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="F0cJ3AJP" Received: by mail-yx1-f46.google.com with SMTP id 956f58d0204a3-64c9a6d68e5so5958183d50.3 for ; Wed, 18 Mar 2026 07:17:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=soleen.com; s=google; t=1773843423; x=1774448223; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=J4M6tHJH+NIswtfacOyFlweafgc3XAP5SglzYx4YyzE=; b=F0cJ3AJPh4UEOTpmJK6CCyv0K1N24Fp6Y615VYZNJqSNU7KYQb/AxA0zOWZD+gDlqf 6/HelNw9s4Cns207hwd+r+/UEdJBEKbp/d/X2IlVc/KQ6IG1YMCrRWgg9XtftNoYFD+3 ga2iAvYwKj+vWCmJme9GC/ip/UIHHiK6F8+/GfYrQzv+koJN6PL8t+Kycn1E18DamBtR Hc7J6cjxwp3g6dgLFJcHPdZQRgyF5bMmtATW9fAHfLZH+CNjZIrHujDu9FYGJPdJ/3BL cAiKH51YdhurDGKHXPQ/FCk4n+LhqkwkE0LOWil2qWxqoFMMqCIMwb4LaBWFezp2g1pr e+RQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1773843423; x=1774448223; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=J4M6tHJH+NIswtfacOyFlweafgc3XAP5SglzYx4YyzE=; b=XXoibcV3N77Tn3TXKH66wW/ph8iUNWDiq/2qF8Teq+yrv9DKV+zKD5jzzY0lpB1lV6 ESITaX3KHJvRMLnzfFazN/bvjtpVvggcOXhN5RcSAvUxRc2+eRLE5uPDGz26D7nMJg3H sLgXBVz8ovBimti+HhWxWCCA2teIh0dE59UDg+pLagoOFIvvxcFn3PYPThDq/WVjIPdr +67Ip3mfoJHOI5mP3eZHjgIH9UD7TFuI4EAydIdBxwUJGGqgPSNC5nt2SBlCisK2bf7q oTOvFveyPJGaxHVOqwJY0M5j7Qw/fIW1JNmQMpD+ZdtJh+n+zoen32msavlt7jxSwJef YHZA== X-Forwarded-Encrypted: i=1; AJvYcCWfQ4PzExBhZ7tGsjvytqFRxPHYO35TNneg0C9MYl/MEWeQUPJJxa65QBvMzPN4nexgr5sTQORFV7QcfMQ=@vger.kernel.org X-Gm-Message-State: AOJu0Yyr9rFRMBJcCcdIyAiND3bOFeXbJFPu+Fnj07Rxfm95+l4dn3io I4hnw+9aFP3fFbbA18g/TVLL/0J1pKzXiGjP1OxcdFKPNttFw6rc+k+/QVZkdXq3Ibc= X-Gm-Gg: ATEYQzxue+27I84wFE4tX8aBoUJ6cO3h/Imv88v8O4/bKUjyRIEyLjCq1vjm8FcW+VD W/YzOU13b3i0/8pSNEaYbURHX599r1NublbtwVK8lie61C/WHNiIZIimji/oH8UnNJUqS+rA5+h lPikASV40mlEhzwOtTKHdXVfWGZ2x4oB5558QdjqbaA4ZPmTxMO6ckvfpKuee8MbzRKViQUdTuC aUacuVQcJSo/+9RvDM3x/qQzcWQfXBdqLd9WituhFfjgDA2zDv3nSqIGLn0O45sTz3A3GyyxyR3 c25GAak4ZSoihThVgQJk3KRFjmXYge7fWCHAxR9AwMjEe2G/NHs237A0qfZrsmQYuVk5MlL1X8u rpIV+m+TRQfvZSzp2GaHM/Qk/p6DIr35ZGZxordDBWfujMpGAVMFi1zjP0g0p1ZCedbZKzBxGgx aA7X931VpMyD4vbUG8/ySLZvJmo3TUQCU0D8VQOcG+53bwJmX+E0wf0eimKObSUoQs5frt/Z0ff 2k/RK7vDfsTIE8R/uIk3yzOQgkRFQZHhtjiv0YvE1aISWev+g== X-Received: by 2002:a53:ccc1:0:b0:64c:f90c:740b with SMTP id 956f58d0204a3-64e9133cc6cmr2802395d50.18.1773843422693; Wed, 18 Mar 2026 07:17:02 -0700 (PDT) Received: from soleen.c.googlers.com.com (57.233.150.34.bc.googleusercontent.com. [34.150.233.57]) by smtp.gmail.com with ESMTPSA id 956f58d0204a3-64e91be0e91sm1672028d50.15.2026.03.18.07.17.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Mar 2026 07:17:01 -0700 (PDT) From: Pasha Tatashin To: rppt@kernel.org, akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, pasha.tatashin@soleen.com, dmatlack@google.com, pratyush@kernel.org Subject: [PATCH v2 6/8] liveupdate: Auto unregister FLBs on file handler unregistration Date: Wed, 18 Mar 2026 10:16:44 -0400 Message-ID: <20260318141637.1870220-16-pasha.tatashin@soleen.com> X-Mailer: git-send-email 2.53.0.851.ga537e3e6e9-goog In-Reply-To: <20260318141637.1870220-10-pasha.tatashin@soleen.com> References: <20260318141637.1870220-10-pasha.tatashin@soleen.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=6387; i=pasha.tatashin@soleen.com; h=from:subject; bh=EalrGmrqwRzzH6yUEQF0bva997eCnPDMp/i8mRFTvIA=; b=owEBbQKS/ZANAwAKAbt3KEzbc3reAcsmYgBpurPNTzeG4rxv/awumbGni4KwSHI8Znp/TwC3c +0LmOIOqaCJAjMEAAEKAB0WIQRBMaqT7LRvGvB/NmK7dyhM23N63gUCabqzzQAKCRC7dyhM23N6 3kp7D/9rYKOXxrYJk2Vo8xunmH8iFfYAyW1VooFl+SuhHbwZjw1AkNif4cjY4Xf2ewk0ThMNTQ5 7l987GROBYr+Z0JBaB15vSO79amsq+XsNBD1TbTm+9jRbfF6apyY0ul5pXw43lbV45CkDJ7LvNF sRia+95B/ECSas2//sdqLD/8UqD1R3fDMUBkdSguuoONWkgWfLBoC8fV9KOLr+E50PAAor1XYjw lEpaTVF58eKKeGAN4VGmKVfl7QdaQnd+vx/Zopnbh6L1H677NPE5YE0YXhmE+olW6opFlj4DYFH aQkrt4D2J0jx9QY6eMKGXoadD6ufLUxRDJF6XEEA+8CrZAmOWbNJycefp87udjAuU/pWIdr1FCh gMTLC9X3bwlqkZffir6BfwyCHbZ7zxR8Hhtwq4zYD3DCZo1QkkQrzz0ACo1JtHDGU2bB9/QhWZO I6nJLQVYAtReRso101qqMvsqWnGBcmkdRUPngcLoUzVJ3cGH8prwiLR5ik99jac8O3NEMsBvYMh 83BUndZnaVme2f950b7mUDo7ufJJwxTYK3++gQ41Cupfa5216iaZZeU7MzLvSMzVhYuiodHQwFt 7i7tBY0VF869IR1E6E8RaIan+ol65/ZJHYkfqd4aiVPoWlArw395OleHCAUbSOFfbn+jdvh5+gG uTeI/EbAK1ZhyBA== X-Developer-Key: i=pasha.tatashin@soleen.com; a=openpgp; fpr=CAAAB722DD22A081F0D49F35633A6A993D43B569 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" To ensure that unregistration is always successful and doesn't leave dangling resources, introduce auto-unregistration of FLBs: when a file handler is unregistered, all FLBs associated with it are automatically unregistered. Introduce a new helper luo_flb_unregister_all() which unregisters all FLBs linked to the given file handler. Signed-off-by: Pasha Tatashin --- kernel/liveupdate/luo_file.c | 17 +----- kernel/liveupdate/luo_flb.c | 93 ++++++++++++++++++++------------ kernel/liveupdate/luo_internal.h | 1 + 3 files changed, 61 insertions(+), 50 deletions(-) diff --git a/kernel/liveupdate/luo_file.c b/kernel/liveupdate/luo_file.c index c0ce08d55747..b9ba1b8dce84 100644 --- a/kernel/liveupdate/luo_file.c +++ b/kernel/liveupdate/luo_file.c @@ -873,15 +873,6 @@ int liveupdate_register_file_handler(struct liveupdate= _file_handler *fh) * * Unregisters the file handler from the liveupdate core. This function * reverses the operations of liveupdate_register_file_handler(). - * - * It ensures safe removal by checking that: - * No FLB registered with this file handler. - * - * If the unregistration fails, the internal test state is reverted. - * - * Return: 0 Success. -EOPNOTSUPP when live update is not enabled. -EBUSY = A live - * update is in progress, FLB is registred with - * this file handler. */ int liveupdate_unregister_file_handler(struct liveupdate_file_handler *fh) { @@ -891,15 +882,9 @@ int liveupdate_unregister_file_handler(struct liveupda= te_file_handler *fh) liveupdate_test_unregister(fh); =20 scoped_guard(rwsem_write, &luo_file_handler_lock) { - if (!list_empty(&ACCESS_PRIVATE(fh, flb_list))) - goto err_register; - + luo_flb_unregister_all(fh); list_del(&ACCESS_PRIVATE(fh, list)); } =20 return 0; - -err_register: - liveupdate_test_register(fh); - return -EBUSY; } diff --git a/kernel/liveupdate/luo_flb.c b/kernel/liveupdate/luo_flb.c index 8bbe11a7286b..5b61c0844a49 100644 --- a/kernel/liveupdate/luo_flb.c +++ b/kernel/liveupdate/luo_flb.c @@ -316,6 +316,64 @@ void luo_flb_file_finish(struct liveupdate_file_handle= r *fh) luo_flb_file_finish_one(iter->flb); } =20 +static void luo_flb_unregister_one(struct liveupdate_file_handler *fh, + struct liveupdate_flb *flb) +{ + struct luo_flb_private *private =3D luo_flb_get_private(flb); + struct list_head *flb_list =3D &ACCESS_PRIVATE(fh, flb_list); + struct luo_flb_link *iter; + bool found =3D false; + + /* Find and remove the link from the file handler's list */ + list_for_each_entry(iter, flb_list, list) { + if (iter->flb =3D=3D flb) { + list_del(&iter->list); + kfree(iter); + found =3D true; + break; + } + } + + if (!found) { + pr_warn("Failed to unregister FLB '%s': not found in file handler '%s'\n= ", + flb->compatible, fh->compatible); + return; + } + + private->users--; + + /* + * If this is the last file-handler with which we are registred, remove + * from the global list. + */ + if (!private->users) { + list_del_init(&private->list); + luo_flb_global.count--; + } +} + +/** + * luo_flb_unregister_all - Unregister all FLBs associated with a file han= dler. + * @fh: The file handler whose FLBs should be unregistered. + * + * This function iterates through the list of FLBs associated with the giv= en + * file handler and unregisters them all one by one. + */ +void luo_flb_unregister_all(struct liveupdate_file_handler *fh) +{ + struct list_head *flb_list =3D &ACCESS_PRIVATE(fh, flb_list); + struct luo_flb_link *iter, *tmp; + + if (!liveupdate_enabled()) + return; + + guard(rwsem_write)(&luo_flb_lock); + guard(rwsem_write)(&ACCESS_PRIVATE(fh, flb_lock)); + + list_for_each_entry_safe(iter, tmp, flb_list, list) + luo_flb_unregister_one(fh, iter->flb); +} + /** * liveupdate_register_flb - Associate an FLB with a file handler and regi= ster it globally. * @fh: The file handler that will now depend on the FLB. @@ -417,50 +475,17 @@ int liveupdate_register_flb(struct liveupdate_file_ha= ndler *fh, * the FLB is removed from the global registry and the reference to its * owner module (acquired during registration) is released. * - * Context: This function ensures the session is quiesced (no active FDs - * being created) during the update. It is typically called from a - * subsystem's module exit function. - * Return: 0 on success. - * -EOPNOTSUPP if live update is disabled. - * -EBUSY if the live update session is active and cannot be quies= ced. - * -ENOENT if the FLB was not found in the file handler's list. */ int liveupdate_unregister_flb(struct liveupdate_file_handler *fh, struct liveupdate_flb *flb) { - struct luo_flb_private *private =3D luo_flb_get_private(flb); - struct list_head *flb_list =3D &ACCESS_PRIVATE(fh, flb_list); - struct luo_flb_link *iter; - int err =3D -ENOENT; - if (!liveupdate_enabled()) return -EOPNOTSUPP; =20 guard(rwsem_write)(&luo_flb_lock); guard(rwsem_write)(&ACCESS_PRIVATE(fh, flb_lock)); =20 - /* Find and remove the link from the file handler's list */ - list_for_each_entry(iter, flb_list, list) { - if (iter->flb =3D=3D flb) { - list_del(&iter->list); - kfree(iter); - err =3D 0; - break; - } - } - - if (err) - return err; - - private->users--; - /* - * If this is the last file-handler with which we are registred, remove - * from the global list. - */ - if (!private->users) { - list_del_init(&private->list); - luo_flb_global.count--; - } + luo_flb_unregister_one(fh, flb); =20 return 0; } diff --git a/kernel/liveupdate/luo_internal.h b/kernel/liveupdate/luo_inter= nal.h index ec949f91c8c1..730c3faa7616 100644 --- a/kernel/liveupdate/luo_internal.h +++ b/kernel/liveupdate/luo_internal.h @@ -101,6 +101,7 @@ void luo_file_set_destroy(struct luo_file_set *file_set= ); int luo_flb_file_preserve(struct liveupdate_file_handler *fh); void luo_flb_file_unpreserve(struct liveupdate_file_handler *fh); void luo_flb_file_finish(struct liveupdate_file_handler *fh); +void luo_flb_unregister_all(struct liveupdate_file_handler *fh); int __init luo_flb_setup_outgoing(void *fdt); int __init luo_flb_setup_incoming(void *fdt); void luo_flb_serialize(void); --=20 2.53.0.851.ga537e3e6e9-goog From nobody Mon Apr 6 18:24:24 2026 Received: from mail-yx1-f52.google.com (mail-yx1-f52.google.com [74.125.224.52]) (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 2E9A33DD512 for ; Wed, 18 Mar 2026 14:17:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.224.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773843428; cv=none; b=beEnPziJG+GqBu01AexJtydQXOGvuWymAiaLI4OxBSc0WTdc1WVH56r/kC2SjjxY5wHQLI3p5NXOMBQ9kzpm5/X9No+VIt/gC/2Jb65ck3Cn+je47dQUQ+tXwgtD2w0iyEgJu1MCdXsIj8WW/lG7OAgBwl6wFlYMhLrBP4pzHmQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773843428; c=relaxed/simple; bh=K0BUPL/dwXL3g5pX2ncyNWZVq0YZ4fBzU0LlavaQGd4=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=CoiETjgZalWlWQ5cwGD3iB6B9Oaul2Z7XaSVXd97w+jwapFL/m0ejE0ZFLCqLhNuGfkGxN4IdRkTevmqNSbhddufyjDVvNSsNQWR0ZDyCfxcTJM4HJ324CqgapziVFgc+9+PJVoQRREph33KcKUByGqQ2okw3hUCb/Qlzmr3ad8= 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=Fw99+cce; arc=none smtp.client-ip=74.125.224.52 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="Fw99+cce" Received: by mail-yx1-f52.google.com with SMTP id 956f58d0204a3-64ca6595c8aso6625299d50.0 for ; Wed, 18 Mar 2026 07:17:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=soleen.com; s=google; t=1773843424; x=1774448224; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=ttHPCX4MWc57OiDPcB0pv4zDHcsSOXKOATFAKs8NkL8=; b=Fw99+cceqh7nbufjR7+CWX6kOL9WB8NDYMMVP7Va2HuJ60wCkJbM2hpl7jmCn8SlRb XeJK7IG6jsIK+fiWWXJ1KfpURZ/Z8uAjsTNEt73d6RbWDCeDHlF08rIjOi90wMXjBRqx Ntr2YujWYII77JuS+fnSfQ7xdsbzq4NgxbxfTe45oog8PG6dupmIlCF4o7aaPX6UCNVy lbWZtrz8ob61uzAQLbc4L43r6m8wIrUePPyyNX1VLnD19uo2QYwmctyUGPGPK2hVhHLz Is4+6ATkWe3+l4WxEDV9P3YqkDUO7yF1rtCf5ZnsWYfmCFCy9E1nxOTTmMQLb1r0/rAd 5erA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1773843424; x=1774448224; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=ttHPCX4MWc57OiDPcB0pv4zDHcsSOXKOATFAKs8NkL8=; b=IXD66IJeTtCDfykYKxZJ+4fLjN7fUj22mAG7hL+pgqzFVi7xgr/myh81/LtIeEgtsL e8lWTYYhC2gTYDBAC9l0mnWXWdiYYxZJk4GBVW9BlD/EfoKP8azNrcQbyP15mix5c3T0 IAm0jyGrnarzBiD32Bi2c0AFWEtxIIa7n3meJ2U/hRL5DRmKpUT3OdAG1WfjwXoAWTuS iWLj7dkfKrRogu6YoJhGtdu+AnQyv/n7k8FxPgwjd+tqKLHNjEu9wAQSKGiLuPPZJiS7 BnnlIKkmlFo5Bt3BbuZmjGzgH55QB2EGRRaKOAc9bfpJ43CafCjR77VSitEUwjSYgK1w SB3w== X-Forwarded-Encrypted: i=1; AJvYcCXsBKIqZDNfA96f2sd3W8SBwB0/qASf3wvZgbNcwBBXDA7GiAZ76bdVgmRUZf/19u91DGtD3Nox1jYZIWI=@vger.kernel.org X-Gm-Message-State: AOJu0YxnYHO+kL8mfek4zfQ2FVyOP2moTzoqaaLbWMh2w94u0sUoPAgt ym4nqkqwsUfGDuxvhoTxb+vFK/dTsMMA4ihaqyjDA4fCVgy82zCxtvhhgVjpx7TcP+/cGB31zRj qMDfs X-Gm-Gg: ATEYQzw2UBmojvG3x/QU7MjY7V/DD4Ei823VD10uUEUmTRMrHSWpaQ3dPP4c106WWAt fnvaBUFUu2CKwXLHVY31Pp6uLIqRw9N9MCdzd3enz458yvU13PEAzaq6XSL9D4awsTpx2FM9ExR 9GQGt7EI66vbvIQeqTkjGzTr0LrV0SPKX49knqhpjO3uvz1yLLHZ/Os/JR4SZLVL1iRr/6HymTH XRw8GbBIiys+pZoCHm7QTEUwtmCAfUfBjjD8LGYA8n718CjxW3HrfecDr5fRh3K0YRiLzo9EqfB LjcMXP3NArdKiSUQBU8I3j17joS320JnWdTqmLXuwmU3dBGCviE8gp3jWWss1krpNJAtYGKC6YM RypS8GzhhwJNKVmqCg7GhidQS+5O7Q78XOlEsApKoP3cWGhljq/PuU6Or0BZ0rgjOqyIJrXjzHM 8BCxep3ng5GNxrORZr1UQiVKM6SetcbqLAvGRORDr23eIIGFEWVDBEtf3j8ulC5PhRQXvEsXbBL OANrK+msf8vQvHaWUbOwqvhAWKN5NZAMse8I9uyUBTLN+HtBA== X-Received: by 2002:a53:b191:0:b0:64e:597a:f5c2 with SMTP id 956f58d0204a3-64e915e80f8mr2412684d50.65.1773843423813; Wed, 18 Mar 2026 07:17:03 -0700 (PDT) Received: from soleen.c.googlers.com.com (57.233.150.34.bc.googleusercontent.com. [34.150.233.57]) by smtp.gmail.com with ESMTPSA id 956f58d0204a3-64e91be0e91sm1672028d50.15.2026.03.18.07.17.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Mar 2026 07:17:03 -0700 (PDT) From: Pasha Tatashin To: rppt@kernel.org, akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, pasha.tatashin@soleen.com, dmatlack@google.com, pratyush@kernel.org Subject: [PATCH v2 7/8] liveupdate: Remove liveupdate_test_unregister() Date: Wed, 18 Mar 2026 10:16:45 -0400 Message-ID: <20260318141637.1870220-17-pasha.tatashin@soleen.com> X-Mailer: git-send-email 2.53.0.851.ga537e3e6e9-goog In-Reply-To: <20260318141637.1870220-10-pasha.tatashin@soleen.com> References: <20260318141637.1870220-10-pasha.tatashin@soleen.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2549; i=pasha.tatashin@soleen.com; h=from:subject; bh=K0BUPL/dwXL3g5pX2ncyNWZVq0YZ4fBzU0LlavaQGd4=; b=owEBbQKS/ZANAwAKAbt3KEzbc3reAcsmYgBpurPP1LV3yCAjinWTg6lNdro69Oow89FShnYUd 5XBSotUvG6JAjMEAAEKAB0WIQRBMaqT7LRvGvB/NmK7dyhM23N63gUCabqzzwAKCRC7dyhM23N6 3gxdD/kBAcbVuJAln8vuFoiIAN/2+S34O9sqBq1g8GB8w094PpFKGMIVriocJu24Nugz9RgvsJc aYXnK4/JiWqX8HH2J3v7lPblg4lHrxQdrU2BwTYV1zsXXgGuWOlN72SPcYr3RnadUL0JWLByL1C Z8iQRIPsrIXO3XPVh4ym+36kyAQqYTCqF8rB4jUu4RmQkLYKb7xogSPXz79WeIH8jCAbn01JWd7 Bu7MkunLbH66XySlw86xMt7m2cjo6OySzpJSSzJQAX7TFoNkYmL1bhs4aWt60/+PXmwOskOI5kL s9F07J6nCAkvcksHFljYSlxWWDlXTQS8yonCFone3vpZjwSxtR95odn7coLdP1ZF9QOfnqGiFCq SYfhoi3lAnh6o8DCPhHPUvLSqQXIt3riz1iMF8wst4/PHvsPVpll0kJ57yT8FioUNqtBpIpaOCQ HLr6SXaOue7bV7NryUZIBgAoLH/gqdAMvN3W9uxG6EvtTQkTHr5TogqT/GXOUpNU729IjQA+B9L INIDFx/1WpjBN1njv04RDwITIsilyEcyZoORtbG0TdCPf/qQdwIA/qi7QUopi11DcztF1MippWz cIembuzdpPOOKQT/tDjQoPjwzJ+YjK+VMIfo8ow4j1f5C1soH+AlvM1ceVHiAKBnpvDzaepMtQP xXcnPwGm1ALSP7Q== X-Developer-Key: i=pasha.tatashin@soleen.com; a=openpgp; fpr=CAAAB722DD22A081F0D49F35633A6A993D43B569 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Now that file handler unregistration automatically unregisters all associated file handlers (FLBs), the liveupdate_test_unregister() function is no longer needed. Remove it along with its usages and declarations. Signed-off-by: Pasha Tatashin --- kernel/liveupdate/luo_file.c | 2 -- kernel/liveupdate/luo_internal.h | 2 -- lib/tests/liveupdate.c | 18 ------------------ 3 files changed, 22 deletions(-) diff --git a/kernel/liveupdate/luo_file.c b/kernel/liveupdate/luo_file.c index b9ba1b8dce84..c9c26015020b 100644 --- a/kernel/liveupdate/luo_file.c +++ b/kernel/liveupdate/luo_file.c @@ -879,8 +879,6 @@ int liveupdate_unregister_file_handler(struct liveupdat= e_file_handler *fh) if (!liveupdate_enabled()) return -EOPNOTSUPP; =20 - liveupdate_test_unregister(fh); - scoped_guard(rwsem_write, &luo_file_handler_lock) { luo_flb_unregister_all(fh); list_del(&ACCESS_PRIVATE(fh, list)); diff --git a/kernel/liveupdate/luo_internal.h b/kernel/liveupdate/luo_inter= nal.h index 730c3faa7616..137ae317188a 100644 --- a/kernel/liveupdate/luo_internal.h +++ b/kernel/liveupdate/luo_internal.h @@ -108,10 +108,8 @@ void luo_flb_serialize(void); =20 #ifdef CONFIG_LIVEUPDATE_TEST void liveupdate_test_register(struct liveupdate_file_handler *fh); -void liveupdate_test_unregister(struct liveupdate_file_handler *fh); #else static inline void liveupdate_test_register(struct liveupdate_file_handler= *fh) { } -static inline void liveupdate_test_unregister(struct liveupdate_file_handl= er *fh) { } #endif =20 #endif /* _LINUX_LUO_INTERNAL_H */ diff --git a/lib/tests/liveupdate.c b/lib/tests/liveupdate.c index 496d6ef91a30..e4b0ecbee32f 100644 --- a/lib/tests/liveupdate.c +++ b/lib/tests/liveupdate.c @@ -135,24 +135,6 @@ void liveupdate_test_register(struct liveupdate_file_h= andler *fh) TEST_NFLBS, fh->compatible); } =20 -void liveupdate_test_unregister(struct liveupdate_file_handler *fh) -{ - int err, i; - - for (i =3D 0; i < TEST_NFLBS; i++) { - struct liveupdate_flb *flb =3D &test_flbs[i]; - - err =3D liveupdate_unregister_flb(fh, flb); - if (err) { - pr_err("Failed to unregister %s %pe\n", - flb->compatible, ERR_PTR(err)); - } - } - - pr_info("Unregistered %d FLBs from file handler: [%s]\n", - TEST_NFLBS, fh->compatible); -} - MODULE_LICENSE("GPL"); MODULE_AUTHOR("Pasha Tatashin "); MODULE_DESCRIPTION("In-kernel test for LUO mechanism"); --=20 2.53.0.851.ga537e3e6e9-goog From nobody Mon Apr 6 18:24:24 2026 Received: from mail-yx1-f54.google.com (mail-yx1-f54.google.com [74.125.224.54]) (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 750813DC4B5 for ; Wed, 18 Mar 2026 14:17:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.224.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773843428; cv=none; b=J7Wzu5aslsO3O0MDVoSRCPemsJzgkjbtbY4xICz+LlNt4qz2Y+cSEtYIzrkK+bbRSy0bGoseEG7h1Aumr8QSRmWr/LszxpzZb8myN9W+5TWl9pQe68H7nN6hWMoajFc95Ix6uXkG6keHqJ7bp1RnZxlieEL4ELuZGYpPxtcMRmU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773843428; c=relaxed/simple; bh=iQJqefJr/CoUSt54uwlSGDn/SfrrD/dJQLTwLis101Q=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=GAQsLYe0Zmsgv99vlawQxR7CiSvbNMBcnETD4ZVMzP7h7aqMH0gyJdKFuCTlsD8kLfndG6O6izi430z7Z500vfLg7Nh4VUSiDICgUtmOWPB5a7wcpIDQslA/J/4RS6PQ/eP/8LmepQql5Rz9WmUEoNGkESY8Vk9j6A97zw63c1Q= 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=R2Puydnx; arc=none smtp.client-ip=74.125.224.54 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="R2Puydnx" Received: by mail-yx1-f54.google.com with SMTP id 956f58d0204a3-64e87a81639so2640835d50.0 for ; Wed, 18 Mar 2026 07:17:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=soleen.com; s=google; t=1773843425; x=1774448225; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=zJIAgTqcwEqKxZF+DzcRiR6G39ka6soPVjhZwY8SjyM=; b=R2PuydnxEw1OVL5t3eHUFXZu0gsXQ/04IT8nLnpbP78crveRy5Wu3NyN+lDLgSBOrF H73RFPxzIY+OGIr5UWQRtFNBTROc6DdMaN5aMLK8OHOzJIUIdl1X3Qq99nx0KFBe3+J4 osAk1SBoxEfuqV0coQMG9Nk2JzyQk6KZNwzTLVOuXxF3oPm0gpQ+JT4WhXMCgLhzqF1a qggQcF4sfzr3YiQDOIzOJhB3z4Il6Jxl7095NnoZGVR/sdodAkKrfFZ3eqthKx/wJKdK pyTZpuGMPB7IrgcJ0YC0+PpaPXv9I6fIP4uhI+DYB/W/DwfkUHLmcMd4nivjy9Sx7Oyn L8hw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1773843425; x=1774448225; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=zJIAgTqcwEqKxZF+DzcRiR6G39ka6soPVjhZwY8SjyM=; b=eaUMPSfGXszA2cri+3JbvEXg6sySD4FZHpmS0jsPBWosvYusXu1Au3bozDOAmlG8O7 BuapTYyQE+IWS4g6E7gUE8c7/JwUsDId1j6tSIbCT4gGYP2h9si3lvMQzH6QX6M5esgw htS2GaFGb0wHxomgaAq5xwmz0CnvD/KcbTHqmCiL+8D9nxI1W9dz+xhV0pVAlAeJO74u 0Lixvf4zUzDayHhwtcOiX0Jg7hcdySLuNn8Rs+HRtO3nejP5TSzR/5FkoHauXIbntECW n73psddqMc3gjC7/jtpLOAyLdX8PV14zx4DEEHAPRCduHMYhn5HiUODcsDoYSJNgv8EU T+/A== X-Forwarded-Encrypted: i=1; AJvYcCUEMEo5g4bUblH/kDWaftCHjeW2wm/19lonmqRcqhTNGsG0lLQiL0jvOTXvs6L8ImST2s5j1ZtKMujpOsE=@vger.kernel.org X-Gm-Message-State: AOJu0Yx0lQqlb6ZaNhrLoKEO23hbP0uCi0ds9dq/t4T8Q6gEAIngf8zg eUU9Vcj17RXRer0VAuDDOcUQZxoHdcdu9MxXrF5SlRfZImDQMmFG6YHvos2uABedZ9Y= X-Gm-Gg: ATEYQzxmgeiM5aPRKeOGNDtsMVkngtm7FR7BVzl/0sNJq0CctvYEuShmNUBC8IP8LJ4 vV0xZH+zbmoJ+/I7hBepvlcQAtUFMtvcurpwKvK9m2xE8mcb5ExcrsDlfpNph27DuGQJgWHz3Yc MZ7lxcH5PKJ6o0kkxOqeeMt65NDlQXfpDN8Qge3nB2aNyIFEtsFm9DT9fE2y4ZXIc3Yxh83FVrB /6xBDM109QE7zOyQnhlcs/EAvm49eKLTf3ht2O5LdnNf5u41lEY1+VMDRtQVptW35m9oJWyzuZI IuZjVkHgvA4AogjpeyQF7jzXtFz6zaBrhYJJ5veTPkfdbNO3x0b6on2DODnzG4irdZuC2wcovBQ /gg+ABclRtGFlO2H7Unk/QeN9Ta4KPqXHwxh8Gh37J1Y6UTfaU0AkTf4H09WXinB0H+0FNjiBhF QzQlsjF35DP4xqvbAKa56Ij1e5jNXGq4aBHScCXatlsbAd481pyTHwQkM3ZoAAbrE6dpznjgrBv Y1tVf2vzG7tvF3Fzbas1PRIaLkxjwv8HgOQx2FCenuW/EyWWQ== X-Received: by 2002:a53:b451:0:b0:64e:7d41:29a6 with SMTP id 956f58d0204a3-64e9172c834mr2927143d50.78.1773843425032; Wed, 18 Mar 2026 07:17:05 -0700 (PDT) Received: from soleen.c.googlers.com.com (57.233.150.34.bc.googleusercontent.com. [34.150.233.57]) by smtp.gmail.com with ESMTPSA id 956f58d0204a3-64e91be0e91sm1672028d50.15.2026.03.18.07.17.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Mar 2026 07:17:04 -0700 (PDT) From: Pasha Tatashin To: rppt@kernel.org, akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, pasha.tatashin@soleen.com, dmatlack@google.com, pratyush@kernel.org Subject: [PATCH v2 8/8] liveupdate: Make unregister functions return void Date: Wed, 18 Mar 2026 10:16:46 -0400 Message-ID: <20260318141637.1870220-18-pasha.tatashin@soleen.com> X-Mailer: git-send-email 2.53.0.851.ga537e3e6e9-goog In-Reply-To: <20260318141637.1870220-10-pasha.tatashin@soleen.com> References: <20260318141637.1870220-10-pasha.tatashin@soleen.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=4047; i=pasha.tatashin@soleen.com; h=from:subject; bh=iQJqefJr/CoUSt54uwlSGDn/SfrrD/dJQLTwLis101Q=; b=owEBbQKS/ZANAwAKAbt3KEzbc3reAcsmYgBpurPQ01nnBZVHBvgS5KZW9wUgfyP0EgxeiXQoQ Aio6skXjrSJAjMEAAEKAB0WIQRBMaqT7LRvGvB/NmK7dyhM23N63gUCabqz0AAKCRC7dyhM23N6 3qYdEADIX8djMB8QpL7SqEjHbjgNU4y6AHtYiJSRuvwaqKvRH9B/uTysQ9JuByNUn+QCH+u9yOI uAgpflNxMb3xxezKl/4CjMyqMwjxcIhdw3kAY4O5GoJsMHpCDtqVfHLPJ+CH31h1hH50Il0NKGV AcT3X53LUz0Zlv7nXC0/5pB+mkR0KSLbtrCLMs1NNl3RqJ43a+2jtRq2+uYnqakButu+3GcdBx7 MjogkEWuhtHzgYCI0sa8gq8AdUFMxf8Ng62w6E6DGlaSOm8h+V0xKlV9ZczAeQ3oK7eis2RdYuA Y/zb58JqMTHw7jILMxq8Q8kUiv/5AI3SS/jLuyE7eDwUz3s627zXDITXdBOkkW6QcyxFNlFMu56 jQVigdcJm/8S8w9d/3ghjQ8Jr7QuhlG3SptT8J9QG4Wld5Zi13Gcd1keHjw9Tp5QDzVk2yfHMOc a//f0+R9F4VJshhpzAlFiJzVpb7GE/gCxB37WyLq+/av7UqWlRICO4o9J9TTcUujty4N4LekaS9 VtluW/IkW4XIviSrynpY4KxRWo4kiBocTX+d+SlK/sj6nKUhG4KW7IrTg7V3uK9XO5x3lD4AR6Y EJfxB9ZuNiX7eruEQWckstsGNqwrh+d11lM+YPWBix0OTifxDCn3iO/m4PENWX3FBhfYWa+qOAy IrUAF+aiUQjauCQ== X-Developer-Key: i=pasha.tatashin@soleen.com; a=openpgp; fpr=CAAAB722DD22A081F0D49F35633A6A993D43B569 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Change liveupdate_unregister_file_handler and liveupdate_unregister_flb to return void instead of an error code. This follows the design principle that unregistration during module unload should not fail, as the unload cannot be stopped at that point. Signed-off-by: Pasha Tatashin --- include/linux/liveupdate.h | 14 ++++++-------- kernel/liveupdate/luo_file.c | 6 ++---- kernel/liveupdate/luo_flb.c | 8 +++----- 3 files changed, 11 insertions(+), 17 deletions(-) diff --git a/include/linux/liveupdate.h b/include/linux/liveupdate.h index 8394fb2d8774..636175432d62 100644 --- a/include/linux/liveupdate.h +++ b/include/linux/liveupdate.h @@ -231,12 +231,12 @@ bool liveupdate_enabled(void); int liveupdate_reboot(void); =20 int liveupdate_register_file_handler(struct liveupdate_file_handler *fh); -int liveupdate_unregister_file_handler(struct liveupdate_file_handler *fh); +void liveupdate_unregister_file_handler(struct liveupdate_file_handler *fh= ); =20 int liveupdate_register_flb(struct liveupdate_file_handler *fh, struct liveupdate_flb *flb); -int liveupdate_unregister_flb(struct liveupdate_file_handler *fh, - struct liveupdate_flb *flb); +void liveupdate_unregister_flb(struct liveupdate_file_handler *fh, + struct liveupdate_flb *flb); =20 int liveupdate_flb_get_incoming(struct liveupdate_flb *flb, void **objp); int liveupdate_flb_get_outgoing(struct liveupdate_flb *flb, void **objp); @@ -258,9 +258,8 @@ static inline int liveupdate_register_file_handler(stru= ct liveupdate_file_handle return -EOPNOTSUPP; } =20 -static inline int liveupdate_unregister_file_handler(struct liveupdate_fil= e_handler *fh) +static inline void liveupdate_unregister_file_handler(struct liveupdate_fi= le_handler *fh) { - return -EOPNOTSUPP; } =20 static inline int liveupdate_register_flb(struct liveupdate_file_handler *= fh, @@ -269,10 +268,9 @@ static inline int liveupdate_register_flb(struct liveu= pdate_file_handler *fh, return -EOPNOTSUPP; } =20 -static inline int liveupdate_unregister_flb(struct liveupdate_file_handler= *fh, - struct liveupdate_flb *flb) +static inline void liveupdate_unregister_flb(struct liveupdate_file_handle= r *fh, + struct liveupdate_flb *flb) { - return -EOPNOTSUPP; } =20 static inline int liveupdate_flb_get_incoming(struct liveupdate_flb *flb, diff --git a/kernel/liveupdate/luo_file.c b/kernel/liveupdate/luo_file.c index c9c26015020b..a38ea4975824 100644 --- a/kernel/liveupdate/luo_file.c +++ b/kernel/liveupdate/luo_file.c @@ -874,15 +874,13 @@ int liveupdate_register_file_handler(struct liveupdat= e_file_handler *fh) * Unregisters the file handler from the liveupdate core. This function * reverses the operations of liveupdate_register_file_handler(). */ -int liveupdate_unregister_file_handler(struct liveupdate_file_handler *fh) +void liveupdate_unregister_file_handler(struct liveupdate_file_handler *fh) { if (!liveupdate_enabled()) - return -EOPNOTSUPP; + return; =20 scoped_guard(rwsem_write, &luo_file_handler_lock) { luo_flb_unregister_all(fh); list_del(&ACCESS_PRIVATE(fh, list)); } - - return 0; } diff --git a/kernel/liveupdate/luo_flb.c b/kernel/liveupdate/luo_flb.c index 5b61c0844a49..874830f8e44d 100644 --- a/kernel/liveupdate/luo_flb.c +++ b/kernel/liveupdate/luo_flb.c @@ -476,18 +476,16 @@ int liveupdate_register_flb(struct liveupdate_file_ha= ndler *fh, * owner module (acquired during registration) is released. * */ -int liveupdate_unregister_flb(struct liveupdate_file_handler *fh, - struct liveupdate_flb *flb) +void liveupdate_unregister_flb(struct liveupdate_file_handler *fh, + struct liveupdate_flb *flb) { if (!liveupdate_enabled()) - return -EOPNOTSUPP; + return; =20 guard(rwsem_write)(&luo_flb_lock); guard(rwsem_write)(&ACCESS_PRIVATE(fh, flb_lock)); =20 luo_flb_unregister_one(fh, flb); - - return 0; } =20 /** --=20 2.53.0.851.ga537e3e6e9-goog