xfs
[Top] [All Lists]

Re: [PATCH 10/19] NET: set PF_FSTRANS while holding sk_lock

To: NeilBrown <neilb@xxxxxxx>
Subject: Re: [PATCH 10/19] NET: set PF_FSTRANS while holding sk_lock
From: Eric Dumazet <eric.dumazet@xxxxxxxxx>
Date: Tue, 15 Apr 2014 22:13:46 -0700
Cc: linux-mm@xxxxxxxxx, linux-nfs@xxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx, xfs@xxxxxxxxxxx, netdev@xxxxxxxxxxxxxxx
Delivered-to: xfs@xxxxxxxxxxx
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:subject:from:to:cc:date:in-reply-to:references :content-type:content-transfer-encoding:mime-version; bh=xD9DIIaID91y+ESCvfXO5o/T2UrOqB3PRddDdod4zWQ=; b=hfAL7yISP8AIC3Dp2qe/J11jhTDeUkI/hm4Nf9b0KKZfVrx5C/VseUQY7feF2HTtdS OtoO5WgO3tZt1aTw7dQXV/z7sa+IE1W61FjqlH0JbBGpqQT/rL9AipASDbE8EsQpwQBn 8GkFbhUeMUcHfocSi1v0UGnVQ5FDXSIUTzKA0mdnAv+AieloZZBwt3aGMwtLf60HmE/E 4Rr8gAHNu4Gciucn6RNohqM5ciX4qeVCgxWpLv0fSx/mjWqDf+xgaezKFkWxYO4u0gVh ZFMtK1aFRDAmnUUWgSbWDGMkONpCR7rFPaAW/CsqtfRn5WIy71l3yccxJSNoGSrAXytx uzdw==
In-reply-to: <20140416040336.10604.96000.stgit@xxxxxxxxxxxxxx>
References: <20140416033623.10604.69237.stgit@xxxxxxxxxxxxxx> <20140416040336.10604.96000.stgit@xxxxxxxxxxxxxx>
On Wed, 2014-04-16 at 14:03 +1000, NeilBrown wrote:
> sk_lock can be taken while reclaiming memory (in nfsd for loop-back
> NFS mounts, and presumably in nfs), and memory can be allocated while
> holding sk_lock, at least via:
> 
>  inet_listen -> inet_csk_listen_start ->reqsk_queue_alloc
> 
> So to avoid deadlocks, always set PF_FSTRANS while holding sk_lock.
> 
> This deadlock was found by lockdep.

Wow, this is adding expensive stuff in fast path, only for nfsd :(

BTW, why should the current->flags should be saved on a socket field,
and not a current->save_flags. This really looks a thread property, not
a socket one.

Why nfsd could not have PF_FSTRANS in its current->flags ?

For applications handling millions of sockets, this makes a difference.


<Prev in Thread] Current Thread [Next in Thread>