From: Krzysztof Kozlowski Date: Tue, 5 Nov 2013 05:55:41 +0000 (+1100) Subject: frontswap: enable call to invalidate area on swapoff X-Git-Tag: next-20131105~2^2~239 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=89d4767399b00d208f997d789a3a0fe5e24f2bb4;p=karo-tx-linux.git frontswap: enable call to invalidate area on swapoff During swapoff the frontswap_map was NULL-ified before calling frontswap_invalidate_area(). However the frontswap_invalidate_area() exits early if frontswap_map is NULL. Invalidate was never called during swapoff. This patch moves frontswap_map_set() in swapoff just after calling frontswap_invalidate_area() so outside of locks (swap_lock and swap_info_struct->lock). This shouldn't be a problem as during swapon the frontswap_map_set() is called also outside of any locks. Signed-off-by: Krzysztof Kozlowski Reviewed-by: Seth Jennings Cc: Konrad Rzeszutek Wilk Cc: Shaohua Li Cc: Minchan Kim Signed-off-by: Andrew Morton --- diff --git a/mm/swapfile.c b/mm/swapfile.c index 64458e3997bc..612a7c9795f6 100644 --- a/mm/swapfile.c +++ b/mm/swapfile.c @@ -1924,10 +1924,10 @@ SYSCALL_DEFINE1(swapoff, const char __user *, specialfile) p->cluster_info = NULL; p->flags = 0; frontswap_map = frontswap_map_get(p); - frontswap_map_set(p, NULL); spin_unlock(&p->lock); spin_unlock(&swap_lock); frontswap_invalidate_area(type); + frontswap_map_set(p, NULL); mutex_unlock(&swapon_mutex); free_percpu(p->percpu_cluster); p->percpu_cluster = NULL;