Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=91.218.175.165 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796435606; b=gbjdLOO46MjdSahtVFzM3mxR5dRkrZ5B0AEmqYtXAUC0NNR8kyGszgyA6vQvP2yZ5/fT MsCLsOYa9zJ1PyZD6uMNP+sXK/xn6mi81Haeh/gANV9pbEPSC0EFqXeFc/gEgCb27p4nG /1HuH5Lsuhnud+KlVrmmC/7jsAJ9KLMe5mUYXAx6RjwmJfTfFgaph6wwFzTkdQnsAmjAb zh+7OIAO0ubjQ/n+wFF+QKJ1cGRTXdWZ9JxSyqinqRYukkC3pX/i3G7Jvlmmzr24O4wj7 PaltLECgjWy6QgBAWFp+daJDSM+h8RqBuQUyMd8pUMS7JSAsA7ugIXxK+SwYaWnBIoA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796435606; h=DMARC-Filter:X-Envelope-To:DKIM-Signature:X-Envelope-To:Received: X-Mizu-Trace-ID:X-Migadu-Flow:Date:From:To:Cc:Subject:Message-ID: References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To; bh=p7ScxZJTYyRuxuBqZQTJrKe5J1Yw2m8mCESmevfPuM8=; b=jjxPxaZgFuq4zf8ewn+IBOc1Jm/gxhB+x5WC4QlczNldZimvZcMtXMUMFu7Sn/KwHqJb qZxbqWE5A+xsNdUATmzrMO2AisYTv9DG3rCckB67fUj0J8awwHfxTACieD23sPRSZVts9 /Uq9kiaB1WRYEQvrtRApuBCS1qyVs4m43nWJdfJm4L/S1/551RuVEPSv/dNjvU3v5ARNa DAvhOCqVENgurP1eN+zlraJcKPnF69Io7f+m3s/S0P/U16jIJKVBBISyREfRPNVW/Q3Ce 4Uqy4iUp4d6Pw2xRM+a3GpeWMFgJB04MfovOtmOk7aiA9tKdeLkuwFqAoT2NA+DJjbA== 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=T0zndP6J; arc=none smtp.remote-ip=91.218.175.165 Received: from mta0.migadu.com (out-165.mta0.migadu.com [91.218.175.165]) (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 37763606A322 for ; Sat, 5 Dec 2026 01:53:24 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 37763606A322 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=T0zndP6J X-Envelope-To: sashiko-reviews@lists.linux.dev DKIM-Signature: a=rsa-sha256; bh=HEJnHD4scZAZs8m1Cl6zHLy6YJ/jtjmCYqjmC9Za4WM=; c=simple/simple; d=linux.dev; h=from:to:subject:date:message-id:mime-version:content-type; s=key1; t=1796435603; v=1; x=1797040403; b=T0zndP6JvY5Z73Txwt90bxHVqkQa+U5oEuF9fanPK5jrFOt/OIabwUgjBLEKMtTQ0o8L7hC2 09NZxJz1W2wTOx0/smbfxp5skUlIfR8ZNAzIFsyaQHzB4nS0tYLTK/FYZa2t7dawja4paWVt9ok V4rY9X9f1d7HTTNNjciTPHZE= X-Envelope-To: sashiko-reviews@lists.linux.dev Received: by smtp.migadu.com with ESMTPS id 179fab67f205dbb3; Sat, 05 Dec 2026 01:53:23 +0000 X-Mizu-Trace-ID: 179fab67f205dbb3 X-Migadu-Flow: FLOW_OUT Date: Fri, 4 Dec 2026 17:53:21 -0800 From: Shakeel Butt To: sashiko-reviews@lists.linux.dev Cc: tj@kernel.org, hannes@cmpxchg.org, mkoutny@suse.com Subject: Re: [PATCH 2/3] kernfs: add a sequence count to directories Message-ID: References: <20261204211034.3436390-1-shakeel.butt@linux.dev> <20261204211034.3436390-3-shakeel.butt@linux.dev> X-Mailing-List: sashiko-reviews@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Fri, Dec 04, 2026 at 09:36:34PM +0000, sashiko-bot@kernel.org wrote: [...] > > [Severity: Medium] > Does splitting dir.seq across kernfs_unlink_sibling() and > kernfs_link_sibling() let a concurrent lockless readdir() miss an entry > during an in-place rename? > > Between kernfs_unlink_sibling() and kernfs_link_sibling(), dir.seq returns to > an even value and preemption is re-enabled while kernfs_rename_ns() acquires > kernfs_rename_lock and hashes the new name. Callers such as > sysfs_rename_link_ns() (used by SIOCSIFNAME on /sys/class/net) invoke > kernfs_rename_ns() without the VFS directory i_rwsem: > > CPU0 CPU1 > kernfs_rename_ns(kn, ...) > kernfs_unlink_sibling(kn) > kernfs_dir_write_begin(dir) > rb_erase(&kn->rb, ...) > kernfs_dir_write_end(dir) > kernfs_fop_readdir() > read_seqcount_begin(&dir.seq) > walk dir.children <-- kn absent > read_seqcount_retry(&dir.seq) == 0 > WRITE_ONCE(kn->hash, ...) > kernfs_link_sibling(kn) > > With the lockless readdir walk in commit "kernfs: list directories without > kernfs_rwsem", a reader in that gap sees an unchanged even seqcount and > succeeds without retrying, omitting kn under both its old and new names (or > returning an empty directory if kn is the only visible entry). Previously > kernfs_rwsem held across both steps kept in-place renames atomic with respect > to readdir(). This one seems real i.e. a concurrent renamed node might get skipped by the directory listing. I will think of fixing this somehow. All the other reports are minor and I will address those as well in next version.