From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=95.215.58.160 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796130892; b=5JNyHZwhD9/yeylXEt2+WqVW65oose2ylJWPJuX+gs7tAsqjQRnIo7PXecMuEglbqban Y4zfBkY8osSdtVHsODD7KU4Uo8VowJ5pPBGX8dvPuqlHQ+KmaCJyxckeCOgp7br5iDXcA 8howrJE1Bnw29XLojsrMabV7aFd0dayAmlW78RW9P9NjLVTY6396PFhX9B3QxN5/P6e0O IQtEzi5Fu0Sb8v8aeqsz4t9RkpZ9AHjbfhyiWeyjaY6EtZwQ1BSjOXyDoxODXS5D8uBg6 kt5yElxxl2Rz6Q0rUPG5S4mH3CRJW/FpKf60j1A5CArtL4vSKuPYEYUbKO8izZap1QQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796130892; h=DMARC-Filter:X-Envelope-To:DKIM-Signature:X-Envelope-To:Received: X-Mizu-Trace-ID:X-Migadu-Flow:Message-ID:Date:MIME-Version:User-Agent: Cc:Subject:To:References:From:In-Reply-To:Content-Type: Content-Transfer-Encoding; bh=KqNF8xucU/38My4T7WHRrXnwY/bhQDnrcWxwDymbvCM=; b=sVTmLCVedV6G9iq92B92vE4lkdqVoViaOEVQSG3s6mPe7/oUqgaQDwLd3XauLFybwSxU skXeGXoA0EJEfV7sOQMduDCRrIrqR7unrmxnWNiQnRbEXnacOXyW3BouVv8B+/vEpRDUZ JEhuSAcBwLd6HW6JF8hL7xCPECw7+np+EJ7GG4/Xz8fjA2n0XpYQyqSDVUuUPMLQBPgoN 9JaBv/72Ndv3vPar4HDaDaQWJXULfutMHS4wmsOeczO3vP02zVzEvczW+XjmpAruM1963 BxxP/kixAYjalN8BkV3fYN1FPregyNfz4yIPGJ4jcgS6gH46PX46egmeglpxuhSc6pA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=YNOb3cv2; arc=none smtp.remote-ip=95.215.58.160 Received: from mta1.migadu.com (out-160.mta1.migadu.com [95.215.58.160]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 90811606A325 for ; Tue, 1 Dec 2026 13:14:50 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 90811606A325 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key, unprotected) header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=YNOb3cv2 X-Envelope-To: linux-kernel@vger.kernel.org DKIM-Signature: a=rsa-sha256; bh=+d9rB6kQia+lYT+jm7izUNhfj4wo38Bf9ExIadnrf6c=; c=simple/simple; d=linux.dev; h=from:to:subject:date:message-id:mime-version:content-type; s=key1; t=1796130888; v=1; x=1796735688; b=YNOb3cv2BCRfghjM20xSgaGOudjjzYFBvXqK+6MM7pLyc/d8me4WUa9tt5lG1HkC8RQDLCIb 7etkJbiNz8mrF8g8n9WTmiC4NEiWdtbNUNmm/iROwKXrFEJckUDWfGIBRHZwVwts24FUY0UK8Mb I5cU4R02UrIcTqkHfTaJTt98= X-Envelope-To: linux-kernel@vger.kernel.org Received: by smtp.migadu.com with ESMTPS id 738a5bff3d21d068; Tue, 01 Dec 2026 13:14:48 +0000 X-Mizu-Trace-ID: 738a5bff3d21d068 X-Migadu-Flow: FLOW_OUT Message-ID: <232e31ac-6e41-443f-a708-4e41a14a0c76@linux.dev> Date: Tue, 1 Dec 2026 21:14:42 +0800 X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Cc: cui.tao@linux.dev, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, Shin'ichiro Kawasaki , Jens Axboe , Christoph Hellwig , Tetsuo Handa , cuitao@kylinos.cn Subject: Re: [PATCH v9] loop: defer the queue limits clear to a workqueue To: Bart Van Assche References: <20261126054223.176824-1-cui.tao@linux.dev> <20261126135628.495497-1-cui.tao@linux.dev> <46cefe96-a193-40f9-bc1a-facc73cf6afa@acm.org> <0523850b-2049-41ff-8dfa-ca3a8f055a5f@linux.dev> <6eed3fd1-3c0e-42ac-8d86-634522516f05@acm.org> <2FD3BF4D-509E-4A3E-B605-D6DD16226148@linux.dev> <364fdb6c-bb22-425d-8109-c954e269fff0@acm.org> From: Tao Cui In-Reply-To: <364fdb6c-bb22-425d-8109-c954e269fff0@acm.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Hello, Bart 在 2026/12/1 00:34, Bart Van Assche 写道: > On 11/30/26 6:57 AM, Tao Cui wrote: >> 于 2026年11月30日 GMT+08:00 22:04:09,Bart Van Assche 写道: >>> On 11/30/26 2:20 AM, Tao Cui wrote: >>>> I'm planning to send this as v10 unless you see a problem with the >>>> design. >>> Are there any lo_fallocate() callers that expect that >>> loop_clear_limits() has completed by the time lo_fallocate() returns? >>> >> I think no, nothing depends on that.  lo_fallocate() is only called from >> do_req_filebacked(): both call sites return the fallocate result >> directly to request completion, so the failing request completes with >> EOPNOTSUPP regardless of when the limits update commits, and nothing >> reads the queue limits expecting the cleared state right after >> lo_fallocate() returns.  Requests dispatched before the work item runs >> also fail with EOPNOTSUPP, the first one reports, repeats are quiet, and the work items serialize on lo->workqueue, so the update >> converges. >> >> Tested with PROVE_LOCKING enabled: loop/011, the concurrency sweep and >> the mkfs/unbind stress run clean. >> >> Please correct me if I have misunderstood anything here > Please queue the dynamically allocated work on another workqueue than > lo->workqueue. I'm concerned that using lo->workqueue might trigger a > deadlock. > Done: the work item is now queued on a dedicated unbounded workqueue (loopc%d) instead of lo->workqueue, and lo_free_disk() drains that workqueue before the loop_device is freed, so outstanding clear work items cannot outlive it. On the deadlock concern: I could not trigger it on either queue placement, despite trying fairly hard with an adversarial mix of LOOP_SET_BLOCK_SIZE, LOOP_SET_DIRECT_IO, write-zeroes and rebind churn (600 rebinds, 10,000 queue-limits updates, up to 56 concurrent failing requests, stacked loop devices) under PROVE_LOCKING. The backing files in these tests are memory-backed, so the drain times are short. The failure reporting stays at exactly one per binding throughout, and no report, hang or deadlock was observed with either the shared or the dedicated workqueue. The full suite (loop/011, the concurrency sweep and the mkfs/unbind stress) also runs clean on both kernels. Thanks, Tao. > Thanks, > > Bart.