From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 68D3ABA49 for ; Tue, 7 Mar 2023 18:31:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D918EC433D2; Tue, 7 Mar 2023 18:31:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1678213884; bh=iekUbFaHy0iI7ba32ARR5AJyI2XPJiiHfOfw7/xv9UU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RJJOfVpxBNlL89EHhVzdosYjtYsH757y7lOn1gbccJRk0j4mxr2f0C+Y8l8irBRXE 7u+uPh2o/rhTwdXaVKNrAiB7kgMb0LzPHtdRqAWRrQpWe+jx2NRfCn4HW0uRoffJ/U vWx0arwwDs68HDKNcLJaWFh5VhjXHG4mVRCLVDtA= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Keith Busch , Jens Axboe Subject: [PATCH 6.1 651/885] block: clear bio->bi_bdev when putting a bio back in the cache Date: Tue, 7 Mar 2023 17:59:45 +0100 Message-Id: <20230307170030.427928548@linuxfoundation.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230307170001.594919529@linuxfoundation.org> References: <20230307170001.594919529@linuxfoundation.org> User-Agent: quilt/0.67 Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Jens Axboe commit 11eb695feb636fa5211067189cad25ac073e7fe5 upstream. This isn't strictly needed in terms of correctness, but it does allow polling to know if the bio has been put already by a different task and hence avoid polling something that we don't need to. Cc: stable@vger.kernel.org Fixes: be4d234d7aeb ("bio: add allocation cache abstraction") Reviewed-by: Keith Busch Signed-off-by: Jens Axboe Signed-off-by: Greg Kroah-Hartman --- block/bio.c | 1 + 1 file changed, 1 insertion(+) --- a/block/bio.c +++ b/block/bio.c @@ -747,6 +747,7 @@ void bio_put(struct bio *bio) bio_uninit(bio); cache = per_cpu_ptr(bio->bi_pool->cache, get_cpu()); bio->bi_next = cache->free_list; + bio->bi_bdev = NULL; cache->free_list = bio; if (++cache->nr > ALLOC_CACHE_MAX + ALLOC_CACHE_SLACK) bio_alloc_cache_prune(cache, ALLOC_CACHE_SLACK);