diff options
-rw-r--r-- | mm/swapfile.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/mm/swapfile.c b/mm/swapfile.c index 5ac5333f37a0..4b39e9501d44 100644 --- a/mm/swapfile.c +++ b/mm/swapfile.c | |||
@@ -1129,6 +1129,7 @@ asmlinkage long sys_swapoff(const char __user * specialfile) | |||
1129 | swap_list_unlock(); | 1129 | swap_list_unlock(); |
1130 | goto out_dput; | 1130 | goto out_dput; |
1131 | } | 1131 | } |
1132 | destroy_swap_extents(p); | ||
1132 | down(&swapon_sem); | 1133 | down(&swapon_sem); |
1133 | swap_list_lock(); | 1134 | swap_list_lock(); |
1134 | drain_mmlist(); | 1135 | drain_mmlist(); |
@@ -1139,7 +1140,6 @@ asmlinkage long sys_swapoff(const char __user * specialfile) | |||
1139 | swap_map = p->swap_map; | 1140 | swap_map = p->swap_map; |
1140 | p->swap_map = NULL; | 1141 | p->swap_map = NULL; |
1141 | p->flags = 0; | 1142 | p->flags = 0; |
1142 | destroy_swap_extents(p); | ||
1143 | swap_device_unlock(p); | 1143 | swap_device_unlock(p); |
1144 | swap_list_unlock(); | 1144 | swap_list_unlock(); |
1145 | up(&swapon_sem); | 1145 | up(&swapon_sem); |
@@ -1531,6 +1531,7 @@ bad_swap: | |||
1531 | set_blocksize(bdev, p->old_block_size); | 1531 | set_blocksize(bdev, p->old_block_size); |
1532 | bd_release(bdev); | 1532 | bd_release(bdev); |
1533 | } | 1533 | } |
1534 | destroy_swap_extents(p); | ||
1534 | bad_swap_2: | 1535 | bad_swap_2: |
1535 | swap_list_lock(); | 1536 | swap_list_lock(); |
1536 | swap_map = p->swap_map; | 1537 | swap_map = p->swap_map; |
@@ -1540,7 +1541,6 @@ bad_swap_2: | |||
1540 | if (!(swap_flags & SWAP_FLAG_PREFER)) | 1541 | if (!(swap_flags & SWAP_FLAG_PREFER)) |
1541 | ++least_priority; | 1542 | ++least_priority; |
1542 | swap_list_unlock(); | 1543 | swap_list_unlock(); |
1543 | destroy_swap_extents(p); | ||
1544 | vfree(swap_map); | 1544 | vfree(swap_map); |
1545 | if (swap_file) | 1545 | if (swap_file) |
1546 | filp_close(swap_file, NULL); | 1546 | filp_close(swap_file, NULL); |