[Qemu-devel] [PATCH] do not chdir(/) in qemu-nbd

2012-01-13 Thread Michael Tokarev
When qemu-nbd becomes a daemon it calls daemon(3) with nochdir=0, so daemon(3) changes current directory to /. But at this time, qemu-nbd did not open any user-specified files yet, so by changing current directory, all non-absolute paths becomes wrong. The solution is to pass nochdir=1 to

Re: [Qemu-devel] [PATCH] do not chdir(/) in qemu-nbd

2012-01-13 Thread Stefan Hajnoczi
On Fri, Jan 13, 2012 at 9:04 AM, Michael Tokarev m...@tls.msk.ru wrote: When qemu-nbd becomes a daemon it calls daemon(3) with nochdir=0, so daemon(3) changes current directory to /. But at this time, qemu-nbd did not open any user-specified files yet, so by changing current directory, all

Re: [Qemu-devel] [PATCH] do not chdir(/) in qemu-nbd

2012-01-13 Thread Michael Tokarev
On 13.01.2012 15:57, Stefan Hajnoczi wrote: On Fri, Jan 13, 2012 at 9:04 AM, Michael Tokarev m...@tls.msk.ru wrote: When qemu-nbd becomes a daemon it calls daemon(3) with nochdir=0, so daemon(3) changes current directory to /. But at this time, qemu-nbd did not open any user-specified files

Re: [Qemu-devel] [PATCH] do not chdir(/) in qemu-nbd

2012-01-13 Thread Daniel P. Berrange
On Fri, Jan 13, 2012 at 04:47:35PM +0400, Michael Tokarev wrote: On 13.01.2012 15:57, Stefan Hajnoczi wrote: On Fri, Jan 13, 2012 at 9:04 AM, Michael Tokarev m...@tls.msk.ru wrote: When qemu-nbd becomes a daemon it calls daemon(3) with nochdir=0, so daemon(3) changes current directory to /.

Re: [Qemu-devel] [PATCH] do not chdir(/) in qemu-nbd

2012-01-13 Thread Paolo Bonzini
On 01/13/2012 01:47 PM, Michael Tokarev wrote: But instead of adding a chdir later, I'll try to rearrange code a bit to do all init in the parent instead. That's not possible, because when you fork you lose all threads except the main thread. That's why the daemon() was moved very early.