Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp235844imm; Fri, 19 Oct 2018 22:25:48 -0700 (PDT) X-Google-Smtp-Source: ACcGV62gwSq4K3h0J9ALwabgmQEAVgIR2pbGMp9CCEXP87Jt9tYF8/4lCZ1X8DnhKeVeOFVO0q71 X-Received: by 2002:a62:7788:: with SMTP id s130-v6mr37266847pfc.189.1540013148024; Fri, 19 Oct 2018 22:25:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540013148; cv=none; d=google.com; s=arc-20160816; b=UITUwyg9KAil8GNPB4ijCsuG4BYngt8kXHrK+3KSpMqUlAdIwn0rIWx5BVrqJOAkfA cfQ6zdRzv8FS1E/ikIkKCCbxkdOTHGkaIS/Au4XJtR6qgc+Mly/bDAnfxSoe8ycaIvYj /h5sfOgfXXp8jFczcbxaaJE5w8rSSqKW9mgt9tIe/KzaGoZTWrTUeoTtDJJK6mw/aaWK JhvomlrQl26qYfEgT2KEad0fOYjDNAgFEY010kPe7SV9a2bjAzVQRrUTlv7urP4Ttxf5 mQ+OUnSP+VKana+S/PP7RQW3YbaLlniKpdFvgb8lEEbsZPItsThUgzaoBcsEv7WueFu2 s2zA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=8shFL9csW5rhyACXafcahVLEfHRe6LFbYbC5OKIc8qs=; b=lTU2XrG/RwO9feJ9QVbZ4z2UUppHosUswVstsXI90X7r29A/qT8mf2TS+r+GrpJdu8 e/GmdN6GFlDqdU+BUdP53esMxlfonAjmGk3hvCA2LIjVpYOaEP+w3enPbRf79X1viwis vn77drloKw4cseTY5FHFAXAy8h968WkOVwFwWP5kWHN98RuoWOnUUanAecvluyi5ZzBV 4tuDW+xG/8xwXVtVl5FiIcGksatyaKpma9Z3apW4qZdpBUMNsvXuhw/C1YwJmTxvOI62 VxHgva7mHAEkBGnBtJOb7r+pm2N9cIvDoEHxIlsfJVJRUOlLg9ldMmYkEDUgmjQUkvdl dzcg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p25-v6si7736372pli.239.2018.10.19.22.25.32; Fri, 19 Oct 2018 22:25:47 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726916AbeJTNeW (ORCPT + 99 others); Sat, 20 Oct 2018 09:34:22 -0400 Received: from zeniv.linux.org.uk ([195.92.253.2]:46278 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726312AbeJTNeW (ORCPT ); Sat, 20 Oct 2018 09:34:22 -0400 Received: from viro by ZenIV.linux.org.uk with local (Exim 4.90_1 #2 (Red Hat Linux)) id 1gDjl3-0006jD-Nu; Sat, 20 Oct 2018 05:25:05 +0000 Date: Sat, 20 Oct 2018 06:25:05 +0100 From: Al Viro To: David Howells Cc: Alan Jenkins , torvalds@linux-foundation.org, ebiederm@xmission.com, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, mszeredi@redhat.com Subject: Re: [PATCH 03/34] teach move_mount(2) to work with OPEN_TREE_CLONE [ver #12] Message-ID: <20181020052505.GK32577@ZenIV.linux.org.uk> References: <97872123-70be-2833-ea7a-a463ce204b53@gmail.com> <862e36a2-2a6f-4e26-3228-8cab4b4cf230@gmail.com> <153754740781.17872.7869536526927736855.stgit@warthog.procyon.org.uk> <153754743491.17872.12115848333103740766.stgit@warthog.procyon.org.uk> <6518.1539956277@warthog.procyon.org.uk> <29902.1539988579@warthog.procyon.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <29902.1539988579@warthog.procyon.org.uk> User-Agent: Mutt/1.9.1 (2017-09-22) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Oct 19, 2018 at 11:36:19PM +0100, David Howells wrote: > Alan Jenkins wrote: > > > # open_tree_clone 3 > # cd /proc/self/fd/3 > > # mount --move . /mnt > > [ 41.747831] mnt_flags=1020 umount=0 > > # cd / > > # umount /mnt > > umount: /mnt: target is busy > > > > ^ a newly introduced bug? I do not remember having this problem before. > > The reason EBUSY is returned is because propagate_mount_busy() is called by > do_umount() with refcnt == 2, but mnt_count == 3: > > umount-3577 M=f8898a34 u=3 0x555 sp=__x64_sys_umount+0x12/0x15 > > the trace line being added here: > > if (!propagate_mount_busy(mnt, 2)) { > if (!list_empty(&mnt->mnt_list)) > umount_tree(mnt, UMOUNT_PROPAGATE|UMOUNT_SYNC); > retval = 0; > } else { > trace_mnt_count(mnt, mnt->mnt_id, > atomic_read(&mnt->mnt_count), > 0x555, __builtin_return_address(0)); > } > > The busy evaluation is a result of this check: > > if (!list_empty(&mnt->mnt_mounts) || do_refcount_check(mnt, refcnt)) > > in propagate_mount_busy(). > > > The problem apparently being that mnt_count counts both refs from mountings > and refs from other sources, such as file descriptors or pathwalk. As it bloody well should. Once the tree has been attached, that open_ctree() descriptor is refering to vfsmount of /mnt (what else could it be?) IOW, it *is* genuinely busy. The livelock on umount -l you've mentioned is a different story - that's definitely a bug, but this -EBUSY is correct.