{"action":"created","issue":{"url":"https://api.github.com/repos/NixOS/nixpkgs/issues/15226","repository_url":"https://api.github.com/repos/NixOS/nixpkgs","labels_url":"https://api.github.com/repos/NixOS/nixpkgs/issues/15226/labels{/name}","comments_url":"https://api.github.com/repos/NixOS/nixpkgs/issues/15226/comments","events_url":"https://api.github.com/repos/NixOS/nixpkgs/issues/15226/events","html_url":"https://github.com/NixOS/nixpkgs/issues/15226","id":153094649,"number":15226,"title":"Broken swraid boot/shutdown sequence","user":{"login":"viric","id":66664,"avatar_url":"https://avatars.githubusercontent.com/u/66664?v=3","gravatar_id":"","url":"https://api.github.com/users/viric","html_url":"https://github.com/viric","followers_url":"https://api.github.com/users/viric/followers","following_url":"https://api.github.com/users/viric/following{/other_user}","gists_url":"https://api.github.com/users/viric/gists{/gist_id}","starred_url":"https://api.github.com/users/viric/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/viric/subscriptions","organizations_url":"https://api.github.com/users/viric/orgs","repos_url":"https://api.github.com/users/viric/repos","events_url":"https://api.github.com/users/viric/events{/privacy}","received_events_url":"https://api.github.com/users/viric/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/NixOS/nixpkgs/labels/0.kind:%20bug","name":"0.kind: bug","color":"84b6eb"},{"url":"https://api.github.com/repos/NixOS/nixpkgs/labels/6.topic:%20kernel","name":"6.topic: kernel","color":"fef2c0"},{"url":"https://api.github.com/repos/NixOS/nixpkgs/labels/6.topic:%20nixos","name":"6.topic: nixos","color":"fef2c0"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":21,"created_at":"2016-05-04T19:26:30Z","updated_at":"2016-05-05T13:28:45Z","closed_at":null,"body":"This seems to affect every NixOS with swraid since 15.09. Both lvm raid and mdraid.\r\n\r\nSymptoms:\r\nRAID work at a performance much slower than usual on writing.\r\nA good test is that of postgresql/bin/pg_test_fsync, and see fsync/s results. The first write(8k)-fsync() loop test will show over 100fsync/s on normal spindisks (ext4-over-raid1), and will show below 15fsync/s on that degraded performance (I have 3,5fsync/s on one disk for that test).\r\n\r\nMoreover, the kernel log will contain a message like this in your boot:\r\n```\r\n[    1.768469] md: md127 in immediate safe mode\r\n[    1.769362] md: md126 in immediate safe mode\r\n```\r\nSee the lines in the swraid nixos test from hydra for 15.09: https://hydra.nixos.org/build/27544644/log/raw and for 16.03: https://hydra.nixos.org/build/35228170\r\n\r\nThis \"immediate safe mode\" seems to be for *shutdown*, writing metadata at every data write (some \"sync\" mode), for cases when the RAID cannot be stopped easily on shutdown (like rootfs). I read about this in this blog post from 2012: http://neil.brown.name/blog/20120615073245\r\nWhy we have this state set at boot, I don't know.\r\n\r\nI have been requesting help from LVM developers (lvm raid) on this regard: https://bugzilla.redhat.com/show_bug.cgi?id=1332221\r\n\r\nSolution:\r\n1) It seems that our shutdown does not deactivate the arrays. It seems that it should, or at least *activate* that \"immediate safe mode\".\r\n2) (LVM) I've also been told that running a broad \"vgchange -ay\" (for lvm raids) on boot is not a safe thing to do, that we should only enable the minimum set of LVs for boot \"lvchange -ay rootvg/rootlv\", and leave the rest for systemd (stage 2).\r\n\r\nOnce a LV (lvm raid) has been started in such mode and runs slow, it can be made fast again by deactivating it (lvchange -an) and activating it again (lvchange -ay). That requires umounting, if it holds a fs, of course.\r\n\r\nFor what I could google, only NixOS is affected by these \"immediate safe mode\" messages a boot. So we have to improve all this."},"comment":{"url":"https://api.github.com/repos/NixOS/nixpkgs/issues/comments/217154562","html_url":"https://github.com/NixOS/nixpkgs/issues/15226#issuecomment-217154562","issue_url":"https://api.github.com/repos/NixOS/nixpkgs/issues/15226","id":217154562,"user":{"login":"grahamc","id":76716,"avatar_url":"https://avatars.githubusercontent.com/u/76716?v=3","gravatar_id":"","url":"https://api.github.com/users/grahamc","html_url":"https://github.com/grahamc","followers_url":"https://api.github.com/users/grahamc/followers","following_url":"https://api.github.com/users/grahamc/following{/other_user}","gists_url":"https://api.github.com/users/grahamc/gists{/gist_id}","starred_url":"https://api.github.com/users/grahamc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/grahamc/subscriptions","organizations_url":"https://api.github.com/users/grahamc/orgs","repos_url":"https://api.github.com/users/grahamc/repos","events_url":"https://api.github.com/users/grahamc/events{/privacy}","received_events_url":"https://api.github.com/users/grahamc/received_events","type":"User","site_admin":false},"created_at":"2016-05-05T13:28:45Z","updated_at":"2016-05-05T13:28:45Z","body":"I wonder if it would be a better strategy to write this in a language which doesn't execute other programs as part of determining which programs to kill."}}