Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp346898pxm; Wed, 2 Mar 2022 17:00:34 -0800 (PST) X-Google-Smtp-Source: ABdhPJzMEWS+8jixB2sVsIJBGKnTF53JCDWY6xhZX3JISENNo4/crEXy/wf7Kft10f2/tSMJKMHw X-Received: by 2002:a17:902:e806:b0:14f:d9b7:ab1 with SMTP id u6-20020a170902e80600b0014fd9b70ab1mr33854025plg.151.1646269234100; Wed, 02 Mar 2022 17:00:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646269234; cv=none; d=google.com; s=arc-20160816; b=dmaV4USFIiUL51YUiZddrS0XmUiKzYC31xwHIYE2ZDXct8VOEMvCmbwE0y8XIW4Jf6 0YCYBdv8ZK36HmTDkSf2ywGgNFsJOQbXMfZ/cZWNglUuZj/ct9Kzub8eeMAwbGUJiz7I d/3cKnZpV/NvjIxcYtiMoUXBycXh3NdOd6Nsd+YAuPmrKlXSdF+IQnVUOPIufBcEBtcB FbMDh2GSBHJ3WpUVXpWxKfuVvuHvsziJqC2ZXHWOLiKF1AH61EbWy7AYrHfB5hI/qUUm +KX2LCe8fptMd2za9ehKCm5NDNTIUIrFvKMk97wlYTIG1iF0uddFqEhsDxG2qiNBeh6I lYzQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=ETM+Zu622nDqVa3wz+osL6CiDEUlv57g1pg0q6yBmFs=; b=bIVdmcGKxzvbTcu1kbM+7bcWeAOIWaCzoAhs87aLaBFMdIAgRNhjtZHOFs4o/idJ7M HqDdSyobcJf3mciTbrYvdxBZXcyKRiIHe9Y4tOJLuXJFNu2j4VVsmIjKBVa1vkiNSt3D JoylPD1egM19lTVrFKpqhqO9NlWlogeHyd6V2oKEoGrgdCCnYB1vor8VI/kQsVxESZa6 fLDYe9wz2bJtzt7EtPG8V+7S4gjHxDuDzDLTo5kXgNXh42/XLfPCg696CIz+G4xMuLw8 afQpGRIcnoPfwz6ckbO4raSePh4LSQk6fBywujyrK9+qn9gwfp/h22qjDdSefo7Ijuql Zh/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@toxicpanda-com.20210112.gappssmtp.com header.s=20210112 header.b=1cVjwE4v; spf=softfail (google.com: domain of transitioning linux-nfs-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id f20-20020a056a001ad400b004f11edaa589si656179pfv.227.2022.03.02.17.00.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Mar 2022 17:00:34 -0800 (PST) Received-SPF: softfail (google.com: domain of transitioning linux-nfs-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@toxicpanda-com.20210112.gappssmtp.com header.s=20210112 header.b=1cVjwE4v; spf=softfail (google.com: domain of transitioning linux-nfs-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 69A8E5F8FF; Wed, 2 Mar 2022 16:29:43 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230350AbiCCAaW (ORCPT + 99 others); Wed, 2 Mar 2022 19:30:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39036 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230342AbiCCAaV (ORCPT ); Wed, 2 Mar 2022 19:30:21 -0500 Received: from mail-qk1-x72d.google.com (mail-qk1-x72d.google.com [IPv6:2607:f8b0:4864:20::72d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DAD3151318 for ; Wed, 2 Mar 2022 16:29:36 -0800 (PST) Received: by mail-qk1-x72d.google.com with SMTP id g24so2779640qkl.3 for ; Wed, 02 Mar 2022 16:29:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=toxicpanda-com.20210112.gappssmtp.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=ETM+Zu622nDqVa3wz+osL6CiDEUlv57g1pg0q6yBmFs=; b=1cVjwE4vryVzO1VUWJHcv42VskLLZjk0RsqPoeURS2jD7Uxvwz6pQIVXxlwysIk2P+ sKDKbeU4gOZm6AIwCT15S8A1zrNeXV9ouyjHz2tRsR6cvr5B1ntLqqCAwNv6ERiQWFCT /islPG8S+hCZ7lvveaZjL1vC57gnghbBzl4DznRjFFxzj2RYpY9Pk6PFNIrZQcF7uMsj HT3UXTbP/ECCPSy65z1SiWUO2YA9z/UHYL6b39AyEFcVwIqgDV9Hq+8c2gPCKfSQ4rnk LeYWPKQm78CCvfcVL9x3QYyseJIuxjvtATbEH3nYeaM2LOC9We3f9Veek/QeZ0+piUFL 3s1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=ETM+Zu622nDqVa3wz+osL6CiDEUlv57g1pg0q6yBmFs=; b=lKYOpu7HTPh+J/ApzmmU5wczm0kowxalvvxrHQpasG+t0Kfx4X5WDWBXMKhscoumVn Jlp+/BItBSLYHxyk8v2Wz+admJeQCjOeM0cVy708/zsf6so+SqBUBLU1ZMH1v0GXlzVk eFwb8sFBArKviBO1DidfoHmXyiPTjRE5ATeTcchK0SJ5W/Td4qdpiKQEQGrz5Zp9m/c4 teL+aXnS5zmznraPosj/lx3d+2notj5nAdfKZ8UmziVeo4okgvWLl9Hx7vt6O+mu3RIv Cnlgn6Z7TDI0E+l8S3iXN+0L+IqzunomVYRlpFEXPXksc0cifKA8Bs7k1itj46qeu+My ZaNA== X-Gm-Message-State: AOAM532Tm67wZAM8MHWX789ZwnJymliM0YDnwzhSAwULF5g0ZjIfRzgH Whe5UlqhHk277D3R2RUZqJ+Lwg== X-Received: by 2002:a37:9c92:0:b0:60d:d77e:e643 with SMTP id f140-20020a379c92000000b0060dd77ee643mr18108824qke.252.1646267375830; Wed, 02 Mar 2022 16:29:35 -0800 (PST) Received: from localhost (cpe-174-109-172-136.nc.res.rr.com. [174.109.172.136]) by smtp.gmail.com with ESMTPSA id c16-20020a05622a059000b002dc93dc92d1sm403829qtb.48.2022.03.02.16.29.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Mar 2022 16:29:35 -0800 (PST) Date: Wed, 2 Mar 2022 19:29:34 -0500 From: Josef Bacik To: "J. Bruce Fields" Cc: linux-fsdevel , linux-nfs@vger.kernel.org, Chuck Lever Subject: Re: nfs generic/373 failure after "fs: allow cross-vfsmount reflink/dedupe" Message-ID: References: <20220302065952.GE3927073@dread.disaster.area> <20220302082658.GF3927073@dread.disaster.area> <20220302211226.GG3927073@dread.disaster.area> <20220302220450.GD10757@fieldses.org> <20220302224250.GF10757@fieldses.org> <20220303000735.GA21944@fieldses.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220303000735.GA21944@fieldses.org> X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org On Wed, Mar 02, 2022 at 07:07:35PM -0500, J. Bruce Fields wrote: > On Wed, Mar 02, 2022 at 06:45:12PM -0500, Josef Bacik wrote: > > On Wed, Mar 02, 2022 at 05:42:50PM -0500, J. Bruce Fields wrote: > > > On Wed, Mar 02, 2022 at 05:26:08PM -0500, Josef Bacik wrote: > > > > On Wed, Mar 02, 2022 at 05:04:50PM -0500, J. Bruce Fields wrote: > > > > > I started seeing generic/373 fail on recent linux-next in NFS testing. > > > > > > > > > > Bisect lands it on aaf40970b1d0 "fs: allow cross-vfsmount > > > > > reflink/dedupe". > > > > > > > > > > The test fails because a clone between two mounts is expected to fail, > > > > > and no longer does. > > > > > > > > > > In my setup both mounts are nfs mounts. They are mounts of different > > > > > exports, and the exports are exports of different filesystems. So it > > > > > does make sense that the clone should fail. > > > > > > > > > > I see the NFS client send a CLONE rpc to the server, and the server > > > > > return success. That seems wrong. > > > > > > > > > > Both exported filesystems are xfs, and from the code it looks like the > > > > > server calls vfs_clone_file_range(), which ends up calling > > > > > xfs_file_remap_range(). > > > > > > > > > > Are we missing a check now in that xfs case? > > > > > > > > > > I haven't looked any more closely at what's going on, so I could be > > > > > missing something. > > > > > > > > > > > > > Yeah there's a few fstests that test this functionality that need to be removed, > > > > I have patches pending for this in our fstests staging tree (since we run > > > > fstests nightly on our tree) > > > > > > > > https://github.com/btrfs/fstests/tree/staging > > > > > > > > Right now the patches just remove the tests from auto since that's what we run, > > > > I'll remove them properly once the patch lands in linus. Thanks, > > > > > > So, out of curiosity, what is xfs doing in this case? These are two > > > filesystems on separate partitions, is it falling back on a read/write > > > loop or something? > > > > I don't think so? I'm actually kind of confused, because nfsd does > > vfs_clone_file_range, and the only place I messed with for CLONE was > > ioctl_clone_file, so the patch changed literally nothing, unless you aren't > > using nfsd for the server? > > > > And if they are in fact two different file systems the i_sb != i_sb of the > > files, so there's something pretty strange going on here, my patch shouldn't > > affect your setup. Thanks, > > Sorry, took me a minute to understand, myself: > > It's actually only the client behavior that changed. Previously the > client would reject an attempt to clone across filesystems, so the > server never saw such a request. After this patch, the client will go > ahead and send the CLONE. (Which, come to think of it, is probably the > right thing for the client to do.) > > So the server's probably always had a bug, and this just uncovered it. > > I'd be curious what the consequences are. And where the check should be > (above or below vfs_clone_file_range()?). > This is where I'm confused, this really shouldn't succeed loff_t do_clone_file_range(struct file *file_in, loff_t pos_in, struct file *file_out, loff_t pos_out, loff_t len, unsigned int remap_flags) { loff_t ret; WARN_ON_ONCE(remap_flags & REMAP_FILE_DEDUP); if (file_inode(file_in)->i_sb != file_inode(file_out)->i_sb) return -EXDEV; loff_t vfs_clone_file_range(struct file *file_in, loff_t pos_in, struct file *file_out, loff_t pos_out, loff_t len, unsigned int remap_flags) { loff_t ret; file_start_write(file_out); ret = do_clone_file_range(file_in, pos_in, file_out, pos_out, len, remap_flags); And even if we get past here, I imagine XFS would freak out because it can't find the extents (unless you're getting lucky and everything is lining up?). I'm super confused... Josef