Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp276791pxu; Tue, 5 Jan 2021 10:33:45 -0800 (PST) X-Google-Smtp-Source: ABdhPJzqzZxmmO4tXKU1KYrzpZeJM+5TDr+xuZrIUI09KuzdCbUaflBTCefzBk4K+IDgvLtTSnJQ X-Received: by 2002:a17:907:6e9:: with SMTP id yh9mr383999ejb.131.1609871624945; Tue, 05 Jan 2021 10:33:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609871624; cv=none; d=google.com; s=arc-20160816; b=MnrLINF4PshQsW1WFf+/Br4LbrTEXpkbKc5R4NiF0/1Bzz+EuS1EGXmW9JC4wTxsnE AFkw75F8M53md7Rxcsi2wrzswaeiGlbxB7ev6np+b1lIbZ48AHQZEd8u/rkl/MSnSeli xwIAhwVe6zHdjADeBLKGfjlmwESDiPJ2z6HUmDCTHlbBUKse5/OH5R4EhEpKKj7v3l8M rg6rk+rr9bEa8LXKW3kcVS3ln9VNeKKF/QbGNRkcf1Qr1ufOVI4dNAYNlRhWzfvaylEQ IMeaAA6MGPZXOxKEQgbILrgC5ynJZm+wwiV3KY+vNh9rZv+eRotse/9FUtNHpNALt3TJ GDOg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :mime-version:user-agent:date:message-id:subject:from:cc:to :dkim-signature; bh=+TyQkEMafuxHeItsQmIw3IkEc+mWTDN39fb3kbBoCAQ=; b=KwLo0Se1Vbckzh8rVHEbFlo2DPnx1T7dqAMCtqaAbJKatI+/2e1hd/qGxRrNB++CLO nKDLwqitpgzrG5jnB0rSZnhmYlG22Q/hTRh54njGgKuV6PqGwDF77UCpciGFhcdU5Imi 9rur9WIWa8w5ID/8t89/u2cvcgDUQge399u+ENvIIJP+SjGTrxfcT6UMjKGvh/g+FO9Q 7WGFYXc/tWUAHU7Dxc3q7+5JPzYvPnVntBFHzO+VeURQVK+7T0+kL25XNUr4IhzkhlCc k5IAhBeG7qiHzDZ00UOgBNd88h5SGQCENA8veDByym8ivxu7BvwaJsfnDx/cbF/HxzTE MJdA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel-dk.20150623.gappssmtp.com header.s=20150623 header.b=SUnf7Ruc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p24si227949edw.475.2021.01.05.10.33.21; Tue, 05 Jan 2021 10:33:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel-dk.20150623.gappssmtp.com header.s=20150623 header.b=SUnf7Ruc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730671AbhAES3z (ORCPT + 99 others); Tue, 5 Jan 2021 13:29:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38234 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725838AbhAES3y (ORCPT ); Tue, 5 Jan 2021 13:29:54 -0500 Received: from mail-io1-xd2a.google.com (mail-io1-xd2a.google.com [IPv6:2607:f8b0:4864:20::d2a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A209AC061574 for ; Tue, 5 Jan 2021 10:29:13 -0800 (PST) Received: by mail-io1-xd2a.google.com with SMTP id 81so214318ioc.13 for ; Tue, 05 Jan 2021 10:29:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20150623.gappssmtp.com; s=20150623; h=to:cc:from:subject:message-id:date:user-agent:mime-version :content-language:content-transfer-encoding; bh=+TyQkEMafuxHeItsQmIw3IkEc+mWTDN39fb3kbBoCAQ=; b=SUnf7RuciFcT7xoD/lKhNL+PDI/zrsFawvjUbXJAVrZn0I7SGaLzrfDZAzVB92/71m 9T/bmyhAiNxUrRbDsA5t0Iz50Dma067juh75ksoMK313gwGRyxbn1F/hPp9RQvQYmOyd gYPuLsVF5s0Z6YeiW4ICYvfIyn6vcCslod9h1ZfZ8s++Qz0CFPT0QO5kGwbLGCaCGg7x wCRrn8r+NJkUL4ZOujT2KsDRmfyYNy8e4t0LdVrrZgsv2iqhXkl5KorpXviYaROBRrh9 shkuYqNyY05HBiqf8Ozn4Qrka8/fcaOyD+9z38U6W6dOL7mMgoMiRSf6b8dVcF8yV1xt u6eQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:cc:from:subject:message-id:date:user-agent :mime-version:content-language:content-transfer-encoding; bh=+TyQkEMafuxHeItsQmIw3IkEc+mWTDN39fb3kbBoCAQ=; b=O01TyCZiJV4vC2y8L01nNwseztmMGGoi0vxuhjJHHApHxPqkfMCGNvDWswoTxkWo79 22/gOxGD3zaEktMWAmrmoLVGkwWFK2zaTASI6ZPgn5uwI5fDt7s7Vs8ec4n6EHSSYzkZ fcLocjSxXBx0QkldEW0buWi69Yq6NJs1LjDkbZaKaHMLsmCXzOxIN0n2VLL/+nAYOq+m t9L2+6Vag4DQgQzWuDLZjaej0bK1QcCOEe3NWRrCoMsGKSLPxFvr3iBMN8DTkLsKphGG W9D8VJ0fpChDRX/e0AqXrFXLxAQX/rG//0N45linfZobCwM6re6ClPugQrqVAEKIQjF8 zSzQ== X-Gm-Message-State: AOAM533PFKJOyvkoste1tf4MNprxNtukFCOxtTAiCjmP6zEsqtaJPIAe DgAlOPtm6y26NMFsyXwqwVKKKg== X-Received: by 2002:a02:9691:: with SMTP id w17mr812141jai.9.1609871352998; Tue, 05 Jan 2021 10:29:12 -0800 (PST) Received: from [192.168.1.30] ([65.144.74.34]) by smtp.gmail.com with ESMTPSA id k76sm61777ilk.36.2021.01.05.10.29.12 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 05 Jan 2021 10:29:12 -0800 (PST) To: linux-fsdevel , "linux-kernel@vger.kernel.org" Cc: Alexander Viro , Oleg Nesterov , Song Liu From: Jens Axboe Subject: [PATCH] fs: process fput task_work with TWA_SIGNAL Message-ID: Date: Tue, 5 Jan 2021 11:29:11 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Song reported a boot regression in a kvm image with 5.11-rc, and bisected it down to the below patch. Debugging this issue, turns out that the boot stalled when a task is waiting on a pipe being released. As we no longer run task_work from get_signal() unless it's queued with TWA_SIGNAL, the task goes idle without running the task_work. This prevents ->release() from being called on the pipe, which another boot task is waiting on. Use TWA_SIGNAL for the file fput work to ensure it's run before the task goes idle. Fixes: 98b89b649fce ("signal: kill JOBCTL_TASK_WORK") Reported-by: Song Liu Signed-off-by: Jens Axboe --- The other alternative here is obviously to re-instate the: if (unlikely(current->task_works)) task_work_run(); in get_signal() that we had before this change. Might be safer in case there are other cases that need to ensure the work is run in a timely fashion, though I do think it's cleaner to long term to correctly mark task_work with the needed notification type. Comments welcome... diff --git a/fs/file_table.c b/fs/file_table.c index 45437f8e1003..7c76b611c95b 100644 --- a/fs/file_table.c +++ b/fs/file_table.c @@ -338,7 +338,13 @@ void fput_many(struct file *file, unsigned int refs) if (likely(!in_interrupt() && !(task->flags & PF_KTHREAD))) { init_task_work(&file->f_u.fu_rcuhead, ____fput); - if (!task_work_add(task, &file->f_u.fu_rcuhead, TWA_RESUME)) + /* + * We could be dependent on the fput task_work running, + * eg for pipes where someone is waiting on release + * being called. Use TWA_SIGNAL to ensure it's run + * before the task goes idle. + */ + if (!task_work_add(task, &file->f_u.fu_rcuhead, TWA_SIGNAL)) return; /* * After this task has run exit_task_work(), -- Jens Axboe