)]}'
{
  "commit": "a522dd871024a0f065bfa7638afdb929607f58fc",
  "tree": "259f5d5eeb7bc6c2a4411aecdd9fe7e6643558a9",
  "parents": [
    "82f1c815aaef1905c5c6c386c8a0d74f6ff70a54"
  ],
  "author": {
    "name": "Amir Goldstein",
    "email": "amir73il@gmail.com",
    "time": "Fri Oct 30 16:55:52 2026 +0100"
  },
  "committer": {
    "name": "Christian Brauner",
    "email": "brauner@kernel.org",
    "time": "Fri Oct 30 17:18:39 2026 +0100"
  },
  "message": "fs: don\u0027t fail __d_obtain_alias() for unlinked inodes\n\nCommit 669bb5af15d4 (\"fs: make sure to call fsnotify_inoderemove() only\nonce when inode is dead\") did two things. It made dentry_unlink_inode()\ncall fsnotify_inoderemove() only once the inode has neither links nor\naliases left. And it made __d_obtain_alias() fail with -ESTALE for an\ninode in that state so that open_by_handle_at() can\u0027t create a new alias\nafter FS_DELETE_SELF has been reported and the inode marks are gone.\n\nThe second part is wrong for network filesystems. __d_obtain_alias()\nbacks d_obtain_alias() and d_obtain_root(). Those are what the\n-\u003efh_to_dentry() and -\u003eget_parent() methods use to turn the inode they\nlooked up into a dentry for exportfs_decode_fh_raw(), i.e., for\nopen_by_handle_at() and for nfsd file handle decoding.\n\nFor a local filesystem an in-core inode without links and aliases is an\norphan that goes away on the final iput(). For a network filesystem\nthat\u0027s not true. i_nlink is just the link count the server last\nreported and whether the object is still reachable through its file\nhandle is up to the server. If a file is unlinked while it is still\nopen elsewhere, e.g., by another NFSv4 client or by a process on the\nserver, the server keeps the object alive and its file handle stays\nvalid. nfs_fh_to_dentry() fetches the attributes for such a handle,\nnfs_fhget() sets i_nlink to 0 from them, the new inode has no aliases\nyet and so __d_obtain_alias() now fails with -ESTALE. The same applies\nto fuse_get_dentry() which takes i_nlink from the fuse server.\nFilesystems that care about unlinked inodes already make that decision\nthemselves in -\u003efh_to_dentry(), e.g., ceph\u0027s __fh_to_dentry() fetches\nthe link count with CEPH_CAP_LINK_SHARED and only refuses an unlinked\ninode if it isn\u0027t open.\n\nNote that on a network filesystem i_nlink drops to zero through\nattribute updates when another client unlinks the file. So the inode\nmight never have gone through dentry_unlink_inode() with i_nlink \u003d\u003d 0,\ni.e., fsnotify_inoderemove() might never have been called for it and\nthere\u0027s nothing for the -ESTALE to protect.\n\nSo drop the two checks from __d_obtain_alias() again and go back to the\nunconditional alias lookup. While at it, update the comment above\ninode_notify_dead() since it no longer blocks new aliases.\n\nAmir sent this as v3 to replace 669bb5af15d4 but that commit was already\nin mainline by then. So do it as a fix on top. The resulting code is\nidentical to v3.\n\nThis means open_by_handle_at() can again create a new alias for an\nunlinked inode after FS_DELETE_SELF has been reported. Closing that file\nreports a second FS_DELETE_SELF and the file has none of the inode marks\nthat were torn down. That\u0027s what Daehyeon\u0027s open_by_handle_at() LTP test\nchecks so it is expected to fail again. This needs to be handled\nseparately. A mark that is added through such a file while\nfsnotify_destroy_marks() is still running is rejected with -ENOENT since\n36ebddca56b9 (\"fsnotify: prevent mark additions during connector\nteardown\") so it can\u0027t end up on a detached connector.\n\nChristian Brauner \u003cbrauner@kernel.org\u003e says:\n\nAmir\u0027s v3 replaced 669bb5af15d4 as a whole. I turned it into an\nincremental fix on top of mainline and wrote a new commit message.\nJan\u0027s Reviewed-by was given on v3 and the resulting code is identical.\n\nFixes: 669bb5af15d4 (\"fs: make sure to call fsnotify_inoderemove() only once when inode is dead\")\nCc: stable@vger.kernel.org\nReported-by: Daehyeon Ko \u003c4ncienth@gmail.com\u003e\nSigned-off-by: Amir Goldstein \u003camir73il@gmail.com\u003e\nLink: https://patch.msgid.link/CAOQ4uxg7Qt436SiKhKEJKOjtCjeB_XyTjazYF7HMyQAGGcgx2A@mail.gmail.com\nReviewed-by: Jan Kara \u003cjack@suse.cz\u003e\nLink: https://patch.msgid.link/20261030-work-dcache-obtain_alias-v1-1-a1f7e44536d2@kernel.org\nSigned-off-by: Christian Brauner (Amutable) \u003cbrauner@kernel.org\u003e\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "efd9332c84074162da5b729ba9bac78a47b4a8dc",
      "old_mode": 33188,
      "old_path": "fs/dcache.c",
      "new_id": "810ac48ae7532bbb661fd5c48242bfbed10f7df0",
      "new_mode": 33188,
      "new_path": "fs/dcache.c"
    }
  ]
}
