From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pj1-f46.google.com (mail-pj1-f46.google.com [209.85.216.46]) (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 7D13333C1B4 for ; Thu, 13 Aug 2026 07:01:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.46 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786604484; cv=none; b=krpi2S+KRYvaXRj27U4GMbIS7/0nwU++vaTzlhT5rOeXyeVd/TkwMN3GcfLO33YJry3Nqb/BC7QtJ3y63z8DLOhcq+mqT4J+uEJi/FcRr7yAUR/mscuYaeuTSXMd/6g9Iy99m7JxJ5RoJ72CNC5NSdr/I88fWjYjZnBDRLPNjJU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786604484; c=relaxed/simple; bh=pJ4bXSHGfm8TbQyOoSBLs6jPz6gU1/UAwnTr/Sicq3E=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=nkJ1QFHL0AtvNakgONAxf1WakEAGO14SrPLnLHspvVl4HhmaK5M8w/dqSAIDBWuKfchnSACuxQb2/+RAiVxhs8XdTsy7lf9vHtiDMo7GiL9F5lnD3i9Ul7WrT3E3eZ6RE/VIZCDBnLGSTt/7ae9j8vAVveuwcPS2kFa+omAa204= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=Cu2ETNJO; arc=none smtp.client-ip=209.85.216.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="Cu2ETNJO" Received: by mail-pj1-f46.google.com with SMTP id 98e67ed59e1d1-382ef647e20so452766a91.1 for ; Thu, 13 Aug 2026 00:01:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1786604476; x=1787209276; darn=vger.kernel.org; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:from:to:cc:subject :date:message-id:reply-to:content-type; bh=/+va/p8eCSzFb3xt/YoCSohYQyDiAZvnN1kvdxdc8t8=; b=Cu2ETNJO+57KuxstV6nbs1yQ/+CniFUK037wCoExYG+OuDqPI8za6WFg3i6m+shsOR rrBs8+8mqtE/qBdR0HBfQeVilK1I3UrRXa5XWdsKkQFocUsQwG/lZQJhw55h6YeUWiys KWH68ycgDisYH1ZKxRFq6/0z9OILadTjRrevY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1786604476; x=1787209276; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=/+va/p8eCSzFb3xt/YoCSohYQyDiAZvnN1kvdxdc8t8=; b=X1q8D3SCBHKyHp+7932QBil9X/qZipSmbJxSx+byj0ZAeb8hFKbeXx8UKfOBBF7F2q 1mFNbEYwiJf65fsVHKguGYAjQwGQKySVUmQkY5sp1s0zitBgZVx3BjAAvzgtrHo1pw6q zB9YXKQa7JP7zhcQkaFbUyHq7mdzNw4LpYaDkm8jsRPluSx95ZHOjfCow0/SSyql1Yew PJ3gAmzFKAO2oEwl9kCHNKr+pGmB1nAQEiDjiHzwV9TDRV1Zh6BlvpDJWoyH4QFYTF1y HHHDm4OfzvncW6Uj3P7yhjizvZ4rIRrrz3lfWBmgddIfYXU/H7WX52HlB8/tLqWqpiwj 0pGA== X-Forwarded-Encrypted: i=1; AHgh+Rqm7SRso9Utvm1Id0CJ8DNOBkawXrT8xrwZVhqjxXeM2vXo4CB3xqJc0+YfLfwWONw4RQVJORxK/Aq6Pm0=@vger.kernel.org X-Gm-Message-State: AOJu0YyYHyvSeMpX6eKabhwUADrYNaXd1HP/wXP9CceaKpsZsraPQqui wjD/V2vprmEeHgOce/J4VvZLA0nT8d+RFb3AK91ArJttqFVP73CWyKdI33Od6ICfWg== X-Gm-Gg: AR+sD10hlJuyalWLAemuFTzId4quW+s4osVdxeS98xbutALAdgnJZwPLwYvEHc6C9rE mmWc2sUBU+P8VlgmvaUuZ+pZ4l4OnhpMOA74yJjfLiymV2uSSNf7sc2nUfOSu6uJee49zERL5GN xETI8TaJCwtH2yvkZAxvxncEgieeqD9juTxEBILKBxPbxdsGs9fU+Aze0lWU0q30M297Ge/O+2Z FIlQxW4nuiCequPtlXWtC9aW12B2nPK37JSB/gnb9+9nhZrTP1urWsBA/RppEmnJGiOB/VGRHZy T/ZSEQzqdlziflNskaLrF7/8EfdUiLDHon1GUhbgqQEKqvNEcMsOpQFhH/Gm6KQbio12Wbjfq0s d6J+XUzJXg5mUCgUY3h2OHDH6UYga9ZPXmCQZ32E82Gq7F9mfUiwaBab3PmpKAZz8ooo4owsvDu oZjW38CHGxnY0ZV7LJUrJEVao6trOA+XnYkKs9Wrf/Q4gCHuMzPK5v+V4do5pMWOIbhl7xqA1IX YOa5ikpXyOF5Q0qF3aqvJEN9a2J X-Received: by 2002:a17:90a:e70d:b0:38e:7268:220d with SMTP id 98e67ed59e1d1-3931e31b7d7mr4571815a91.20.1786604476449; Thu, 13 Aug 2026 00:01:16 -0700 (PDT) Received: from google.com ([2a00:79e0:2031:6:d0c1:aa7f:9c69:12bc]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-3931db13c3bsm671336a91.3.2026.08.13.00.01.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Aug 2026 00:01:15 -0700 (PDT) Date: Thu, 13 Aug 2026 16:01:12 +0900 From: Sergey Senozhatsky To: Miklos Szeredi Cc: fuse-devel@lists.linux.dev, linux-kernel@vger.kernel.org, Sergey Senozhatsky Subject: Re: [RFC PATCH] fuse: permit freezing while waiting for request answer Message-ID: References: <20260812095431.1216919-1-senozhatsky@chromium.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20260812095431.1216919-1-senozhatsky@chromium.org> On (26/08/12 18:54), Sergey Senozhatsky wrote: > Suspend freezes tasks in random order and doesn't take into > consideration producer-consumer dependency that may exist > between tasks. One example where this can cause issues is: > fuse server getting frozen ahead of clients, which then get > stuck waiting for req answers that never come (the server > is already frozen): > > PM: suspend entry (s2idle) > Filesystems sync: 0.018 seconds > Freezing user space processes > Freezing user space processes failed after 20.001 seconds (1 tasks refusing to freeze, wq_busy=0): > task:ThreadPoolForeg state:D stack:0 pid:7873 tgid:7854 ppid:7827 flags:0x00004006 > Call Trace: > > __schedule+0x554/0x1320 > ? vprintk_emit+0x2a8/0x320 > schedule+0x5e/0xd0 > __fuse_simple_request+0x4c8/0x6d0 > fuse_do_getattr+0x1e9/0x320 > fuse_update_get_attr+0x362/0x6a0 > fuse_file_read_iter+0x13a/0x1b0 > vfs_read+0x29f/0x2f0 > ksys_read+0x75/0xf0 > do_syscall_64+0x70/0xf0 > > Make all wait-event calls in request_wait_answer() freezer-friendly. > This uses TASK_FREEZABLE_UNSAFE because often time we freeze holding > locks (in the upper layers), which triggers debug_locks warning. > > Signed-off-by: Sergey Senozhatsky > --- > fs/fuse/dev.c | 14 +++++++++----- > 1 file changed, 9 insertions(+), 5 deletions(-) > > diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c > index 27dafda2a841..9e98ece4143f 100644 > --- a/fs/fuse/dev.c > +++ b/fs/fuse/dev.c > @@ -703,8 +703,10 @@ static void request_wait_answer(struct fuse_req *req) > > if (!fch->no_interrupt) { > /* Any signal may interrupt this */ > - err = wait_event_interruptible(req->waitq, > - test_bit(FR_FINISHED, &req->flags)); > + err = wait_event_state(req->waitq, > + test_bit(FR_FINISHED, &req->flags), > + TASK_INTERRUPTIBLE | > + TASK_FREEZABLE_UNSAFE); Or I can switch to TASK_FREEZABLE, people probably don't run fuse under lockdep, and that debug locks warning is WARN_ONCE() and is not a terminal condition for lockdep. We landed TASK_FREEZABLE a while back in fuse_get_req(). Alternatively, I can also switch fuse_get_req() to TASK_FREEZABLE_UNSAFE. It sort of exists for cases like this, on one hand; I understand that adding new FREEZABLE_UNSAFE users might be problematic on the other hand. We use fuse on consumer devices (laptops) and suspend is important, failing suspend is a bad user experience.