)]}'
{
  "commit": "a164637644572e50547569cb05fe2d958c7061ec",
  "tree": "b0fec1d9dd64071cbc45054afe9967ffbe60373f",
  "parents": [
    "0a36982a2abdaf4b20401bc0a0ba3881c7071f4a"
  ],
  "author": {
    "name": "Jan Kara",
    "email": "jack@suse.cz",
    "time": "Tue Nov 24 15:34:35 2015 -0500"
  },
  "committer": {
    "name": "Zefan Li",
    "email": "lizefan@huawei.com",
    "time": "Wed Oct 26 23:15:34 2016 +0800"
  },
  "message": "jbd2: Fix unreclaimed pages after truncate in data\u003djournal mode\n\ncommit bc23f0c8d7ccd8d924c4e70ce311288cb3e61ea8 upstream.\n\nTed and Namjae have reported that truncated pages don\u0027t get timely\nreclaimed after being truncated in data\u003djournal mode. The following test\ntriggers the issue easily:\n\nfor (i \u003d 0; i \u003c 1000; i++) {\n\tpwrite(fd, buf, 1024*1024, 0);\n\tfsync(fd);\n\tfsync(fd);\n\tftruncate(fd, 0);\n}\n\nThe reason is that journal_unmap_buffer() finds that truncated buffers\nare not journalled (jh-\u003eb_transaction \u003d\u003d NULL), they are part of\ncheckpoint list of a transaction (jh-\u003eb_cp_transaction !\u003d NULL) and have\nbeen already written out (!buffer_dirty(bh)). We clean such buffers but\nwe leave them in the checkpoint list. Since checkpoint transaction holds\na reference to the journal head, these buffers cannot be released until\nthe checkpoint transaction is cleaned up. And at that point we don\u0027t\ncall release_buffer_page() anymore so pages detached from mapping are\nlingering in the system waiting for reclaim to find them and free them.\n\nFix the problem by removing buffers from transaction checkpoint lists\nwhen journal_unmap_buffer() finds out they don\u0027t have to be there\nanymore.\n\nReported-and-tested-by: Namjae Jeon \u003cnamjae.jeon@samsung.com\u003e\nFixes: de1b794130b130e77ffa975bb58cb843744f9ae5\nSigned-off-by: Jan Kara \u003cjack@suse.cz\u003e\nSigned-off-by: Theodore Ts\u0027o \u003ctytso@mit.edu\u003e\nSigned-off-by: Zefan Li \u003clizefan@huawei.com\u003e\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "f512c690d38e70c31b0d839474131514cc9b2bb3",
      "old_mode": 33188,
      "old_path": "fs/jbd2/transaction.c",
      "new_id": "51a743e6307bd30bc631a30404196cb5027fdf95",
      "new_mode": 33188,
      "new_path": "fs/jbd2/transaction.c"
    }
  ]
}
