)]}'
{
  "commit": "a48b94c7e3a283dff1b3f3b60ce17f96fb5f5e7d",
  "tree": "10c2fdd26e27081f8a09782cb756b02b920dfe9d",
  "parents": [
    "c2b9221547423b27a55e070653090e28043c66fb"
  ],
  "author": {
    "name": "Luis Chamberlain",
    "email": "mcgrof@kernel.org",
    "time": "Tue May 11 02:44:07 2021 +0000"
  },
  "committer": {
    "name": "Luis Chamberlain",
    "email": "mcgrof@kernel.org",
    "time": "Tue May 11 23:16:23 2021 -0700"
  },
  "message": "block: add add_disk() failure injection support\n\nFor a long time we have lived without any error handling\non the add_disk() error path. Now that we have some initial\nerror handling, add error injection support for its path so\nthat we can test it and ensure we don\u0027t regress this path\nmoving forward.\n\nThis only adds runtime code *iff* the new bool CONFIG_FAIL_ADD_DISK is\nenabled in your kernel. If you don\u0027t have this enabled this provides\nno new functional. When CONFIG_FAIL_ADD_DISK is disabled the new routine\nblk_should_fail_add_disk() ends up being transformed to if (false), and\nso the compiler should optimize these out as dead code producing no\nnew effective binary changes.\n\nFailure injection lets us configure at boot how often we want a failure\nto take place by specifying the interval, the probability, and when needed\na size constraint. We don\u0027t need to test for size constraints for add_disk()\nand so ignore that part of error injection. Although testing early boot\nfailures with add_disk() failures might be useful we don\u0027t to make add_disk()\nfail every time as otherwise we wouldn\u0027t be able to boot. So enabling\nadd_disk() error injection requires a second post boot step where you specify\nwhere in the add_disk() code path you want to enable failure injection for.\nThis lets us verify correctness of the different error handling parts of\nadd_disk(), while also allowing a respective blktests test to grow\ndynamically in case the add_disk() paths grows.\n\nWe currently enable 11 code paths on add_disk() which can fail\nand we can test for:\n\n\t# ls -1 /sys/kernel/debug/block/config_fail_add_disk/\n\talloc_devt\n\talloc_events\n\tbdi_register\n\tdevice_add\n\tdisk_add_events\n\tget_queue\n\tintegrity_add\n\tregister_disk\n\tregister_queue\n\tsysfs_bdi_link\n\tsysfs_depr_link\n\nIf you want to modify the configuration of fail_add_disk dynamically\nat boot, you can enable CONFIG_FAULT_INJECTION_DEBUG_FS. If you\u0027ve\nenabled CONFIG_FAIL_ADD_DISK you will see these knobs:\n\n\t# ls -1 /sys/kernel/debug/block/fail_add_disk/\n\tinterval\n\tprobability\n\tspace\n\ttask-filter\n\ttimes\n\tverbose\n\tverbose_ratelimit_burst\n\tverbose_ratelimit_interval_ms\n\nSuggested-by: Bart Van Assche \u003cbvanassche@acm.org\u003e\nSigned-off-by: Luis Chamberlain \u003cmcgrof@kernel.org\u003e\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "31ecfe44e5b454631e6163df80ab103499af66c5",
      "old_mode": 33188,
      "old_path": "Documentation/fault-injection/fault-injection.rst",
      "new_id": "129f41b9a581bd76b61c119561fdf09639f70754",
      "new_mode": 33188,
      "new_path": "Documentation/fault-injection/fault-injection.rst"
    },
    {
      "type": "modify",
      "old_id": "8d841f5f986fe4fb673a3ccfd81ed79fcc325a7a",
      "old_mode": 33188,
      "old_path": "block/Makefile",
      "new_id": "1589bffe252869486cb570327423e101bde931fc",
      "new_mode": 33188,
      "new_path": "block/Makefile"
    },
    {
      "type": "modify",
      "old_id": "9bcdae93f6d4f7850c6cb98021116958a5f8be70",
      "old_mode": 33188,
      "old_path": "block/blk-core.c",
      "new_id": "657da4ae7d357f4f1a87c2424dbdb4fc731c15f2",
      "new_mode": 33188,
      "new_path": "block/blk-core.c"
    },
    {
      "type": "modify",
      "old_id": "01ec7aba8d70ad0a9e586e4e1d956b48a13fc9cc",
      "old_mode": 33188,
      "old_path": "block/blk.h",
      "new_id": "4d7be19ae3025072e8cb8f1df916a981654ecbd6",
      "new_mode": 33188,
      "new_path": "block/blk.h"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "c2922e803b7e6ea510fe80d8554708a49009046a",
      "new_mode": 33188,
      "new_path": "block/failure-injection.c"
    },
    {
      "type": "modify",
      "old_id": "cb2283c7427bbe0bf4c20e9f138b774f1fb7743a",
      "old_mode": 33188,
      "old_path": "block/genhd.c",
      "new_id": "be5b38c5a43f4a93b7ca26d8d88a5298b0f11ebc",
      "new_mode": 33188,
      "new_path": "block/genhd.c"
    },
    {
      "type": "modify",
      "old_id": "d1467658361fe8afe1497bcee6ea6f902a83e8cd",
      "old_mode": 33188,
      "old_path": "lib/Kconfig.debug",
      "new_id": "a08f41a57096826aff7e39a4742afc1e71c431cc",
      "new_mode": 33188,
      "new_path": "lib/Kconfig.debug"
    }
  ]
}
