{"action":"created","issue":{"url":"https://api.github.com/repos/zfsonlinux/zfs/issues/3225","labels_url":"https://api.github.com/repos/zfsonlinux/zfs/issues/3225/labels{/name}","comments_url":"https://api.github.com/repos/zfsonlinux/zfs/issues/3225/comments","events_url":"https://api.github.com/repos/zfsonlinux/zfs/issues/3225/events","html_url":"https://github.com/zfsonlinux/zfs/pull/3225","id":64274443,"number":3225,"title":"Fix deadlocks resulting from the post-kmem rework merge","user":{"login":"dweeezil","id":1432005,"avatar_url":"https://avatars.githubusercontent.com/u/1432005?v=3","gravatar_id":"","url":"https://api.github.com/users/dweeezil","html_url":"https://github.com/dweeezil","followers_url":"https://api.github.com/users/dweeezil/followers","following_url":"https://api.github.com/users/dweeezil/following{/other_user}","gists_url":"https://api.github.com/users/dweeezil/gists{/gist_id}","starred_url":"https://api.github.com/users/dweeezil/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dweeezil/subscriptions","organizations_url":"https://api.github.com/users/dweeezil/orgs","repos_url":"https://api.github.com/users/dweeezil/repos","events_url":"https://api.github.com/users/dweeezil/events{/privacy}","received_events_url":"https://api.github.com/users/dweeezil/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/zfsonlinux/zfs/labels/Bug%20-%20Major","name":"Bug - Major","color":"e11d21"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/zfsonlinux/zfs/milestones/24","html_url":"https://github.com/zfsonlinux/zfs/milestones/0.6.4","labels_url":"https://api.github.com/repos/zfsonlinux/zfs/milestones/24/labels","id":175735,"number":24,"title":"0.6.4","description":"ZFS on Linux v0.6.4 - Functionality / Integration","creator":{"login":"behlendorf","id":148917,"avatar_url":"https://avatars.githubusercontent.com/u/148917?v=3","gravatar_id":"","url":"https://api.github.com/users/behlendorf","html_url":"https://github.com/behlendorf","followers_url":"https://api.github.com/users/behlendorf/followers","following_url":"https://api.github.com/users/behlendorf/following{/other_user}","gists_url":"https://api.github.com/users/behlendorf/gists{/gist_id}","starred_url":"https://api.github.com/users/behlendorf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/behlendorf/subscriptions","organizations_url":"https://api.github.com/users/behlendorf/orgs","repos_url":"https://api.github.com/users/behlendorf/repos","events_url":"https://api.github.com/users/behlendorf/events{/privacy}","received_events_url":"https://api.github.com/users/behlendorf/received_events","type":"User","site_admin":false},"open_issues":4,"closed_issues":426,"state":"open","created_at":"2012-09-16T18:38:17Z","updated_at":"2015-03-25T23:53:56Z","due_on":null,"closed_at":null},"comments":3,"created_at":"2015-03-25T13:52:48Z","updated_at":"2015-03-26T16:20:59Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/zfsonlinux/zfs/pulls/3225","html_url":"https://github.com/zfsonlinux/zfs/pull/3225","diff_url":"https://github.com/zfsonlinux/zfs/pull/3225.diff","patch_url":"https://github.com/zfsonlinux/zfs/pull/3225.patch"},"body":"Put the following functions under PF_FSTRANS to prevent deadlocks\r\ndue to re-entering the filesystem during reclaim:\r\n\r\n\tdbuf_hold()\r\n\tdmu_prefetch()\r\n\tsa_buf_hold()\r\n\r\nTesting this one now:\r\n\tdmu_zfetch_fetch() - z_hold_mtx[] via zget and zf_rwlock via dmu_zfetch"},"comment":{"url":"https://api.github.com/repos/zfsonlinux/zfs/issues/comments/86601309","html_url":"https://github.com/zfsonlinux/zfs/pull/3225#issuecomment-86601309","issue_url":"https://api.github.com/repos/zfsonlinux/zfs/issues/3225","id":86601309,"user":{"login":"tuxoko","id":119672,"avatar_url":"https://avatars.githubusercontent.com/u/119672?v=3","gravatar_id":"","url":"https://api.github.com/users/tuxoko","html_url":"https://github.com/tuxoko","followers_url":"https://api.github.com/users/tuxoko/followers","following_url":"https://api.github.com/users/tuxoko/following{/other_user}","gists_url":"https://api.github.com/users/tuxoko/gists{/gist_id}","starred_url":"https://api.github.com/users/tuxoko/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tuxoko/subscriptions","organizations_url":"https://api.github.com/users/tuxoko/orgs","repos_url":"https://api.github.com/users/tuxoko/repos","events_url":"https://api.github.com/users/tuxoko/events{/privacy}","received_events_url":"https://api.github.com/users/tuxoko/received_events","type":"User","site_admin":false},"created_at":"2015-03-26T16:20:59Z","updated_at":"2015-03-26T16:20:59Z","body":"@dweeezil \r\nYou HAVE TO put z_hold_mtx under FSTRANS. Otherwise, you'll have to add spl_fstrans_mark to every possible memory allocation under z_hold_mtx. The reason is just as you described, direct reclaim will cause reentry on z_hold_mtx, and it will cause deadlock even if the reentry is on different z_hold_mtx entry, because there could be multiple threads doing reclaim."}}