linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] docs: fs: Refactor directory-locking.rst for better reading
@ 2021-08-16 22:26 Kari Argillander
  2021-09-07  7:43 ` Kari Argillander
  0 siblings, 1 reply; 2+ messages in thread
From: Kari Argillander @ 2021-08-16 22:26 UTC (permalink / raw)
  To: Jonathan Corbet
  Cc: Kari Argillander, linux-doc, linux-kernel, linux-fsdevel, Al Viro

Reorganize classes so that it is easier to read. Before number 4 was
written in one lenghty paragraph. It is as long as number 6 and it is
basically same kind of class (rename()). Also old number 5 was list and
it is as short as 1, 2, 3 so it can be converted non list.

This makes file now much readible.

Signed-off-by: Kari Argillander <kari.argillander@gmail.com>
---
 .../filesystems/directory-locking.rst         | 31 +++++++++----------
 1 file changed, 15 insertions(+), 16 deletions(-)

diff --git a/Documentation/filesystems/directory-locking.rst b/Documentation/filesystems/directory-locking.rst
index 504ba940c36c..33921dff7af4 100644
--- a/Documentation/filesystems/directory-locking.rst
+++ b/Documentation/filesystems/directory-locking.rst
@@ -11,7 +11,7 @@ When taking the i_rwsem on multiple non-directory objects, we
 always acquire the locks in order by increasing address.  We'll call
 that "inode pointer" order in the following.
 
-For our purposes all operations fall in 5 classes:
+For our purposes all operations fall in 6 classes:
 
 1) read access.  Locking rules: caller locks directory we are accessing.
 The lock is taken shared.
@@ -22,26 +22,25 @@ exclusive.
 3) object removal.  Locking rules: caller locks parent, finds victim,
 locks victim and calls the method.  Locks are exclusive.
 
-4) rename() that is _not_ cross-directory.  Locking rules: caller locks
-the parent and finds source and target.  In case of exchange (with
-RENAME_EXCHANGE in flags argument) lock both.  In any case,
-if the target already exists, lock it.  If the source is a non-directory,
-lock it.  If we need to lock both, lock them in inode pointer order.
-Then call the method.  All locks are exclusive.
-NB: we might get away with locking the source (and target in exchange
-case) shared.
+4) link creation.  Locking rules: lock parent, check that source is not
+a directory, lock source and call the method.  Locks are exclusive.
 
-5) link creation.  Locking rules:
+5) rename() that is _not_ cross-directory.
+Locking rules:
 
-	* lock parent
-	* check that source is not a directory
-	* lock source
-	* call the method.
+	* Caller locks the parent and finds source and target.
+	* In case of exchange (with RENAME_EXCHANGE in flags argument)
+	  lock both the source and the target.
+	* If the target exists, lock it,  If the source is a non-directory,
+	  lock it. If we need to lock both, do so in inode pointer order.
+	* Call the method.
 
 All locks are exclusive.
+NB: we might get away with locking the source (and target in exchange
+case) shared.
 
-6) cross-directory rename.  The trickiest in the whole bunch.  Locking
-rules:
+6) rename() that _is_ cross-directory.  The trickiest in the whole bunch.
+Locking rules:
 
 	* lock the filesystem
 	* lock parents in "ancestors first" order.
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] docs: fs: Refactor directory-locking.rst for better reading
  2021-08-16 22:26 [PATCH] docs: fs: Refactor directory-locking.rst for better reading Kari Argillander
@ 2021-09-07  7:43 ` Kari Argillander
  0 siblings, 0 replies; 2+ messages in thread
From: Kari Argillander @ 2021-09-07  7:43 UTC (permalink / raw)
  To: Jonathan Corbet; +Cc: linux-doc, linux-kernel, linux-fsdevel, Al Viro

On Tue, Aug 17, 2021 at 01:26:39AM +0300, Kari Argillander wrote:
> Reorganize classes so that it is easier to read. Before number 4 was
> written in one lenghty paragraph. It is as long as number 6 and it is
> basically same kind of class (rename()). Also old number 5 was list and
> it is as short as 1, 2, 3 so it can be converted non list.
> 
> This makes file now much readible.

Gently ping for this one.

> 
> Signed-off-by: Kari Argillander <kari.argillander@gmail.com>
> ---
>  .../filesystems/directory-locking.rst         | 31 +++++++++----------
>  1 file changed, 15 insertions(+), 16 deletions(-)
> 
> diff --git a/Documentation/filesystems/directory-locking.rst b/Documentation/filesystems/directory-locking.rst
> index 504ba940c36c..33921dff7af4 100644
> --- a/Documentation/filesystems/directory-locking.rst
> +++ b/Documentation/filesystems/directory-locking.rst
> @@ -11,7 +11,7 @@ When taking the i_rwsem on multiple non-directory objects, we
>  always acquire the locks in order by increasing address.  We'll call
>  that "inode pointer" order in the following.
>  
> -For our purposes all operations fall in 5 classes:
> +For our purposes all operations fall in 6 classes:
>  
>  1) read access.  Locking rules: caller locks directory we are accessing.
>  The lock is taken shared.
> @@ -22,26 +22,25 @@ exclusive.
>  3) object removal.  Locking rules: caller locks parent, finds victim,
>  locks victim and calls the method.  Locks are exclusive.
>  
> -4) rename() that is _not_ cross-directory.  Locking rules: caller locks
> -the parent and finds source and target.  In case of exchange (with
> -RENAME_EXCHANGE in flags argument) lock both.  In any case,
> -if the target already exists, lock it.  If the source is a non-directory,
> -lock it.  If we need to lock both, lock them in inode pointer order.
> -Then call the method.  All locks are exclusive.
> -NB: we might get away with locking the source (and target in exchange
> -case) shared.
> +4) link creation.  Locking rules: lock parent, check that source is not
> +a directory, lock source and call the method.  Locks are exclusive.
>  
> -5) link creation.  Locking rules:
> +5) rename() that is _not_ cross-directory.
> +Locking rules:
>  
> -	* lock parent
> -	* check that source is not a directory
> -	* lock source
> -	* call the method.
> +	* Caller locks the parent and finds source and target.
> +	* In case of exchange (with RENAME_EXCHANGE in flags argument)
> +	  lock both the source and the target.
> +	* If the target exists, lock it,  If the source is a non-directory,
> +	  lock it. If we need to lock both, do so in inode pointer order.
> +	* Call the method.
>  
>  All locks are exclusive.
> +NB: we might get away with locking the source (and target in exchange
> +case) shared.
>  
> -6) cross-directory rename.  The trickiest in the whole bunch.  Locking
> -rules:
> +6) rename() that _is_ cross-directory.  The trickiest in the whole bunch.
> +Locking rules:
>  
>  	* lock the filesystem
>  	* lock parents in "ancestors first" order.
> -- 
> 2.30.2
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-09-07  7:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-16 22:26 [PATCH] docs: fs: Refactor directory-locking.rst for better reading Kari Argillander
2021-09-07  7:43 ` Kari Argillander

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).