)]}'
{
  "commit": "9f53d2fe815b4011ff930a7b6db98385d45faa68",
  "tree": "a46926f5cf0874102dcb81447894423994a09701",
  "parents": [
    "12ebffd146768556ab7c415d0ff9ab78e3d16b7a"
  ],
  "author": {
    "name": "Stanislaw Gruszka",
    "email": "sgruszka@redhat.com",
    "time": "Fri Mar 02 10:43:28 2012 +0100"
  },
  "committer": {
    "name": "Jens Axboe",
    "email": "axboe@kernel.dk",
    "time": "Fri Mar 02 10:44:17 2012 +0100"
  },
  "message": "block: fix __blkdev_get and add_disk race condition\n\nThe following situation might occur:\n\n__blkdev_get:\t\t\tadd_disk:\n\n\t\t\t\tregister_disk()\nget_gendisk()\n\ndisk_block_events()\n\tdisk-\u003eev \u003d\u003d NULL\n\n\t\t\t\tdisk_add_events()\n\n__disk_unblock_events()\n\tdisk-\u003eev !\u003d NULL\n\t--ev-\u003eblock\n\nThen we unblock events, when they are suppose to be blocked. This can\ntrigger events related block/genhd.c warnings, but also can crash in\nsd_check_events() or other places.\n\nI\u0027m able to reproduce crashes with the following scripts (with\nconnected usb dongle as sdb disk).\n\n\u003csnip\u003e\nDEV\u003d/dev/sdb\nENABLE\u003d/sys/bus/usb/devices/1-2/bConfigurationValue\n\nfunction stop_me()\n{\n\tfor i in `jobs -p` ; do kill $i 2\u003e /dev/null ; done\n\texit\n}\n\ntrap stop_me SIGHUP SIGINT SIGTERM\n\nfor ((i \u003d 0; i \u003c 10; i++)) ; do\n\twhile true; do fdisk -l $DEV  2\u003e\u00261 \u003e /dev/null ; done \u0026\ndone\n\nwhile true ; do\necho 1 \u003e $ENABLE\nsleep 1\necho 0 \u003e $ENABLE\ndone\n\u003c/snip\u003e\n\nI use the script to verify patch fixing oops in sd_revalidate_disk\nhttp://marc.info/?l\u003dlinux-scsi\u0026m\u003d132935572512352\u0026w\u003d2\nWithout Jun\u0027ichi Nomura patch titled \"Fix NULL pointer dereference in\nsd_revalidate_disk\" or this one, script easily crash kernel within\na few seconds. With both patches applied I do not observe crash.\nUnfortunately after some time (dozen of minutes), script will hung in:\n\n[ 1563.906432]  [\u003cc08354f5\u003e] schedule_timeout_uninterruptible+0x15/0x20\n[ 1563.906437]  [\u003cc04532d5\u003e] msleep+0x15/0x20\n[ 1563.906443]  [\u003cc05d60b2\u003e] blk_drain_queue+0x32/0xd0\n[ 1563.906447]  [\u003cc05d6e00\u003e] blk_cleanup_queue+0xd0/0x170\n[ 1563.906454]  [\u003cc06d278f\u003e] scsi_free_queue+0x3f/0x60\n[ 1563.906459]  [\u003cc06d7e6e\u003e] __scsi_remove_device+0x6e/0xb0\n[ 1563.906463]  [\u003cc06d4aff\u003e] scsi_forget_host+0x4f/0x60\n[ 1563.906468]  [\u003cc06cd84a\u003e] scsi_remove_host+0x5a/0xf0\n[ 1563.906482]  [\u003cf7f030fb\u003e] quiesce_and_remove_host+0x5b/0xa0 [usb_storage]\n[ 1563.906490]  [\u003cf7f03203\u003e] usb_stor_disconnect+0x13/0x20 [usb_storage]\n\nAnyway I think this patch is some step forward.\n\nAs drawback, I do not teardown on sysfs file create error, because I do\nnot know how to nullify disk-\u003eev (since it can be used). However add_disk\nerror handling practically does not exist too, and things will work\nwithout this sysfs file, except events will not be exported to user\nspace.\n\nSigned-off-by: Stanislaw Gruszka \u003csgruszka@redhat.com\u003e\nAcked-by: Tejun Heo \u003ctj@kernel.org\u003e\nCc: stable@kernel.org\nSigned-off-by: Jens Axboe \u003caxboe@kernel.dk\u003e\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "23b4f7063322c303dd5a1ab15c66a3a62daca7ca",
      "old_mode": 33188,
      "old_path": "block/genhd.c",
      "new_id": "b26c4085590da7917a666e068ac469cfbb8fe69d",
      "new_mode": 33188,
      "new_path": "block/genhd.c"
    }
  ]
}
