)]}'
{
  "commit": "4d707b9f48e2c4aa94b96f1133813b73df71fb55",
  "tree": "2e8e6c44e55bcea9ae2de200ebb3edaac81c2a88",
  "parents": [
    "eef6a7d5c2f38adadab8240fabf43730fe796482"
  ],
  "author": {
    "name": "Oleg Nesterov",
    "email": "oleg@redhat.com",
    "time": "Fri Apr 23 17:40:40 2010 +0200"
  },
  "committer": {
    "name": "Tejun Heo",
    "email": "tj@kernel.org",
    "time": "Fri Apr 30 08:57:25 2010 +0200"
  },
  "message": "workqueue: change cancel_work_sync() to clear work-\u003edata\n\nIn short: change cancel_work_sync(work) to mark this work as \"never\nqueued\" upon return.\n\nWhen cancel_work_sync(work) succeeds, we know that this work can\u0027t be\nqueued or running, and since we own WORK_STRUCT_PENDING nobody can change\nthe bits in work-\u003edata under us. This means we can also clear the \"cwq\"\npart along with _PENDING bit lockless before return, unless the work is\nqueued nobody can assume get_wq_data() is stable even under cwq-\u003elock.\n\nThis change can speedup the subsequent cancel/flush requests, and as\nDmitry pointed out this simplifies the usage of work_struct\u0027s which\ncan be queued on different workqueues. Consider this pseudo code from\nthe input subsystem:\n\n\tstruct workqueue_struct *WQ;\n\tstruct work_struct *WORK;\n\n\tfor (;;) {\n\t\tWQ \u003d create_workqueue();\n\t\t...\n\t\tif (condition())\n\t\t\tqueue_work(WQ, WORK);\n\t\t...\n\t\tcancel_work_sync(WORK);\n\t\tdestroy_workqueue(WQ);\n\t}\n\nIf condition() returns T and then F, cancel_work_sync() will crash the\nkernel because WORK-\u003edata still points to the already destroyed workqueue.\nWith this patch the code like above becomes correct.\n\nSuggested-by: Dmitry Torokhov \u003cdmitry.torokhov@gmail.com\u003e\nSigned-off-by: Oleg Nesterov \u003coleg@redhat.com\u003e\nSigned-off-by: Tejun Heo \u003ctj@kernel.org\u003e\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "0225fea89340a7f23db32adc160dfa24c8aba11b",
      "old_mode": 33188,
      "old_path": "kernel/workqueue.c",
      "new_id": "77dabbf64b8fd45acdab9eb33cde54bad83cba62",
      "new_mode": 33188,
      "new_path": "kernel/workqueue.c"
    }
  ]
}
