From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=95.215.58.159 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796130892; b=i+PHChUYB7d903fdmHIx4C5oGuvuRzA1KnoPFv+AiewfkB2LbNjYBUOAs2NpH9zhpFgx OHvmqjTClS91IkGbh1pxLCrt4r4vi2S9OsnZfF62owa+SlUtwoFd4hLwKeB/t96MmJCxH yy2SEHgW/KjOOMIHyoRnzpjzMBPTmHpbYEnA9iL9I4URhxJyb+8qznPnl8pQBiWcF3m/h DPV1cuVAz88647jpozL7ud9Cgs2ktL2AiqjKaAhDTEUavslBP9N9G8iW/hCI3QTzdSKpV qtwKDS7TlCUffim5Jp+aP/tPM+bODMOs39yMF+FcAiQb8kgA+qNM9LHJEVNubfIu3wQ== 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=IS1F28TcegTgmRGnlNHtOqxXUKsxAusT1VWDzqiSRS9kNsM6Luxdmsx+uvIKfnhvyEbS aMz2NtdxFVlrmZvIiHJaij8VyHU6y7DcAwVBg6cAUomhx3UPRJu25G4nVOpVsi9dwDDF1 E/Cno3PF6yndTe95RDAVkRfG6DV0U/d+R7pJFY7kltcP2FTlREPD5URURyD3u4AVurVnz QC+4QyXXRK87O1vBSlZuvScm6I+SPphPsGZ9u5LE93eSUA8gFa6OphicbXErYNvuPmXwT UW2idt08nXYDJKIDdpYudYXo2+W52239aVg8ATgvea0b8JpxJBF5pSvJGKFTx9TSWrQ== 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.159 Received: from mta1.migadu.com (out-159.mta1.migadu.com [95.215.58.159]) (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 9982E606A327 for ; Tue, 1 Dec 2026 13:14:49 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 9982E606A327 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-block@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-block@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-block@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.