From nobody Mon Jun 8 12:11:55 2026 Received: from out-178.mta0.migadu.com (out-178.mta0.migadu.com [91.218.175.178]) (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 D2E94329396 for ; Fri, 29 May 2026 09:54:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.178 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780048501; cv=none; b=tSvF7J1xfRUoHxWGBkMUtyehYpYPYb45rQDkmY9fIs43XaDaOonahFS/gYGZFUT+k0HqGcYSg+oaaRx1vWI6MwPjNl//kkrNO9C4sFie3DAPcVgx/BZaLQ/fASarO2+JejLZ/anWsNhmuz0zC8jbag1oc4Wg65gOb/BBUKOrlPQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780048501; c=relaxed/simple; bh=dJg9bIeT2YRl5P1C+hiKUh2tgUgnSLSppchcQHqK2Y8=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=pb2uS/RGQgtkv1y0acE0/CTjVni+O0bzvAvx3rEF4GnlHr0nzOM2cAUajZyElAw0hEu2OcCAlEOLxu/nKP/w7zTuPatqzl2cWmlrJTSIu9n4FNDUD5FOVezy3kEZjJ0VBbUBQTSDYVR+nToRRBAzhPagrFbhTIcrLAbDYaHrmL8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=Q31krKlZ; arc=none smtp.client-ip=91.218.175.178 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) header.d=linux.dev header.i=@linux.dev header.b="Q31krKlZ" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1780048498; 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; bh=f4mO7zh2OYfYFujcbkhj/OStXm55oARYSUbui2B5HyE=; b=Q31krKlZX5C3DKx46Q+ShVyS2qfwxshsVuLaVkEnOoN6qb/DOiaYOXo1e+fxzsGLEjZH+b BAoTTvOIBBMWQ62nYGEEfoncKFeUYDAyuGuAAz0aYlNmZ/a2g6pFU26rpOljCwCWpQj1RL rLGO3crz+jqgRT0eiXrWZPIPXsxko6Y= From: Guopeng Zhang To: Alexander Viro , Christian Brauner Cc: Jan Kara , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Guopeng Zhang Subject: [PATCH] fs/namespace: notify pollers of legacy propagation changes Date: Fri, 29 May 2026 17:54:41 +0800 Message-ID: <20260529095441.1744006-1-guopeng.zhang@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Migadu-Flow: FLOW_OUT Content-Type: text/plain; charset="utf-8" From: Guopeng Zhang Changing mount propagation through the legacy mount API changes user-visible mountinfo contents, including the shared: and master: optional fields. The mount_setattr() path already touches the mount namespace after change_mnt_propagation(), so pollers of /proc//mountinfo are woken when the namespace event changes. The legacy mount --make-* path also changes propagation through change_mnt_propagation(), and MOVE_MOUNT_SET_GROUP updates the propagation relationship of the target mount. Both paths currently return without touching the affected mount namespace. As a result, userspace polling /proc//mountinfo can miss these propagation-only changes even though mountinfo has changed. A simple reproducer that polls /proc/self/mountinfo while changing propagation shows the inconsistency. Before this change: legacy MS_SHARED: poll ret=3D0 revents=3D0x0 mount_setattr MS_SHARED: poll ret=3D1 revents=3D0xa After this change: legacy MS_SHARED: poll ret=3D1 revents=3D0xa mount_setattr MS_SHARED: poll ret=3D1 revents=3D0xa Touch the affected mount namespace after successfully changing propagation state in do_change_type() and do_set_group(). Take the vfsmount lock for write around touch_mnt_namespace(), as required by its locking rules. Signed-off-by: Guopeng Zhang --- fs/namespace.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/fs/namespace.c b/fs/namespace.c index 9a66a806a9b8..f871c7bf3bc8 100644 --- a/fs/namespace.c +++ b/fs/namespace.c @@ -2908,6 +2908,10 @@ static int do_change_type(const struct path *path, i= nt ms_flags) for (m =3D mnt; m; m =3D (recurse ? next_mnt(m, mnt) : NULL)) change_mnt_propagation(m, type); =20 + lock_mount_hash(); + touch_mnt_namespace(mnt->mnt_ns); + unlock_mount_hash(); + return 0; } =20 @@ -3479,6 +3483,11 @@ static int do_set_group(const struct path *from_path= , const struct path *to_path list_add(&to->mnt_share, &from->mnt_share); set_mnt_shared(to); } + + lock_mount_hash(); + touch_mnt_namespace(to->mnt_ns); + unlock_mount_hash(); + return 0; } =20 --=20 2.43.0