A few questions about nbd

From: Kasper Dupont (kasperd_at_daimi.au.dk)
Date: 07/31/03


Date: Thu, 31 Jul 2003 10:48:20 +0200

I want to implement a new block device encryption. It
is more complicated than what can be implemented using
cryptoloop. First I want to do a proof of concept
implementation in user mode. For that nbd seems like
the right choice. Later I will consider a kernel
implementation.

The nbd documentation suggests that running client and
server on the same machine can cause deadlocks. Is
that completely unavoidable? Right now I use mlockall
and touch all my pages before I start doing any nbd
stuff. Is there still a possibility of deadlocks, and
how?

Looking in the source I found, that my program will
need to call the NBD_DO_IT ioctl, which will enter a
while (1) loop in the kernel. What is the proper way
to leave that loop again? To me it looks like the only
way out of the loop is this piece of code:

   if (!req) {
      printk(KERN_ALERT "req should never be null\n" );
      goto out;
   }

I can probably force that to happen, but shouldn't
there be a cleaner way? And isn't it kind of waste to
keep user space around when I really just want to
keep the process in kernel mode until I want it to
quit. It is not just a piece of memory wasted, but
also a TLB flush on context switches.

-- 
Kasper Dupont -- der bruger for meget tid paa usenet.
For sending spam use mailto:aaarep@daimi.au.dk
Their business was zero and it was shrinking.


Relevant Pages

  • Re: bug in 2.6.22-rc2: loop mount limited to one single iso image
    ... > In kernel 2.6.22-rc2 the number of available loop mounts is reduced ... > Kernel 2.6.20.11 does not show that problem. ... sudo mount -o loop cd1.iso m1 ... commit 705962ccc9d21a08b74b6b6e1d3cf10f98968a67 ...
    (Linux-Kernel)
  • Re: [PATCH] loopback device cant act as its backing store
    ... Your patch addresses direct loop0-on-loop0 recursion, ... his case we simply stacked loop deveces too deep. ... While playing around with loop mounts on kernel 2.6.9 I managed to get ...
    (Linux-Kernel)
  • Re: Help with a driver im writing.
    ... Tasklets don't interfere each other on single CPU with non-preemeptable ... put it into a critical section with interrupt off anyway. ... > It's running on kernel version 2.6.14 single intel cpu, ... > My write routine is a loop in which i shift data out to the ...
    (comp.os.linux.development.system)
  • Re: raid1 with nbd member hangs MD on SLES10 and RHEL5
    ... >> Call Trace: ... >> If not this specific NBD change, ... > definitely an issue with the nbd kernel driver. ... > nbd SMP fix that went into 2.6.16 was in some way causing this MD/NBD ...
    (Linux-Kernel)
  • Re: [BUG] usb/core/hub.c loops forever on resume from ram due to bluetooth
    ... The oddball thing here is that on a UP machine with a UP kernel, ... After moving the drive to a dual-core machine and rebuilding ... By restricting iterations on the unbounded loop ... Greg / Marcel: any words of wisdom? ...
    (Linux-Kernel)

Loading