Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp3397817ybk; Tue, 19 May 2020 03:45:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwmXnuatQw5wJEQUcZ7hnFsDdhL4BsohPSTrij7Mc2Fbzcbj7f8YBUz6+KX32K3EErhTYXm X-Received: by 2002:a50:d98b:: with SMTP id w11mr16340574edj.196.1589885103117; Tue, 19 May 2020 03:45:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589885103; cv=none; d=google.com; s=arc-20160816; b=qTPNO/0tgtxOpSiaVuF5mY3WfCpwJaXSaS8F0Ef2Gyczrlv9U59Zzt7I26cojEKWRl fAg9bWS45TUM+wPDOUVwtKeBstBxnP+dMdvZ/3b4BKpW6BUjerp/EeRmwXq4tQs/t6r6 TiGyiXFlLWsTvKIr/DS4qOiz49u3TB84GjXUtfLaqJejJf7JNqR06mtVGAZWDIqQFu4q dWhdGIH2NTicQ5tbchm0sSlcDT29z2XXkSibyRW/mamwT1T00GHND1XX+gdWKB3mN/VF CSCPmjQ9zaKYJnVpNmDREGvL5sWfncOCOynvRlOKCNjEHhQopuKSrvnNw0iakQhAdVTE FrGg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id:dkim-signature; bh=U7tcvYJ3fh+dtmjblOcazELDy86HZy5kpJiI0dqyKSM=; b=nZmQok0hqfj0TlFVOt/vrDk8+M6wqFoR/6nsaJ/Yugc24VTzTH2i1YhrzTG/QbVw0S 6VsYxldMBrGpsBqX/3GoEhOIN7kpm4MlieOP/6LXBAjBaXytTzgxgKCXJkKL0lqPGM4n EVoTq0J8MnozGJ4oZGunCg2XGx+AqGA6bGbCB6no69LHY1P0owRyMZ/8mWRgy6TH4Ab/ 4Gl5Xzl+lnL68lVmo3BBuCPmbWaS9mJTwoRbCAgODke7nfhi9SF6FOl07H9K9tqNRN/v uiDGsBRRGltEppQ2lfOSUwlCtA6LeZVvgqD8jX1MeyMxknaMyp4nHQbdeq3ICiRzor9c HzWg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=yu54AhMc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i12si8352759ejx.447.2020.05.19.03.44.39; Tue, 19 May 2020 03:45:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=yu54AhMc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728630AbgESKnN (ORCPT + 99 others); Tue, 19 May 2020 06:43:13 -0400 Received: from mail.kernel.org ([198.145.29.99]:47658 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725911AbgESKnN (ORCPT ); Tue, 19 May 2020 06:43:13 -0400 Received: from tleilax.poochiereds.net (68-20-15-154.lightspeed.rlghnc.sbcglobal.net [68.20.15.154]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 5D16F20674; Tue, 19 May 2020 10:43:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1589884992; bh=L/14AxOpD03Run3O+IBY+gN9A7FJED5ePKYXqAc56ws=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=yu54AhMcabq+AvDj6KUaIZzm3VsU3sxprdYjdyBn4/dTgi6hv+V+fb5zg98nfd0c7 S4KRXKLI2BF7HS9+UnY87jbiO+9sb5WkqjNckH6HhvEHhOsL4iBfllNifxeTl4GyFq m9nsqEJDYV8sFa4C82IJh/xWQU8YATQrG1pz8cqM= Message-ID: Subject: Re: [PATCH] ceph: don't return -ESTALE if there's still an open file From: Jeff Layton To: Amir Goldstein , Gregory Farnum Cc: Luis Henriques , Ilya Dryomov , ceph-devel , linux-kernel , fstests , Dave Chinner , Christoph Hellwig , Miklos Szeredi Date: Tue, 19 May 2020 06:43:10 -0400 In-Reply-To: References: <20200514111453.GA99187@suse.com> <8497fe9a11ac1837813ee5f14b6ebae8fa6bf707.camel@kernel.org> <20200514124845.GA12559@suse.com> <4e5bf0e3bf055e53a342b19d168f6cf441781973.camel@kernel.org> <20200515111548.GA54598@suse.com> <61b1f19edcc349641b5383c2ac70cbf9a15ba4bd.camel@kernel.org> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.36.2 (3.36.2-1.fc32) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 2020-05-19 at 07:00 +0300, Amir Goldstein wrote: > On Tue, May 19, 2020 at 1:30 AM Gregory Farnum wrote: > > Maybe we resolved this conversation; I can't quite tell... > > I think v2 patch wraps it up... > > [...] > Agreed. > > > > Questions: > > > > 1. Does sync() result in fully purging inodes on MDS? > > > > > > I don't think so, but again, that code is not trivial to follow. I do > > > know that the MDS keeps around a "strays directory" which contains > > > unlinked inodes that are lazily cleaned up. My suspicion is that it's > > > satisfying lookups out of this cache as well. > > > > > > Which may be fine...the MDS is not required to be POSIX compliant after > > > all. Only the fs drivers are. > > > > I don't think this is quite that simple. Yes, the MDS is certainly > > giving back stray inodes in response to a lookup-by-ino request. But > > that's for a specific purpose: we need to be able to give back caps on > > unlinked-but-open files. For NFS specifically, I don't know what the > > rules are on NFS file handles and unlinked files, but the Ceph MDS > > won't know when files are closed everywhere, and it translates from > > NFS fh to Ceph inode using that lookup-by-ino functionality. > > > > There is no protocol rule that NFS server MUST return ESTALE > for file handle of a deleted file, but there is a rule that it MAY return > ESTALE for deleted file. For example, on server restart and traditional > block filesystem, there is not much choice. > > So returning ESTALE when file is deleted but opened on another ceph > client is definitely allowed by the protocol standard, the question is > whether changing the behavior will break any existing workloads... > Right -- that was sort of the point of my original question about the xfstest. The fact that ceph wasn't returning ESTALE in this situation didn't seem to be technically _wrong_ to me, but the xfstest treated that as a failure. It's probably best to return ESTALE since that's the conventional behavior, but I don't think it's necessarily required for correct operation in general. FWIW, if we ever implement O_TMPFILE in ceph, then we may need to revisit this code. With that, you can do a 0->1 transition on i_nlink, which blows some of the assumptions we're making here out of the water. > > > > 2. Is i_nlink synchronized among nodes on deferred delete? > > > > IWO, can inode come back from the dead on client if another node > > > > has linked it before i_nlink 0 was observed? > > > > > > No, that shouldn't happen. The caps mechanism should ensure that it > > > can't be observed by other clients until after the change. > > > > > > That said, Luis' current patch doesn't ensure we have the correct caps > > > to check the i_nlink. We may need to add that in before we can roll with > > > this. > > > > > > > 3. Can an NFS client be "migrated" from one ceph node to another > > > > with an open but unlinked file? > > > > > > > > > > No. Open files in ceph are generally per-client. You can't pass around a > > > fd (or equivalent). > > > > But the NFS file handles I think do work across clients, right? > > > > Maybe they can, but that would be like NFS server restart, so > all bets are off w.r.t open but deleted files. > They do work across clients, but a file handle is just an identifier for an inode. That's completely orthogonal to whether the file is open. -- Jeff Layton