]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
frontswap: enable call to invalidate area on swapoff
authorKrzysztof Kozlowski <k.kozlowski@samsung.com>
Tue, 12 Nov 2013 23:07:47 +0000 (15:07 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 13 Nov 2013 03:09:07 +0000 (12:09 +0900)
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 <k.kozlowski@samsung.com>
Reviewed-by: Seth Jennings <sjenning@linux.vnet.ibm.com>
Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Cc: Shaohua Li <shli@fusionio.com>
Cc: Minchan Kim <minchan@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
mm/swapfile.c

index 64458e3997bcf4dd18b6255967827e28a7cfa3fd..612a7c9795f6eca1f43f7e86af43d2e74e2f56fa 100644 (file)
@@ -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;