Openwall GNU/*/Linux - a small security-enhanced Linux distro for servers
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Sat, 11 Feb 2017 20:15:21 -0500
From: Bruce Fields <bfields@...ldses.org>
To: Jeff Layton <jlayton@...chiereds.net>
Cc: David Windsor <dwindsor@...il.com>, linux-nfs@...r.kernel.org,
	netdev@...r.kernel.org, kernel-hardening@...ts.openwall.com,
	Kees Cook <keescook@...omium.org>,
	"Reshetova, Elena" <elena.reshetova@...el.com>
Subject: Re: [RFC][PATCH] nfsd: add +1 to reference counting scheme for
 struct nfsd4_session

On Sat, Feb 11, 2017 at 07:31:42AM -0500, Jeff Layton wrote:
> The basic idea here is that nfsv4 sessions have a "resting state" of 0.
> We want to keep them around, but if they go "dead" then we we'll tear
> them down if they aren't actively in use at the time. So, we still free
> the thing when the refcount goes to zero, but we have an extra condition
> before we free it on the put -- that the session is also "dead" (meaning
> that the client asked us to destroy it).
> 
> Your patch doesn't look like it'll break anything, but I personally find
>  it harder to follow that way. The freeable reference state will be 1
> instead of the normal 0.

Alas, I don't have any examples in mind, but doesn't this pattern happen
all over?

You have objects that live in some data structure.  They're freed only
when they're removed from the data structure.  You want removal to fail
whenever they're in use.

So it's natural to use an atomic counter to track the number of external
users and some other lock to serialize lookup and destruction.

--b.

Powered by blists - more mailing lists

Your e-mail address:

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.