Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=199.89.1.14 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796318306; b=WY6QUSA0ES5g+iQvVeq33nAbYK1/iPEIBU52gQMsxU5zIez1Xj8JbuNVZsHmTq8Oxqeg MxlwCUoCOE6rI8IZvQOMoRN0US52nfkYXtHfoGwPbQaHXX/TrXIhTBT+GNClRykPQnEK4 nhurNVhsYLvggC2BpqTdE1afkkiy+KVePj6ICQk4HMo2BIQW3kb9yuKlQU069k73fgoIL Mgk/uiZwpQ9Vb1A6dAgq4Vgd/6lUw4n8IGxyeCJ5limCfHHVMA6op5ga41tpwZqHfRvXs ISBNoR5+2CDisHEQr8xSBa/omnmOjI182ubsT0CNWOSYVDt+aRpEu3SM9nCwIB8YmBw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796318306; h=DMARC-Filter:Received:DKIM-Signature:X-Virus-Scanned:Received: Received:Message-ID:Date:MIME-Version:User-Agent:Subject:To:Cc: References:Content-Language:From:In-Reply-To:Content-Type: Content-Transfer-Encoding; bh=WL+sV//dJG+/SNB2IBaOI2Ipf45gebV6tER51x1PWwA=; b=Y/uUOSgWelJsIzY6zdp9orBldX5PLvLYuu/kuXMCrVLjmGwWEIktlslXWbiVm7r8vKuI whlx5r7w8v60Uv80upd+7D8KNvDFmYlq0voj8DrykhkCWNQbSWOKtRoAuSRvFTU8EF/Nt CVLpBC5TtE5T/TM0s+IMVAWeEyRl/zE8gG6GuGzoUXP4cGw+MGilX4bKZ4eNPDafzxSBm PCFNC8Nn63Q6dUJOMTRs3YnsFxiEjk6FuLhp/JFckZgjw7KQXueVftNwb5WCcfcVjPmmy rRmmfk/M9q9d0eXYXPz5QTfvLtnfd9McLxaocHA9Ytnc0KCIJNVcV+njyVb3weTndrw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=acm.org; spf=pass smtp.mailfrom=acm.org; dkim=pass header.d=acm.org header.i=@acm.org header.a=rsa-sha256 header.s=mr01 header.b=GqacJN4A; arc=none smtp.remote-ip=199.89.1.14 Received: from 011.lax.mailroute.net (011.lax.mailroute.net [199.89.1.14]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C25EE606A32D; Thu, 3 Dec 2026 17:18:25 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org C25EE606A32D Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=acm.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=acm.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=acm.org header.i=@acm.org header.a=rsa-sha256 header.s=mr01 header.b=GqacJN4A Received: from localhost (localhost [127.0.0.1]) by 011.lax.mailroute.net (Postfix) with ESMTP id 4jgLtn1NtPz1XMYJR; Thu, 3 Dec 2026 17:18:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=acm.org; h= content-transfer-encoding:content-type:content-type:in-reply-to :from:from:content-language:references:subject:subject :user-agent:mime-version:date:date:message-id:received:received; s=mr01; t=1796318302; x=1798910303; bh=WL+sV//dJG+/SNB2IBaOI2Ip f45gebV6tER51x1PWwA=; b=GqacJN4A/fz5oWR0KBqWIus/rXqhBC2DEOhsa4uI OrDzsI2j4WZBDurg8BGeVQ87meOYtpd+HoAcDFn5rzD5GLU4O17npex5w0JwFkAV W7IML3ZXuM4uKbmdA0vYHPZOVkXHbyjbmN0aDM1ePJcoQy83hCdYri8n59uI4Cuc S4eKBxipd7r2NhKWdL8QY/W4ei9+cehY0ZjE+YkU44p+twXbQ7Su53dM+rkMjUwT 7H13hV8QaS0ZQaaUkveoLQmqbCR2X2am1/lzIRqu2FnWqyx6yZ55nTN5K8jbLq5I I0ImmiQAMUYPpvifcnW42EzRL2vdbVB/aISZhcFV1hJD1g== X-Virus-Scanned: by MailRoute Received: from 011.lax.mailroute.net ([127.0.0.1]) by localhost (011.lax [127.0.0.1]) (mroute_mailscanner, port 10029) with LMTP id E3EzwzTDZj8H; Thu, 3 Dec 2026 17:18:22 +0000 (UTC) Received: from [100.77.36.205] (unknown [104.135.183.85]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: bvanassche@acm.org) by 011.lax.mailroute.net (Postfix) with ESMTPSA id 4jgLtk0cN4z1XMYJL; Thu, 3 Dec 2026 17:18:22 +0000 (UTC) Message-ID: Date: Thu, 3 Dec 2026 09:18:21 -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 Subject: Re: [PATCH v10] loop: defer the queue limits clear to a workqueue To: Tao Cui , axboe@kernel.dk Cc: hch@lst.de, Tetsuo Handa , cuitao@kylinos.cn, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, Shin'ichiro Kawasaki References: <20261126054223.176824-1-cui.tao@linux.dev> <20261203081657.2577866-1-cui.tao@linux.dev> Content-Language: en-US From: Bart Van Assche In-Reply-To: <20261203081657.2577866-1-cui.tao@linux.dev> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit 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? > + if (!file) > + return false; lo_fallocate() has already dereferenced 'file', so this can't happen. > + 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. > + 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. > + 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. Thanks, Bart.