)]}'
{
  "commit": "cebc2de44d3bce53e46476e774126c298ca2c8a9",
  "tree": "81050974e59be27436092b16cd47262cb5a9f93f",
  "parents": [
    "f6d16d32797f665100b1507f6a77c4cd0acb30c5"
  ],
  "author": {
    "name": "Joe Thornber",
    "email": "ejt@redhat.com",
    "time": "Fri Mar 07 14:57:19 2014 +0000"
  },
  "committer": {
    "name": "Mike Snitzer",
    "email": "snitzer@redhat.com",
    "time": "Fri Mar 07 12:02:47 2014 -0500"
  },
  "message": "dm space map metadata: fix refcount decrement below 0 which caused corruption\n\nThis has been a relatively long-standing issue that wasn\u0027t nailed down\nuntil Teng-Feng Yang\u0027s meticulous bug report to dm-devel on 3/7/2014,\nsee: http://www.redhat.com/archives/dm-devel/2014-March/msg00021.html\n\nFrom that report:\n  \"When decreasing the reference count of a metadata block with its\n  reference count equals 3, we will call dm_btree_remove() to remove\n  this enrty from the B+tree which keeps the reference count info in\n  metadata device.\n\n  The B+tree will try to rebalance the entry of the child nodes in each\n  node it traversed, and the rebalance process contains the following\n  steps.\n\n  (1) Finding the corresponding children in current node (shadow_current(s))\n  (2) Shadow the children block (issue BOP_INC)\n  (3) redistribute keys among children, and free children if necessary (issue BOP_DEC)\n\n  Since the update of a metadata block\u0027s reference count could be\n  recursive, we will stash these reference count update operations in\n  smm-\u003euncommitted and then process them in a FILO fashion.\n\n  The problem is that step(3) could free the children which is created\n  in step(2), so the BOP_DEC issued in step(3) will be carried out\n  before the BOP_INC issued in step(2) since these BOPs will be\n  processed in FILO fashion. Once the BOP_DEC from step(3) tries to\n  decrease the reference count of newly shadow block, it will report\n  failure for its reference equals 0 before decreasing. It looks like we\n  can solve this issue by processing these BOPs in a FIFO fashion\n  instead of FILO.\"\n\nCommit 5b564d80 (\"dm space map: disallow decrementing a reference count\nbelow zero\") changed the code to report an error for this temporary\nrefcount decrement below zero.  So what was previously a harmless\ninvalid refcount became a hard failure due to the new error path:\n\n device-mapper: space map common: unable to decrement a reference count below 0\n device-mapper: thin: 253:6: dm_thin_insert_block() failed: error \u003d -22\n device-mapper: thin: 253:6: switching pool to read-only mode\n\nThis bug is in dm persistent-data code that is common to the DM thin and\ncache targets.  So any users of those targets should apply this fix.\n\nFix this by applying recursive space map operations in FIFO order rather\nthan FILO.\n\nResolves: https://bugzilla.kernel.org/show_bug.cgi?id\u003d68801\n\nReported-by: Apollon Oikonomopoulos \u003capoikos@debian.org\u003e\nReported-by: edwillam1007@gmail.com\nReported-by: Teng-Feng Yang \u003cshinrairis@gmail.com\u003e\nSigned-off-by: Joe Thornber \u003cejt@redhat.com\u003e\nSigned-off-by: Mike Snitzer \u003csnitzer@redhat.com\u003e\nCc: stable@vger.kernel.org # 3.13+\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "e9bdd462f4f51a7cdcf917c6abbac85a80f58eaf",
      "old_mode": 33188,
      "old_path": "drivers/md/persistent-data/dm-space-map-metadata.c",
      "new_id": "786b689bdfc7fe0c42d9a651a2369ffadcdc2382",
      "new_mode": 33188,
      "new_path": "drivers/md/persistent-data/dm-space-map-metadata.c"
    }
  ]
}
