aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation/filesystems/Locking
diff options
context:
space:
mode:
Diffstat (limited to 'Documentation/filesystems/Locking')
-rw-r--r--Documentation/filesystems/Locking43
1 files changed, 24 insertions, 19 deletions
diff --git a/Documentation/filesystems/Locking b/Documentation/filesystems/Locking
index 75d2d57e2c44..15853d522941 100644
--- a/Documentation/filesystems/Locking
+++ b/Documentation/filesystems/Locking
@@ -69,31 +69,31 @@ prototypes:
69 69
70locking rules: 70locking rules:
71 all may block 71 all may block
72 i_mutex(inode) 72 i_rwsem(inode)
73lookup: yes 73lookup: shared
74create: yes 74create: exclusive
75link: yes (both) 75link: exclusive (both)
76mknod: yes 76mknod: exclusive
77symlink: yes 77symlink: exclusive
78mkdir: yes 78mkdir: exclusive
79unlink: yes (both) 79unlink: exclusive (both)
80rmdir: yes (both) (see below) 80rmdir: exclusive (both)(see below)
81rename: yes (all) (see below) 81rename: exclusive (all) (see below)
82readlink: no 82readlink: no
83get_link: no 83get_link: no
84setattr: yes 84setattr: exclusive
85permission: no (may not block if called in rcu-walk mode) 85permission: no (may not block if called in rcu-walk mode)
86get_acl: no 86get_acl: no
87getattr: no 87getattr: no
88listxattr: no 88listxattr: no
89fiemap: no 89fiemap: no
90update_time: no 90update_time: no
91atomic_open: yes 91atomic_open: exclusive
92tmpfile: no 92tmpfile: no
93 93
94 94
95 Additionally, ->rmdir(), ->unlink() and ->rename() have ->i_mutex on 95 Additionally, ->rmdir(), ->unlink() and ->rename() have ->i_rwsem
96victim. 96 exclusive on victim.
97 cross-directory ->rename() has (per-superblock) ->s_vfs_rename_sem. 97 cross-directory ->rename() has (per-superblock) ->s_vfs_rename_sem.
98 98
99See Documentation/filesystems/directory-locking for more detailed discussion 99See Documentation/filesystems/directory-locking for more detailed discussion
@@ -111,10 +111,10 @@ prototypes:
111 111
112locking rules: 112locking rules:
113 all may block 113 all may block
114 i_mutex(inode) 114 i_rwsem(inode)
115list: no 115list: no
116get: no 116get: no
117set: yes 117set: exclusive
118 118
119--------------------------- super_operations --------------------------- 119--------------------------- super_operations ---------------------------
120prototypes: 120prototypes:
@@ -217,14 +217,14 @@ prototypes:
217locking rules: 217locking rules:
218 All except set_page_dirty and freepage may block 218 All except set_page_dirty and freepage may block
219 219
220 PageLocked(page) i_mutex 220 PageLocked(page) i_rwsem
221writepage: yes, unlocks (see below) 221writepage: yes, unlocks (see below)
222readpage: yes, unlocks 222readpage: yes, unlocks
223writepages: 223writepages:
224set_page_dirty no 224set_page_dirty no
225readpages: 225readpages:
226write_begin: locks the page yes 226write_begin: locks the page exclusive
227write_end: yes, unlocks yes 227write_end: yes, unlocks exclusive
228bmap: 228bmap:
229invalidatepage: yes 229invalidatepage: yes
230releasepage: yes 230releasepage: yes
@@ -439,6 +439,7 @@ prototypes:
439 ssize_t (*read_iter) (struct kiocb *, struct iov_iter *); 439 ssize_t (*read_iter) (struct kiocb *, struct iov_iter *);
440 ssize_t (*write_iter) (struct kiocb *, struct iov_iter *); 440 ssize_t (*write_iter) (struct kiocb *, struct iov_iter *);
441 int (*iterate) (struct file *, struct dir_context *); 441 int (*iterate) (struct file *, struct dir_context *);
442 int (*iterate_shared) (struct file *, struct dir_context *);
442 unsigned int (*poll) (struct file *, struct poll_table_struct *); 443 unsigned int (*poll) (struct file *, struct poll_table_struct *);
443 long (*unlocked_ioctl) (struct file *, unsigned int, unsigned long); 444 long (*unlocked_ioctl) (struct file *, unsigned int, unsigned long);
444 long (*compat_ioctl) (struct file *, unsigned int, unsigned long); 445 long (*compat_ioctl) (struct file *, unsigned int, unsigned long);
@@ -480,6 +481,10 @@ mutex or just to use i_size_read() instead.
480Note: this does not protect the file->f_pos against concurrent modifications 481Note: this does not protect the file->f_pos against concurrent modifications
481since this is something the userspace has to take care about. 482since this is something the userspace has to take care about.
482 483
484->iterate() is called with i_rwsem exclusive.
485
486->iterate_shared() is called with i_rwsem at least shared.
487
483->fasync() is responsible for maintaining the FASYNC bit in filp->f_flags. 488->fasync() is responsible for maintaining the FASYNC bit in filp->f_flags.
484Most instances call fasync_helper(), which does that maintenance, so it's 489Most instances call fasync_helper(), which does that maintenance, so it's
485not normally something one needs to worry about. Return values > 0 will be 490not normally something one needs to worry about. Return values > 0 will be