)]}'
{
  "commit": "c50edcaa7db6f5e77bbc16bf6cad3caac110c65a",
  "tree": "d7361f16715490b9284800fa75fded005a926e1a",
  "parents": [
    "f355a7d02f35cf51847dfc10af72dee077c892ff"
  ],
  "author": {
    "name": "Dave Chinner",
    "email": "dchinner@redhat.com",
    "time": "Wed Jun 30 18:38:59 2021 -0400"
  },
  "committer": {
    "name": "Eric Sandeen",
    "email": "sandeen@sandeen.net",
    "time": "Wed Jun 30 18:38:59 2021 -0400"
  },
  "message": "xfs: bunmapi has unnecessary AG lock ordering issues\n\nSource kernel commit: 0fe0bbe00a6fb77adf75085b7d06b71a830dd6f2\n\nlarge directory block size operations are assert failing because\nxfs_bunmapi() is not completely removing fragmented directory blocks\nlike so:\n\nXFS: Assertion failed: done, file: fs/xfs/libxfs/xfs_dir2.c, line: 677\n....\nCall Trace:\nxfs_dir2_shrink_inode+0x1a8/0x210\nxfs_dir2_block_to_sf+0x2ae/0x410\nxfs_dir2_block_removename+0x21a/0x280\nxfs_dir_removename+0x195/0x1d0\nxfs_rename+0xb79/0xc50\n? avc_has_perm+0x8d/0x1a0\n? avc_has_perm_noaudit+0x9a/0x120\nxfs_vn_rename+0xdb/0x150\nvfs_rename+0x719/0xb50\n? __lookup_hash+0x6a/0xa0\ndo_renameat2+0x413/0x5e0\n__x64_sys_rename+0x45/0x50\ndo_syscall_64+0x3a/0x70\nentry_SYSCALL_64_after_hwframe+0x44/0xae\n\nWe are aborting the bunmapi() pass because of this specific chunk of\ncode:\n\n/*\n* Make sure we don\u0027t touch multiple AGF headers out of order\n* in a single transaction, as that could cause AB-BA deadlocks.\n*/\nif (!wasdel \u0026\u0026 !isrt) {\nagno \u003d XFS_FSB_TO_AGNO(mp, del.br_startblock);\nif (prev_agno !\u003d NULLAGNUMBER \u0026\u0026 prev_agno \u003e agno)\nbreak;\nprev_agno \u003d agno;\n}\n\nThis is designed to prevent deadlocks in AGF locking when freeing\nmultiple extents by ensuring that we only ever lock in increasing\nAG number order. Unfortunately, this also violates the \"bunmapi will\nalways succeed\" semantic that some high level callers depend on,\nsuch as xfs_dir2_shrink_inode(), xfs_da_shrink_inode() and\nxfs_inactive_symlink_rmt().\n\nThis AG lock ordering was introduced back in 2017 to fix deadlocks\ntriggered by generic/299 as reported here:\n\nhttps://lore.kernel.org/linux-xfs/800468eb-3ded-9166-20a4-047de8018582@gmail.com/\n\nThis codebase is old enough that it was before we were defering all\nAG based extent freeing from within xfs_bunmapi(). THat is, we never\nactually lock AGs in xfs_bunmapi() any more - every non-rt based\nextent free is added to the defer ops list, as is all BMBT block\nfreeing. And RT extents are not RT based, so there\u0027s no lock\nordering issues associated with them.\n\nHence this AGF lock ordering code is both broken and dead. Let\u0027s\njust remove it so that the large directory block code works reliably\nagain.\n\nTested against xfs/538 and generic/299 which is the original test\nthat exposed the deadlocks that this code fixed.\n\nFixes: 5b094d6dac04 (\"xfs: fix multi-AG deadlock in xfs_bunmapi\")\nSigned-off-by: Dave Chinner \u003cdchinner@redhat.com\u003e\nReviewed-by: Darrick J. Wong \u003cdjwong@kernel.org\u003e\nSigned-off-by: Darrick J. Wong \u003cdjwong@kernel.org\u003e\nSigned-off-by: Eric Sandeen \u003csandeen@sandeen.net\u003e\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "05e4e84f6d013cfea6f1866f6d389af657901293",
      "old_mode": 33188,
      "old_path": "libxfs/xfs_bmap.c",
      "new_id": "1c8706a761980542dfd06eae06250b02e5266188",
      "new_mode": 33188,
      "new_path": "libxfs/xfs_bmap.c"
    }
  ]
}
