lkml.org 
[lkml]   [2012]   [Jun]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
Subjectfrontswap: is frontswap_init called from swapoff safe?
I was looking at the swapfile.c parts of the recently-merged frontswap, 
and noticed that frontswap_init can be called from swapoff when
try_to_unuse fails.

This looks odd to me. Whether it is safe or not depends on what
frontswap_ops.init does, but the comment for __frontswap_init ("Called
when a swap device is swapon'd") and the function name itself seem to
imply it should be called only for swapon, not when relinking the
swap_info after a failed swapoff.

In particular, if frontswap_ops.init assumes the swap map is empty, it
would break, since as far as I know when try_to_unuse fails there are
still pages in the swap.

(By the way, the comment above enable_swap_info at sys_swapoff needs to
be updated to also explain why reading p->frontswap_map outside the lock
is safe at that point, like it does for p->prio and p->swap_map.)

--
Cesar Eduardo Barros
cesarb@cesarb.net
cesar.barros@gmail.com


\
 
 \ /
  Last update: 2012-06-05 13:21    [W:0.054 / U:0.032 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site