diff options
author | Eric Biggers <ebiggers@google.com> | 2020-09-22 18:44:18 +0200 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2021-01-04 20:02:08 +0100 |
commit | 14e43bf435612639cab01541fce7cc41bf7e370b (patch) | |
tree | d0a418ace1f97fbdc4ad4fcf88ce5119237bccdd /Documentation/filesystems/porting.rst | |
parent | Linux 5.11-rc1 (diff) | |
download | linux-14e43bf435612639cab01541fce7cc41bf7e370b.tar.xz linux-14e43bf435612639cab01541fce7cc41bf7e370b.zip |
vfs: don't unnecessarily clone write access for writable fds
There's no need for mnt_want_write_file() to increment mnt_writers when
the file is already open for writing, provided that
mnt_drop_write_file() is changed to conditionally decrement it.
We seem to have ended up in the current situation because
mnt_want_write_file() used to be paired with mnt_drop_write(), due to
mnt_drop_write_file() not having been added yet. So originally
mnt_want_write_file() had to always increment mnt_writers.
But later mnt_drop_write_file() was added, and all callers of
mnt_want_write_file() were paired with it. This makes the compatibility
between mnt_want_write_file() and mnt_drop_write() no longer necessary.
Therefore, make __mnt_want_write_file() and __mnt_drop_write_file() skip
incrementing mnt_writers on files already open for writing. This
removes the only caller of mnt_clone_write(), so remove that too.
Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'Documentation/filesystems/porting.rst')
-rw-r--r-- | Documentation/filesystems/porting.rst | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/Documentation/filesystems/porting.rst b/Documentation/filesystems/porting.rst index 867036aa90b8..6a6d3e673b48 100644 --- a/Documentation/filesystems/porting.rst +++ b/Documentation/filesystems/porting.rst @@ -865,3 +865,10 @@ no matter what. Everything is handled by the caller. clone_private_mount() returns a longterm mount now, so the proper destructor of its result is kern_unmount() or kern_unmount_array(). + +--- + +**mandatory** + +mnt_want_write_file() can now only be paired with mnt_drop_write_file(), +whereas previously it could be paired with mnt_drop_write() as well. |