Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp19861953rwd; Wed, 28 Jun 2023 15:45:06 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4A61+my/3x58DAKgcHaH3IjAbY+wH3KKR+pj59HiqQGBsH/Fo40KkLv6qPNSo3+HEhpGrJ X-Received: by 2002:a05:6a20:3d15:b0:12c:9100:362f with SMTP id y21-20020a056a203d1500b0012c9100362fmr1740169pzi.4.1687992306229; Wed, 28 Jun 2023 15:45:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687992306; cv=none; d=google.com; s=arc-20160816; b=Mtes2Jlh5OMKKRWWra9M70rAot/HgIJXh/qWQ2vc3XvExv30C6cBHOpTkCLYGs07AF 4eBVHK53QpXSoCxaeAkgxCZd7/Flh+o+b8pFc3n609ZGAKdS2yt+W/wgkrUi615ZlvDQ t42/LgVT7XcakgjIg98HhIAYmhO25m3EOLiHEef70X56XGhP9NcMsqIRyIPNstGeDzki fWQYtalO2Q7Dye6yy3Yrrg62AiibdUr3ipgYqw9lkDzUd4htXpI6d+gq2lR7qxcFB+sa DEOQQ8+Cje82rhzht6AAcgkQ+9fylwfjmHWUYJJuPehBKzJj6Yn276nX37CfvcbGm8SW LhEA== 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:dkim-signature:date; bh=v8WVoQUFJwrHXrcj8iB/cmADxHGelZ4I+K1br+JoT3I=; fh=vsF40E3Ve9ZoKkTEiZu7G/WyCu/9wCkGmr1G5IU9IAE=; b=Ye145LqRgge26cNBOuCV1pKtKnIdTbEAvwKEHrzMVIR3+eQyruPJcs53O8/YvwdVIA A2Yrb2OXUCesLeT86XKQCQU9oKdGO6kMM9UXAO6k7aRPfKJUachNI8LJC0+iViOcT7/x ZkOMEi981fVrtwjJsqFeb1VD5Mm9XUGd4VJ8EaA+TMio4sxBnxleSJbF7vhy9Nb35Ukh /RDrZAQNf1rPGLjkqt7OFY/oYwpUArYzu42FB8NM9muLHP45+A80qzkAaIflxr0oGitg zC0v5f3/A024BlxvNbW5Ty47waa/1aqTkQOeAg1nl+DSaCOQR4mj+yMXTEyzA++ceCmo IPNg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=c2rOpx7H; 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=linux.dev Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s17-20020a632c11000000b0054288b91d66si9723685pgs.635.2023.06.28.15.44.53; Wed, 28 Jun 2023 15:45:06 -0700 (PDT) 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.dev header.s=key1 header.b=c2rOpx7H; 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=linux.dev Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231915AbjF1WOL (ORCPT + 99 others); Wed, 28 Jun 2023 18:14:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43212 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231359AbjF1WNw (ORCPT ); Wed, 28 Jun 2023 18:13:52 -0400 Received: from out-32.mta1.migadu.com (out-32.mta1.migadu.com [95.215.58.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 140832118 for ; Wed, 28 Jun 2023 15:13:49 -0700 (PDT) Date: Wed, 28 Jun 2023 18:13:42 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1687990428; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=v8WVoQUFJwrHXrcj8iB/cmADxHGelZ4I+K1br+JoT3I=; b=c2rOpx7HvgGzuU9oykOoqbse4XOSwYZ4wb/OkY+9zmp5xL/0qECfYdcr3bryvf+X8z/3lh ImguE4Rp0ECCFxI6vwJL0XpIV/6ePGsHS591NZPBgP9gATRlDYB0Kq9Kf0dn89xmGFZRBQ hOiS+AQCgaXsXCG+9t2kVRMbBIQieB4= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Kent Overstreet To: Jens Axboe Cc: torvalds@linux-foundation.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-bcachefs@vger.kernel.org, Christoph Hellwig , Christian Brauner , Al Viro Subject: Re: [GIT PULL] bcachefs Message-ID: <20230628221342.4j3gr3zscnsu366p@moria.home.lan> References: <23922545-917a-06bd-ec92-ff6aa66118e2@kernel.dk> <20230627201524.ool73bps2lre2tsz@moria.home.lan> <20230628040114.oz46icbsjpa4egpp@moria.home.lan> <4b863e62-4406-53e4-f96a-f4d1daf098ab@kernel.dk> <20230628175204.oeek4nnqx7ltlqmg@moria.home.lan> <2e635579-37ba-ddfc-a2ab-e6c080ab4971@kernel.dk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2e635579-37ba-ddfc-a2ab-e6c080ab4971@kernel.dk> X-Migadu-Flow: FLOW_OUT X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 Wed, Jun 28, 2023 at 03:17:43PM -0600, Jens Axboe wrote: > Case in point, just changed my reproducer to use aio instead of > io_uring. Here's the full script: > > #!/bin/bash > > DEV=/dev/nvme1n1 > MNT=/data > ITER=0 > > while true; do > echo loop $ITER > sudo mount $DEV $MNT > fio --name=test --ioengine=aio --iodepth=2 --filename=$MNT/foo --size=1g --buffered=1 --overwrite=0 --numjobs=12 --minimal --rw=randread --output=/dev/null & > Y=$(($RANDOM % 3)) > X=$(($RANDOM % 10)) > VAL="$Y.$X" > sleep $VAL > ps -e | grep fio > /dev/null 2>&1 > while [ $? -eq 0 ]; do > killall -9 fio > /dev/null 2>&1 > echo will wait > wait > /dev/null 2>&1 > echo done waiting > ps -e | grep "fio " > /dev/null 2>&1 > done > sudo umount /data > if [ $? -ne 0 ]; then > break > fi > ((ITER++)) > done > > and if I run that, fails on the first umount attempt in that loop: > > axboe@m1max-kvm ~> bash test2.sh > loop 0 > will wait > done waiting > umount: /data: target is busy. > > So yeah, this is _nothing_ new. I really don't think trying to address > this in the kernel is the right approach, it'd be a lot saner to harden > the xfstest side to deal with the umount a bit more sanely. There are > obviously tons of other ways that a mount could get pinned, which isn't > too relevant here since the bdev and mount point are basically exclusive > to the test being run. But the kill and delayed fput is enough to make > that case imho. Uh, count me very much not in favor of hacking around bugs elsewhere. Al, do you know if this has been considered before? We've got fput() being called from aio completion, which often runs out of a worqueue (if not a workqueue, a bottom half of some sort - what happens then, I wonder) - so the effect is that it goes on the global list, not the task work list. hence, kill -9ing a process doing aio (or io_uring io, for extra reasons) causes umount to fail with -EBUSY. and since there's no mechanism for userspace to deal with this besides sleep and retry, this seems pretty gross. I'd be willing to tackle this for aio since I know that code...