From: Dr Fields James Bruce Subject: Re: [PATCH] locks: try to catch potential deadlock between file-private and classic locks from same process Date: Thu, 6 Mar 2014 13:41:13 -0500 Message-ID: <20140306184113.GB17485@fieldses.org> References: <1393960249-18961-1-git-send-email-jlayton@redhat.com> <20140304193551.GG12805@fieldses.org> <20140304151451.07530a98@tlielax.poochiereds.net> <20140304153723.088db7cd@tlielax.poochiereds.net> <849B7F2D-A1C2-4E65-AE6A-0CCFA92990F0@primarydata.com> <20140304211443.GJ12805@fieldses.org> <2047AB7C-DE42-4FF8-A1BD-0F5CA33540BD@primarydata.com> <20140304225617.GK12805@fieldses.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: Layton Jeff , Andy Lutomirski , Linux FS Devel To: Trond Myklebust Return-path: Received: from fieldses.org ([174.143.236.118]:52860 "EHLO fieldses.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751276AbaCFSlQ (ORCPT ); Thu, 6 Mar 2014 13:41:16 -0500 Content-Disposition: inline In-Reply-To: Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Tue, Mar 04, 2014 at 06:50:10PM -0500, Trond Myklebust wrote: >=20 > On Mar 4, 2014, at 17:56, Dr Fields James Bruce wrote: >=20 > > On Tue, Mar 04, 2014 at 05:42:31PM -0500, Trond Myklebust wrote: > >> On Mar 4, 2014, at 16:14, Dr Fields James Bruce > >> wrote: > >>> Good point: if I understand it right, in the mandatory locking ca= se, > >>> before doing a read or write we first check if we'd be able to ap= ply > >>> a classic posix lock. And that lock will always conflict with a > >>> file-private lock. > >>>=20 > >>> I think we should just not worry about it and see if anyone > >>> complains. File-private locks are a new feature and I don't see > >>> that we're under any obligation to support the combination of > >>> file-private locks and mandatory locking. > >>>=20 > >>> Mandatory locking is already buggy (because of the race between > >>> checking for locks and performing the IO). If we get no complain= ts > >>> about this file-private behavior then that's more evidence we cou= ld > >>> use to justify just ripping it out completely some day.... > > ... > >> The problem is that mandatory locking is something the administrat= or > >> and user enable. It isn=E2=80=99t entirely under the control of th= e > >> application=E2=80=A6 If you write a program that uses file-private= locks, I > >> can trivially DOS it by manipulating the mount parameters and > >> manipulating the file's group execute and sgid bit. > >=20 > > Or you could take a lock on the file and DOS it in the same way. > >=20 > > Why isn't the answer "don't do that=E2=80=9D? >=20 > =E2=80=A6because as a rule, it is bloody non-obvious and neither you = nor Jeff had > thought of it? Agreed that it certainly violates the principal of least surprise. I just don't think that maintaining Linux's mandatory locking is worth any unnecessary effort. Nobody should be using it anyway as far as I can tell. But, fair enough, I don't feel terrifically strong about this, and it's probably not too hard to fix. --b. -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel= " in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html