From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (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 C4183B672 for ; Wed, 30 Apr 2025 04:35:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1745987760; cv=none; b=Oq1seW2WBC0rEt3Rcu064hI8fr6/LI/AlDM+rExQRCO+FkKTuMOKrwjlTV46syj043cZRkTIrIt5WKTUJDx5eHi1TF8N7UvX83o7MUbq44mlV8KcObw8Huj/X+PHzGGest0lEbuq+TitIPPG99Kkin5ZwwJArZaaY9DpH9iWMrM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1745987760; c=relaxed/simple; bh=f6Ws/aKl0hiCia4kpVjXMlUuPlZwZmZuHl7Ufkgnw2A=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=I7IZQwn9I4z8FHPGX8sXzoiIXLi7fxkdCbQIorC/qlHt1nGvW8xVZj4Wj06EruNHmeR1jx5Wz1uqpB9lC5reCOXmcaM/P9WTrAYJTxs8s6zmUwcclwp6r4YooLJXsWPi09KJ3wxJComGWQjAN2/zBa6t064mFfX77M6kE65f+s0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=TF5D+vZS; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="TF5D+vZS" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1745987757; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=wA36hOWRz4zzOanRIrOPG4cgnHK+c3+IavYbiJBSkbA=; b=TF5D+vZS9y4p2B7wEkaDnwnmq7Sa7mzG4DK6UUmEMiEO4kcDJW4jbsPswsM+b63UOYsjye I5uei3OtQsRuxXDhpW023ko6AorrkyIFMAoPgoEYFgSLns17u1ENDOv/PO5w3+W1yXLw+W AaKmdyZNYfQouX2ry5vb+9K3AprmdQk= Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-375-msZ3vjdEMimfwoqLZKzJBQ-1; Wed, 30 Apr 2025 00:35:53 -0400 X-MC-Unique: msZ3vjdEMimfwoqLZKzJBQ-1 X-Mimecast-MFC-AGG-ID: msZ3vjdEMimfwoqLZKzJBQ_1745987752 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (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) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 78EF9180036F; Wed, 30 Apr 2025 04:35:52 +0000 (UTC) Received: from localhost (unknown [10.72.116.48]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 79723180045B; Wed, 30 Apr 2025 04:35:51 +0000 (UTC) From: Ming Lei To: Jens Axboe , linux-block@vger.kernel.org Cc: Nilay Shroff , Shinichiro Kawasaki , =?UTF-8?q?Thomas=20Hellstr=C3=B6m?= , Christoph Hellwig , Ming Lei , Hannes Reinecke Subject: [PATCH V4 04/24] block: use q->elevator with ->elevator_lock held in elv_iosched_show() Date: Wed, 30 Apr 2025 12:35:06 +0800 Message-ID: <20250430043529.1950194-5-ming.lei@redhat.com> In-Reply-To: <20250430043529.1950194-1-ming.lei@redhat.com> References: <20250430043529.1950194-1-ming.lei@redhat.com> Precedence: bulk X-Mailing-List: linux-block@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 Use q->elevator with ->elevator_lock held in elv_iosched_show(), since the local cached elevator reference may become stale after getting ->elevator_lock. Reviewed-by: Hannes Reinecke Reviewed-by: Nilay Shroff Reviewed-by: Christoph Hellwig Signed-off-by: Ming Lei --- block/elevator.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/block/elevator.c b/block/elevator.c index 5051a98dc08c..b32815594892 100644 --- a/block/elevator.c +++ b/block/elevator.c @@ -739,7 +739,6 @@ ssize_t elv_iosched_store(struct gendisk *disk, const char *buf, ssize_t elv_iosched_show(struct gendisk *disk, char *name) { struct request_queue *q = disk->queue; - struct elevator_queue *eq = q->elevator; struct elevator_type *cur = NULL, *e; int len = 0; @@ -748,7 +747,7 @@ ssize_t elv_iosched_show(struct gendisk *disk, char *name) len += sprintf(name+len, "[none] "); } else { len += sprintf(name+len, "none "); - cur = eq->type; + cur = q->elevator->type; } spin_lock(&elv_list_lock); -- 2.47.0