)]}'
{
  "commit": "b5c44c2147a447f77e07fecdb087ae288e1f4e40",
  "tree": "ec1d95eb1e03e320fc5eb5cfb40379f2f4a7267d",
  "parents": [
    "f359b74c80bc76c1f6c2cb8f2837882f2335ba0c"
  ],
  "author": {
    "name": "Suparna Bhattacharya",
    "email": "suparna@in.ibm.com",
    "time": "Sat May 21 16:33:36 2005 -0700"
  },
  "committer": {
    "name": "Linus Torvalds",
    "email": "torvalds@ppc970.osdl.org",
    "time": "Sat May 21 16:45:24 2005 -0700"
  },
  "message": "[PATCH] fix for __generic_file_aio_read() to return 0 on EOF\n\nI came across the following problem while running ltp-aiodio testcases from\nltp-full-20050405 on linux-2.6.12-rc3-mm3.  I tried running the tests with\nEXT3 as well as JFS filesystems.\n\nOne or two fsx-linux testcases were hung after some time.  These testcases\nwere hanging at wait_for_all_aios().\n\nDebugging shows that there were some iocbs which were not getting completed\neventhough the last retry for those returned -EIOCBQUEUED.  Also all such\npending iocbs represented READ operation.\n\nFurther debugging revealed that all such iocbs hit EOF in the DIO layer.\nTo be more precise, the \"pos\" from which they were trying to read was\ngreater than the \"size\" of the file.  So the generic_file_direct_IO\nreturned 0.\n\nThis happens rarely as there is already a check in\n__generic_file_aio_read(), for whether \"pos\" \u003c \"size\" before calling direct\nIO routine.\n\n\u003esize \u003d i_size_read(inode);\n\u003eif (pos \u003c size) {\n\u003e\t  retval \u003d generic_file_direct_IO(READ, iocb,\n\u003e                               iov, pos, nr_segs);\n\nBut for READ, we are taking the inode-\u003ei_sem only in the DIO layer.  So it\nis possible that some other process can change the size of the file before\nwe take the i_sem.  In such a case ( when \"pos\" \u003e \"size\"), the\n__generic_file_aio_read() would return -EIOCBQUEUED even though there were\nno I/O requests submitted by the DIO layer.  This would cause the AIO layer\nto expect aio_complete() for THE iocb, which doesnot happen.  And thus the\ntest hangs forever, waiting for an I/O completion, where there are no\nrequests submitted at all.\n\nThe following patch makes __generic_file_aio_read() return 0 (instead of\nreturning -EIOCBQUEUED), on getting 0 from generic_file_direct_IO(), so\nthat the AIO layer does the aio_complete().\n\nTesting:\n\nI have tested the patch on a SMP machine(with 2 Pentium 4 (HT)) running\nlinux-2.6.12-rc3-mm3.  I ran the ltp-aiodio testcases and none of the\nfsx-linux tests hung.  Also the aio-stress tests ran without any problem.\n\nSigned-off-by: Suzuki K P \u003csuzuki@in.ibm.com\u003e\nSigned-off-by: Suparna Bhattacharya \u003csuparna@in.ibm.com\u003e\nSigned-off-by: Andrew Morton \u003cakpm@osdl.org\u003e\nSigned-off-by: Linus Torvalds \u003ctorvalds@osdl.org\u003e\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "47263ac3e4ea8ef73ea1d955624a23295e514f72",
      "old_mode": 33188,
      "old_path": "mm/filemap.c",
      "new_id": "1d33fec7bac615ed864a504bf99c9e899c5d85f7",
      "new_mode": 33188,
      "new_path": "mm/filemap.c"
    }
  ]
}
