Received: by 2002:a05:7412:6592:b0:d7:7d3a:4fe2 with SMTP id m18csp2562525rdg; Mon, 14 Aug 2023 06:37:15 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEMGHp7ywsuj+cj/SDteRJK7ot+iEDvqu4Q0HMYrVvxM9DU4wTQkYyQ8Dl/XmRXrhlJBPsi X-Received: by 2002:a05:6a20:4325:b0:13b:7776:ceed with SMTP id h37-20020a056a20432500b0013b7776ceedmr10748778pzk.26.1692020234781; Mon, 14 Aug 2023 06:37:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692020234; cv=none; d=google.com; s=arc-20160816; b=lrIQghfM/lP25Y9BGGd1IUC1jO4DIm365kYE9c7o7/zpbkiOiMjenoIpKqlKuls4/s JgmULONUmACekJOjvPn/8E9ysCCqkepn5vPLeJKgsFpdskGWeGvsq7w0yKpNo/y+/jzm IKaIO351f6nNwJLdU2CDzeX220R0QBWS7Q5QLGhBm76oFOirwcFKihTWoNAPw9+fARFv e3ykbJFHjAWBsoZwM+/AW61TKQKfhS/Kk5+V+IhriQzokQYP0Rv4a4IlYBeWkZRU7k3d b+XHBNL+rcG6sHIx4CUu8EZib3gMkdMA4XfGbI8Q5EvZB1dDjh4hyZzTaqxvhykeGxLE MHNA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=izsmEiSniL4Vpqa2NF6daalfMmbpg+9Z6Z1Kc+7+ox4=; fh=ri0DuVNcY06cRdiCO7IvB5NW/fvNxlN5CXs1y48eKBM=; b=jJdBzbEJlWjRbShSHn4jglKI7V2g0Rs8q1XWuuaD4H3TMiUTJFdt/t6wyzFwSS5zS5 xeJeUgj+fH7db3gWfBhzMNEr+Z15L3NUFAVFo0pZgS5gPFhO8P4xtpj/dkWrKeAKWHQm E9ytcVE4WItQGumm4fC+17Ph9BEETMRJ64xNENMajMBB39LYZzVTxo7v6t+OTBo0W52c PC5egjzRZq9GDtkER7qPmPjk4QMMD63ZhkMptkeCq7bWhjLdooBpGoZXxqasQho6I3u0 Qaxvz2Az3BioNWMuneBprxnRCQfra0INKu9NeMp/RXLJFUuQFTG+A/PrH15Dh708+dlr SnFQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@szeredi.hu header.s=google header.b=CLfVoiMh; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=szeredi.hu Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f22-20020a63f116000000b00564a32a6a8esi8209281pgi.790.2023.08.14.06.37.02; Mon, 14 Aug 2023 06:37:14 -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=@szeredi.hu header.s=google header.b=CLfVoiMh; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=szeredi.hu Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230198AbjHNM2c (ORCPT + 99 others); Mon, 14 Aug 2023 08:28:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34784 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231644AbjHNM2X (ORCPT ); Mon, 14 Aug 2023 08:28:23 -0400 Received: from mail-ej1-x62d.google.com (mail-ej1-x62d.google.com [IPv6:2a00:1450:4864:20::62d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 28AD2C3 for ; Mon, 14 Aug 2023 05:28:20 -0700 (PDT) Received: by mail-ej1-x62d.google.com with SMTP id a640c23a62f3a-99bdeae1d0aso568065366b.1 for ; Mon, 14 Aug 2023 05:28:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=szeredi.hu; s=google; t=1692016098; x=1692620898; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=izsmEiSniL4Vpqa2NF6daalfMmbpg+9Z6Z1Kc+7+ox4=; b=CLfVoiMh1sB0QC7DEWNr+AJPXjOCXiRTkBknLkQ0BAm1E8j6pwL+s7tzvft4DAQVM9 3f6csuTf4gJD4MTv2vdSdQ17bOyG0pkikKOFgJkQgVsMRMsqi0xODkFfvltuUgmDVvBY dk6cF1BjxwJLmw03sxMLCFa7ovXAecTrQTnJQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692016098; x=1692620898; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=izsmEiSniL4Vpqa2NF6daalfMmbpg+9Z6Z1Kc+7+ox4=; b=bRR/A6cD0C1+JqP/3kPyuM40NuQnBVlDU/T95m7vimjbvaIi0DMkwmL3NsYRTCsvdu 0okB3b/fWplFNpJEIIupBqiCP4Nxv76YjpXXUJluruqYTlK5Xui7QGhS4ObAFQtg556F bsBRzp57rcjdakwMBBrFhDdlFtrKnDZwxSonx8brN6LeW8AhxBloaLCA8aidlVRIprEm j7T/8GTmu4eDmeRUNsZFQwoIlgYm/5rrp38OH7DK5KaXvw8AkQ+B1ze75kWBzJ6I0R33 yokcHuOzL4YRxTD+lzYSFExz0mZrzT3bEU4Sb3QCQFH50kAaUi4OlP2KZGZ9EUDCGJ6s SNkg== X-Gm-Message-State: AOJu0YwX2WmAjDH0Ot33XkHNVx6pJEnOyG103fTY2iqWIigCsE3s/9M5 UHXplEl7Sqxcfz3ZfELrrTxQTDyrPogWw189kbkAH+go23MiLUW0lnk= X-Received: by 2002:a17:906:73dc:b0:99d:101b:8403 with SMTP id n28-20020a17090673dc00b0099d101b8403mr7579441ejl.36.1692016098647; Mon, 14 Aug 2023 05:28:18 -0700 (PDT) MIME-Version: 1.0 References: <4f66cded234462964899f2a661750d6798a57ec0.camel@bitron.ch> In-Reply-To: From: Miklos Szeredi Date: Mon, 14 Aug 2023 14:28:07 +0200 Message-ID: Subject: Re: [REGRESSION] fuse: execve() fails with ETXTBSY due to async fuse_flush To: Bernd Schubert Cc: =?UTF-8?Q?J=C3=BCrg_Billeter?= , "Eric W. Biederman" , Tycho Andersen , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, regressions@lists.linux.dev Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS 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 Mon, 14 Aug 2023 at 14:07, Bernd Schubert w= rote: > > > > On 8/14/23 13:02, Miklos Szeredi wrote: > > On Mon, 14 Aug 2023 at 08:03, J=C3=BCrg Billeter wrote: > >> > >> Since v6.3-rc1 commit 5a8bee63b1 ("fuse: in fuse_flush only wait if > >> someone wants the return code") `fput()` is called asynchronously if a > >> file is closed as part of a process exiting, i.e., if there was no > >> explicit `close()` before exit. > >> > >> If the file was open for writing, also `put_write_access()` is called > >> asynchronously as part of the async `fput()`. > >> > >> If that newly written file is an executable, attempting to `execve()` > >> the new file can fail with `ETXTBSY` if it's called after the writer > >> process exited but before the async `fput()` has run. > > > > Thanks for the report. > > > > At this point, I think it would be best to revert the original patch, > > since only v6.4 has it. > > > > The original fix was already a workaround, and I don't see a clear > > path forward in this direction. We need to see if there's better > > direction. > > > > Ideas? > > Is there a good reason to flush O_RDONLY? ->flush() is somewhat of a misnomer, it's the callback for explicit close(2) and also for implicit close by exit(2). The reason it's called flush is that nfs/fuse use it to ensure close-to-open cache consistency, which means flushing dirty data on close. On fuse it also used to unlock remote posix locks, and we really know what other "creative" uses were found for this request. So while we could turn off sending FLUSH for read-only case (and use SETLK/F_UNLCK for the remote lock case) but first let's see a use case. Sending FLUSH can already be disabled by returning ENOSYS. > > fuse: Avoid flush for O_RDONLY > > From: Bernd Schubert > > A file opened in read-only moded does not have data to be > flushed, so no need to send flush at all. > > This also mitigates -EBUSY for executables, which is due to > async flush with commit 5a8bee63b1. Does it? If I read the bug report correctly, it's the write case that causes EBUSY. Thanks, Miklos