Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=95.215.58.184 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796378344; b=sKzAcPUUtewC6L2rw6teE6gnw49nyEDdYLs6/3z7M4gfy4BvvRsXGl7AAxVP2MnNpTHt bvHt2Gs0FlkQCTHPley7vN5Ai1LoQYUrKfRZ/23B8sPKGoexrcuApBxhtWrDPgCg3IKoB wyKW2KRLDvs7FibfHfnTBwt1gl/pkzGe1606DUv/1ez6qyYuLzn6/SKTXlfxEus+Bqf6/ I7as+94nD8TYIitB87YuGm2EURKAqdZJi7sOg55m2ITfTmQ7mlVMiRb2lQLzMiOM0nFg6 p1ham4/QXaWYCjoJRyeDffXA1+cIOR09gb67JOP1wfwlLQo1kHwogj6Ubuco7Pf7SUQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796378344; 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=vU1F2L+ZJiCOU31W+h73pF5kH0rdiSny4K3nQ63nvFg=; b=i1RH6VCkcmZkXuIuYHZVS1nsZrfc87dPeFZXNTAXmaR7izqX+wysVBYJsVfQmQOLk8JK rGza8wPAXH+7u4cTuJScjPgEor4FRTTIkw5nenpGigr4GaDJadkU0wA8p7lwE2vRSe4h/ 1TzaLEM8bCNVxFe7gbw4DIp7qyv5UrzXgVC8VQRnlTtBkSm3HR7zsS+3Z3RgmPAMzUXsJ OrEFP3nDwzRAPM1uc3/4D5olblrXtwRDQ43tRqA/dviQDBR1HFiLwBEtRlOu0JfQrCsDo CgRYOUvq4N/X4gM5Ts2TOxMy7v8Mp4dfgrvGRQ158veSgnUePm9nxoZG82VhiOSZWQw== 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=RNb3s4Sw; arc=none smtp.remote-ip=95.215.58.184 Received: from mta1.migadu.com (out-184.mta1.migadu.com [95.215.58.184]) (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 ACA43606A322 for ; Fri, 4 Dec 2026 09:59:03 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org ACA43606A322 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=RNb3s4Sw X-Envelope-To: linux-block@vger.kernel.org DKIM-Signature: a=rsa-sha256; bh=o58ti6zM1wpkWtMXmTaSFhbCUyBamPMgOfzkdkyQwoo=; c=simple/simple; d=linux.dev; h=from:to:subject:date:message-id:mime-version:content-type; s=key1; t=1796378341; v=1; x=1796983141; b=RNb3s4Sw/cBsb85PGeeuiDsgDhToLq3aZTQE7XP/gTkQLD/nnII/5lzZ+UBjzYSXHmVfs33Z PHz9WtZmCAiJY6l3UfSQJyTDoZVVEuCujdkH44ZEyolPiXC8F/jHbvmZrMvwy5qNsHtOUF0uB68 UvqO9rzcboZXZJy8R7VVGP1s= X-Envelope-To: linux-block@vger.kernel.org Received: by smtp.migadu.com with ESMTPS id 60dcd47a47746558; Fri, 04 Dec 2026 09:59:01 +0000 X-Mizu-Trace-ID: 60dcd47a47746558 X-Migadu-Flow: FLOW_OUT Message-ID: Date: Fri, 4 Dec 2026 17:58:55 +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, hch@lst.de, Tetsuo Handa , cuitao@kylinos.cn, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, Shin'ichiro Kawasaki Subject: Re: [PATCH v10] loop: defer the queue limits clear to a workqueue To: Bart Van Assche , axboe@kernel.dk References: <20261126054223.176824-1-cui.tao@linux.dev> <20261203081657.2577866-1-cui.tao@linux.dev> From: Tao Cui In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Hello, Bart, 在 2026/12/4 1:18, Bart Van Assche 写道: > > On 12/3/26 12:16 AM, Tao Cui wrote: >> +        lo->clear_wq = alloc_workqueue("loopc%d", >> +                        WQ_UNBOUND | WQ_MEM_RECLAIM, >> +                        0, lo->lo_number); > > WQ_MEM_RECLAIM creates a rescuer thread per loop device. Is that flag > really needed? Additionally, has it been considered to use a single > workqueue for all loop devices? Agreed on the flag: v11 drops it, loop%d, which runs the request path itself, does not use WQ_MEM_RECLAIM either. On a single workqueue for all devices: I'd rather not, if you're OK with that. The work function reads the loop_device, and the per-device queue is what keeps that safe, since lo_free_disk() destroys it before the loop_device is freed. A shared queue cannot be destroyed at teardown, so the work item would have to carry a new reference on the loop device. loop%d is per device already, so I'd keep this shape unless you prefer the shared queue. > >> +    if (!file) >> +        return false; > > lo_fallocate() has already dereferenced 'file', so this can't happen. > Agreed, will remove. >> +    if (!queue_work(lo->clear_wq, &w->clear_limits_work)) { > > queue_work() cannot fail for a work item that has just been > initialized. Please remove this error path. > Agreed, will remove. >> +        if (loop_clear_limits(lo, file, mode) && >> +            test_and_set_bit(0, &lo->clear_limits_reported)) >> +            rq->rq_flags |= RQF_QUIET; > > Please move the RQF_QUIET changes into a separate patch since these are > not needed to fix the race. Sure, I'll post it as 2/2 of a two-patch series. The marking is what keeps loop/011 at exactly one dmesg error per binding: without it, concurrent failures can all report before the first clear commits (this is how blktests CI failed loop/011 back on v6). > >> +    if (lo->clear_wq) >> +        destroy_workqueue(lo->clear_wq); >>      if (lo->workqueue) >>          destroy_workqueue(lo->workqueue); > > Work queued on lo->workqueue queues work on clear_wq, so please destroy > lo->workqueue first. > Agreed, will swap the order. Thanks, Tao. > Thanks, > > Bart.