linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mo Zou <lostzoumo@gmail.com>
To: viro@zeniv.linux.org.uk, brauner@kernel.org
Cc: linux-fsdevel@vger.kernel.org, Mo Zou <lostzoumo@gmail.com>
Subject: [PATCH] Documentation: fs: fix directory locking proofs
Date: Wed, 11 Oct 2023 13:28:15 +0800	[thread overview]
Message-ID: <20231011052815.15022-1-lostzoumo@gmail.com> (raw)

Commit 28eceeda130f ("fs: Lock moved directories") acquires locks also for
directories when they are moved and updates the deadlock-freedom proof
to claim "a linear ordering of the objects - A < B iff (A is an ancestor
of B) or (B is an ancestor of A and ptr(A) < ptr(B))". This claim,
however, is not correct. Because cross-directory rename may acquire two
parents (old parent and new parent) and two child directories (source
and target) and the ordering between old parent and target (or new parent
and source) may not fall into the above cases, i.e. ptr(old parent) <
ptr(target) may not hold. We should revert to previous description that
"at any moment we have a partial ordering of the objects - A < B iff A is
an ancestor of B".

Signed-off-by: Mo Zou <lostzoumo@gmail.com>
---
 Documentation/filesystems/directory-locking.rst | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/Documentation/filesystems/directory-locking.rst b/Documentation/filesystems/directory-locking.rst
index dccd61c7c5c3..5b26ecd9f0db 100644
--- a/Documentation/filesystems/directory-locking.rst
+++ b/Documentation/filesystems/directory-locking.rst
@@ -67,9 +67,8 @@ If no directory is its own ancestor, the scheme above is deadlock-free.
 
 Proof:
 
-	First of all, at any moment we have a linear ordering of the
-	objects - A < B iff (A is an ancestor of B) or (B is not an ancestor
-        of A and ptr(A) < ptr(B)).
+	First of all, at any moment we have a partial ordering of the
+	objects - A < B iff A is an ancestor of B.
 
 	That ordering can change.  However, the following is true:
 
-- 
2.30.1 (Apple Git-130)


             reply	other threads:[~2023-10-11  5:29 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-11  5:28 Mo Zou [this message]
2023-10-11  6:46 ` [PATCH] Documentation: fs: fix directory locking proofs Al Viro
2023-10-11 14:11   ` Mo Zou
2023-10-11 19:06     ` Al Viro

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231011052815.15022-1-lostzoumo@gmail.com \
    --to=lostzoumo@gmail.com \
    --cc=brauner@kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).