Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CCAD6ECDE47 for ; Thu, 8 Nov 2018 19:31:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 85A8A204FD for ; Thu, 8 Nov 2018 19:31:51 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="EmaqjSX5" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 85A8A204FD Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-nfs-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725922AbeKIFIo (ORCPT ); Fri, 9 Nov 2018 00:08:44 -0500 Received: from mail-vk1-f195.google.com ([209.85.221.195]:33446 "EHLO mail-vk1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725884AbeKIFIn (ORCPT ); Fri, 9 Nov 2018 00:08:43 -0500 Received: by mail-vk1-f195.google.com with SMTP id d201so2251823vka.0 for ; Thu, 08 Nov 2018 11:31:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=U+vUQz3sdViQPd4M0GDhdcoDnWOR3JjJhwO5gd90yfo=; b=EmaqjSX5+JGY4dgk8CkTY++TxGqff153zw0BJyN9OgtfyJoOtkbGvSzVL06IygHYIr ImaDSUFstWrUE/1NBqqbkhwB/lfjacrdtFi1JIioTmupTSoW4Gai8Q5cfusombqFmABC W1e1uSVt2hCGqU2VgzlzE+bwBLmrtbXkcDik0P8i4SszLJyTLo9Y+KBBZEEDi2MmU6LH dhD5QmT9WwbFHQN0TwDi9U527b95D9WA8txVZgJcuaX5CZ9PInizaMS68pvYt/M968wQ QFcftZ7qvX73nYWVo4CgyfhkraPnys8jyfRCzgqQzP/B49XgeHA6cfnFQHDNLt5abNTO b59Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=U+vUQz3sdViQPd4M0GDhdcoDnWOR3JjJhwO5gd90yfo=; b=bFQt5o/wAOLwrUqrut4EVtfVZuTe0lsTbQbOfItULqdfYLxWMW6la2+DITv6F59FBR UD8zWgwJfJ5/8snnNQlLDTNRCUMLr0sVzrNSxTWk41YOpZ1LbBhFAyHgPi+MSu7iPbNk EPX8oItbDwy40V0+u+6EbPhy3rCDru1GmBJy9m+0v7RbQ3+yjx0kDYe++pG13hCJ/gxV rjGvGTjX52SLfrOtcMYAWVqtAVj2AItdXcdpBDMYtk7hvLqM/cU1E6euT5EQ5ppVVZs6 jMBAO9VpJ0KO2HHtLMyGd/ozko6LZZOE22e7XGIydmGmLuEpd5mb3ent3BRtQTpZpB3S wAjw== X-Gm-Message-State: AGRZ1gKNNUcdNvW9HdGfMuv4BFK6liviEK48/oQR9Okx0940nl5GG+wO aAfoNNVkrlLDwz+AXQePWS8hLM/ZKH5gaWr/af8= X-Google-Smtp-Source: AJdET5ePWwkPZzXJzQspu71aWCFXGCdSlzbVrJxFLUjQc+NBRUKkkiwMcM/3Tsa+lSTL40x5uruSYLRINWR687PCf3E= X-Received: by 2002:a1f:ac4:: with SMTP id 187mr2589528vkk.31.1541705509184; Thu, 08 Nov 2018 11:31:49 -0800 (PST) MIME-Version: 1.0 References: <20181019152905.32418-1-olga.kornievskaia@gmail.com> <20181019152905.32418-13-olga.kornievskaia@gmail.com> <20181107185753.GB19588@fieldses.org> <20181108192502.GB6090@fieldses.org> <20181108192759.GC6090@fieldses.org> In-Reply-To: <20181108192759.GC6090@fieldses.org> From: Olga Kornievskaia Date: Thu, 8 Nov 2018 14:31:37 -0500 Message-ID: Subject: Re: [PATCH v1 12/13] NFSD: allow inter server COPY to have a STALE source server fh To: "J. Bruce Fields" Cc: "J. Bruce Fields" , linux-nfs Content-Type: text/plain; charset="UTF-8" Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org On Thu, Nov 8, 2018 at 2:28 PM J. Bruce Fields wrote: > > On Thu, Nov 08, 2018 at 02:25:02PM -0500, J. Bruce Fields wrote: > > On Thu, Nov 08, 2018 at 01:51:58PM -0500, Olga Kornievskaia wrote: > > > On Wed, Nov 7, 2018 at 1:57 PM J. Bruce Fields wrote: > > > > > > > > On Fri, Oct 19, 2018 at 11:29:04AM -0400, Olga Kornievskaia wrote: > > > > > From: Olga Kornievskaia > > > > > > > > > > The inter server to server COPY source server filehandle > > > > > is a foreign filehandle as the COPY is sent to the destination > > > > > server. > > > > > > > > Compounds can do a lot of different strange things, and I'm not > > > > convinced this code handles every case correctly. Examples: I think > > > > that > > > > > > > > PUTFH > > > > TEST_STATEID > > > > SAVEFH > > > > COPY > > > > > > > > will incorrectly return nfserr_stale if the PUTHF gets a foreign > > > > filehandle, even though that filehandle is only used as the source of > > > > the COPY. And: > > > > > > > > PUTFH > > > > SAVEFH > > > > RENAME > > > > COPY > > > > > > > > will pass an unverified source filehandle to rename. > > > > > > > > I can think of a couple ways to get this right for certain: > > > > > > > > - delay all filehandle verification till the time the filehandle > > > > isused. That would make checking this simple, but it would > > > > change our behavior so, for example PUTFH+READ with a bad > > > > filehandle will return the error on the READ where it used to > > > > return it on the PUTFH. I don't know if that's a problem. > > > > > > > > - somewhere at the start of nfsd4_proc_compound, do one pass > > > > through the compound checking where the filehandles will be > > > > used and marking those ops that can skip checking. E.g.: > > > > > > > > nfsd4_op *current, *saved > > > > > > > > foreach op in compound: > > > > - if op is putfh: > > > > current := op > > > > - if op is savefh: > > > > saved := current > > > > - if op is restorefh: > > > > current := saved > > > > - etc. > > > > - if op is copy: > > > > mark_no_verify(saved) > > > > > > > > Or something like that. > > > > > > Do you have a preference over the 2 proposed methods? I'm not sure if > > > there is anything wrong with returning ERR_STALE on READ instead of > > > the PUTFH but for historical reasons it seems wrong to change it. Thus > > > I'd say doing it the 2nd way is better. But then 2nd approach adds an > > > overhead of going thru operations twice for any compound. Is that > > > acceptable? > > > > I think so. Most compounds are pretty short and I don't think it'll be > > a big deal. > > So, yes, could you try the second approach? > > I've been working on the 1st approach--I have a patch here and I may > experiment with it some more. But I'm starting to think that the > separate scan will work better. > > --b.