{"action":"created","issue":{"url":"https://api.github.com/repos/zfsonlinux/zfs/issues/3074","labels_url":"https://api.github.com/repos/zfsonlinux/zfs/issues/3074/labels{/name}","comments_url":"https://api.github.com/repos/zfsonlinux/zfs/issues/3074/comments","events_url":"https://api.github.com/repos/zfsonlinux/zfs/issues/3074/events","html_url":"https://github.com/zfsonlinux/zfs/pull/3074","id":56607075,"number":3074,"title":"Fix SA header size accounting","user":{"login":"nedbass","id":320381,"avatar_url":"https://avatars.githubusercontent.com/u/320381?v=3","gravatar_id":"","url":"https://api.github.com/users/nedbass","html_url":"https://github.com/nedbass","followers_url":"https://api.github.com/users/nedbass/followers","following_url":"https://api.github.com/users/nedbass/following{/other_user}","gists_url":"https://api.github.com/users/nedbass/gists{/gist_id}","starred_url":"https://api.github.com/users/nedbass/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nedbass/subscriptions","organizations_url":"https://api.github.com/users/nedbass/orgs","repos_url":"https://api.github.com/users/nedbass/repos","events_url":"https://api.github.com/users/nedbass/events{/privacy}","received_events_url":"https://api.github.com/users/nedbass/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"},{"url":"https://api.github.com/repos/zfsonlinux/zfs/labels/Difficulty%20-%20Hard","name":"Difficulty - Hard","color":"207de5"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/zfsonlinux/zfs/milestones/24","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":78,"closed_issues":350,"state":"open","created_at":"2012-09-16T18:38:17Z","updated_at":"2015-02-05T19:07:25Z","due_on":null,"closed_at":null},"comments":2,"created_at":"2015-02-04T23:56:30Z","updated_at":"2015-02-05T19:17:16Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/zfsonlinux/zfs/pulls/3074","html_url":"https://github.com/zfsonlinux/zfs/pull/3074","diff_url":"https://github.com/zfsonlinux/zfs/pull/3074.diff","patch_url":"https://github.com/zfsonlinux/zfs/pull/3074.patch"},"body":"The functions sa_find_sizes() and sa_build_layout() fail to account\r\nfor the additional 2 bytes of SA header space when calculating whether\r\na variable size attribute might spill over. They may consequently\r\ndetermine that an attribute will fit in the bonus buffer along with a\r\nspill block pointer, when in reality the attribute would be partially\r\noverwritten by the spill block pointer if spill over occurs. This also\r\ncauses an inconsistency between the SA header size and the number of\r\nvariable size attributes in the layout, tripping an assertion when\r\ndebugging is on. The following reproducer demonstrates the problem.\r\n\r\n  ln -s $(perl -e 'print \"z\" x 20') file\r\n  setfattr -h -n trusted.foo -v $(perl -e 'print \"z\" x 200') file\r\n\r\nEven though sa_find_sizes() computes the index of the attribute where\r\nspill-over will occur, sa_build_layouts() discards the result and\r\nrecomputes it itself. As it turns out, both functions get it wrong.\r\nSince this computation is awkward and, as history has shown, easy to\r\nscrew up, let's just do it in one place. This patch fixes the bug in\r\nsa_find_sizes() and updates sa_build_layout() to use the result\r\ncomputed there.\r\n\r\nAlso improve the comments in sa_find_sizes().\r\n\r\nIssue #3070\r\nSigned-off-by: Ned Bass <bass6@llnl.gov>"},"comment":{"url":"https://api.github.com/repos/zfsonlinux/zfs/issues/comments/73107902","html_url":"https://github.com/zfsonlinux/zfs/pull/3074#issuecomment-73107902","issue_url":"https://api.github.com/repos/zfsonlinux/zfs/issues/3074","id":73107902,"user":{"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},"created_at":"2015-02-05T19:17:16Z","updated_at":"2015-02-05T19:17:16Z","body":"LGTM.  The refactoring and comments help make this code more understandable."}}