Received: by 2002:a89:413:0:b0:1fd:dba5:e537 with SMTP id m19csp53409lqs; Thu, 13 Jun 2024 03:44:34 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCX4R3QzBBDCHUG6fmiqjs0TBhVFC5cYg8Yw2dmzmRlm15+E2ivrSXF0GCqEHEVkuo3OHT/nhoXhLC3qpo3TC6fVdmVkDJp7NGDjsvvhUQ== X-Google-Smtp-Source: AGHT+IHOgX2ac7MImxVRb8j3QdUFJtanMy483HWUbfP3i1DnDp4cTWmNx7cOqD+RAR/AdOMdrKZi X-Received: by 2002:a05:620a:17ab:b0:795:68fe:c2bc with SMTP id af79cd13be357-797f606dc15mr507661285a.2.1718275473984; Thu, 13 Jun 2024 03:44:33 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718275473; cv=pass; d=google.com; s=arc-20160816; b=PNbm2gSctm0Rj8VHCE45THM/fi4WzCZsG+SZlwD+nTfSxHvHqU/fB7I1TKy1/rpVgv ip/BS4ELCJo5glmJGN5PCcgnJPnWcMqYGop02wVFSnQ3hj2ej60n6iUBeW5ZYmKCQHmn voH+www9/WUOLN2sdvDsFEUzVwOLj9QSNPUXkhp7Euw5VqrY0KRKN1R7T99yJU4QrZdv U6Mpn7HR2HQjiyQq9/wfdAmXZmkxKNz9Vj0aq0hq+X7E6rufksUak8aNzmRSHhB2w3Je dCOzq738SZCL/lKrN9Y/cxHtOpyCFMrmsoDxwpBXg9sD+mKDDusb2RdrYU22xih2no8f 6/5A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to:subject :user-agent:mime-version:list-unsubscribe:list-subscribe:list-id :precedence:date:message-id:dkim-signature; bh=KC0WEOCbeOn3xeFYjkoPmf4SR20pzkx2hnnF8x8VHJ4=; fh=6zLmBIbBuLfr0v+YuADa38V22Cu2lb5zvJFB7TBYWO8=; b=xgzgwzHdTMijdakhMg5RmTXN4Ei83vtmTFdPq08BGMpaIXdpNBklHeZgIk2cRXhAqC tJM2GWu20VOsxyd2h8UJKlESuEV7cBdj5Kl6IIZKx76+UuN3UYC8LXt2ChM3oOczkeey 7Bwt2efRZSdX5Vs3TxVCTwAARzTMjObNV1gQ5qA82X4fClPs3mf3eYYyvXO9tIJfjuDx oAottWKxsJJ0+oYjYLxvj9XdTYfT0ffkwElJW30+pmyc5TM9cbvPUtn3aTuHNk9IhuN9 p/X666tklrxzn8B99Raz5+nUEkkWmwN6s5NzvqK3h8ittbG4Zbv1+WUizaxRBk4/E/kw 7SuA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@shopee.com header.s=shopee.com header.b=N1TjR+pb; arc=pass (i=1 spf=pass spfdomain=shopee.com dkim=pass dkdomain=shopee.com dmarc=pass fromdomain=shopee.com); spf=pass (google.com: domain of linux-kernel+bounces-213043-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-213043-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=shopee.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id af79cd13be357-798ab90018dsi105610785a.264.2024.06.13.03.44.33 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jun 2024 03:44:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-213043-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@shopee.com header.s=shopee.com header.b=N1TjR+pb; arc=pass (i=1 spf=pass spfdomain=shopee.com dkim=pass dkdomain=shopee.com dmarc=pass fromdomain=shopee.com); spf=pass (google.com: domain of linux-kernel+bounces-213043-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-213043-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=shopee.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id AFF5D1C21630 for ; Thu, 13 Jun 2024 10:44:33 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0E6F0142906; Thu, 13 Jun 2024 10:44:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=shopee.com header.i=@shopee.com header.b="N1TjR+pb" Received: from mail-pj1-f49.google.com (mail-pj1-f49.google.com [209.85.216.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C19E41422D1 for ; Thu, 13 Jun 2024 10:44:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.49 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718275457; cv=none; b=caOSx7TIVGCb8jR5kDJtH1jtYcVkBMLXPlhSYrcbMiE7UpZwVNieCVzphoGp3iklUvk9p0Fnngi6cOivg8ajbRe+KgU+9pWKVT82RP2EiDs4c7D+JiN9xqPIVdrnUPo64z99hoSqvg3YkC0yQTmh+smXcoPBvOUQ7qxUxJb0d8U= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718275457; c=relaxed/simple; bh=t98d2hcOrmG+gBwD8a5DyCNMvtSGIPlvdKTgtnV4XgE=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=uxG10gGspyy3PpFTYk1StMQz9nUdHTffjMEeW5LEGtPG4B6hQSVwOtnFC7oNEiuCnLJw5XEhmJYgT3zx+4CD4fNkAjIiFCYfcWwWdTsxcIOQWG+RZZ6FwsP0nL/L2OunoQ9qNuFEF0SjDzuo7+237fzV4VRKG8YZ9jE94+FXb2Y= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=shopee.com; spf=pass smtp.mailfrom=shopee.com; dkim=pass (2048-bit key) header.d=shopee.com header.i=@shopee.com header.b=N1TjR+pb; arc=none smtp.client-ip=209.85.216.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=shopee.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=shopee.com Received: by mail-pj1-f49.google.com with SMTP id 98e67ed59e1d1-2c2ef6617bfso692410a91.3 for ; Thu, 13 Jun 2024 03:44:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=shopee.com; s=shopee.com; t=1718275455; x=1718880255; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to:subject :user-agent:mime-version:date:message-id:from:to:cc:subject:date :message-id:reply-to; bh=KC0WEOCbeOn3xeFYjkoPmf4SR20pzkx2hnnF8x8VHJ4=; b=N1TjR+pbBXxu6oqhWgLU6HqtpHBQSFM2vt2JkC1EPHOjSovafYOTEZvbxH4yzjGgyd 7GPWGvsk4ysjt4wsZhwwwBCrzSYfbp+p5KeIrWKnRXQmoCvzYC0LrhG9uGYC5rJ8MXOZ uzqnQZUNYAq1GGP7R62ie+POzeWC7SdrzNhDV+ehsqFiqEtFep9KN/dER115c6bTxItS 2KBvBNImAVbVZZJYaW3AvcQ5CB8zNJ85m9zd6oLSp/gKXvEjA9yiB37kkXDeZkzuuLQJ FpgbQC9NABkyoaBn/nqfNra7tJEwkOBp7MqnZrra7BsbZ/4U73c6W0HWF7IsKzGVLMaF wUjQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718275455; x=1718880255; h=content-transfer-encoding:in-reply-to:from:references:cc:to:subject :user-agent:mime-version:date:message-id:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=KC0WEOCbeOn3xeFYjkoPmf4SR20pzkx2hnnF8x8VHJ4=; b=t6c0aSWEoA/rcLjxM5AGWhWfeRWncALrsLCyLYrXj8GPI1rFpD5Ik4tiNSXchUHFoW VrUNbZqDvX+DAdJKnAH9Ot2DCGoZR5GEpUmZ+lf7E/ofcnFFy+6jXLosK3EimOFLuPuP yHKBj4R7k2txx1zHxqrR/GaxatiVAydWJInskpBPsyyDmFW8QhbnJ0ZlxNDJVZiqCUrS FUGDgiILoJSNJfj6YNqRuzhLf/YlWMZmEjyMAvgNmlUzFgr7hJsCScLrtDbaEMmb2vti hoX3tbrs5tF9cqzbDDLpOYcFSZKKM7Sj/G5rutyDBnE6yfJRts9nos8E5+gHtDvXPwUr wO6Q== X-Forwarded-Encrypted: i=1; AJvYcCVaK7TCkOeEN/zaMhlDIGUFO+B4Li8CQ3OnpFwtYCwyH2BH5afPBQFW/eKAG2QMeWpJhGXJOHFo0QeNXJRbz0fN76CKTPTl79B9mjan X-Gm-Message-State: AOJu0YwNqr3MuxOYQkh4Vg2NpfjIP4HvSxcLB95YnVaYtG8u0V07O8mD ssee2+xWE4g+5cIevsAwO+rRPpK5ywh5NNebZverTnPm//s9yjzcMi+/5v14DUY= X-Received: by 2002:a17:90a:de18:b0:2bf:8ce5:dc51 with SMTP id 98e67ed59e1d1-2c4a76d4e4bmr5106783a91.35.1718275455083; Thu, 13 Jun 2024 03:44:15 -0700 (PDT) Received: from [10.54.24.59] ([143.92.118.3]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2c4c45cc95dsm1322791a91.22.2024.06.13.03.44.13 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 13 Jun 2024 03:44:14 -0700 (PDT) Message-ID: Date: Thu, 13 Jun 2024 18:44:09 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [RFC] fuse: do not generate interrupt requests for fatal signals To: Miklos Szeredi Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org References: <20240613040147.329220-1-haifeng.xu@shopee.com> From: Haifeng Xu In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On 2024/6/13 15:55, Miklos Szeredi wrote: > On Thu, 13 Jun 2024 at 06:02, Haifeng Xu wrote: >> >> When the child reaper of a pid namespace exits, it invokes >> zap_pid_ns_processes() to send SIGKILL to all processes in the >> namespace and wait them exit. But one of the child processes get >> stuck and its call trace like this: >> >> [<0>] request_wait_answer+0x132/0x210 [fuse] >> [<0>] fuse_simple_request+0x1a8/0x2e0 [fuse] >> [<0>] fuse_flush+0x193/0x1d0 [fuse] >> [<0>] filp_close+0x34/0x70 >> [<0>] close_fd+0x38/0x50 >> [<0>] __x64_sys_close+0x12/0x40 >> [<0>] do_syscall_64+0x59/0xc0 >> [<0>] entry_SYSCALL_64_after_hwframe+0x44/0xae > > Which process is this? The client process is one of the processes in container. And the server process is lxcfs which belongs to global namespace. > > In my experience such lockups are caused by badly written fuse servers. In this case, if the interrupt request is processed before the original request is processed, for the arriving original request, fuse_session_process_buf_int()which used in libfuse invokes check_interrupt() can find the interrupt request and mark the req as interrupted, so the server thread which invokes fuse_lib_flush() will sleep for some time and eventually send reply to client without setting FUSE_INT_REQ_BIT in unique. So why the client doesn't get woken up? > >> The flags of fuse request is (FR_ISREPLY | FR_FORCE | FR_WAITING >> | FR_INTERRUPTED | FR_SENT). For interrupt requests, fuse_dev_do_write() >> doesn't invoke fuse_request_end() to wake the client thread, so it will >> get stuck forever and the child reaper can't exit. >> >> In order to write reply to the client thread and make it exit the >> namespace, so do not generate interrupt requests for fatal signals. > > Interrupt request must be generated for all signals. Not generating > them for SIGKILL would break existing filesystems. > > Thanks, > Miklos