Received: by 2002:a05:7208:c24f:b0:81:d631:dc8 with SMTP id w15csp402327rbd; Thu, 4 Apr 2024 12:43:47 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWuNtl1I1i/FU2Op0thrbQNS1cX3iRXxyCjE1fgPMK0byJl8zHRAFlP2z+bPFOsmEQLKDgLjdsju5ELEg67UotlfQ9WUlSxWaXgpQi/nw== X-Google-Smtp-Source: AGHT+IEiAiQc1Hc0/QGYIlnkDkcXKl3MZbT5DZQ45hYEmeZrp5byQEnz2/tSb2dtw1e54umZKk+t X-Received: by 2002:a05:6a21:1f24:b0:1a7:337a:1d4a with SMTP id ry36-20020a056a211f2400b001a7337a1d4amr777624pzb.17.1712259827565; Thu, 04 Apr 2024 12:43:47 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712259827; cv=pass; d=google.com; s=arc-20160816; b=o109+9xB5PwDceZDOKJjffssWFE/vyudOzMr+Iq/u5pID+gCiaeeBx0R95nQ6G7ofb KUT+ZjRLj/pdvRLDXEDdU//sUgkJE8gVFnAICm25Y9FAKJ/jXGVycLAHX25bofZxPRnz s5s4RoQF2RbJWD/5TNdYmaYVTUUxQoH/hAPhNAuL4CL0O63CQgOFPMDUd0QB4w0tFlEV FBPyJY73veciyk6SS7vlWCyb8MFIZ/KCLQHus9jlEzE2NQKxm8tfKf3w5iN+BuNbhTiH jVxyWdQpLtejWn3222Loeb+mm5ioEcUTRaEeqQ2P9fn7MWtI9WVx4ApXHFgdrwtDznv5 1Kwg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=user-agent:in-reply-to:content-disposition:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:references :reply-to:message-id:subject:cc:to:from:date:dkim-signature :dkim-signature:dkim-signature:dkim-signature; bh=gIJTzIQcbHebBkVn3DulvZH4vVRHwONfG5Hh7aP6lMU=; fh=oAx+754D4RHgKtrCNslHWncpPdPtaPyUQ2piX9avtGU=; b=pEQEa1bO+x+1521IoRry+QRWbB//YkV3Os7DNaScG5EvV69mytre3/ZABKUP8OfSE8 7IkP3m3gT82thmDSYYroHNekszuanyEXdhN/I2up4c2BIrr5CR+SLPY6Z5S8LsHXr4LM NB3stWwwWgRPEWnNqjIYl8E0GAPoSbrxanopGj2659+IaHDJnvhA3YBa2/GjWdSL6mvQ YZwzl7QCC7MkzrG3RfC3AkmpPHG7PM+KhyaeBpE+F6znfiR3R1eF/D4UfERt4h1//DK6 AaXy6cn3vHCCmNhXuMpgZca4lBm0JvwHVXeMSxzbvsZFXiQ5icRtGNNhW/Qc6bH90sBp xY/Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=QHYAQErq; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=QHYAQErq; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519; arc=pass (i=1 spf=pass spfdomain=suse.cz dkim=pass dkdomain=suse.cz dkim=pass dkdomain=suse.cz); spf=pass (google.com: domain of linux-kernel+bounces-132056-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-132056-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id w22-20020a634756000000b005f3dca33f3dsi30217pgk.307.2024.04.04.12.43.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Apr 2024 12:43:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-132056-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=QHYAQErq; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=QHYAQErq; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519; arc=pass (i=1 spf=pass spfdomain=suse.cz dkim=pass dkdomain=suse.cz dkim=pass dkdomain=suse.cz); spf=pass (google.com: domain of linux-kernel+bounces-132056-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-132056-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 3962F281F81 for ; Thu, 4 Apr 2024 19:43:47 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1A1901353E3; Thu, 4 Apr 2024 19:43:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b="QHYAQErq"; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b="Ampcvn6r"; dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b="QHYAQErq"; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b="Ampcvn6r" Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6AA20134743; Thu, 4 Apr 2024 19:43:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.135.223.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712259807; cv=none; b=PN0sg3Rs1QzyMaaO4e6ULmE3Dcwy5HTwpCoPZ+W2Vxn+TenC4nLvGmIJi2lYqRsZH22dox1KrCiAy5b+/kljVTg/qAEjVWxn/D+P1iMlpOYeL5Jh9R2cqerhjtIK4aNJ23mHi2Un5pPDHq6nZCpRZy5NNZ/use3DQwzkN/dHJ5E= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712259807; c=relaxed/simple; bh=ssFyVGe6la71DQpqy8kwW+lUpLEMRvFgNVGNpKsWvPE=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Z+8NmfdiXoutxKa3+rvpVZox+1VTsB3gl2izcYV1225AhMlhN4eRsHlrvP2cdrA3U2+QLegT+0dZQ/muy/jzY0uOuJAM0IjtHxBTTCFsAW8Qsq4XioWCmjBUjOiXYQUBV9x0K1JzSal98J4C2/V8RnWMNt7KoBT6ejT2Pi2X9GA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=suse.cz; spf=pass smtp.mailfrom=suse.cz; dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b=QHYAQErq; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b=Ampcvn6r; dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b=QHYAQErq; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b=Ampcvn6r; arc=none smtp.client-ip=195.135.223.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.cz Received: from imap2.dmz-prg2.suse.org (imap2.dmz-prg2.suse.org [10.150.64.98]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 8063B1F444; Thu, 4 Apr 2024 19:43:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1712259802; h=from:from:reply-to:reply-to:date:date:message-id:message-id:to:to: cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=gIJTzIQcbHebBkVn3DulvZH4vVRHwONfG5Hh7aP6lMU=; b=QHYAQErqSuSs0NOzd6WUQt/L3K8BPbjXUwGrtgV5aj02jddC3+MdaAlllIodH4PR4MLlz2 6eEgQtqZofBccIawjK+EEtzdG1T/1ls+dglmaS1UJrS+qSQUOtneYzWRC4a0c7ABYGwzOO 4O1Tuf2todQyr02ZURef/6q9qWlCOQ4= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1712259802; h=from:from:reply-to:reply-to:date:date:message-id:message-id:to:to: cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=gIJTzIQcbHebBkVn3DulvZH4vVRHwONfG5Hh7aP6lMU=; b=Ampcvn6rx+dhtUCHrq7ys/KECzq8yl4np4RgM1DZD7CinKw1X24tJwUge7MUx+908BGYCy CNoPd6VF3McUmhAg== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1712259802; h=from:from:reply-to:reply-to:date:date:message-id:message-id:to:to: cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=gIJTzIQcbHebBkVn3DulvZH4vVRHwONfG5Hh7aP6lMU=; b=QHYAQErqSuSs0NOzd6WUQt/L3K8BPbjXUwGrtgV5aj02jddC3+MdaAlllIodH4PR4MLlz2 6eEgQtqZofBccIawjK+EEtzdG1T/1ls+dglmaS1UJrS+qSQUOtneYzWRC4a0c7ABYGwzOO 4O1Tuf2todQyr02ZURef/6q9qWlCOQ4= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1712259802; h=from:from:reply-to:reply-to:date:date:message-id:message-id:to:to: cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=gIJTzIQcbHebBkVn3DulvZH4vVRHwONfG5Hh7aP6lMU=; b=Ampcvn6rx+dhtUCHrq7ys/KECzq8yl4np4RgM1DZD7CinKw1X24tJwUge7MUx+908BGYCy CNoPd6VF3McUmhAg== Received: from imap2.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap2.dmz-prg2.suse.org (Postfix) with ESMTPS id 6A8CE139E8; Thu, 4 Apr 2024 19:43:22 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap2.dmz-prg2.suse.org with ESMTPSA id I3TdGdoCD2ZtaQAAn2gu4w (envelope-from ); Thu, 04 Apr 2024 19:43:22 +0000 Date: Thu, 4 Apr 2024 21:35:56 +0200 From: David Sterba To: Johannes Thumshirn Cc: Chris Mason , Josef Bacik , David Sterba , linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org, Hans Holmberg , Naohiro Aota , hch@lst.de, Damien LeMoal , Boris Burkov , Johannes Thumshirn Subject: Re: [PATCH RFC PATCH 1/3] btrfs: zoned: traverse device list in should reclaim under rcu_read_lock Message-ID: <20240404193556.GJ14596@twin.jikos.cz> Reply-To: dsterba@suse.cz References: <20240328-hans-v1-0-4cd558959407@kernel.org> <20240328-hans-v1-1-4cd558959407@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240328-hans-v1-1-4cd558959407@kernel.org> User-Agent: Mutt/1.5.23.1-rc1 (2014-03-12) X-Spam-Flag: NO X-Spam-Score: -1.02 X-Spam-Level: X-Spamd-Result: default: False [-1.02 / 50.00]; NEURAL_HAM_LONG(-1.00)[-1.000]; HAS_REPLYTO(0.30)[dsterba@suse.cz]; NEURAL_HAM_SHORT(-0.20)[-0.997]; MIME_GOOD(-0.10)[text/plain]; BAYES_HAM(-0.02)[53.79%]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCPT_COUNT_TWELVE(0.00)[12]; ARC_NA(0.00)[]; TO_DN_SOME(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_TLS_ALL(0.00)[]; FUZZY_BLOCKED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; DKIM_SIGNED(0.00)[suse.cz:s=susede2_rsa,suse.cz:s=susede2_ed25519]; REPLYTO_ADDR_EQ_FROM(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap2.dmz-prg2.suse.org:helo,imap2.dmz-prg2.suse.org:rdns] Subject: btrfs: zoned: traverse device list in should reclaim under rcu_read_lock Please use the function name in the subject instead of the description, so like btrfs: zoned: traverse device list under RCU lock in btrfs_zoned_should_reclaim() On Thu, Mar 28, 2024 at 02:56:31PM +0100, Johannes Thumshirn wrote: > From: Johannes Thumshirn > > As btrfs_zoned_should_reclaim() traverses the device list with the > device_list_mutex held. But we're never changing the device list. All we > do is gathering the used and total bytes. > > So change the list traversal from the holding the device_list_mutex to > rcu_read_lock(). This also opens up the possibilities to call > btrfs_zoned_should_reclaim() with the chunk_mutex held. You can add this patch independently, the device_list_mutex does not seem to be needed for strong consistency of the values you read. There are several other places where devices are under RCU only, like btrfs_commit_device_sizes (though this is also in the transaction context), various ioctls and btrfs_calc_avail_data_space().