From: Sean Anderson <seanga2@gmail.com>
To: linux-fsdevel <linux-fsdevel@vger.kernel.org>, linux-doc@vger.kernel.org
Cc: corbet@lwn.net
Subject: [PATCH] Documentation: filesystems: update filesystem locking documentation
Date: Mon, 31 Jul 2017 11:53:35 -0400 [thread overview]
Message-ID: <2adf1174-ee74-5655-7b2e-3ea8b28ec2ae@gmail.com> (raw)
[-- Attachment #1.1: Type: text/plain, Size: 2491 bytes --]
Documentation/filesystems/Locking no longer reflects current locking
semantics. i_mutex is no longer used for locking, and has been superseded
by i_rwsem. Additionally, ->iterate_shared() was not documented.
Signed-off-by: Sean Anderson <seanga2@gmail.com>
---
Documentation/filesystems/Locking | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/Documentation/filesystems/Locking b/Documentation/filesystems/Locking
index fe25787ff6d4..b098d2e50b7f 100644
--- a/Documentation/filesystems/Locking
+++ b/Documentation/filesystems/Locking
@@ -69,8 +69,8 @@ prototypes:
locking rules:
all may block
- i_mutex(inode)
-lookup: yes
+ i_rwsem(inode)
+lookup: shared
create: yes
link: yes (both)
mknod: yes
@@ -92,7 +92,7 @@ atomic_open: yes
tmpfile: no
- Additionally, ->rmdir(), ->unlink() and ->rename() have ->i_mutex on
+ Additionally, ->rmdir(), ->unlink() and ->rename() have ->i_rwsem on
victim.
cross-directory ->rename() has (per-superblock) ->s_vfs_rename_sem.
@@ -111,7 +111,7 @@ prototypes:
locking rules:
all may block
- i_mutex(inode)
+ i_rwsem(inode)
list: no
get: no
set: yes
@@ -217,7 +217,7 @@ prototypes:
locking rules:
All except set_page_dirty and freepage may block
- PageLocked(page) i_mutex
+ PageLocked(page) i_rwsem
writepage: yes, unlocks (see below)
readpage: yes, unlocks
writepages:
@@ -439,6 +439,7 @@ prototypes:
ssize_t (*read_iter) (struct kiocb *, struct iov_iter *);
ssize_t (*write_iter) (struct kiocb *, struct iov_iter *);
int (*iterate) (struct file *, struct dir_context *);
+ int (*iterate_shared) (struct file *, struct dir_context *);
unsigned int (*poll) (struct file *, struct poll_table_struct *);
long (*unlocked_ioctl) (struct file *, unsigned int, unsigned long);
long (*compat_ioctl) (struct file *, unsigned int, unsigned long);
@@ -480,6 +481,10 @@ mutex or just to use i_size_read() instead.
Note: this does not protect the file->f_pos against concurrent modifications
since this is something the userspace has to take care about.
+->iterate() is called with i_rwsem held.
+
+->iterate_shared() is called with i_rwsem shared.
+
->fasync() is responsible for maintaining the FASYNC bit in filp->f_flags.
Most instances call fasync_helper(), which does that maintenance, so it's
not normally something one needs to worry about. Return values > 0 will be
--
2.13.2
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 618 bytes --]
next reply other threads:[~2017-07-31 15:53 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-31 15:53 Sean Anderson [this message]
2017-07-31 17:23 ` [PATCH] Documentation: filesystems: update filesystem locking documentation Matthew Wilcox
2017-08-01 11:09 ` [PATCH v2] " Sean Anderson
2017-08-01 11:15 ` Jeff Layton
2017-08-01 14:22 ` Jonathan Corbet
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=2adf1174-ee74-5655-7b2e-3ea8b28ec2ae@gmail.com \
--to=seanga2@gmail.com \
--cc=corbet@lwn.net \
--cc=linux-doc@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
/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).