[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87vce1w241.fsf@spindle.srvr.nix>
Date: Tue, 23 Oct 2012 18:05:18 +0100
From: Nix <nix@...eri.org.uk>
To: "Myklebust\, Trond" <Trond.Myklebust@...app.com>
Cc: "J. Bruce Fields" <bfields@...ldses.org>,
"Ted Ts'o" <tytso@....edu>,
"linux-kernel\@vger.kernel.org" <linux-kernel@...r.kernel.org>,
"Schumaker\, Bryan" <Bryan.Schumaker@...app.com>,
Peng Tao <bergwolf@...il.com>,
"gregkh\@linuxfoundation.org" <gregkh@...uxfoundation.org>,
"linux-nfs\@vger.kernel.org" <linux-nfs@...r.kernel.org>,
Stanislav Kinsbursky <skinsbursky@...allels.com>
Subject: Re: Heads-up: 3.6.2 / 3.6.3 NFS server oops: 3.6.2+ regression? (also an unrelated ext4 data loss bug)
On 23 Oct 2012, Trond Myklebust spake thusly:
> On Tue, 2012-10-23 at 12:46 -0400, J. Bruce Fields wrote:
>> Looks like there's some confusion about whether nsm_client_get() returns
>> NULL or an error?
>
> nsm_client_get() looks extremely racy in the case where ln->nsm_users ==
> 0. Since we never recheck the value of ln->nsm_users after taking
> nsm_create_mutex, what is stopping 2 different threads from both setting
> ln->nsm_clnt and re-initialising ln->nsm_users?
Yep. At the worst possible time:
spin_lock(&ln->nsm_clnt_lock);
if (ln->nsm_users) {
if (--ln->nsm_users)
ln->nsm_clnt = NULL;
(1) shutdown = !ln->nsm_users;
}
spin_unlock(&ln->nsm_clnt_lock);
If a thread reinitializes nsm_users at point (1), after the assignment,
we could well end up with ln->nsm_clnt NULL and shutdown false. A bit
later, nsm_mon_unmon gets called with a NULL clnt, and boom.
This seems particularly likely if there is only one nsm_user (which is
true in my case, since I have only one active network namespace).
--
NULL && (void)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists