Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

liveupdate: defer FLB module refcounting to active sessions

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.

Link: https://lore.kernel.org/20260327033335.696621-6-pasha.tatashin@soleen.com
Signed-off-by: Pasha Tatashin <pasha.tatashin@soleen.com>
Reviewed-by: Samiullah Khawaja <skhawaja@google.com>
Reviewed-by: Pratyush Yadav (Google) <pratyush@kernel.org>
Cc: David Matlack <dmatlack@google.com>
Cc: Mike Rapoport <rppt@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Pasha Tatashin and committed by
Andrew Morton
76be9983 6b2b22f7

+17 -10
+17 -10
kernel/liveupdate/luo_flb.c
··· 115 115 struct liveupdate_flb_op_args args = {0}; 116 116 int err; 117 117 118 + if (!try_module_get(flb->ops->owner)) 119 + return -ENODEV; 120 + 118 121 args.flb = flb; 119 122 err = flb->ops->preserve(&args); 120 - if (err) 123 + if (err) { 124 + module_put(flb->ops->owner); 121 125 return err; 126 + } 122 127 private->outgoing.data = args.data; 123 128 private->outgoing.obj = args.obj; 124 129 } ··· 151 146 152 147 private->outgoing.data = 0; 153 148 private->outgoing.obj = NULL; 149 + module_put(flb->ops->owner); 154 150 } 155 151 } 156 152 } ··· 187 181 if (!found) 188 182 return -ENOENT; 189 183 184 + if (!try_module_get(flb->ops->owner)) 185 + return -ENODEV; 186 + 190 187 args.flb = flb; 191 188 args.data = private->incoming.data; 192 189 193 190 err = flb->ops->retrieve(&args); 194 - if (err) 191 + if (err) { 192 + module_put(flb->ops->owner); 195 193 return err; 194 + } 196 195 197 196 private->incoming.obj = args.obj; 198 197 private->incoming.retrieved = true; ··· 231 220 private->incoming.data = 0; 232 221 private->incoming.obj = NULL; 233 222 private->incoming.finished = true; 223 + module_put(flb->ops->owner); 234 224 } 235 225 } 236 226 } ··· 407 395 goto err_resume; 408 396 } 409 397 410 - if (!try_module_get(flb->ops->owner)) { 411 - err = -EAGAIN; 412 - goto err_resume; 413 - } 414 - 415 398 list_add_tail(&private->list, &luo_flb_global.list); 416 399 luo_flb_global.count++; 417 400 } ··· 483 476 private->users--; 484 477 /* 485 478 * If this is the last file-handler with which we are registred, remove 486 - * from the global list, and relese module reference. 479 + * from the global list. 487 480 */ 488 481 if (!private->users) { 489 482 list_del_init(&private->list); 490 483 luo_flb_global.count--; 491 - module_put(flb->ops->owner); 492 484 } 493 485 494 486 up_write(&luo_register_rwlock); ··· 516 510 * 517 511 * Return: 0 on success, or a negative errno on failure. -ENODATA means no 518 512 * incoming FLB data, -ENOENT means specific flb not found in the incoming 519 - * data, and -EOPNOTSUPP when live update is disabled or not configured. 513 + * data, -ENODEV if the FLB's module is unloading, and -EOPNOTSUPP when 514 + * live update is disabled or not configured. 520 515 */ 521 516 int liveupdate_flb_get_incoming(struct liveupdate_flb *flb, void **objp) 522 517 {