Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp9890742rwb; Thu, 24 Nov 2022 21:10:22 -0800 (PST) X-Google-Smtp-Source: AA0mqf4XqYgTbe+CQA2x24Rja52AznnHEEBdA64X6HmQ4WaE9UeBE7OKUSqQrrQEPBAnrpxdE+M5 X-Received: by 2002:a17:902:d395:b0:189:58a9:14aa with SMTP id e21-20020a170902d39500b0018958a914aamr6466460pld.22.1669353022671; Thu, 24 Nov 2022 21:10:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669353022; cv=none; d=google.com; s=arc-20160816; b=A0MplKdpBmCKjBDhQ/REGB7vXbZ/L2YupGdvdFwSpK8xENOyOlCog7qcWDiB9v5f+X FxRLTT8c3r+6zSyYABsw60F2z1t7TsH9Jjgc/kYkGhs0NUiFAjuAoVgB/7aGhoP+1lsm 3hjH2v3xE9EgdaiapwNdjfCa+GSxQpW+0tEzjfI8rnGOxBRrBsgQfwl7CfTDbl5eO9IV S8fz9/3+vG4IsG8XjtzwW1L2kXkfpjzF+vmKnQCSZbOUw8oUfJO1tBVjz83333Fea8LD WLp39jloVYfnUU+up3QLXIxym3xNDlX1pDZMeJXak08aPqtAozciLNKwwR3FpjDCYA2p vh1A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=pxM0Tai1NwFg2mqAJQ1nSkdVi+JTmOQz5Ac0dKx9+yk=; b=PwvFKk+lolAfj0wZhyLdgt+UZuNiaZrTcMN6qUUBQhj96gmDmsioqiBVaUGwIkAtsw 2jFyDYauQcmH2grPw6ALbgaV74InWks7xYZQ9/G6+maiOpKrUmlQ+fP02P/zCUuU27hG rCm1enES0TZlOYujaECYsfH9mqO7oKPPSe2+zToy6K1WsVhUDUfZ5ahNqr1WAws7cPaU g73pNIl6C1GaSKswQigSobLTvnA49CWVNIxt8cHt7fvl0W8qNNWr208J+oFydaAjBDtW DeCrtaA3r0gdL8xZOCNA50Zv6HVIzbD+NF2yy7JviyTf8fAAxOAVKD++zbl4hWrAJFHL 7Euw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.org.uk header.s=zeniv-20220401 header.b=taGO1ATi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=zeniv.linux.org.uk Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id na6-20020a17090b4c0600b00218641b1acdsi7228259pjb.68.2022.11.24.21.10.11; Thu, 24 Nov 2022 21:10:22 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.org.uk header.s=zeniv-20220401 header.b=taGO1ATi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=zeniv.linux.org.uk Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229705AbiKYESn (ORCPT + 87 others); Thu, 24 Nov 2022 23:18:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60126 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229476AbiKYESl (ORCPT ); Thu, 24 Nov 2022 23:18:41 -0500 Received: from zeniv.linux.org.uk (zeniv.linux.org.uk [IPv6:2a03:a000:7:0:5054:ff:fe1c:15ff]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E354C28E06; Thu, 24 Nov 2022 20:18:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=linux.org.uk; s=zeniv-20220401; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=pxM0Tai1NwFg2mqAJQ1nSkdVi+JTmOQz5Ac0dKx9+yk=; b=taGO1ATiA5q4QgCU8nnvoBtIcc lO9tlrR7Y/phz7gCl0S4yEi9UyLuDogzERxdHX9JqxMx7QNxr0xB2EhdUMJOdDgEyHWEEp5DDWN9u l6Gzx6ztvsZLRESGJpoB6+OUFikQQXY7cjlOv796YW8IR5gYUYdrkSTQ1rzAWyIzqZdM96Z0MOFAh OiUvYtMAfx5zuGD88T9ju9s/hCqn2q7fdDoZUXY/GEnTjJzKS2dwZkaYWZxZpBR6zT3XXo0QMw1vZ izeGgBxcMCN4zr8t1TxKibzgwAf91BD4KL+Z4b7yozfju0WMWwTJUD1dHKmLwOqtq1C74L5M9SCfu eN4qXCrg==; Received: from viro by zeniv.linux.org.uk with local (Exim 4.96 #2 (Red Hat Linux)) id 1oyQAK-006aa1-1q; Fri, 25 Nov 2022 04:18:16 +0000 Date: Fri, 25 Nov 2022 04:18:16 +0000 From: Al Viro To: Damien Le Moal Cc: Nitesh Shetty , axboe@kernel.dk, agk@redhat.com, snitzer@kernel.org, dm-devel@redhat.com, kbusch@kernel.org, hch@lst.de, sagi@grimberg.me, james.smart@broadcom.com, kch@nvidia.com, naohiro.aota@wdc.com, jth@kernel.org, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-nvme@lists.infradead.org, linux-fsdevel@vger.kernel.org, anuj20.g@samsung.com, joshi.k@samsung.com, p.raghav@samsung.com, nitheshshetty@gmail.com, gost.dev@samsung.com Subject: Re: [PATCH v5 10/10] fs: add support for copy file range in zonefs Message-ID: References: <20221123055827.26996-1-nj.shetty@samsung.com> <20221123055827.26996-11-nj.shetty@samsung.com> <729254f8-2468-e694-715e-72bcbef80ff3@opensource.wdc.com> <349a4d66-3a9f-a095-005c-1f180c5f3aac@opensource.wdc.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <349a4d66-3a9f-a095-005c-1f180c5f3aac@opensource.wdc.com> Sender: Al Viro X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,SPF_HELO_NONE,SPF_NONE autolearn=ham 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-kernel@vger.kernel.org On Thu, Nov 24, 2022 at 10:47:55AM +0900, Damien Le Moal wrote: > >> + inode_lock(src_inode); > >> + inode_lock(dst_inode); > > > > So you did zonefs_copy_file_checks() outside of these locks, which mean > > that everything about the source and destination files may have changed. > > This does not work. > > I forgot to mention that locking 2 inodes blindly like this can leads to > deadlocks if another process tries a copy range from dst to src at the > same time (lock order is reversed and so can deadlock). Not to mention the deadlocks with existing places where fs/namei.c locks two inodes...