Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
linux-guf
Manage
Activity
Members
Labels
Code
Merge requests
6
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SECO Northern Europe
Kernel
linux-guf
Commits
06af121e
Commit
06af121e
authored
13 years ago
by
Al Viro
Browse files
Options
Downloads
Patches
Plain Diff
aio: merge aio_cancel_all() with wait_for_all_aios()
Signed-off-by:
Al Viro
<
viro@zeniv.linux.org.uk
>
parent
a1c2aa1e
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
fs/aio.c
+7
-15
7 additions, 15 deletions
fs/aio.c
with
7 additions
and
15 deletions
fs/aio.c
+
7
−
15
View file @
06af121e
...
...
@@ -305,15 +305,18 @@ static struct kioctx *ioctx_alloc(unsigned nr_events)
return
ERR_PTR
(
err
);
}
/*
aio_cancel_all
/*
kill_ctx
* Cancels all outstanding aio requests on an aio context. Used
* when the processes owning a context have all exited to encourage
* the rapid destruction of the kioctx.
*/
static
void
aio_cancel_all
(
struct
kioctx
*
ctx
)
static
void
kill_ctx
(
struct
kioctx
*
ctx
)
{
int
(
*
cancel
)(
struct
kiocb
*
,
struct
io_event
*
);
struct
task_struct
*
tsk
=
current
;
DECLARE_WAITQUEUE
(
wait
,
tsk
);
struct
io_event
res
;
spin_lock_irq
(
&
ctx
->
ctx_lock
);
ctx
->
dead
=
1
;
while
(
!
list_empty
(
&
ctx
->
active_reqs
))
{
...
...
@@ -329,15 +332,7 @@ static void aio_cancel_all(struct kioctx *ctx)
spin_lock_irq
(
&
ctx
->
ctx_lock
);
}
}
spin_unlock_irq
(
&
ctx
->
ctx_lock
);
}
static
void
wait_for_all_aios
(
struct
kioctx
*
ctx
)
{
struct
task_struct
*
tsk
=
current
;
DECLARE_WAITQUEUE
(
wait
,
tsk
);
spin_lock_irq
(
&
ctx
->
ctx_lock
);
if
(
!
ctx
->
reqs_active
)
goto
out
;
...
...
@@ -387,9 +382,7 @@ void exit_aio(struct mm_struct *mm)
ctx
=
hlist_entry
(
mm
->
ioctx_list
.
first
,
struct
kioctx
,
list
);
hlist_del_rcu
(
&
ctx
->
list
);
aio_cancel_all
(
ctx
);
wait_for_all_aios
(
ctx
);
kill_ctx
(
ctx
);
if
(
1
!=
atomic_read
(
&
ctx
->
users
))
printk
(
KERN_DEBUG
...
...
@@ -1269,8 +1262,7 @@ static void io_destroy(struct kioctx *ioctx)
if
(
likely
(
!
was_dead
))
put_ioctx
(
ioctx
);
/* twice for the list */
aio_cancel_all
(
ioctx
);
wait_for_all_aios
(
ioctx
);
kill_ctx
(
ioctx
);
/*
* Wake up any waiters. The setting of ctx->dead must be seen
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment