[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[Nbd] nbd-client and SIGSTOP/SIGCONT



Hi,

I'm trying to build an embedded system with an NBD-mounted filesystem as a chroot. That is,I have a simple initrd image loaded into ram from elsewhere, and which the kernel uses as rootfs at boot-up. Then, on the same system, I start an nbd server (on localhost), and a handful of nbd-clients. I mount an ext3 filesystem on one of the clients, then chroot to it and run init from it. This filesystem has Debian 6.0, which starts up very cleanly, and everything so far is working as it should be.

However, when I want to shut it down, things get messy. The shutdown scripts call killall5, and I have populated the appropriate directory with the correct "omit" pids, and I see that killall5 doesn't try to kill either the server or the clients. But the nbd-client for the mounted filesystem dies anyway, which means the subsequent file IO is broken, and the remaining scripts are not executed. I have added debug to nbd-client, and the ioctl(nbd, NBD_DO_IT) call is returning after running killall5. Then I wrote a simple test file that doesn't kill any processes at all, but does the signal(-1, SIGSTOP) followed by signal(-1, SIGCONT), just as killall5 does, and the nbd-client still dies. Delving deeper into the nbd kernel driver, the wait_event_interruptible() call in nbd_find_request() is returning -ERESTARTSYS after the SIGSTOP/SIGCONT sequence has been run. This return value is returned from nbd_ioctl() as it should be. I would think that the ioctl(nbd, NBD_DO_IT) would be restarted, but the ioctl() still returns to the nbd-client. And, of course, the socket and nbd_thread have been shutdown by the time nbd_ioctl() returns.

This is about as far as I got. I think I need a clean way for nbd_ioctl() to return -ERESTARTSYS without shutting everything down, so that when the call is restarted, it can just pick up where it left off.

Has anyone else run into this problem before? I'm using nbd-2.9.16 on (arm) linux 2.6.29.

Regards
ic





Reply to: