)]}'
{
  "commit": "5b808a2300a5ac45f4798ebfac8b367e98a4b692",
  "tree": "b08db2864c1380eeb1c41f29ebeea1a2c29dd473",
  "parents": [
    "fad1a86e25e0a1f85635ed06ef62ddadd5b8fa4c"
  ],
  "author": {
    "name": "Krzysztof Kozlowski",
    "email": "k.kozlowski@samsung.com",
    "time": "Wed Oct 16 13:47:06 2013 -0700"
  },
  "committer": {
    "name": "Linus Torvalds",
    "email": "torvalds@linux-foundation.org",
    "time": "Wed Oct 16 21:35:53 2013 -0700"
  },
  "message": "swap: fix set_blocksize race during swapon/swapoff\n\nFix race between swapoff and swapon.  Swapoff used old_block_size from\nswap_info outside of swapon_mutex so it could be overwritten by\nconcurrent swapon.\n\nThe race has visible effect only if more than one swap block device\nexists with different block sizes (e.g.  /dev/sda1 with block size 4096\nand /dev/sdb1 with 512).  In such case it leads to setting the blocksize\nof swapped off device with wrong blocksize.\n\nThe bug can be triggered with multiple concurrent swapoff and swapon:\n0. Swap for some device is on.\n1. swapoff:\nFirst the swapoff is called on this device and \"struct swap_info_struct\n*p\" is assigned. This is done under swap_lock however this lock is\nreleased for the call try_to_unuse().\n\n2. swapon:\nAfter the assignment above (and before acquiring swapon_mutex \u0026\nswap_lock by swapoff) the swapon is called on the same device.\nThe p-\u003eold_block_size is assigned to the value of block_size the device.\nThis block size should be the same as previous but sometimes it is not.\nThe swapon ends successfully.\n\n3. swapoff:\nSwapoff resumes, grabs the locks and mutex and continues to disable this\nswap device. Now it sets the block size to value taken from swap_info\nwhich was overwritten by swapon in 2.\n\nSigned-off-by: Krzysztof Kozlowski \u003ck.kozlowski@samsung.com\u003e\nReported-by: Weijie Yang \u003cweijie.yang.kh@gmail.com\u003e\nCc: Bob Liu \u003cbob.liu@oracle.com\u003e\nCc: Konrad Rzeszutek Wilk \u003ckonrad.wilk@oracle.com\u003e\nCc: Shaohua Li \u003cshli@fusionio.com\u003e\nCc: Minchan Kim \u003cminchan@kernel.org\u003e\nAcked-by: Hugh Dickins \u003chughd@google.com\u003e\nSigned-off-by: Andrew Morton \u003cakpm@linux-foundation.org\u003e\nSigned-off-by: Linus Torvalds \u003ctorvalds@linux-foundation.org\u003e\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "3963fc24fcc1b6f8c4d365de4d99bda8993311b7",
      "old_mode": 33188,
      "old_path": "mm/swapfile.c",
      "new_id": "de7c904e52e507079f5bae7a2b7854a9d7cf80b0",
      "new_mode": 33188,
      "new_path": "mm/swapfile.c"
    }
  ]
}
