Skip to content

mm/swap: fix some rare issues in swap subsystem

Weijie Yang linux-mm lkml stable 1 version In review

Get series with b4
b4 am '000501cf1b46$b899edb0$29cdc910$%[email protected]'

Versions newest first

  1. v1 Latest8 patches 8 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/8mm/swap: add some comments for swap flag/lock usageinclude/linux/blkdev.h mm/rmap.c mm/swapfile.c+67 -50 replies
2/8mm/swap: fix race on swap_info reuse between swapoff and swaponmm/swapfile.c+11 -33 replies
3/8mm/swap: prevent concurrent swapon on the same S_ISBLK blockdevmm/swapfile.c+3 -14 replies
4/8mm/swap: fix race among frontswap_register_ops, swapoff and swaponinclude/linux/swapfile.h mm/frontswap.c mm/swapfile.c+20 -80 replies
5/8mm/swap: drop useless and bug frontswap_shrink codesinclude/linux/frontswap.h include/linux/swapfile.h mm/frontswap.c +1 more+4 -1360 replies
6/8mm/swap: remove swap_lock to simplify si_swapinfo()mm/swapfile.c+2 -130 replies
7/8mm/swap: check swapfile blocksize greater than PAGE_SIZEmm/page_io.c+2 -00 replies
8/8mm/frontswap: add missing handle on a dup-store failuremm/frontswap.c+3 -10 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/8] mm/swap: fix some rare issues in swap subsystem

This patch series focus on some tiny and rare issues in swap subsystem. These issues happen rarely, so it is just for the correctness of the code.

It firstly add some comments to try to make swap flag/lock usage in swapfile.c more clear and readable,
and fix some rare issues in swap subsystem that cause race condition among swapon, swapoff and frontswap_register_ops.
and fix some not race issues.

Please see individual patch for details, any complaint and suggestion are welcome.

Regards

patch 1/8: add some comments for swap flag/lock usage

patch 2/8: fix race on swap_info reuse between swapoff and swapon
This patch has been in akpm -mm tree, however I improve it according to Heesub Shin and Mateusz Guzik's suggestion. So, that old patch need to be dropped.

patch 3/8: prevent concurrent swapon on the same S_ISBLK blockdev

patch 4/8: fix race among frontswap_register_ops, swapoff and swapon

patch 5/8: drop useless and bug frontswap_shrink codes

patch 6/8: remove swap_lock to simplify si_swapinfo()

patch 7/8: check swapfile blocksize greater than PAGE_SIZE

patch 8/8: add missing handle on a dup-store failure

 include/linux/blkdev.h    |    4 +++-
 include/linux/frontswap.h |    2 --
 include/linux/swapfile.h  |    4 +---
 mm/frontswap.c            |  127 +++++++------------------------------------------------------------------------------------------------------------------------
 mm/page_io.c              |    2 ++
 mm/rmap.c                 |    2 +-
 mm/swapfile.c             |  138 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----------------------------------------
 7 files changed, 112 insertions(+), 167 deletions(-)