Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp3224880imw; Mon, 11 Jul 2022 04:41:41 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vYbx9yTALdnYOwD+HgH6ORjViiwtNn+pES8OxrSNxcO/od0ARID6XKE59qzC2AKAtGFlmA X-Received: by 2002:a17:902:9885:b0:16b:8008:607a with SMTP id s5-20020a170902988500b0016b8008607amr17819301plp.159.1657539701249; Mon, 11 Jul 2022 04:41:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657539701; cv=none; d=google.com; s=arc-20160816; b=eKOlwnwWaEb/2dn7THWXhe41OflXae9klUdEaW8J6MMhFI8mHQIVzaQV4bR+DXG0Cw RFSNT1CFeJA9K2f/rHB61axyG0tLtIAdYIJIknQ1RafKz2RH0o+0/PZ2V8/Wm5rk0VN7 PYlZ8gZx1Mk+x8F28crbz1Rw/L5H63yK4rlxhcOWoH7VeVcNykB0+b0s53HOxXeub+vK I4+0hmlKHTYpCHLTGeGmtMVV0qQrNB1b/b445J4nwm9CTx4xCUGxV9l+JFS1ImDmFBQn pq2pQrhV0BfZGTCufNDmi8Nq6nM5PFTkXE7AL/R29PqzAL55meoU286Rsh+N+fzsMZsv W0NQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=17Ntu7u7zL0owgy2AXHqHsIDETCSIzpTPW2VE5tWiYs=; b=jgtyU5PcEi+F6M1UQTHA9OQyoH8hX57OYp52UEDB6c4YFb1i7HiP/bwCRlCC7sUt1I NpUuyE4Ged0hGbQzV43ubBP1LxdUYQrVu7cfe4uxah6qj6Pja1KxiYhy4ZC0+7ezblzt 1c1Ir6ilK7k1Mdt8Zbx7To/pczF5hx/6ge3VcYuqMZm0E4BqK8rgTI0aEifnZORosPlg m6NK337+a9A+k3mjC3jSBl2nxbTimQRz3aLGebadtlbwFFKSLD18DsROxZ4E+VClG+no L2PwxSZWuOX/KzHzXGExgAWzcz4GLB/7RY09415YtGshH3xHxsY8rHHJjG7q77aEd+CM yhag== ARC-Authentication-Results: i=1; mx.google.com; dkim=temperror (no key for signature) header.i=@szeredi.hu header.s=google header.b=QzlsXM01; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l8-20020a63da48000000b00408d94d8198si9263609pgj.119.2022.07.11.04.41.28; Mon, 11 Jul 2022 04:41:41 -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=temperror (no key for signature) header.i=@szeredi.hu header.s=google header.b=QzlsXM01; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230054AbiGKLQE (ORCPT + 99 others); Mon, 11 Jul 2022 07:16:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52692 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229937AbiGKLPq (ORCPT ); Mon, 11 Jul 2022 07:15:46 -0400 Received: from mail-ed1-x531.google.com (mail-ed1-x531.google.com [IPv6:2a00:1450:4864:20::531]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 668A552FC8 for ; Mon, 11 Jul 2022 03:35:45 -0700 (PDT) Received: by mail-ed1-x531.google.com with SMTP id r18so5669229edb.9 for ; Mon, 11 Jul 2022 03:35:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=szeredi.hu; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=17Ntu7u7zL0owgy2AXHqHsIDETCSIzpTPW2VE5tWiYs=; b=QzlsXM01+eHeF1/SAU+u7zrD7f9xTS62efNCWfVZ6g/lSK+bWdoQdkr1DlYUGTNBNY LKZlhAvyZfZBOIaXua+9MLaMo06cMSuJwff9w/EbvJbhOb0vfO+ptJOe/zKsjfYXAUt9 CNmLfpnBiRBl8EOBNSk7/T4Q/0nknjUoA4yAc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=17Ntu7u7zL0owgy2AXHqHsIDETCSIzpTPW2VE5tWiYs=; b=SpzA+amCjwVhqI6Vzx7EYae4yRw3wLTZoexNY1InXbH1saNMsuT+sFmp+IEVP6nAPj MN0vrPfHLkKhQ9yjZU7gXkPHAwWqFrqI6/EV6NukerY/SklXz2uvfnp6sSmO21sHVbwm 9KLmBX7R6GPOy7Qy0bcr/H9+TYDmPwVQ9YpK6vbyXyd1f653quMU5v2Qwp8RmtWm2x0B tKCHemBUAGww4wMCnJEKiVq7Y/LdcoTGsotoTh5e8sZqPQKzoo+4NVszlgZae0YMBI3p qbCUpSnSP3qrGPt2+iMecjnsyVK3QF6a+PPBEfsPwqWevHjsKof50WmR/YAedTqMhpdj 9ftw== X-Gm-Message-State: AJIora/UuUyW70JX9OPZLYKPQzsXHmbTdhJqQLoVwC+ONFgZoKhG80LN blzT8oO6IFVLzE32i5EI1nPRSsPy/YtX69t+lrNGRw== X-Received: by 2002:a05:6402:4245:b0:43a:961a:583f with SMTP id g5-20020a056402424500b0043a961a583fmr23724564edb.374.1657535743970; Mon, 11 Jul 2022 03:35:43 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Miklos Szeredi Date: Mon, 11 Jul 2022 12:35:32 +0200 Message-ID: Subject: Re: strange interaction between fuse + pidns To: Tycho Andersen Cc: Eric Biederman , Christian Brauner , fuse-devel , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: multipart/mixed; boundary="00000000000039912305e3851d71" X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, 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-kernel@vger.kernel.org --00000000000039912305e3851d71 Content-Type: text/plain; charset="UTF-8" On Thu, 23 Jun 2022 at 19:21, Tycho Andersen wrote: > /* > - * Either request is already in userspace, or it was forced. > - * Wait it out. > + * Womp womp. We sent a request to userspace and now we're getting > + * killed. > */ > - wait_event(req->waitq, test_bit(FR_FINISHED, &req->flags)); You can't remove this, it's a crucial part of fuse request handling. Yes, it causes pain, but making *sent* requests killable is a lot more work. For one: need to duplicate caller's locking state (i_rwsem, ...) and move the request into a backround queue instead of just finishing it off immediately so that the shadow locking can be torn down when the reply actually arrives. This affects a lot of requests. Or we could special case FUSE_FLUSH, which doesn't have any locking. The reason force=true is needed for FUSE_FLUSH is because it affects posix lock state. Not waiting for the reply if the task is killed could have observable consequences, but my guess is that it's an uninteresting corner case and would not cause regressions in real life. Can you try the attached untested patch? Thanks, Miklos --00000000000039912305e3851d71 Content-Type: text/x-patch; charset="US-ASCII"; name="fuse-allow-flush-to-be-killed.patch" Content-Disposition: attachment; filename="fuse-allow-flush-to-be-killed.patch" Content-Transfer-Encoding: base64 Content-ID: X-Attachment-Id: f_l5gly66p0 LS0tCiBmcy9mdXNlL2Rldi5jICAgIHwgICAgOSArKysrKysrKy0KIGZzL2Z1c2UvZmlsZS5jICAg fCAgICAxICsKIGZzL2Z1c2UvZnVzZV9pLmggfCAgICAxICsKIDMgZmlsZXMgY2hhbmdlZCwgMTAg aW5zZXJ0aW9ucygrKSwgMSBkZWx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