From nobody Sat Oct 4 08:03:29 2025 Received: from mail-pj1-f45.google.com (mail-pj1-f45.google.com [209.85.216.45]) (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 473D9266580; Tue, 19 Aug 2025 06:13:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755583992; cv=none; b=ZkSzy85F/X7l1qlgoL+QKb14RVC3k2siT2IItXzDJ6zuviy5YzdhKFkUKZ7B+ZAKi3E0QCkx5AuQ8fhFD8gH4k0snZnd4FHpxVu/RW9/M6ZrcLECj1eOOeK+W30t8Ro0g7N8Wfuy0g6UbBikqLTy99qYipPwLSSK9D9SS7l2Eh0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755583992; c=relaxed/simple; bh=v6vYcXTcBoSBqK9ngA2WTm1fqKDKwId1MYeyfxcSqo0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=icms0fA0JwzIkFnWyf3fdpC+EGFVeGeaPPkKQ0mLcrnavtTwrSf+3X1JBvgjKZjrO4nj+TlkeHFPVGGlKXm18y9V0EAmVA2X3qlQ33O31Yt3XoQ611fUsBDvY9gjllNPkJEJdTJpEeuBGo2Thd6KEZjaM/5sTydrncGHu0JqFdE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=FocrOx69; arc=none smtp.client-ip=209.85.216.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="FocrOx69" Received: by mail-pj1-f45.google.com with SMTP id 98e67ed59e1d1-32326e09f58so5401105a91.2; Mon, 18 Aug 2025 23:13:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1755583990; x=1756188790; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=fi/ShUkxBtk6aRjZ08qLf5FzFDYEi5q8iyCQUeWbe4o=; b=FocrOx69zo7aeg+EiENXKfdTGP1ln/7JBtY2wiX3KZeoMRyH3r6bx3vNGIwDjl6nBf 35l6lZoxYfkDvXdw1NyDmVOa5mjvhRmmpgekKHvNaM2+S0Gm83f0NvxiWTm/XOa3RsOX 09TDm7rpEJnIp0ZfwDoGyc8D/pyi6USXdK8+1ZIPmIGcaE3WQOtduD08FnCoiEZOf3S3 ieBFlRZeKXsCYheNn/j6CxMkE5Xn7kCPrB2r5Bj7vKZReiKolQNDWF4i1+da082FNaCF Rwsv4eYiNSJte5dRwyyoWBRFb6j4NdRJXYSyXCP2yC2z0fHzbTtW5Bg6wrhFYEbsvLbl qrvA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1755583990; x=1756188790; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=fi/ShUkxBtk6aRjZ08qLf5FzFDYEi5q8iyCQUeWbe4o=; b=VW8qfBeDqkXBt4nvWgK5FUnJKnE1pIb1TEsgWoe1ZQodo/QAOTLdeb0tzdZJ/DuDmU UyQTms1m15gf06zyxP679pMDTnbm2D2g7hcUb14sofj+ejrx53hUE0D3XJTueEcDp4/P Ij686XkW6emxqYuxwLTbhlDQWOVYnlk9VkQ4yYgdTg5eBKPbcOEaZs1m4IOEKh7xgEJv oci+k08Q6NxwD6W6I23W5RaqWtwQ8nncbyt2QxGYkZqudtiC5RrJ2MrPNHwNtewaXbjB IQP5/HMrlDLSR78CY/8EFFOFsWaJvWTdU61e5XhWZrfRsl1ytc5XrkdJ8ujVW4bh4UQq xBLw== X-Forwarded-Encrypted: i=1; AJvYcCUIsICFNUs/6PBf4vOleZfbgeOq0Ou15hvIxpDexPRuoTZ6umIaviBtsjRE5gRidXnytW6vaM4lY6j1IiSCww==@vger.kernel.org, AJvYcCWP4ozsswbFKKrriyaipL20aYtHVVK0pmwI2nFcZzEMJnaYq7DrGoQlxKRDx34RRyG+bx2Bm6Ieb40=@vger.kernel.org X-Gm-Message-State: AOJu0YwYlhaIRB4aXwbE+v77OxxQ/nNTzg2fz+huBLw32eIj08HykLM9 O/LSJG1CjzjrjE4E8YajiSNEsDHouES8uyIGVV6526y8iCOC4KkWvDxk X-Gm-Gg: ASbGncskhCJj+jv4MA5uJbOzKIHQiNPFJ6wJH/4scDOt4mQuiw8HBr5aAWRm4ZtPQn/ 5nGLsUtjw/fNDxENM5zKs3zfvHqwVS1zQICNl+6VRFycG+S7oS/D2B78PgG3HONgYOz8BlDVoQb DwRiVPaZKsavZvKTTvDG9tgqL23Yhbdw9xsbvawl6xPcPo9OYDbUS+9UkpS1i+swYxLUBm6zy4N zA9wLYXXJSBdlGbqb5Hi4Sd8Lc8/9zSpLZHfTH8JqcrDw95hTbd8STmtJVWfjD5FjLptJC5KBW8 ZksbjoB6wrrRmZwfZuY5/K/UTpwB5PEmGamlCRWzgp563w4vBXXd6X4UIAuNVr4A208MiSRJ4ja 5fu77kMTfe3v2+DSvbG0G0jJuFogjMOaJ X-Google-Smtp-Source: AGHT+IHxrlyPE1vvqO8g21oUJ1Ho0ML4MJuZ8/bVU+uw43C5It2CxEZZu8wIW6xynIH5F5K8ENGT2A== X-Received: by 2002:a17:903:3845:b0:240:ce24:20a0 with SMTP id d9443c01a7336-245e02d77b2mr19456625ad.11.1755583990333; Mon, 18 Aug 2025 23:13:10 -0700 (PDT) Received: from archie.me ([103.124.138.155]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2446cb0101esm97442055ad.46.2025.08.18.23.13.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Aug 2025 23:13:07 -0700 (PDT) Received: by archie.me (Postfix, from userid 1000) id 66E8541A38C4; Tue, 19 Aug 2025 13:13:04 +0700 (WIB) From: Bagas Sanjaya To: Linux Kernel Mailing List , Linux Documentation , Linux Filesystems Development Cc: Jonathan Corbet , Bagas Sanjaya , Christian Brauner , Mauro Carvalho Chehab , Randy Dunlap Subject: [PATCH 1/5] Documentation: sharedsubtree: Format remaining of shell snippets as literal code blcoks Date: Tue, 19 Aug 2025 13:12:49 +0700 Message-ID: <20250819061254.31220-2-bagasdotme@gmail.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20250819061254.31220-1-bagasdotme@gmail.com> References: <20250819061254.31220-1-bagasdotme@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=4402; i=bagasdotme@gmail.com; h=from:subject; bh=v6vYcXTcBoSBqK9ngA2WTm1fqKDKwId1MYeyfxcSqo0=; b=owGbwMvMwCX2bWenZ2ig32LG02pJDBlLRF58XMCwzL9FP3+m5fWZi/0Y3s3g8JV4a3rkl4kl7 +S7LInrO0pZGMS4GGTFFFkmJfI1nd5lJHKhfa0jzBxWJpAhDFycAjCRb4EM/xNbvNTOHLw1lXtZ 5Scm3ocMXxVaw7QnbG169Hx23GPrwCOMDNcTdxsYP41YbHOvfF5YOHNYjGii/r6vxxg7nKd2XVb pYQQA X-Developer-Key: i=bagasdotme@gmail.com; a=openpgp; fpr=701B806FDCA5D3A58FFB8F7D7C276C64A5E44A1D Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Fix formatting inconsistency of shell snippets by wrapping the remaining of them in literal code blocks. Signed-off-by: Bagas Sanjaya --- Documentation/filesystems/sharedsubtree.rst | 68 +++++++++++---------- 1 file changed, 37 insertions(+), 31 deletions(-) diff --git a/Documentation/filesystems/sharedsubtree.rst b/Documentation/fi= lesystems/sharedsubtree.rst index 1cf56489ed484d..06497c4455b41d 100644 --- a/Documentation/filesystems/sharedsubtree.rst +++ b/Documentation/filesystems/sharedsubtree.rst @@ -90,37 +90,42 @@ replicas continue to be exactly same. =20 Here is an example: =20 - Let's say /mnt has a mount which is shared. - # mount --make-shared /mnt + Let's say /mnt has a mount which is shared:: =20 - Let's bind mount /mnt to /tmp - # mount --bind /mnt /tmp + # mount --make-shared /mnt + + Let's bind mount /mnt to /tmp:: + + # mount --bind /mnt /tmp =20 the new mount at /tmp becomes a shared mount and it is a replica of the mount at /mnt. =20 - Now let's make the mount at /tmp; a slave of /mnt - # mount --make-slave /tmp + Now let's make the mount at /tmp; a slave of /mnt:: =20 - let's mount /dev/sd0 on /mnt/a - # mount /dev/sd0 /mnt/a + # mount --make-slave /tmp =20 - #ls /mnt/a - t1 t2 t3 + let's mount /dev/sd0 on /mnt/a:: =20 - #ls /tmp/a - t1 t2 t3 + # mount /dev/sd0 /mnt/a + + # ls /mnt/a + t1 t2 t3 + + # ls /tmp/a + t1 t2 t3 =20 Note the mount event has propagated to the mount at /tmp =20 - However let's see what happens if we mount something on the mount at /tmp + However let's see what happens if we mount something on the mount at + /tmp:: =20 - # mount /dev/sd1 /tmp/b + # mount /dev/sd1 /tmp/b =20 - #ls /tmp/b - s1 s2 s3 + # ls /tmp/b + s1 s2 s3 =20 - #ls /mnt/b + # ls /mnt/b =20 Note how the mount event has not propagated to the mount at /mnt @@ -137,7 +142,7 @@ replicas continue to be exactly same. =20 # mount --make-unbindable /mnt =20 - Let's try to bind mount this mount somewhere else:: + Let's try to bind mount this mount somewhere else:: =20 # mount --bind /mnt /tmp mount: wrong fs type, bad option, bad superblock on /mnt, @@ -471,9 +476,9 @@ replicas continue to be exactly same. =20 5d) Move semantics =20 - Consider the following command + Consider the following command:: =20 - mount --move A B/b + mount --move A B/b =20 where 'A' is the source mount, 'B' is the destination mount and 'b' is the dentry in the destination mount. @@ -663,9 +668,9 @@ replicas continue to be exactly same. 'B' is the slave of 'A' and 'C' is a slave of 'B' A -> B -> C =20 - at this point if we execute the following command + at this point if we execute the following command:: =20 - mount --bind /bin /tmp/test + mount --bind /bin /tmp/test =20 The mount is attempted on 'A' =20 @@ -706,8 +711,8 @@ replicas continue to be exactly same. / \ tmp usr =20 - And we want to replicate the tree at multiple - mountpoints under /root/tmp + And we want to replicate the tree at multiple + mountpoints under /root/tmp =20 step 2: :: @@ -731,7 +736,7 @@ replicas continue to be exactly same. / m1 =20 - it has two vfsmounts + it has two vfsmounts =20 step 3: :: @@ -739,7 +744,7 @@ replicas continue to be exactly same. mkdir -p /tmp/m2 mount --rbind /root /tmp/m2 =20 - the new tree now looks like this:: + the new tree now looks like this:: =20 root / \ @@ -759,14 +764,15 @@ replicas continue to be exactly same. / \ m1 m2 =20 - it has 6 vfsmounts + it has 6 vfsmounts =20 step 4: - :: + :: + mkdir -p /tmp/m3 mount --rbind /root /tmp/m3 =20 - I won't draw the tree..but it has 24 vfsmounts + I won't draw the tree..but it has 24 vfsmounts =20 =20 at step i the number of vfsmounts is V[i] =3D i*V[i-1]. @@ -785,8 +791,8 @@ replicas continue to be exactly same. / \ tmp usr =20 - How do we set up the same tree at multiple locations under - /root/tmp + How do we set up the same tree at multiple locations under + /root/tmp =20 step 2: :: --=20 An old man doll... just what I always wanted! - Clara From nobody Sat Oct 4 08:03:29 2025 Received: from mail-pg1-f174.google.com (mail-pg1-f174.google.com [209.85.215.174]) (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 3D828265606; Tue, 19 Aug 2025 06:13:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.174 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755583991; cv=none; b=CZP4KTpZVmf4mHRIEAUPfX19rCr8R+hfcghCBB5U+Ky2m0ZlIAAxKkuFtMILvtKrqETScO6sMLECgPG07GU6ztyPkrBbWsbBXgbuljvyOXAmGj6ojqo6Nowxrjv9WZBFp6J4YSqaGkOFlCIHo6y51CDh8b4T9OM85+tF21jKHCY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755583991; c=relaxed/simple; bh=I7KmCXyl42aYn842W603tt/7xQNS3vegUK19V0pwZ1I=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=W0X6pzpyHQ2nj3mi+JQ4YQEefQi+mVYR7qewrb8c3Y9YGEoaUBXlAOeRB894qS7ur5Xjzcx2TDRARLQFBkEWRLQjXTPkEoglBP/YBjZOD81bUjmQqx1UYvCn6T3deGDNoNTUNzNmOZbEqD8GRXRurnqB2kdYegc7nTeBc+pLXCw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=QnH/FrUQ; arc=none smtp.client-ip=209.85.215.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="QnH/FrUQ" Received: by mail-pg1-f174.google.com with SMTP id 41be03b00d2f7-b47173749dbso3340925a12.1; Mon, 18 Aug 2025 23:13:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1755583989; x=1756188789; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=FMm+ItPj3hUTjJZjxg/ff1pADD3fWr8FSx3pNcuiyqM=; b=QnH/FrUQJmJByOlQcQXCqPBj9U0lcf1TKSD7PAS1rB9bbIds0DcC258MEcLvbcJKVS 4Hc6N+d9hFquUDBCU8gceySLbcRUFH35xFZbbN7pOz432XbP14yKLqTHDp3GY4U/7Gd6 Y+nHHLWYG/Z53KfryMSN8nFTCSBwsQs0CM4SZb3RNiaIkWYF3T9kIkIoEm63K1GgsC5P eK4uU3tAOKNlHcC02T4tbrH8Ymgw6+1w0SUkJN0wuiIJukVfwmm8Sza4nqtZxmOSoDgU 2mkMijn+6AE3ptbkZL7bhkuQQK8v1r7jj3wfl6FXa5uXkZI2q+jCYhRP/YpPwSpp31Y1 Hj+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1755583989; x=1756188789; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=FMm+ItPj3hUTjJZjxg/ff1pADD3fWr8FSx3pNcuiyqM=; b=EtlFZ2MO0eUI+mg7YzegDkKsc4jvdsqNCIgh5hzFr1aM1aRNl8N0JVvWPqOWQ160Km FeU50Yj0+o93KZ2KK8E+izLrMaJiua7HDkT8iNNVxr6+p8MDQK6hgsgS6czud5KC06qX 52JXMRgQHRq/XdoxfIML/4iKBdE1D57u8wAYes5VkksiwBItUtbjQmpxMH2bHrkk2hHi Llki9KxcLjANgf3NyMQ2kXMNyqjnpED/Wepywu56rRfplRgBhxjPeziioqgbeMYA6wIz PeZoD8bghNZemDTTcNGAVa4cpCHZA/9nqAJSW6H1/zKRgLrHUeapjoa2o20yIN7MHSUQ KUYA== X-Forwarded-Encrypted: i=1; AJvYcCW2FfBehHfn+Cwo/JSMsScNWyBWL3Np3QhVSA9vOYfeNHGwBpWcdVr24/JzQRIJBkBDtQvTuXl394bP6cyDFA==@vger.kernel.org, AJvYcCXqkPjvg/t8jOfLfsV4cmyR99x6bNIsEsAaeW50GxeHIj/i5k0ZWlNzLll8NtEeHYcPiowYJKput34=@vger.kernel.org X-Gm-Message-State: AOJu0Yxtn49KnIEJss1Jza/6zydOWHklgMz4WHwV0w4nd4kfsKNTm6xF YK5c/qV7FZKA5ThEQ2a/Azlmp+LFluhzWkn/xAgR4oLJsn0p4kWUiby8 X-Gm-Gg: ASbGncuOag10+8vFy3C1hEVBxOR/kXxNaVS0ZRkjDrqOFC5MRfarT5jwa7J1f3k22tf SN+PAbzyhvcODfI4LcnkJBaaapCln55++Qzp6mzoxhgWWArG3d9gvdcurz+V2GoeY75X7oFWnTh IiStNQL+Yd/fz/QjHPXhrZ3SEML1e1/Ptoi2ndzM2Cvs3sQlsuQZDd0YdEwKhZotH8GKz4qvTkz XaKluf/pRGfp//AcZNgaHBqgQoEBUH34LwNWoAhl9QkDOJ/b6Wlask8PvFWWiW22lQV+hTJJrBI RL3EWRohQoPVL9IpM3PxJnjvhCpVpKRsQygb2S0DpsQPi/UgFZWsy2Pxc1Yi3cQxgf3LYqhhe0I lnP5X80hKyZ2PJCdKzl4TkKBXOsU74qH3 X-Google-Smtp-Source: AGHT+IFd0BGA8T2XXal0HJWOiS1R/oNe/7plsRqUR229O+uQ6zbFJpuj840bfWx8tu9rcqKH0Xlxyg== X-Received: by 2002:a17:902:e804:b0:240:3f3d:fd37 with SMTP id d9443c01a7336-245e05092b3mr14365495ad.27.1755583989267; Mon, 18 Aug 2025 23:13:09 -0700 (PDT) Received: from archie.me ([103.124.138.155]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2446d516a30sm97749385ad.95.2025.08.18.23.13.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Aug 2025 23:13:07 -0700 (PDT) Received: by archie.me (Postfix, from userid 1000) id 914C342BF5D4; Tue, 19 Aug 2025 13:13:04 +0700 (WIB) From: Bagas Sanjaya To: Linux Kernel Mailing List , Linux Documentation , Linux Filesystems Development Cc: Jonathan Corbet , Bagas Sanjaya , Christian Brauner , Mauro Carvalho Chehab , Randy Dunlap Subject: [PATCH 2/5] Documentation: sharedsubtree: Use proper enumerator sequence for enumerated lists Date: Tue, 19 Aug 2025 13:12:50 +0700 Message-ID: <20250819061254.31220-3-bagasdotme@gmail.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20250819061254.31220-1-bagasdotme@gmail.com> References: <20250819061254.31220-1-bagasdotme@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=5653; i=bagasdotme@gmail.com; h=from:subject; bh=I7KmCXyl42aYn842W603tt/7xQNS3vegUK19V0pwZ1I=; b=owGbwMvMwCX2bWenZ2ig32LG02pJDBlLRF68eFeyz3ragiOsuplpvLuX7X4nx5VmGSwxS0C0O eOGTun2jlIWBjEuBlkxRZZJiXxNp3cZiVxoX+sIM4eVCWQIAxenAExETozhf3L3nnyV13vTfSp8 qkuipTP1VzbrGO3ad7nNdbOQl86RHQz/tLUOxt65mrvlfun5d4EMHd6K+XuO3AgS4/UO5OFl9nr DBgA= X-Developer-Key: i=bagasdotme@gmail.com; a=openpgp; fpr=701B806FDCA5D3A58FFB8F7D7C276C64A5E44A1D Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Sphinx does not recognize mixed-letter sequences (e.g. 2a) as enumerator for enumerated lists. As such, lists that use such sequences end up as definition lists instead. Use proper enumeration sequences for this purpose. Signed-off-by: Bagas Sanjaya --- Documentation/filesystems/sharedsubtree.rst | 40 ++++++++++----------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/Documentation/filesystems/sharedsubtree.rst b/Documentation/fi= lesystems/sharedsubtree.rst index 06497c4455b41d..7ad5101b4c03ad 100644 --- a/Documentation/filesystems/sharedsubtree.rst +++ b/Documentation/filesystems/sharedsubtree.rst @@ -39,8 +39,8 @@ precise d. unbindable mount =20 =20 -2a) A shared mount can be replicated to as many mountpoints and all the -replicas continue to be exactly same. +a) A shared mount can be replicated to as many mountpoints and all the + replicas continue to be exactly same. =20 Here is an example: =20 @@ -83,8 +83,8 @@ replicas continue to be exactly same. contents will be visible under /tmp/a too. =20 =20 -2b) A slave mount is like a shared mount except that mount and umount even= ts - only propagate towards it. +b) A slave mount is like a shared mount except that mount and umount events + only propagate towards it. =20 All slave mounts have a master mount which is a shared. =20 @@ -131,12 +131,12 @@ replicas continue to be exactly same. /mnt =20 =20 -2c) A private mount does not forward or receive propagation. +c) A private mount does not forward or receive propagation. =20 This is the mount we are familiar with. Its the default type. =20 =20 -2d) A unbindable mount is a unbindable private mount +d) A unbindable mount is a unbindable private mount =20 let's say we have a mount at /mnt and we make it unbindable:: =20 @@ -185,7 +185,7 @@ replicas continue to be exactly same. namespaces. =20 B) A process wants its mounts invisible to any other process, but - still be able to see the other system mounts. + still be able to see the other system mounts. =20 Solution: =20 @@ -250,7 +250,7 @@ replicas continue to be exactly same. Note: the word 'vfsmount' and the noun 'mount' have been used to mean the same thing, throughout this document. =20 -5a) Mount states +a) Mount states =20 A given mount can be in one of the following states =20 @@ -360,7 +360,7 @@ replicas continue to be exactly same. the state of a mount depending on type of the destination mount. Its explained in section 5d. =20 -5b) Bind semantics +b) Bind semantics =20 Consider the following command:: =20 @@ -437,7 +437,7 @@ replicas continue to be exactly same. 8. 'A' is a unbindable mount and 'B' is a non-shared mount. This is a invalid operation. A unbindable mount cannot be bind mounted. =20 -5c) Rbind semantics +c) Rbind semantics =20 rbind is same as bind. Bind replicates the specified mount. Rbind replicates all the mounts in the tree belonging to the specified mount. @@ -474,7 +474,7 @@ replicas continue to be exactly same. =20 =20 =20 -5d) Move semantics +d) Move semantics =20 Consider the following command:: =20 @@ -551,7 +551,7 @@ replicas continue to be exactly same. 'A' is mounted on mount 'B' at dentry 'b'. Mount 'A' continues to be a unbindable mount. =20 -5e) Mount semantics +e) Mount semantics =20 Consider the following command:: =20 @@ -564,7 +564,7 @@ replicas continue to be exactly same. that the source mount is always a private mount. =20 =20 -5f) Unmount semantics +f) Unmount semantics =20 Consider the following command:: =20 @@ -598,7 +598,7 @@ replicas continue to be exactly same. to be unmounted and 'C1' has some sub-mounts, the umount operation is failed entirely. =20 -5g) Clone Namespace +g) Clone Namespace =20 A cloned namespace contains all the mounts as that of the parent namespace. @@ -682,18 +682,18 @@ replicas continue to be exactly same. 7) FAQ ------ =20 - Q1. Why is bind mount needed? How is it different from symbolic links? + 1. Why is bind mount needed? How is it different from symbolic links? symbolic links can get stale if the destination mount gets unmounted or moved. Bind mounts continue to exist even if the other mount is unmounted or moved. =20 - Q2. Why can't the shared subtree be implemented using exportfs? + 2. Why can't the shared subtree be implemented using exportfs? =20 exportfs is a heavyweight way of accomplishing part of what shared subtree can do. I cannot imagine a way to implement the semantics of slave mount using exportfs? =20 - Q3 Why is unbindable mount needed? + 3. Why is unbindable mount needed? =20 Let's say we want to replicate the mount tree at multiple locations within the same subtree. @@ -852,7 +852,7 @@ replicas continue to be exactly same. 8) Implementation ----------------- =20 -8A) Datastructure +A) Datastructure =20 4 new fields are introduced to struct vfsmount: =20 @@ -941,7 +941,7 @@ replicas continue to be exactly same. =20 NOTE: The propagation tree is orthogonal to the mount tree. =20 -8B Locking: +B) Locking: =20 ->mnt_share, ->mnt_slave, ->mnt_slave_list, ->mnt_master are protected by namespace_sem (exclusive for modifications, shared for reading). @@ -953,7 +953,7 @@ replicas continue to be exactly same. The latter holds namespace_sem and the only references to vfsmount are in lists that can't be traversed without namespace_sem. =20 -8C Algorithm: +C) Algorithm: =20 The crux of the implementation resides in rbind/move operation. =20 --=20 An old man doll... just what I always wanted! - Clara From nobody Sat Oct 4 08:03:29 2025 Received: from mail-pl1-f174.google.com (mail-pl1-f174.google.com [209.85.214.174]) (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 430ED262FD2; Tue, 19 Aug 2025 06:13:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.174 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755583990; cv=none; b=r0DvJ2Iulbd67NSFc5105B4189KPy1IosT5ah8gBJ5iyg2yk2nRkBwgV3O2/6jlot8Yu17DO1bQVc2/wYs17xWCO7xUbkr/F9ToAn/+zsuydGnzIwZxbgmbyAXse77yIT4rLoqhxbrQjx7GaB2Yy0BONmTYEya11UFqmqL6NlJI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755583990; c=relaxed/simple; bh=WusUPjktTaFOEo5j8A4EAsYn1P0uoASZi6qPARnDqvc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=tFEM9wgVeX/3gCQrER/wK4gqp2JixNNcbRG7RKXjgVbFwD2Pz1qDMTUeG6YZdju9uT16HVceaTlw0sFOodbjBidC417+e0brG5fiD6ePV719JAaPPkIlqxIT/Mk/FrBLOi2tqv1HsSi3kOpcvBVw1TGW9sT+cv5IY9j5LOXfzSA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=Vfqhw3nV; arc=none smtp.client-ip=209.85.214.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Vfqhw3nV" Received: by mail-pl1-f174.google.com with SMTP id d9443c01a7336-24457f5b692so52325655ad.0; Mon, 18 Aug 2025 23:13:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1755583988; x=1756188788; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=LFwT5ZiTUuDpxS+mxykO7NbdKhzWorUx8IdTr0TGJa0=; b=Vfqhw3nVVfLfTxCfH9u+L8RlYKUHOg49MXdJnE8BtqM4Zn8/Ko1FofpIm2b4YIUo0f YiyIRhSMzLVOPqxZwyyWeNV0AUhIZbcUxbZ7cECyzya30cqSMJvzQmTAq5K4IzBP6Vdb AxCcjBI9GNxyFZAq+bnTDoacY0HM5mxidaoUGkkxmBCmgkh4esgMsxfN8f1Je96Kk/we 4e9tdL07Er1/ULo1YNxm0tvB/qaYF8ZQgK4gmYzUPAQZFADe3cSODJkSLihotRBVXBxJ IVrlxKr0Uip/keMyLT8nvEZBEXdUJ3ePcyYYaIQqE1L83nRpys5SNECFeYQDHWQli84l +Zfg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1755583988; x=1756188788; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=LFwT5ZiTUuDpxS+mxykO7NbdKhzWorUx8IdTr0TGJa0=; b=tnQ5QquXgtVHV2JQtpU5A/HTq8+YPaTqtiz14kZA2C4XzruIY9M7h/03TMbZe6wbYH K9+wFZ7bPiIVQSYw6lKzZJ1KflH6/dE/gb9g4I1eWnDrUw/rbVEmgQvGFy6If2WFgSUm R6nYoPDXLqj41qiskmy9mfsgH36w0MelnFjCfkll4uOxVnZXrW/tQ3XiCpM4GIqGpZ2P m3rMjhMvlAp9RmkREzTUFtxYIZKyws+ubx/kEhPNd3JheXmyOWLzV/c2vkgpChln3/DX sN++1XYBbACt8sk8uoZYBxlRte/BPI8c3xU+Y8S2rEiKytn5ZSrJ2FQOg3rTnKZFb2il W6fw== X-Forwarded-Encrypted: i=1; AJvYcCWLNCgb3vYPnal4UTtC+Dmviua5YZ3/MompFM1kUoGnrbJ22s22a+3XWItCkbEFNhXqBtwTW1hp/u81NDKhHw==@vger.kernel.org, AJvYcCXHzp3GyekYYKVBVF8yhHNbSBpZysbBknUfWgiSS2zxmvaiHYqnWvknMoZA+Khh1RHCklL9nmVW+uk=@vger.kernel.org X-Gm-Message-State: AOJu0Yxn/gHfUCBNlT9L2FaGm++2IkEiHt/8sBxkUP4MRyvgiVq9WA9L 5c/jKaBVWk4w/PHAfgZdL8PBQ3Finkao7HpD9GVzDWocULLnSgumYoS4 X-Gm-Gg: ASbGncu0bm2MrrAxgBV7M+dcBj/MqKu9YJ6lkVJqVO+dtCWwXn8mKRA8lEUR4qvClL6 Q+utUAH6F2PF0viilCpvg+kpWeSj6/fMf4rQikQLtezzxWjPox6BchIqQoIQm+zm3P1WwsRYVFU JAW8SHBHsKxfvBSJGm2qfz6tM1zisZxTzij3nNYUlQPAZoMsyLXV6lTQb5QEBB9pjWKkhiKEPFc GTgFym2HuEhEko+wwqznN1GaGnlal/T/ou7sZWOCXYIeZMJ2NCFXnHkdquN036no/OpeTV9dIgI s9BYzx1jjx2KbER0dSiqwu2YIpR2d7yTsvtZ0NfV7ylOg3e8CARKfjfc57rfHJMu/vnvAhsPs+l cI3dGjJ4xRON6j1aBViIDng== X-Google-Smtp-Source: AGHT+IGbTN128iZ91t0tdqaygNrJ8ejH/QDxe5JNKjXyrpUZR0il22Tn1o3Hm5hmXmU491iA1fyCoQ== X-Received: by 2002:a17:902:f682:b0:23f:df36:5f0c with SMTP id d9443c01a7336-245e047d995mr21331345ad.29.1755583988363; Mon, 18 Aug 2025 23:13:08 -0700 (PDT) Received: from archie.me ([103.124.138.155]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2446caf2de1sm97563715ad.45.2025.08.18.23.13.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Aug 2025 23:13:07 -0700 (PDT) Received: by archie.me (Postfix, from userid 1000) id C9316459631D; Tue, 19 Aug 2025 13:13:04 +0700 (WIB) From: Bagas Sanjaya To: Linux Kernel Mailing List , Linux Documentation , Linux Filesystems Development Cc: Jonathan Corbet , Bagas Sanjaya , Christian Brauner , Mauro Carvalho Chehab , Randy Dunlap Subject: [PATCH 3/5] Documentation: sharedsubtree: Don't repeat lists with explanation Date: Tue, 19 Aug 2025 13:12:51 +0700 Message-ID: <20250819061254.31220-4-bagasdotme@gmail.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20250819061254.31220-1-bagasdotme@gmail.com> References: <20250819061254.31220-1-bagasdotme@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=7665; i=bagasdotme@gmail.com; h=from:subject; bh=WusUPjktTaFOEo5j8A4EAsYn1P0uoASZi6qPARnDqvc=; b=owGbwMvMwCX2bWenZ2ig32LG02pJDBlLRF4YvN3bft7/Pvsvq84MoROZvZdvhf57UJ4wpzpQP 13s3IXejlIWBjEuBlkxRZZJiXxNp3cZiVxoX+sIM4eVCWQIAxenAEzkiTvDfxe1LZsdXf1/N3PN CU3Jf6Dy0Tj7+sWfy9cfzTF5bfsgzpWRYaKHj+gZa06J+zOLPtZY3Z/0+bxs1Pp1sQ8rg+Vd7eW ZOQA= X-Developer-Key: i=bagasdotme@gmail.com; a=openpgp; fpr=701B806FDCA5D3A58FFB8F7D7C276C64A5E44A1D Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Don't repeat lists only mentioning the items when a corresponding list with item's explanations suffices. Signed-off-by: Bagas Sanjaya --- Documentation/filesystems/sharedsubtree.rst | 106 ++++++++------------ 1 file changed, 44 insertions(+), 62 deletions(-) diff --git a/Documentation/filesystems/sharedsubtree.rst b/Documentation/fi= lesystems/sharedsubtree.rst index 7ad5101b4c03ad..64858ff0471b81 100644 --- a/Documentation/filesystems/sharedsubtree.rst +++ b/Documentation/filesystems/sharedsubtree.rst @@ -31,15 +31,10 @@ and versioned filesystem. ----------- =20 Shared subtree provides four different flavors of mounts; struct vfsmount = to be -precise - - a. shared mount - b. slave mount - c. private mount - d. unbindable mount +precise: =20 =20 -a) A shared mount can be replicated to as many mountpoints and all the +a) A **shared mount** can be replicated to as many mountpoints and all the replicas continue to be exactly same. =20 Here is an example: @@ -83,7 +78,7 @@ a) A shared mount can be replicated to as many mountpoint= s and all the contents will be visible under /tmp/a too. =20 =20 -b) A slave mount is like a shared mount except that mount and umount events +b) A **slave mount** is like a shared mount except that mount and umount e= vents only propagate towards it. =20 All slave mounts have a master mount which is a shared. @@ -131,12 +126,13 @@ b) A slave mount is like a shared mount except that m= ount and umount events /mnt =20 =20 -c) A private mount does not forward or receive propagation. +c) A **private mount** does not forward or receive propagation. =20 This is the mount we are familiar with. Its the default type. =20 =20 -d) A unbindable mount is a unbindable private mount +d) An **unbindable mount** is, as the name suggests, an unbindable private + mount. =20 let's say we have a mount at /mnt and we make it unbindable:: =20 @@ -252,24 +248,18 @@ d) A unbindable mount is a unbindable private mount =20 a) Mount states =20 - A given mount can be in one of the following states - - 1) shared - 2) slave - 3) shared and slave - 4) private - 5) unbindable - - A 'propagation event' is defined as event generated on a vfsmount + A **propagation event** is defined as event generated on a vfsmount that leads to mount or unmount actions in other vfsmounts. =20 - A 'peer group' is defined as a group of vfsmounts that propagate + A **peer group** is defined as a group of vfsmounts that propagate events to each other. =20 + A given mount can be in one of the following states: + (1) Shared mounts =20 - A 'shared mount' is defined as a vfsmount that belongs to a - 'peer group'. + A **shared mount** is defined as a vfsmount that belongs to a + peer group. =20 For example:: =20 @@ -284,7 +274,7 @@ a) Mount states =20 (2) Slave mounts =20 - A 'slave mount' is defined as a vfsmount that receives + A **slave mount** is defined as a vfsmount that receives propagation events and does not forward propagation events. =20 A slave mount as the name implies has a master mount from which @@ -299,7 +289,7 @@ a) Mount states =20 (3) Shared and Slave =20 - A vfsmount can be both shared as well as slave. This state + A vfsmount can be both **shared** as well as **slave**. This state indicates that the mount is a slave of some vfsmount, and has its own peer group too. This vfsmount receives propagation events from its master vfsmount, and also forwards propagation @@ -318,12 +308,12 @@ a) Mount states =20 (4) Private mount =20 - A 'private mount' is defined as vfsmount that does not + A **private mount** is defined as vfsmount that does not receive or forward any propagation events. =20 (5) Unbindable mount =20 - A 'unbindable mount' is defined as vfsmount that does not + A **unbindable mount** is defined as vfsmount that does not receive or forward any propagation events and cannot be bind mounted. =20 @@ -854,31 +844,26 @@ g) Clone Namespace =20 A) Datastructure =20 - 4 new fields are introduced to struct vfsmount: - - * ->mnt_share - * ->mnt_slave_list - * ->mnt_slave - * ->mnt_master + Several new fields are introduced to struct vfsmount: =20 ->mnt_share - links together all the mount to/from which this vfsmount + Links together all the mount to/from which this vfsmount send/receives propagation events. =20 ->mnt_slave_list - links all the mounts to which this vfsmount propagates + Links all the mounts to which this vfsmount propagates to. =20 ->mnt_slave - links together all the slaves that its master vfsmount + Links together all the slaves that its master vfsmount propagates to. =20 ->mnt_master - points to the master vfsmount from which this vfsmount + Points to the master vfsmount from which this vfsmount receives propagation. =20 ->mnt_flags - takes two more flags to indicate the propagation status of + Takes two more flags to indicate the propagation status of the vfsmount. MNT_SHARE indicates that the vfsmount is a shared vfsmount. MNT_UNCLONABLE indicates that the vfsmount cannot be replicated. @@ -960,39 +945,36 @@ C) Algorithm: The overall algorithm breaks the operation into 3 phases: (look at attach_recursive_mnt() and propagate_mnt()) =20 - 1. prepare phase. - 2. commit phases. - 3. abort phases. + 1. Prepare phase. =20 - Prepare phase: + For each mount in the source tree: =20 - for each mount in the source tree: + a) Create the necessary number of mount trees to + be attached to each of the mounts that receive + propagation from the destination mount. + b) Do not attach any of the trees to its destination. + However note down its ->mnt_parent and ->mnt_mountpoint + c) Link all the new mounts to form a propagation tree that + is identical to the propagation tree of the destination + mount. =20 - a) Create the necessary number of mount trees to - be attached to each of the mounts that receive - propagation from the destination mount. - b) Do not attach any of the trees to its destination. - However note down its ->mnt_parent and ->mnt_mountpoint - c) Link all the new mounts to form a propagation tree that - is identical to the propagation tree of the destination - mount. + If this phase is successful, there should be 'n' new + propagation trees; where 'n' is the number of mounts in the + source tree. Go to the commit phase =20 - If this phase is successful, there should be 'n' new - propagation trees; where 'n' is the number of mounts in the - source tree. Go to the commit phase + Also there should be 'm' new mount trees, where 'm' is + the number of mounts to which the destination mount + propagates to. =20 - Also there should be 'm' new mount trees, where 'm' is - the number of mounts to which the destination mount - propagates to. + If any memory allocations fail, go to the abort phase. =20 - if any memory allocations fail, go to the abort phase. + 2. Commit phase. =20 - Commit phase - attach each of the mount trees to their corresponding - destination mounts. + Attach each of the mount trees to their corresponding + destination mounts. =20 - Abort phase - delete all the newly created trees. + 3. Abort phase. + Delete all the newly created trees. =20 .. Note:: all the propagation related functionality resides in the file pnode.c --=20 An old man doll... just what I always wanted! - Clara From nobody Sat Oct 4 08:03:29 2025 Received: from mail-pl1-f176.google.com (mail-pl1-f176.google.com [209.85.214.176]) (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 C3A5926A0B9; Tue, 19 Aug 2025 06:13:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.176 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755583996; cv=none; b=QeRXkH+KApmGpGeBdLwQZvdSV+DxxY9cXqMgk55ltszRSa/9uX6x95FPMvmwUbRAkzQGjlUPqwF/FCJ2IjpNW3VkZ9TQy1JYOZ+lb+Y7/5MKEgrfXFd/JN3W/HG1PtgJ8wSvUY18THHJTwMtKT6j2GoHe/bXls+JkS7EaOFHQGk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755583996; c=relaxed/simple; bh=aa3bA6N8HiYvZs6mfHD8e/oeMHrqjnyzOS98reYIuL0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=mZ1ze6hqlWdyqjw2l/xCOHxMLQGv0tWNIE357jLQgRTqCK2QFLFOFpY/n53+yQZMCIUmm4PVyFIeuEhT9s9q8tiaZZZSrngi0EQvrw6dT6ro3bRdJ9jK9f1hWa6X4/oPaWKTLavMP5mu7UDs4lAuIpMx8VkSWaxn6EPm2GtSL0c= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=B1sBub0c; arc=none smtp.client-ip=209.85.214.176 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="B1sBub0c" Received: by mail-pl1-f176.google.com with SMTP id d9443c01a7336-244580523a0so43418215ad.1; Mon, 18 Aug 2025 23:13:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1755583992; x=1756188792; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=aFernzrG6f3CulgyvvNbb0nRHZ8JONDQG4wsxAi3bbk=; b=B1sBub0c5N+iUhOkqziWS6ifWCM1cRuyWA6O3hytZD/xuRTGnuVhkzrRAjqrBTucc7 ViNBgZgEBgZJeef/dxJghiDEGXgHaaAwz0xieaqzpnJIFBiyh0Oi8VQT9Sb7gcELIi9e IFTRVOkZup2ai1VTt5EMt5lyRWE6DBt4jTANeM9b9Gtk5zp7Ft1wBs1smLINS98IxTyn JdAltSOYElOyKPUXAptx+Cum7i5Mx9S84t3O14OSWT9zECIWZfLNJq5uKR6Nw4fua4ao 4EahGIym/pY9In/QHIyAp6btyDd9SBS9SWYG/P502Oqz3XIkuvKjUYh9H7l0EKAzJTn0 T4QQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1755583992; x=1756188792; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=aFernzrG6f3CulgyvvNbb0nRHZ8JONDQG4wsxAi3bbk=; b=wmk8Ki5iSCO/pNgUeXgQjQzboB/BMKgbJN5BXuIKzWJoaiWQ3KSyX8p8G6ABNUWbWP 7WcPYV3CFfP/hfJb+t1oL85DUdQvy4ExdXxpWf94ZcmaLiznB0j80+EplGNjMqoi1X13 0hqUXCyucq329s1gXsorg4BHQvUNJE4HhSCBbM+5tt8HPDI9rLjhdB4WVeVAzpniZqNF Px1aZpElF8xD2X8HA6x1Jursk3Nj29zmQgx37x+3c6HCJpG8a90VN7So4wRYp1dVhXv1 r+SReOkPWibLXA6Hr2gpq2y5uuNNcXR6KI8vqOydZ2e3/LKC+nGN7aCoVa6QM40upv0j rZ1A== X-Forwarded-Encrypted: i=1; AJvYcCVmx12Yp43p4P3YKNNvqEMurSk9VP43j4r/LPUX1PQFlBbc+iyHc5QEEw2A48w5Aq9Xo/uOsu/mtei1iYnOaQ==@vger.kernel.org, AJvYcCW8VakYld8Wr52XCnP+ylrqGypbLY8cqPo5dgYDricDkolp6dcWFJ1yKfSxzEP2O6KVPktIsxPnBSs=@vger.kernel.org X-Gm-Message-State: AOJu0Yy6zP9mxs5vw0RtoqWQ6Vx/+WYbJSNJ/bOaZpQUXF6AFRJnMT8Y BhdvOOO0caIJxjS/HMdgSVaMz0TWt7b4Hd3ddoYMkOzi8nv8W48FEnP7 X-Gm-Gg: ASbGncswtlpJrTKDzR355ZOFTfSUZ62OldTfzfGU8E+zxUsBNm59XnOK+7Wl5vk9HjH S2A0xTCZd1+Au1+yvIYXMxJ+JwfEln6qxN9hg9JCGE9gSaHdsZtsNiroiIAnMv4JKkrVQs4wJ/Q iBjKsqKX6/5+ggRwLfDlHiazqrgbjMHzkaecqpWSKSPVU/53lcmEkBdQZyvB28lnSrS3GrtycI0 EQtyGvMgrahlglx9haXZl5efS6boUKqn/xM+MPoSp8u/AdNH8P5kUDbxUruXuBDVCHXICJmzvNu sP2C9LB1v8FnYdhdJPshcODrKJhMPkPM+OXzhSy8VVEkZA/+eN6cz2791TLeF9HKGZLorpgEGcJ LwWW+U1MXVfyY/z6URsgatA== X-Google-Smtp-Source: AGHT+IH/um8BmOedGHyWwBZH2YtCb00zNnx/Qu9BmFRrR2ok8BibAmMEUCs8KfCw3Gh91sh5xAThmQ== X-Received: by 2002:a17:903:2308:b0:242:b315:ddaf with SMTP id d9443c01a7336-245e0465fa9mr18660365ad.7.1755583991296; Mon, 18 Aug 2025 23:13:11 -0700 (PDT) Received: from archie.me ([103.124.138.155]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2446d50f664sm97027105ad.75.2025.08.18.23.13.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Aug 2025 23:13:07 -0700 (PDT) Received: by archie.me (Postfix, from userid 1000) id 16BD6462A061; Tue, 19 Aug 2025 13:13:04 +0700 (WIB) From: Bagas Sanjaya To: Linux Kernel Mailing List , Linux Documentation , Linux Filesystems Development Cc: Jonathan Corbet , Bagas Sanjaya , Christian Brauner , Mauro Carvalho Chehab , Randy Dunlap Subject: [PATCH 4/5] Documentation: sharedsubtree: Align text Date: Tue, 19 Aug 2025 13:12:52 +0700 Message-ID: <20250819061254.31220-5-bagasdotme@gmail.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20250819061254.31220-1-bagasdotme@gmail.com> References: <20250819061254.31220-1-bagasdotme@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=64831; i=bagasdotme@gmail.com; h=from:subject; bh=aa3bA6N8HiYvZs6mfHD8e/oeMHrqjnyzOS98reYIuL0=; b=owGbwMvMwCX2bWenZ2ig32LG02pJDBlLRF5WBtrWqufUnw/YUr+I52olX9KWSMkMDbcY7V2vn yUzf1rdUcrCIMbFICumyDIpka/p9C4jkQvtax1h5rAygQxh4OIUgIkE7GZkuP/92KT8m4KpU3P+ nv3k1LJg41T37Q2Nmet2npepWfptxVpGhsaWVKFFjzNOdE1pFr57/PbHiysvXSicc/HFsheTLQ9 t+80PAA== X-Developer-Key: i=bagasdotme@gmail.com; a=openpgp; fpr=701B806FDCA5D3A58FFB8F7D7C276C64A5E44A1D Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The docs make heavy use of lists. As it is currently written, these generate a lot of unnecessary hanging indents since these are not semantically meant to be definition lists by accident. Align text to trim these indents. Signed-off-by: Bagas Sanjaya --- Documentation/filesystems/sharedsubtree.rst | 1247 ++++++++++--------- 1 file changed, 624 insertions(+), 623 deletions(-) diff --git a/Documentation/filesystems/sharedsubtree.rst b/Documentation/fi= lesystems/sharedsubtree.rst index 64858ff0471b81..b09650e285341c 100644 --- a/Documentation/filesystems/sharedsubtree.rst +++ b/Documentation/filesystems/sharedsubtree.rst @@ -37,947 +37,948 @@ precise: a) A **shared mount** can be replicated to as many mountpoints and all the replicas continue to be exactly same. =20 - Here is an example: + Here is an example: =20 - Let's say /mnt has a mount that is shared:: + Let's say /mnt has a mount that is shared:: =20 - mount --make-shared /mnt + # mount --make-shared /mnt =20 - Note: mount(8) command now supports the --make-shared flag, - so the sample 'smount' program is no longer needed and has been - removed. + Note: mount(8) command now supports the --make-shared flag, + so the sample 'smount' program is no longer needed and has been + removed. =20 - :: + :: =20 - # mount --bind /mnt /tmp + # mount --bind /mnt /tmp =20 - The above command replicates the mount at /mnt to the mountpoint /tmp - and the contents of both the mounts remain identical. + The above command replicates the mount at /mnt to the mountpoint /tmp + and the contents of both the mounts remain identical. =20 - :: + :: =20 - #ls /mnt - a b c + #ls /mnt + a b c =20 - #ls /tmp - a b c + #ls /tmp + a b c =20 - Now let's say we mount a device at /tmp/a:: + Now let's say we mount a device at /tmp/a:: =20 - # mount /dev/sd0 /tmp/a + # mount /dev/sd0 /tmp/a =20 - #ls /tmp/a - t1 t2 t3 + # ls /tmp/a + t1 t2 t3 =20 - #ls /mnt/a - t1 t2 t3 + # ls /mnt/a + t1 t2 t3 =20 - Note that the mount has propagated to the mount at /mnt as well. + Note that the mount has propagated to the mount at /mnt as well. =20 - And the same is true even when /dev/sd0 is mounted on /mnt/a. The - contents will be visible under /tmp/a too. + And the same is true even when /dev/sd0 is mounted on /mnt/a. The + contents will be visible under /tmp/a too. =20 =20 b) A **slave mount** is like a shared mount except that mount and umount e= vents only propagate towards it. =20 - All slave mounts have a master mount which is a shared. + All slave mounts have a master mount which is a shared. =20 - Here is an example: + Here is an example: =20 - Let's say /mnt has a mount which is shared:: + Let's say /mnt has a mount which is shared:: =20 - # mount --make-shared /mnt + # mount --make-shared /mnt =20 - Let's bind mount /mnt to /tmp:: + Let's bind mount /mnt to /tmp:: =20 - # mount --bind /mnt /tmp + # mount --bind /mnt /tmp =20 - the new mount at /tmp becomes a shared mount and it is a replica of - the mount at /mnt. + the new mount at /tmp becomes a shared mount and it is a replica of + the mount at /mnt. =20 - Now let's make the mount at /tmp; a slave of /mnt:: + Now let's make the mount at /tmp; a slave of /mnt:: =20 - # mount --make-slave /tmp + # mount --make-slave /tmp =20 - let's mount /dev/sd0 on /mnt/a:: + let's mount /dev/sd0 on /mnt/a:: =20 - # mount /dev/sd0 /mnt/a + # mount /dev/sd0 /mnt/a =20 - # ls /mnt/a - t1 t2 t3 + # ls /mnt/a + t1 t2 t3 =20 - # ls /tmp/a - t1 t2 t3 + # ls /tmp/a + t1 t2 t3 =20 - Note the mount event has propagated to the mount at /tmp + Note the mount event has propagated to the mount at /tmp =20 - However let's see what happens if we mount something on the mount at - /tmp:: + However let's see what happens if we mount something on the mount at + /tmp:: =20 - # mount /dev/sd1 /tmp/b + # mount /dev/sd1 /tmp/b =20 - # ls /tmp/b - s1 s2 s3 + # ls /tmp/b + s1 s2 s3 =20 - # ls /mnt/b + # ls /mnt/b =20 - Note how the mount event has not propagated to the mount at - /mnt + Note how the mount event has not propagated to the mount at + /mnt =20 =20 c) A **private mount** does not forward or receive propagation. =20 - This is the mount we are familiar with. Its the default type. + This is the mount we are familiar with. Its the default type. =20 =20 d) An **unbindable mount** is, as the name suggests, an unbindable private mount. =20 - let's say we have a mount at /mnt and we make it unbindable:: + let's say we have a mount at /mnt and we make it unbindable:: =20 - # mount --make-unbindable /mnt + # mount --make-unbindable /mnt =20 - Let's try to bind mount this mount somewhere else:: + Let's try to bind mount this mount somewhere else:: =20 - # mount --bind /mnt /tmp - mount: wrong fs type, bad option, bad superblock on /mnt, - or too many mounted file systems + # mount --bind /mnt /tmp mount: wrong fs type, bad option, bad + superblock on /mnt, or too many mounted file systems =20 - Binding a unbindable mount is a invalid operation. + Binding a unbindable mount is a invalid operation. =20 =20 3) Setting mount states ----------------------- =20 - The mount command (util-linux package) can be used to set mount - states:: +The mount command (util-linux package) can be used to set mount +states:: =20 - mount --make-shared mountpoint - mount --make-slave mountpoint - mount --make-private mountpoint - mount --make-unbindable mountpoint + mount --make-shared mountpoint + mount --make-slave mountpoint + mount --make-private mountpoint + mount --make-unbindable mountpoint =20 =20 4) Use cases ------------ =20 - A) A process wants to clone its own namespace, but still wants to - access the CD that got mounted recently. +A) A process wants to clone its own namespace, but still wants to + access the CD that got mounted recently. =20 - Solution: + Solution: =20 - The system administrator can make the mount at /cdrom shared:: + The system administrator can make the mount at /cdrom shared:: =20 - mount --bind /cdrom /cdrom - mount --make-shared /cdrom + mount --bind /cdrom /cdrom + mount --make-shared /cdrom =20 - Now any process that clones off a new namespace will have a - mount at /cdrom which is a replica of the same mount in the - parent namespace. + Now any process that clones off a new namespace will have a + mount at /cdrom which is a replica of the same mount in the + parent namespace. =20 - So when a CD is inserted and mounted at /cdrom that mount gets - propagated to the other mount at /cdrom in all the other clone - namespaces. + So when a CD is inserted and mounted at /cdrom that mount gets + propagated to the other mount at /cdrom in all the other clone + namespaces. =20 - B) A process wants its mounts invisible to any other process, but - still be able to see the other system mounts. +B) A process wants its mounts invisible to any other process, but + still be able to see the other system mounts. =20 - Solution: + Solution: =20 - To begin with, the administrator can mark the entire mount tree - as shareable:: + To begin with, the administrator can mark the entire mount tree + as shareable:: =20 - mount --make-rshared / + mount --make-rshared / =20 - A new process can clone off a new namespace. And mark some part - of its namespace as slave:: + A new process can clone off a new namespace. And mark some part + of its namespace as slave:: =20 - mount --make-rslave /myprivatetree + mount --make-rslave /myprivatetree =20 - Hence forth any mounts within the /myprivatetree done by the - process will not show up in any other namespace. However mounts - done in the parent namespace under /myprivatetree still shows - up in the process's namespace. + Hence forth any mounts within the /myprivatetree done by the + process will not show up in any other namespace. However mounts + done in the parent namespace under /myprivatetree still shows + up in the process's namespace. =20 =20 - Apart from the above semantics this feature provides the - building blocks to solve the following problems: +Apart from the above semantics this feature provides the +building blocks to solve the following problems: =20 - C) Per-user namespace +C) Per-user namespace =20 - The above semantics allows a way to share mounts across - namespaces. But namespaces are associated with processes. If - namespaces are made first class objects with user API to - associate/disassociate a namespace with userid, then each user - could have his/her own namespace and tailor it to his/her - requirements. This needs to be supported in PAM. + The above semantics allows a way to share mounts across + namespaces. But namespaces are associated with processes. If + namespaces are made first class objects with user API to + associate/disassociate a namespace with userid, then each user + could have his/her own namespace and tailor it to his/her + requirements. This needs to be supported in PAM. =20 - D) Versioned files +D) Versioned files =20 - If the entire mount tree is visible at multiple locations, then - an underlying versioning file system can return different - versions of the file depending on the path used to access that - file. + If the entire mount tree is visible at multiple locations, then + an underlying versioning file system can return different + versions of the file depending on the path used to access that + file. =20 - An example is:: + An example is:: =20 - mount --make-shared / - mount --rbind / /view/v1 - mount --rbind / /view/v2 - mount --rbind / /view/v3 - mount --rbind / /view/v4 + mount --make-shared / + mount --rbind / /view/v1 + mount --rbind / /view/v2 + mount --rbind / /view/v3 + mount --rbind / /view/v4 =20 - and if /usr has a versioning filesystem mounted, then that - mount appears at /view/v1/usr, /view/v2/usr, /view/v3/usr and - /view/v4/usr too + and if /usr has a versioning filesystem mounted, then that + mount appears at /view/v1/usr, /view/v2/usr, /view/v3/usr and + /view/v4/usr too =20 - A user can request v3 version of the file /usr/fs/namespace.c - by accessing /view/v3/usr/fs/namespace.c . The underlying - versioning filesystem can then decipher that v3 version of the - filesystem is being requested and return the corresponding - inode. + A user can request v3 version of the file /usr/fs/namespace.c + by accessing /view/v3/usr/fs/namespace.c . The underlying + versioning filesystem can then decipher that v3 version of the + filesystem is being requested and return the corresponding + inode. =20 5) Detailed semantics --------------------- - The section below explains the detailed semantics of - bind, rbind, move, mount, umount and clone-namespace operations. +The section below explains the detailed semantics of +bind, rbind, move, mount, umount and clone-namespace operations. =20 - Note: the word 'vfsmount' and the noun 'mount' have been used - to mean the same thing, throughout this document. +Note: the word 'vfsmount' and the noun 'mount' have been used +to mean the same thing, throughout this document. =20 a) Mount states =20 - A **propagation event** is defined as event generated on a vfsmount - that leads to mount or unmount actions in other vfsmounts. + A **propagation event** is defined as event generated on a vfsmount + that leads to mount or unmount actions in other vfsmounts. =20 - A **peer group** is defined as a group of vfsmounts that propagate - events to each other. + A **peer group** is defined as a group of vfsmounts that propagate + events to each other. =20 - A given mount can be in one of the following states: + A given mount can be in one of the following states: =20 - (1) Shared mounts + (1) Shared mounts =20 - A **shared mount** is defined as a vfsmount that belongs to a - peer group. + A **shared mount** is defined as a vfsmount that belongs to a + peer group. =20 - For example:: + For example:: =20 - mount --make-shared /mnt - mount --bind /mnt /tmp + mount --make-shared /mnt + mount --bind /mnt /tmp =20 - The mount at /mnt and that at /tmp are both shared and belong - to the same peer group. Anything mounted or unmounted under - /mnt or /tmp reflect in all the other mounts of its peer - group. + The mount at /mnt and that at /tmp are both shared and belong + to the same peer group. Anything mounted or unmounted under + /mnt or /tmp reflect in all the other mounts of its peer + group. =20 =20 - (2) Slave mounts + (2) Slave mounts =20 - A **slave mount** is defined as a vfsmount that receives - propagation events and does not forward propagation events. + A **slave mount** is defined as a vfsmount that receives + propagation events and does not forward propagation events. =20 - A slave mount as the name implies has a master mount from which - mount/unmount events are received. Events do not propagate from - the slave mount to the master. Only a shared mount can be made - a slave by executing the following command:: + A slave mount as the name implies has a master mount from which + mount/unmount events are received. Events do not propagate from + the slave mount to the master. Only a shared mount can be made + a slave by executing the following command:: =20 - mount --make-slave mount + mount --make-slave mount =20 - A shared mount that is made as a slave is no more shared unless - modified to become shared. + A shared mount that is made as a slave is no more shared unless + modified to become shared. =20 - (3) Shared and Slave + (3) Shared and Slave =20 - A vfsmount can be both **shared** as well as **slave**. This state - indicates that the mount is a slave of some vfsmount, and - has its own peer group too. This vfsmount receives propagation - events from its master vfsmount, and also forwards propagation - events to its 'peer group' and to its slave vfsmounts. + A vfsmount can be both **shared** as well as **slave**. This state + indicates that the mount is a slave of some vfsmount, and + has its own peer group too. This vfsmount receives propagation + events from its master vfsmount, and also forwards propagation + events to its 'peer group' and to its slave vfsmounts. =20 - Strictly speaking, the vfsmount is shared having its own - peer group, and this peer-group is a slave of some other - peer group. + Strictly speaking, the vfsmount is shared having its own + peer group, and this peer-group is a slave of some other + peer group. =20 - Only a slave vfsmount can be made as 'shared and slave' by - either executing the following command:: + Only a slave vfsmount can be made as 'shared and slave' by + either executing the following command:: =20 - mount --make-shared mount + mount --make-shared mount =20 - or by moving the slave vfsmount under a shared vfsmount. + or by moving the slave vfsmount under a shared vfsmount. =20 - (4) Private mount + (4) Private mount =20 - A **private mount** is defined as vfsmount that does not - receive or forward any propagation events. + A **private mount** is defined as vfsmount that does not + receive or forward any propagation events. =20 - (5) Unbindable mount + (5) Unbindable mount =20 - A **unbindable mount** is defined as vfsmount that does not - receive or forward any propagation events and cannot - be bind mounted. + A **unbindable mount** is defined as vfsmount that does not + receive or forward any propagation events and cannot + be bind mounted. =20 =20 - State diagram: + State diagram: =20 - The state diagram below explains the state transition of a mount, - in response to various commands:: + The state diagram below explains the state transition of a mount, + in response to various commands:: =20 - ---------------------------------------------------------------------= -- - | |make-shared | make-slave | make-private |make-unbind= ab| - --------------|------------|--------------|--------------|-----------= --| - |shared |shared |*slave/private| private | unbindable | - | | | | | = | - |-------------|------------|--------------|--------------|-----------= --| - |slave |shared | **slave | private | unbindable | - | |and slave | | | = | - |-------------|------------|--------------|--------------|-----------= --| - |shared |shared | slave | private | unbindable= | - |and slave |and slave | | | = | - |-------------|------------|--------------|--------------|-----------= --| - |private |shared | **private | private | unbindable= | - |-------------|------------|--------------|--------------|-----------= --| - |unbindable |shared |**unbindable | private | unbindable= | - ---------------------------------------------------------------------= --- + --------------------------------------------------------------= --------- + | |make-shared | make-slave | make-private |make= -unbindab| + --------------|------------|--------------|--------------|----= ---------| + |shared |shared |*slave/private| private | unb= indable | + | | | | | = | + |-------------|------------|--------------|--------------|----= ---------| + |slave |shared | **slave | private | unb= indable | + | |and slave | | | = | + |-------------|------------|--------------|--------------|----= ---------| + |shared |shared | slave | private | unb= indable | + |and slave |and slave | | | = | + |-------------|------------|--------------|--------------|----= ---------| + |private |shared | **private | private | unb= indable | + |-------------|------------|--------------|--------------|----= ---------| + |unbindable |shared |**unbindable | private | unb= indable | + --------------------------------------------------------------= ---------- =20 - * if the shared mount is the only mount in its peer group, making it - slave, makes it private automatically. Note that there is no master to - which it can be slaved to. + * if the shared mount is the only mount in its peer group, mak= ing it + slave, makes it private automatically. Note that there is no m= aster to + which it can be slaved to. =20 - ** slaving a non-shared mount has no effect on the mount. + ** slaving a non-shared mount has no effect on the mount. =20 - Apart from the commands listed below, the 'move' operation also changes - the state of a mount depending on type of the destination mount. Its - explained in section 5d. + Apart from the commands listed below, the 'move' operation also cha= nges + the state of a mount depending on type of the destination mount. Its + explained in section 5d. =20 b) Bind semantics =20 - Consider the following command:: + Consider the following command:: =20 - mount --bind A/a B/b + mount --bind A/a B/b =20 - where 'A' is the source mount, 'a' is the dentry in the mount 'A', 'B' - is the destination mount and 'b' is the dentry in the destination mount. + where 'A' is the source mount, 'a' is the dentry in the mount 'A', 'B' + is the destination mount and 'b' is the dentry in the destination mount. =20 - The outcome depends on the type of mount of 'A' and 'B'. The table - below contains quick reference:: + The outcome depends on the type of mount of 'A' and 'B'. The table + below contains quick reference:: =20 - ---------------------------------------------------------------------= ----- - | BIND MOUNT OPERATION = | - |********************************************************************= ****| - |source(A)->| shared | private | slave | unbinda= ble | - | dest(B) | | | | = | - | | | | | | = | - | v | | | | = | - |********************************************************************= ****| - | shared | shared | shared | shared & slave | invali= d | - | | | | | = | - |non-shared| shared | private | slave | invali= d | - *********************************************************************= ***** + --------------------------------------------------------------= ------------ + | BIND MOUNT OPERATION = | + |*************************************************************= ***********| + |source(A)->| shared | private | slave | = unbindable | + | dest(B) | | | | = | + | | | | | | = | + | v | | | | = | + |*************************************************************= ***********| + | shared | shared | shared | shared & slave | = invalid | + | | | | | = | + |non-shared| shared | private | slave | = invalid | + **************************************************************= ************ =20 - Details: + Details: =20 - 1. 'A' is a shared mount and 'B' is a shared mount. A new mount 'C' - which is clone of 'A', is created. Its root dentry is 'a' . 'C' is - mounted on mount 'B' at dentry 'b'. Also new mount 'C1', 'C2', 'C3' ... - are created and mounted at the dentry 'b' on all mounts where 'B' - propagates to. A new propagation tree containing 'C1',..,'Cn' is - created. This propagation tree is identical to the propagation tree of - 'B'. And finally the peer-group of 'C' is merged with the peer group - of 'A'. + 1. 'A' is a shared mount and 'B' is a shared mount. A new mount 'C' + which is clone of 'A', is created. Its root dentry is 'a' . 'C' is + mounted on mount 'B' at dentry 'b'. Also new mount 'C1', 'C2', 'C3' = ... + are created and mounted at the dentry 'b' on all mounts where 'B' + propagates to. A new propagation tree containing 'C1',..,'Cn' is + created. This propagation tree is identical to the propagation tree = of + 'B'. And finally the peer-group of 'C' is merged with the peer group + of 'A'. =20 - 2. 'A' is a private mount and 'B' is a shared mount. A new mount 'C' - which is clone of 'A', is created. Its root dentry is 'a'. 'C' is - mounted on mount 'B' at dentry 'b'. Also new mount 'C1', 'C2', 'C3' ... - are created and mounted at the dentry 'b' on all mounts where 'B' - propagates to. A new propagation tree is set containing all new mounts - 'C', 'C1', .., 'Cn' with exactly the same configuration as the - propagation tree for 'B'. + 2. 'A' is a private mount and 'B' is a shared mount. A new mount 'C' + which is clone of 'A', is created. Its root dentry is 'a'. 'C' is + mounted on mount 'B' at dentry 'b'. Also new mount 'C1', 'C2', 'C3' = ... + are created and mounted at the dentry 'b' on all mounts where 'B' + propagates to. A new propagation tree is set containing all new moun= ts + 'C', 'C1', .., 'Cn' with exactly the same configuration as the + propagation tree for 'B'. =20 - 3. 'A' is a slave mount of mount 'Z' and 'B' is a shared mount. A new - mount 'C' which is clone of 'A', is created. Its root dentry is 'a' . - 'C' is mounted on mount 'B' at dentry 'b'. Also new mounts 'C1', 'C2', - 'C3' ... are created and mounted at the dentry 'b' on all mounts where - 'B' propagates to. A new propagation tree containing the new mounts - 'C','C1',.. 'Cn' is created. This propagation tree is identical to the - propagation tree for 'B'. And finally the mount 'C' and its peer group - is made the slave of mount 'Z'. In other words, mount 'C' is in the - state 'slave and shared'. + 3. 'A' is a slave mount of mount 'Z' and 'B' is a shared mount. A new + mount 'C' which is clone of 'A', is created. Its root dentry is 'a' . + 'C' is mounted on mount 'B' at dentry 'b'. Also new mounts 'C1', 'C2= ', + 'C3' ... are created and mounted at the dentry 'b' on all mounts whe= re + 'B' propagates to. A new propagation tree containing the new mounts + 'C','C1',.. 'Cn' is created. This propagation tree is identical to = the + propagation tree for 'B'. And finally the mount 'C' and its peer gro= up + is made the slave of mount 'Z'. In other words, mount 'C' is in the + state 'slave and shared'. =20 - 4. 'A' is a unbindable mount and 'B' is a shared mount. This is a - invalid operation. + 4. 'A' is a unbindable mount and 'B' is a shared mount. This is a + invalid operation. =20 - 5. 'A' is a private mount and 'B' is a non-shared(private or slave or - unbindable) mount. A new mount 'C' which is clone of 'A', is created. - Its root dentry is 'a'. 'C' is mounted on mount 'B' at dentry 'b'. + 5. 'A' is a private mount and 'B' is a non-shared(private or slave or + unbindable) mount. A new mount 'C' which is clone of 'A', is created. + Its root dentry is 'a'. 'C' is mounted on mount 'B' at dentry 'b'. =20 - 6. 'A' is a shared mount and 'B' is a non-shared mount. A new mount 'C' - which is a clone of 'A' is created. Its root dentry is 'a'. 'C' is - mounted on mount 'B' at dentry 'b'. 'C' is made a member of the - peer-group of 'A'. + 6. 'A' is a shared mount and 'B' is a non-shared mount. A new mount 'C' + which is a clone of 'A' is created. Its root dentry is 'a'. 'C' is + mounted on mount 'B' at dentry 'b'. 'C' is made a member of the + peer-group of 'A'. =20 - 7. 'A' is a slave mount of mount 'Z' and 'B' is a non-shared mount. A - new mount 'C' which is a clone of 'A' is created. Its root dentry is - 'a'. 'C' is mounted on mount 'B' at dentry 'b'. Also 'C' is set as a - slave mount of 'Z'. In other words 'A' and 'C' are both slave mounts of - 'Z'. All mount/unmount events on 'Z' propagates to 'A' and 'C'. But - mount/unmount on 'A' do not propagate anywhere else. Similarly - mount/unmount on 'C' do not propagate anywhere else. + 7. 'A' is a slave mount of mount 'Z' and 'B' is a non-shared mount. A + new mount 'C' which is a clone of 'A' is created. Its root dentry is + 'a'. 'C' is mounted on mount 'B' at dentry 'b'. Also 'C' is set as a + slave mount of 'Z'. In other words 'A' and 'C' are both slave mounts= of + 'Z'. All mount/unmount events on 'Z' propagates to 'A' and 'C'. But + mount/unmount on 'A' do not propagate anywhere else. Similarly + mount/unmount on 'C' do not propagate anywhere else. =20 - 8. 'A' is a unbindable mount and 'B' is a non-shared mount. This is a - invalid operation. A unbindable mount cannot be bind mounted. + 8. 'A' is a unbindable mount and 'B' is a non-shared mount. This is a + invalid operation. A unbindable mount cannot be bind mounted. =20 c) Rbind semantics =20 - rbind is same as bind. Bind replicates the specified mount. Rbind - replicates all the mounts in the tree belonging to the specified mount. - Rbind mount is bind mount applied to all the mounts in the tree. + rbind is same as bind. Bind replicates the specified mount. Rbind + replicates all the mounts in the tree belonging to the specified mount. + Rbind mount is bind mount applied to all the mounts in the tree. =20 - If the source tree that is rbind has some unbindable mounts, - then the subtree under the unbindable mount is pruned in the new - location. + If the source tree that is rbind has some unbindable mounts, + then the subtree under the unbindable mount is pruned in the new + location. =20 - eg: + eg: =20 - let's say we have the following mount tree:: + let's say we have the following mount tree:: =20 - A - / \ - B C - / \ / \ - D E F G + A + / \ + B C + / \ / \ + D E F G =20 - Let's say all the mount except the mount C in the tree are - of a type other than unbindable. + Let's say all the mount except the mount C in the tree are + of a type other than unbindable. =20 - If this tree is rbound to say Z + If this tree is rbound to say Z =20 - We will have the following tree at the new location:: + We will have the following tree at the new location:: =20 - Z - | - A' - / - B' Note how the tree under C is pruned - / \ in the new location. - D' E' + Z + | + A' + / + B' Note how the tree under C is pruned + / \ in the new location. + D' E' =20 =20 =20 d) Move semantics =20 - Consider the following command:: + Consider the following command:: =20 - mount --move A B/b + mount --move A B/b =20 - where 'A' is the source mount, 'B' is the destination mount and 'b' is - the dentry in the destination mount. + where 'A' is the source mount, 'B' is the destination mount and 'b' is + the dentry in the destination mount. =20 - The outcome depends on the type of the mount of 'A' and 'B'. The table - below is a quick reference:: + The outcome depends on the type of the mount of 'A' and 'B'. The table + below is a quick reference:: =20 - ---------------------------------------------------------------------= ------ - | MOVE MOUNT OPERATION | - |********************************************************************= ****** - | source(A)->| shared | private | slave | unbind= able | - | dest(B) | | | | = | - | | | | | | = | - | v | | | | = | - |********************************************************************= ****** - | shared | shared | shared |shared and slave| inval= id | - | | | | | = | - |non-shared| shared | private | slave | unbind= able | - *********************************************************************= ****** + --------------------------------------------------------------= ------------- + | MOVE MOUNT OPERATION = | + |*************************************************************= ************* + | source(A)->| shared | private | slave |= unbindable | + | dest(B) | | | |= | + | | | | | |= | + | v | | | |= | + |*************************************************************= ************* + | shared | shared | shared |shared and slave|= invalid | + | | | | |= | + |non-shared| shared | private | slave |= unbindable | + **************************************************************= ************* =20 - .. Note:: moving a mount residing under a shared mount is invalid. + .. Note:: moving a mount residing under a shared mount is invalid. =20 - Details follow: + Details follow: =20 - 1. 'A' is a shared mount and 'B' is a shared mount. The mount 'A' is - mounted on mount 'B' at dentry 'b'. Also new mounts 'A1', 'A2'...'An' - are created and mounted at dentry 'b' on all mounts that receive - propagation from mount 'B'. A new propagation tree is created in the - exact same configuration as that of 'B'. This new propagation tree - contains all the new mounts 'A1', 'A2'... 'An'. And this new - propagation tree is appended to the already existing propagation tree - of 'A'. + 1. 'A' is a shared mount and 'B' is a shared mount. The mount 'A' is + mounted on mount 'B' at dentry 'b'. Also new mounts 'A1', 'A2'...'A= n' + are created and mounted at dentry 'b' on all mounts that receive + propagation from mount 'B'. A new propagation tree is created in the + exact same configuration as that of 'B'. This new propagation tree + contains all the new mounts 'A1', 'A2'... 'An'. And this new + propagation tree is appended to the already existing propagation tree + of 'A'. =20 - 2. 'A' is a private mount and 'B' is a shared mount. The mount 'A' is - mounted on mount 'B' at dentry 'b'. Also new mount 'A1', 'A2'... 'An' - are created and mounted at dentry 'b' on all mounts that receive - propagation from mount 'B'. The mount 'A' becomes a shared mount and a - propagation tree is created which is identical to that of - 'B'. This new propagation tree contains all the new mounts 'A1', - 'A2'... 'An'. + 2. 'A' is a private mount and 'B' is a shared mount. The mount 'A' is + mounted on mount 'B' at dentry 'b'. Also new mount 'A1', 'A2'... 'An' + are created and mounted at dentry 'b' on all mounts that receive + propagation from mount 'B'. The mount 'A' becomes a shared mount and= a + propagation tree is created which is identical to that of + 'B'. This new propagation tree contains all the new mounts 'A1', + 'A2'... 'An'. =20 - 3. 'A' is a slave mount of mount 'Z' and 'B' is a shared mount. The - mount 'A' is mounted on mount 'B' at dentry 'b'. Also new mounts 'A1', - 'A2'... 'An' are created and mounted at dentry 'b' on all mounts that - receive propagation from mount 'B'. A new propagation tree is created - in the exact same configuration as that of 'B'. This new propagation - tree contains all the new mounts 'A1', 'A2'... 'An'. And this new - propagation tree is appended to the already existing propagation tree of - 'A'. Mount 'A' continues to be the slave mount of 'Z' but it also - becomes 'shared'. + 3. 'A' is a slave mount of mount 'Z' and 'B' is a shared mount. The + mount 'A' is mounted on mount 'B' at dentry 'b'. Also new mounts 'A= 1', + 'A2'... 'An' are created and mounted at dentry 'b' on all mounts that + receive propagation from mount 'B'. A new propagation tree is created + in the exact same configuration as that of 'B'. This new propagation + tree contains all the new mounts 'A1', 'A2'... 'An'. And this new + propagation tree is appended to the already existing propagation tre= e of + 'A'. Mount 'A' continues to be the slave mount of 'Z' but it also + becomes 'shared'. =20 - 4. 'A' is a unbindable mount and 'B' is a shared mount. The operation - is invalid. Because mounting anything on the shared mount 'B' can - create new mounts that get mounted on the mounts that receive - propagation from 'B'. And since the mount 'A' is unbindable, cloning - it to mount at other mountpoints is not possible. + 4. 'A' is a unbindable mount and 'B' is a shared mount. The operation + is invalid. Because mounting anything on the shared mount 'B' can + create new mounts that get mounted on the mounts that receive + propagation from 'B'. And since the mount 'A' is unbindable, cloning + it to mount at other mountpoints is not possible. =20 - 5. 'A' is a private mount and 'B' is a non-shared(private or slave or - unbindable) mount. The mount 'A' is mounted on mount 'B' at dentry 'b'. + 5. 'A' is a private mount and 'B' is a non-shared(private or slave or + unbindable) mount. The mount 'A' is mounted on mount 'B' at dentry '= b'. =20 - 6. 'A' is a shared mount and 'B' is a non-shared mount. The mount 'A' - is mounted on mount 'B' at dentry 'b'. Mount 'A' continues to be a - shared mount. + 6. 'A' is a shared mount and 'B' is a non-shared mount. The mount 'A' + is mounted on mount 'B' at dentry 'b'. Mount 'A' continues to be a + shared mount. =20 - 7. 'A' is a slave mount of mount 'Z' and 'B' is a non-shared mount. - The mount 'A' is mounted on mount 'B' at dentry 'b'. Mount 'A' - continues to be a slave mount of mount 'Z'. + 7. 'A' is a slave mount of mount 'Z' and 'B' is a non-shared mount. + The mount 'A' is mounted on mount 'B' at dentry 'b'. Mount 'A' + continues to be a slave mount of mount 'Z'. =20 - 8. 'A' is a unbindable mount and 'B' is a non-shared mount. The mount - 'A' is mounted on mount 'B' at dentry 'b'. Mount 'A' continues to be a - unbindable mount. + 8. 'A' is a unbindable mount and 'B' is a non-shared mount. The mount + 'A' is mounted on mount 'B' at dentry 'b'. Mount 'A' continues to be= a + unbindable mount. =20 e) Mount semantics =20 - Consider the following command:: + Consider the following command:: =20 - mount device B/b + mount device B/b =20 - 'B' is the destination mount and 'b' is the dentry in the destination - mount. + 'B' is the destination mount and 'b' is the dentry in the destination + mount. =20 - The above operation is the same as bind operation with the exception - that the source mount is always a private mount. + The above operation is the same as bind operation with the exception + that the source mount is always a private mount. =20 =20 f) Unmount semantics =20 - Consider the following command:: + Consider the following command:: =20 - umount A + umount A =20 - where 'A' is a mount mounted on mount 'B' at dentry 'b'. + where 'A' is a mount mounted on mount 'B' at dentry 'b'. =20 - If mount 'B' is shared, then all most-recently-mounted mounts at dentry - 'b' on mounts that receive propagation from mount 'B' and does not have - sub-mounts within them are unmounted. + If mount 'B' is shared, then all most-recently-mounted mounts at dentry + 'b' on mounts that receive propagation from mount 'B' and does not have + sub-mounts within them are unmounted. =20 - Example: Let's say 'B1', 'B2', 'B3' are shared mounts that propagate to - each other. + Example: Let's say 'B1', 'B2', 'B3' are shared mounts that propagate to + each other. =20 - let's say 'A1', 'A2', 'A3' are first mounted at dentry 'b' on mount - 'B1', 'B2' and 'B3' respectively. + let's say 'A1', 'A2', 'A3' are first mounted at dentry 'b' on mount + 'B1', 'B2' and 'B3' respectively. =20 - let's say 'C1', 'C2', 'C3' are next mounted at the same dentry 'b' on - mount 'B1', 'B2' and 'B3' respectively. + let's say 'C1', 'C2', 'C3' are next mounted at the same dentry 'b' on + mount 'B1', 'B2' and 'B3' respectively. =20 - if 'C1' is unmounted, all the mounts that are most-recently-mounted on - 'B1' and on the mounts that 'B1' propagates-to are unmounted. + if 'C1' is unmounted, all the mounts that are most-recently-mounted on + 'B1' and on the mounts that 'B1' propagates-to are unmounted. =20 - 'B1' propagates to 'B2' and 'B3'. And the most recently mounted mount - on 'B2' at dentry 'b' is 'C2', and that of mount 'B3' is 'C3'. + 'B1' propagates to 'B2' and 'B3'. And the most recently mounted mount + on 'B2' at dentry 'b' is 'C2', and that of mount 'B3' is 'C3'. =20 - So all 'C1', 'C2' and 'C3' should be unmounted. + So all 'C1', 'C2' and 'C3' should be unmounted. =20 - If any of 'C2' or 'C3' has some child mounts, then that mount is not - unmounted, but all other mounts are unmounted. However if 'C1' is told - to be unmounted and 'C1' has some sub-mounts, the umount operation is - failed entirely. + If any of 'C2' or 'C3' has some child mounts, then that mount is not + unmounted, but all other mounts are unmounted. However if 'C1' is told + to be unmounted and 'C1' has some sub-mounts, the umount operation is + failed entirely. =20 g) Clone Namespace =20 - A cloned namespace contains all the mounts as that of the parent - namespace. + A cloned namespace contains all the mounts as that of the parent + namespace. =20 - Let's say 'A' and 'B' are the corresponding mounts in the parent and the - child namespace. + Let's say 'A' and 'B' are the corresponding mounts in the parent and the + child namespace. =20 - If 'A' is shared, then 'B' is also shared and 'A' and 'B' propagate to - each other. + If 'A' is shared, then 'B' is also shared and 'A' and 'B' propagate to + each other. =20 - If 'A' is a slave mount of 'Z', then 'B' is also the slave mount of - 'Z'. + If 'A' is a slave mount of 'Z', then 'B' is also the slave mount of + 'Z'. =20 - If 'A' is a private mount, then 'B' is a private mount too. + If 'A' is a private mount, then 'B' is a private mount too. =20 - If 'A' is unbindable mount, then 'B' is a unbindable mount too. + If 'A' is unbindable mount, then 'B' is a unbindable mount too. =20 =20 6) Quiz ------- =20 - A. What is the result of the following command sequence? +A. What is the result of the following command sequence? =20 - :: + :: =20 - mount --bind /mnt /mnt - mount --make-shared /mnt - mount --bind /mnt /tmp - mount --move /tmp /mnt/1 + mount --bind /mnt /mnt + mount --make-shared /mnt + mount --bind /mnt /tmp + mount --move /tmp /mnt/1 =20 - what should be the contents of /mnt /mnt/1 /mnt/1/1 should be? - Should they all be identical? or should /mnt and /mnt/1 be - identical only? + what should be the contents of /mnt /mnt/1 /mnt/1/1 should be? + Should they all be identical? or should /mnt and /mnt/1 be + identical only? =20 =20 - B. What is the result of the following command sequence? +B. What is the result of the following command sequence? =20 - :: + :: =20 - mount --make-rshared / - mkdir -p /v/1 - mount --rbind / /v/1 + mount --make-rshared / + mkdir -p /v/1 + mount --rbind / /v/1 =20 - what should be the content of /v/1/v/1 be? + what should be the content of /v/1/v/1 be? =20 =20 - C. What is the result of the following command sequence? +C. What is the result of the following command sequence? =20 - :: + :: =20 - mount --bind /mnt /mnt - mount --make-shared /mnt - mkdir -p /mnt/1/2/3 /mnt/1/test - mount --bind /mnt/1 /tmp - mount --make-slave /mnt - mount --make-shared /mnt - mount --bind /mnt/1/2 /tmp1 - mount --make-slave /mnt + mount --bind /mnt /mnt + mount --make-shared /mnt + mkdir -p /mnt/1/2/3 /mnt/1/test + mount --bind /mnt/1 /tmp + mount --make-slave /mnt + mount --make-shared /mnt + mount --bind /mnt/1/2 /tmp1 + mount --make-slave /mnt =20 - At this point we have the first mount at /tmp and - its root dentry is 1. Let's call this mount 'A' - And then we have a second mount at /tmp1 with root - dentry 2. Let's call this mount 'B' - Next we have a third mount at /mnt with root dentry - mnt. Let's call this mount 'C' + At this point we have the first mount at /tmp and + its root dentry is 1. Let's call this mount 'A' + And then we have a second mount at /tmp1 with root + dentry 2. Let's call this mount 'B' + Next we have a third mount at /mnt with root dentry + mnt. Let's call this mount 'C' =20 - 'B' is the slave of 'A' and 'C' is a slave of 'B' - A -> B -> C + 'B' is the slave of 'A' and 'C' is a slave of 'B' + A -> B -> C =20 - at this point if we execute the following command:: + at this point if we execute the following command:: =20 - mount --bind /bin /tmp/test + mount --bind /bin /tmp/test =20 - The mount is attempted on 'A' + The mount is attempted on 'A' =20 - will the mount propagate to 'B' and 'C' ? + will the mount propagate to 'B' and 'C' ? =20 - what would be the contents of - /mnt/1/test be? + what would be the contents of + /mnt/1/test be? =20 7) FAQ ------ =20 - 1. Why is bind mount needed? How is it different from symbolic links? - symbolic links can get stale if the destination mount gets - unmounted or moved. Bind mounts continue to exist even if the - other mount is unmounted or moved. +1. Why is bind mount needed? How is it different from symbolic links? =20 - 2. Why can't the shared subtree be implemented using exportfs? + symbolic links can get stale if the destination mount gets + unmounted or moved. Bind mounts continue to exist even if the + other mount is unmounted or moved. =20 - exportfs is a heavyweight way of accomplishing part of what - shared subtree can do. I cannot imagine a way to implement the - semantics of slave mount using exportfs? +2. Why can't the shared subtree be implemented using exportfs? =20 - 3. Why is unbindable mount needed? + exportfs is a heavyweight way of accomplishing part of what + shared subtree can do. I cannot imagine a way to implement the + semantics of slave mount using exportfs? =20 - Let's say we want to replicate the mount tree at multiple - locations within the same subtree. +3. Why is unbindable mount needed? =20 - if one rbind mounts a tree within the same subtree 'n' times - the number of mounts created is an exponential function of 'n'. - Having unbindable mount can help prune the unneeded bind - mounts. Here is an example. + Let's say we want to replicate the mount tree at multiple + locations within the same subtree. =20 - step 1: - let's say the root tree has just two directories with - one vfsmount:: + if one rbind mounts a tree within the same subtree 'n' times + the number of mounts created is an exponential function of 'n'. + Having unbindable mount can help prune the unneeded bind + mounts. Here is an example. =20 - root - / \ - tmp usr + step 1: + let's say the root tree has just two directories with + one vfsmount:: =20 - And we want to replicate the tree at multiple - mountpoints under /root/tmp + root + / \ + tmp usr =20 - step 2: - :: + And we want to replicate the tree at multiple + mountpoints under /root/tmp + + step 2: + :: =20 =20 - mount --make-shared /root + mount --make-shared /root =20 - mkdir -p /tmp/m1 + mkdir -p /tmp/m1 =20 - mount --rbind /root /tmp/m1 + mount --rbind /root /tmp/m1 =20 - the new tree now looks like this:: + the new tree now looks like this:: =20 - root - / \ - tmp usr - / - m1 - / \ - tmp usr - / - m1 + root + / \ + tmp usr + / + m1 + / \ + tmp usr + / + m1 =20 - it has two vfsmounts + it has two vfsmounts =20 - step 3: - :: + step 3: + :: =20 - mkdir -p /tmp/m2 - mount --rbind /root /tmp/m2 + mkdir -p /tmp/m2 + mount --rbind /root /tmp/m2 =20 - the new tree now looks like this:: + the new tree now looks like this:: =20 - root - / \ - tmp usr - / \ - m1 m2 - / \ / \ - tmp usr tmp usr - / \ / - m1 m2 m1 - / \ / \ - tmp usr tmp usr - / / \ - m1 m1 m2 - / \ - tmp usr - / \ - m1 m2 + root + / \ + tmp usr + / \ + m1 m2 + / \ / \ + tmp usr tmp usr + / \ / + m1 m2 m1 + / \ / \ + tmp usr tmp usr + / / \ + m1 m1 m2 + / \ + tmp usr + / \ + m1 m2 =20 - it has 6 vfsmounts + it has 6 vfsmounts =20 - step 4: - :: + step 4: + :: =20 - mkdir -p /tmp/m3 - mount --rbind /root /tmp/m3 + mkdir -p /tmp/m3 + mount --rbind /root /tmp/m3 =20 - I won't draw the tree..but it has 24 vfsmounts + I won't draw the tree..but it has 24 vfsmounts =20 =20 - at step i the number of vfsmounts is V[i] =3D i*V[i-1]. - This is an exponential function. And this tree has way more - mounts than what we really needed in the first place. + at step i the number of vfsmounts is V[i] =3D i*V[i-1]. + This is an exponential function. And this tree has way more + mounts than what we really needed in the first place. =20 - One could use a series of umount at each step to prune - out the unneeded mounts. But there is a better solution. - Unclonable mounts come in handy here. + One could use a series of umount at each step to prune + out the unneeded mounts. But there is a better solution. + Unclonable mounts come in handy here. =20 - step 1: - let's say the root tree has just two directories with - one vfsmount:: + step 1: + let's say the root tree has just two directories with + one vfsmount:: =20 - root - / \ - tmp usr + root + / \ + tmp usr =20 - How do we set up the same tree at multiple locations under - /root/tmp + How do we set up the same tree at multiple locations under + /root/tmp =20 - step 2: - :: + step 2: + :: =20 =20 - mount --bind /root/tmp /root/tmp + mount --bind /root/tmp /root/tmp =20 - mount --make-rshared /root - mount --make-unbindable /root/tmp + mount --make-rshared /root + mount --make-unbindable /root/tmp =20 - mkdir -p /tmp/m1 + mkdir -p /tmp/m1 =20 - mount --rbind /root /tmp/m1 + mount --rbind /root /tmp/m1 =20 - the new tree now looks like this:: + the new tree now looks like this:: =20 - root - / \ - tmp usr - / - m1 - / \ - tmp usr + root + / \ + tmp usr + / + m1 + / \ + tmp usr =20 - step 3: - :: + step 3: + :: =20 - mkdir -p /tmp/m2 - mount --rbind /root /tmp/m2 + mkdir -p /tmp/m2 + mount --rbind /root /tmp/m2 =20 - the new tree now looks like this:: + the new tree now looks like this:: =20 - root - / \ - tmp usr - / \ - m1 m2 - / \ / \ - tmp usr tmp usr + root + / \ + tmp usr + / \ + m1 m2 + / \ / \ + tmp usr tmp usr =20 - step 4: - :: + step 4: + :: =20 - mkdir -p /tmp/m3 - mount --rbind /root /tmp/m3 + mkdir -p /tmp/m3 + mount --rbind /root /tmp/m3 =20 - the new tree now looks like this:: + the new tree now looks like this:: =20 - root - / \ - tmp usr - / \ \ - m1 m2 m3 - / \ / \ / \ - tmp usr tmp usr tmp usr + root + / \ + tmp usr + / \ \ + m1 m2 m3 + / \ / \ / \ + tmp usr tmp usr tmp usr =20 8) Implementation ----------------- =20 A) Datastructure =20 - Several new fields are introduced to struct vfsmount: + Several new fields are introduced to struct vfsmount: =20 - ->mnt_share - Links together all the mount to/from which this vfsmount - send/receives propagation events. + ->mnt_share + Links together all the mount to/from which this vfsmount + send/receives propagation events. =20 - ->mnt_slave_list - Links all the mounts to which this vfsmount propagates - to. + ->mnt_slave_list + Links all the mounts to which this vfsmount propagates + to. =20 - ->mnt_slave - Links together all the slaves that its master vfsmount - propagates to. + ->mnt_slave + Links together all the slaves that its master vfsmount + propagates to. =20 - ->mnt_master - Points to the master vfsmount from which this vfsmount - receives propagation. + ->mnt_master + Points to the master vfsmount from which this vfsmount + receives propagation. =20 - ->mnt_flags - Takes two more flags to indicate the propagation status of - the vfsmount. MNT_SHARE indicates that the vfsmount is a shared - vfsmount. MNT_UNCLONABLE indicates that the vfsmount cannot be - replicated. + ->mnt_flags + Takes two more flags to indicate the propagation status of + the vfsmount. MNT_SHARE indicates that the vfsmount is a shared + vfsmount. MNT_UNCLONABLE indicates that the vfsmount cannot be + replicated. =20 - All the shared vfsmounts in a peer group form a cyclic list through - ->mnt_share. + All the shared vfsmounts in a peer group form a cyclic list through + ->mnt_share. =20 - All vfsmounts with the same ->mnt_master form on a cyclic list anchored - in ->mnt_master->mnt_slave_list and going through ->mnt_slave. + All vfsmounts with the same ->mnt_master form on a cyclic list anchored + in ->mnt_master->mnt_slave_list and going through ->mnt_slave. =20 - ->mnt_master can point to arbitrary (and possibly different) members - of master peer group. To find all immediate slaves of a peer group - you need to go through _all_ ->mnt_slave_list of its members. - Conceptually it's just a single set - distribution among the - individual lists does not affect propagation or the way propagation - tree is modified by operations. + ->mnt_master can point to arbitrary (and possibly different) members + of master peer group. To find all immediate slaves of a peer group + you need to go through _all_ ->mnt_slave_list of its members. + Conceptually it's just a single set - distribution among the + individual lists does not affect propagation or the way propagation + tree is modified by operations. =20 - All vfsmounts in a peer group have the same ->mnt_master. If it is - non-NULL, they form a contiguous (ordered) segment of slave list. + All vfsmounts in a peer group have the same ->mnt_master. If it is + non-NULL, they form a contiguous (ordered) segment of slave list. =20 - A example propagation tree looks as shown in the figure below. - [ NOTE: Though it looks like a forest, if we consider all the shared - mounts as a conceptual entity called 'pnode', it becomes a tree]:: + A example propagation tree looks as shown in the figure below. + [ NOTE: Though it looks like a forest, if we consider all the shared + mounts as a conceptual entity called 'pnode', it becomes a tree]:: =20 =20 - A <--> B <--> C <---> D - /|\ /| |\ - / F G J K H I - / - E<-->K - /|\ - M L N + A <--> B <--> C <---> D + /|\ /| |\ + / F G J K H I + / + E<-->K + /|\ + M L N =20 - In the above figure A,B,C and D all are shared and propagate to each - other. 'A' has got 3 slave mounts 'E' 'F' and 'G' 'C' has got 2 slave - mounts 'J' and 'K' and 'D' has got two slave mounts 'H' and 'I'. - 'E' is also shared with 'K' and they propagate to each other. And - 'K' has 3 slaves 'M', 'L' and 'N' + In the above figure A,B,C and D all are shared and propagate to each + other. 'A' has got 3 slave mounts 'E' 'F' and 'G' 'C' has got 2 slave + mounts 'J' and 'K' and 'D' has got two slave mounts 'H' and 'I'. + 'E' is also shared with 'K' and they propagate to each other. And + 'K' has 3 slaves 'M', 'L' and 'N' =20 - A's ->mnt_share links with the ->mnt_share of 'B' 'C' and 'D' + A's ->mnt_share links with the ->mnt_share of 'B' 'C' and 'D' =20 - A's ->mnt_slave_list links with ->mnt_slave of 'E', 'K', 'F' and 'G' + A's ->mnt_slave_list links with ->mnt_slave of 'E', 'K', 'F' and 'G' =20 - E's ->mnt_share links with ->mnt_share of K + E's ->mnt_share links with ->mnt_share of K =20 - 'E', 'K', 'F', 'G' have their ->mnt_master point to struct vfsmount of 'A' + 'E', 'K', 'F', 'G' have their ->mnt_master point to struct vfsmount of = 'A' =20 - 'M', 'L', 'N' have their ->mnt_master point to struct vfsmount of 'K' + 'M', 'L', 'N' have their ->mnt_master point to struct vfsmount of 'K' =20 - K's ->mnt_slave_list links with ->mnt_slave of 'M', 'L' and 'N' + K's ->mnt_slave_list links with ->mnt_slave of 'M', 'L' and 'N' =20 - C's ->mnt_slave_list links with ->mnt_slave of 'J' and 'K' + C's ->mnt_slave_list links with ->mnt_slave of 'J' and 'K' =20 - J and K's ->mnt_master points to struct vfsmount of C + J and K's ->mnt_master points to struct vfsmount of C =20 - and finally D's ->mnt_slave_list links with ->mnt_slave of 'H' and 'I' + and finally D's ->mnt_slave_list links with ->mnt_slave of 'H' and 'I' =20 - 'H' and 'I' have their ->mnt_master pointing to struct vfsmount of 'D'. + 'H' and 'I' have their ->mnt_master pointing to struct vfsmount of 'D'. =20 =20 - NOTE: The propagation tree is orthogonal to the mount tree. + NOTE: The propagation tree is orthogonal to the mount tree. =20 B) Locking: =20 - ->mnt_share, ->mnt_slave, ->mnt_slave_list, ->mnt_master are protected - by namespace_sem (exclusive for modifications, shared for reading). + ->mnt_share, ->mnt_slave, ->mnt_slave_list, ->mnt_master are protected + by namespace_sem (exclusive for modifications, shared for reading). =20 - Normally we have ->mnt_flags modifications serialized by vfsmount_lock. - There are two exceptions: do_add_mount() and clone_mnt(). - The former modifies a vfsmount that has not been visible in any shared - data structures yet. - The latter holds namespace_sem and the only references to vfsmount - are in lists that can't be traversed without namespace_sem. + Normally we have ->mnt_flags modifications serialized by vfsmount_lock. + There are two exceptions: do_add_mount() and clone_mnt(). + The former modifies a vfsmount that has not been visible in any shared + data structures yet. + The latter holds namespace_sem and the only references to vfsmount + are in lists that can't be traversed without namespace_sem. =20 C) Algorithm: =20 - The crux of the implementation resides in rbind/move operation. + The crux of the implementation resides in rbind/move operation. =20 - The overall algorithm breaks the operation into 3 phases: (look at - attach_recursive_mnt() and propagate_mnt()) + The overall algorithm breaks the operation into 3 phases: (look at + attach_recursive_mnt() and propagate_mnt()) =20 - 1. Prepare phase. + 1. Prepare phase. =20 - For each mount in the source tree: + For each mount in the source tree: =20 - a) Create the necessary number of mount trees to - be attached to each of the mounts that receive - propagation from the destination mount. - b) Do not attach any of the trees to its destination. - However note down its ->mnt_parent and ->mnt_mountpoint - c) Link all the new mounts to form a propagation tree that - is identical to the propagation tree of the destination - mount. + a) Create the necessary number of mount trees to + be attached to each of the mounts that receive + propagation from the destination mount. + b) Do not attach any of the trees to its destination. + However note down its ->mnt_parent and ->mnt_mountpoint + c) Link all the new mounts to form a propagation tree that + is identical to the propagation tree of the destination + mount. =20 - If this phase is successful, there should be 'n' new - propagation trees; where 'n' is the number of mounts in the - source tree. Go to the commit phase + If this phase is successful, there should be 'n' new + propagation trees; where 'n' is the number of mounts in the + source tree. Go to the commit phase =20 - Also there should be 'm' new mount trees, where 'm' is - the number of mounts to which the destination mount - propagates to. + Also there should be 'm' new mount trees, where 'm' is + the number of mounts to which the destination mount + propagates to. =20 - If any memory allocations fail, go to the abort phase. + If any memory allocations fail, go to the abort phase. =20 - 2. Commit phase. + 2. Commit phase. =20 - Attach each of the mount trees to their corresponding - destination mounts. + Attach each of the mount trees to their corresponding + destination mounts. =20 - 3. Abort phase. - Delete all the newly created trees. + 3. Abort phase. =20 - .. Note:: - all the propagation related functionality resides in the file pnode.c + Delete all the newly created trees. + + .. Note:: + all the propagation related functionality resides in the file pnode.c =20 =20 ------------------------------------------------------------------------ --=20 An old man doll... just what I always wanted! - Clara From nobody Sat Oct 4 08:03:29 2025 Received: from mail-pj1-f53.google.com (mail-pj1-f53.google.com [209.85.216.53]) (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 AD65F26B973; Tue, 19 Aug 2025 06:13:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755583995; cv=none; b=NUj7Dysx1shps1h4VJCEXlMyIvVGc5k2yJiXYMoVSOxd5Gb1Cc/K9YheUi1Z6V70/ZqHl3w9FToYVNdYIJt1ahooGHYQR4xSRiAlfUbXX4AOjLFqKqICl6V+Y0OrjQrUQiAHAnzefC/gcD/BXXwpC7b7A8FNxyDb+WrtB47iE5Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755583995; c=relaxed/simple; bh=QvbQ3Yi9pFPzh0dk01am7J13l7ixDhkVqrIdUZUGhb8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=HEU/JAWN3Y0J7/MXbu0+f8Y7fzv7VRekVjnwfNuHk5hGOr6oafdEgpWmJ17KwzE9GjW5oEP1BtnxZhDI+AcZ1JsTMWQ4a2sZLnd64XCWZRkX70wph7BtjQ4yC1jDw+j0Ljy5FoVsj4Bob44Fz/PnOSl9Rffmbq941uwrYLS/6lo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=giMbf/qk; arc=none smtp.client-ip=209.85.216.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="giMbf/qk" Received: by mail-pj1-f53.google.com with SMTP id 98e67ed59e1d1-323267872f3so4187396a91.1; Mon, 18 Aug 2025 23:13:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1755583993; x=1756188793; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=MaZrleaHbOR6yTEtT9sf3iBhWN1ohy2mL86EbvZxfqc=; b=giMbf/qkvmcbFgDlZeB8PjN9ltBG5uzCwODffV2cKS9+hyGhLof9vKkU5NXQOPYLUw f07KPyTfkNkV/QIw0JZaHg0L/8Wq3i4VpukQK9L4YAl/dAVehZwqT0FrIwEd9aLmHXn6 W36Fsj66PSn4JTkmizKtyjfAhRuXr5lSyyDfhLPy+XRKQC2B0wZCYB6HooXxvBnqcm2x TKqhTTGZuTuunks8YU9RbGUi6YVl0NbNLLjP8TKKeOm3pa82N7XwnfWfOVV+WP4d+Fyb xI3u09kA9ShBOUBpK+7oCECZ+WaCjRIvFTaflVp0tDW7+yJU7LUDzlASa0cNK2tk1obH WDTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1755583993; x=1756188793; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=MaZrleaHbOR6yTEtT9sf3iBhWN1ohy2mL86EbvZxfqc=; b=dLpVQOF2eduoqtdIotwx5AB+4WZnB3nZnrqFfU1XdwxmifM+Ay9pMEbfNoraxR8owg VFCj3SLiGY2W/dRzzJbzSz48XpGGM4sVuQDOyGQJzav1NJT+UazoSQhV6T+gt5D+72J9 02H/RZ/u4RkZjiBS7YhCEbNrrzrgdfX6w1ZL4RVkO5v8u3uf/ofYxbvPMXX6sP6ISJ+N tVe4nEIetN1AzXFsz8i6psQBMkV5x0oCieEc+4Cq40y213sk3RvYzsO0yRQFVGC5nvek xbgem0FL7MwQo0rLev7otbC/cqOexhYJ/QN62u1bvEBb5CJsR8Ec8M5wrje5dosszb1n rgWA== X-Forwarded-Encrypted: i=1; AJvYcCUASrYPSIJTgsU1EY47zMq9pLqZ3S1t7Z50G1TUDfJnt+1Lng5h+pHZStoANH9UsueaQ58WCWYdC70=@vger.kernel.org, AJvYcCVhq83z8xeptADKu/wOY7gzBQuyNY9qp9sNlBXz6Q4REFw2n9J8COgO6pDf14h8x9+VkuEj/oQhjxim0IB8gA==@vger.kernel.org X-Gm-Message-State: AOJu0YymB7/37ZjWaogGXHcgAmPWaNFxOYPtzxlUeUUoS7yTQByMl22D CK7s+s2ZOdhtYRFPj1UKys15Fv+nToCiI+AYs0zazvmQmBtikSoO1v7P X-Gm-Gg: ASbGncsji8TEcerppzVzzZXzLDzFTEkwGyj0SzIxI9N0BN7GFvo722B40DCD/ttKYdl 5FW8gGC5S55SaJHEKCdycQCI2MTM5oxW8QUT7XSNlmhMDyAUrBSDFhh7tJYahG8UB/bXAv0iN0p Tzqh8gSvvum4dDwK0n6aF1NVm/92zHYkzy+Dmkd49oRNIfgf44f5Z6vLfyuThTRo3bmADUPWhqn EfLZdZ5urv98ZRGoMbppeTnRivdFFRO/0BF8wkdJfdWHlg2RkGYln+dxyg+WCa06hY0DTOAltTe y2M1dH/l86YSOGHmg/FXBtQmr38hm6JcVRJvWxOu1e7CzBelRR9t0QKsk3nvJX4PFtiynHyJ96v b13l1YRqwV4rDWO4gLfy6B3zaFhtkPT8o X-Google-Smtp-Source: AGHT+IGU58wwfT/quTp7EuntTbg1eQWm60+JbZHn0Oeg/m29Gae1PjVVDhcgaza6WxCqdYYE47E1Vw== X-Received: by 2002:a17:90b:4ccd:b0:312:f0d0:bc4 with SMTP id 98e67ed59e1d1-32476a4a623mr1950322a91.5.1755583992736; Mon, 18 Aug 2025 23:13:12 -0700 (PDT) Received: from archie.me ([103.124.138.155]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-b473ce25dafsm7160306a12.17.2025.08.18.23.13.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Aug 2025 23:13:11 -0700 (PDT) Received: by archie.me (Postfix, from userid 1000) id 55FC64650015; Tue, 19 Aug 2025 13:13:04 +0700 (WIB) From: Bagas Sanjaya To: Linux Kernel Mailing List , Linux Documentation , Linux Filesystems Development Cc: Jonathan Corbet , Bagas Sanjaya , Christian Brauner , Mauro Carvalho Chehab , Randy Dunlap Subject: [PATCH 5/5] Documentation: sharedsubtree: Convert notes to note directive Date: Tue, 19 Aug 2025 13:12:53 +0700 Message-ID: <20250819061254.31220-6-bagasdotme@gmail.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20250819061254.31220-1-bagasdotme@gmail.com> References: <20250819061254.31220-1-bagasdotme@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2074; i=bagasdotme@gmail.com; h=from:subject; bh=QvbQ3Yi9pFPzh0dk01am7J13l7ixDhkVqrIdUZUGhb8=; b=owGbwMvMwCX2bWenZ2ig32LG02pJDBlLRF7etkiJrHvRG+XVubXLzmdL8ob4RuZ0lbXldTWbP BVfXXLqKGVhEONikBVTZJmUyNd0epeRyIX2tY4wc1iZQIYwcHEKwEQufGH4n3B1OvstuxMTdToZ Ojrk7ViFkp98vJBgfsT+bccMoR0qyYwMjUf3NPDWn9wue5j3zRrT+ojGRqHygxXi/s8b7GsOSvZ zAwA= X-Developer-Key: i=bagasdotme@gmail.com; a=openpgp; fpr=701B806FDCA5D3A58FFB8F7D7C276C64A5E44A1D Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" While a few of the notes are already in reST syntax, others are left intact (inconsistent). Convert them to reST syntax too. Signed-off-by: Bagas Sanjaya --- Documentation/filesystems/sharedsubtree.rst | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/Documentation/filesystems/sharedsubtree.rst b/Documentation/fi= lesystems/sharedsubtree.rst index b09650e285341c..8b7dc915908377 100644 --- a/Documentation/filesystems/sharedsubtree.rst +++ b/Documentation/filesystems/sharedsubtree.rst @@ -43,9 +43,10 @@ a) A **shared mount** can be replicated to as many mount= points and all the =20 # mount --make-shared /mnt =20 - Note: mount(8) command now supports the --make-shared flag, - so the sample 'smount' program is no longer needed and has been - removed. + .. note:: + mount(8) command now supports the --make-shared flag, + so the sample 'smount' program is no longer needed and has been + removed. =20 :: =20 @@ -242,8 +243,9 @@ D) Versioned files The section below explains the detailed semantics of bind, rbind, move, mount, umount and clone-namespace operations. =20 -Note: the word 'vfsmount' and the noun 'mount' have been used -to mean the same thing, throughout this document. +.. Note:: + the word 'vfsmount' and the noun 'mount' have been used + to mean the same thing, throughout this document. =20 a) Mount states =20 @@ -885,8 +887,12 @@ A) Datastructure non-NULL, they form a contiguous (ordered) segment of slave list. =20 A example propagation tree looks as shown in the figure below. - [ NOTE: Though it looks like a forest, if we consider all the shared - mounts as a conceptual entity called 'pnode', it becomes a tree]:: + + .. note:: + Though it looks like a forest, if we consider all the shared + mounts as a conceptual entity called 'pnode', it becomes a tree. + + :: =20 =20 A <--> B <--> C <---> D --=20 An old man doll... just what I always wanted! - Clara