hc
2023-11-06 e3e12f52b214121840b44c91de5b3e5af5d3eb84
kernel/fs/aio.c
....@@ -121,6 +121,7 @@
121121 long nr_pages;
122122
123123 struct rcu_work free_rwork; /* see free_ioctx() */
124
+ struct work_struct free_work; /* see free_ioctx() */
124125
125126 /*
126127 * signals when all in-flight requests are done
....@@ -608,9 +609,9 @@
608609 * and ctx->users has dropped to 0, so we know no more kiocbs can be submitted -
609610 * now it's safe to cancel any that need to be.
610611 */
611
-static void free_ioctx_users(struct percpu_ref *ref)
612
+static void free_ioctx_users_work(struct work_struct *work)
612613 {
613
- struct kioctx *ctx = container_of(ref, struct kioctx, users);
614
+ struct kioctx *ctx = container_of(work, struct kioctx, free_work);
614615 struct aio_kiocb *req;
615616
616617 spin_lock_irq(&ctx->ctx_lock);
....@@ -628,6 +629,14 @@
628629 percpu_ref_put(&ctx->reqs);
629630 }
630631
632
+static void free_ioctx_users(struct percpu_ref *ref)
633
+{
634
+ struct kioctx *ctx = container_of(ref, struct kioctx, users);
635
+
636
+ INIT_WORK(&ctx->free_work, free_ioctx_users_work);
637
+ schedule_work(&ctx->free_work);
638
+}
639
+
631640 static int ioctx_add_table(struct kioctx *ctx, struct mm_struct *mm)
632641 {
633642 unsigned i, new_nr;