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

Re: [Nbd] Deadlock Issues with Local NBD Server



On Tue, Sep 27, 2011 at 05:25:50PM +0100, Alex Bligh wrote:
> --On 27 September 2011 03:57:45 -0700 Adam Cozzette
> <acozzette@...946...> wrote:
> 
> >I have read about similar attempts and I know that there are deadlock
> >issues associated with running NBD as a client and server on the same
> >machine.
> 
> Provided swap is not on nbd, and you are not trying to exotically
> run nbd on nbd, I can't immediately see what the deadlocking are
> in modern kernels. Paul might know better. I suppose the danger is
> a full block layer request list toward nbd, and nbd-server not
> being able to make progress due to the block layer list being full.
> I think to the extend there is a concept of 'fullness' at all,
> it is by device.

I'm definitely not an expert, but here is what I was envisioning (this might be
what you were saying). There are an nbd client and an nbd server both running
locally and talking to each other. Suppose that the buffer cache becomes
entirely full with dirty pages for this block device. The kernel needs to free
up some memory, so it starts to write those dirty pages to the nbd device. Then
in userspace, the server has to allocate some memory in order to write out those
pages. So deadlock results because the kernel cannot free up any memory until
the nbd server writes out those dirty pages, and the nbd server cannot write out
any dirty pages without first allocating some memory.

So it seems to me that the deadlock situation is essentially the same whether
you're swapping to a block device or just writing out dirty pages. Or am I
mistaken about that? Is this something that is so unlikely to occur that there
is no point in worrying about it?

Thank you,
Adam

-- 
Adam Cozzette
Harvey Mudd College Class of 2012



Reply to: