This looks correct and safe to me, but I wonder if anyone relieson multi-threaded /dev/sg write usage, which would be completelyserialized with this.