diff options
Diffstat (limited to 'Documentation/filesystems/Locking')
| -rw-r--r-- | Documentation/filesystems/Locking | 43 |
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 | ||
| 70 | locking rules: | 70 | locking rules: |
| 71 | all may block | 71 | all may block |
| 72 | i_mutex(inode) | 72 | i_rwsem(inode) |
| 73 | lookup: yes | 73 | lookup: shared |
| 74 | create: yes | 74 | create: exclusive |
| 75 | link: yes (both) | 75 | link: exclusive (both) |
| 76 | mknod: yes | 76 | mknod: exclusive |
| 77 | symlink: yes | 77 | symlink: exclusive |
| 78 | mkdir: yes | 78 | mkdir: exclusive |
| 79 | unlink: yes (both) | 79 | unlink: exclusive (both) |
| 80 | rmdir: yes (both) (see below) | 80 | rmdir: exclusive (both)(see below) |
| 81 | rename: yes (all) (see below) | 81 | rename: exclusive (all) (see below) |
| 82 | readlink: no | 82 | readlink: no |
| 83 | get_link: no | 83 | get_link: no |
| 84 | setattr: yes | 84 | setattr: exclusive |
| 85 | permission: no (may not block if called in rcu-walk mode) | 85 | permission: no (may not block if called in rcu-walk mode) |
| 86 | get_acl: no | 86 | get_acl: no |
| 87 | getattr: no | 87 | getattr: no |
| 88 | listxattr: no | 88 | listxattr: no |
| 89 | fiemap: no | 89 | fiemap: no |
| 90 | update_time: no | 90 | update_time: no |
| 91 | atomic_open: yes | 91 | atomic_open: exclusive |
| 92 | tmpfile: no | 92 | tmpfile: no |
| 93 | 93 | ||
| 94 | 94 | ||
| 95 | Additionally, ->rmdir(), ->unlink() and ->rename() have ->i_mutex on | 95 | Additionally, ->rmdir(), ->unlink() and ->rename() have ->i_rwsem |
| 96 | victim. | 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 | ||
| 99 | See Documentation/filesystems/directory-locking for more detailed discussion | 99 | See Documentation/filesystems/directory-locking for more detailed discussion |
| @@ -111,10 +111,10 @@ prototypes: | |||
| 111 | 111 | ||
| 112 | locking rules: | 112 | locking rules: |
| 113 | all may block | 113 | all may block |
| 114 | i_mutex(inode) | 114 | i_rwsem(inode) |
| 115 | list: no | 115 | list: no |
| 116 | get: no | 116 | get: no |
| 117 | set: yes | 117 | set: exclusive |
| 118 | 118 | ||
| 119 | --------------------------- super_operations --------------------------- | 119 | --------------------------- super_operations --------------------------- |
| 120 | prototypes: | 120 | prototypes: |
| @@ -217,14 +217,14 @@ prototypes: | |||
| 217 | locking rules: | 217 | locking 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 |
| 221 | writepage: yes, unlocks (see below) | 221 | writepage: yes, unlocks (see below) |
| 222 | readpage: yes, unlocks | 222 | readpage: yes, unlocks |
| 223 | writepages: | 223 | writepages: |
| 224 | set_page_dirty no | 224 | set_page_dirty no |
| 225 | readpages: | 225 | readpages: |
| 226 | write_begin: locks the page yes | 226 | write_begin: locks the page exclusive |
| 227 | write_end: yes, unlocks yes | 227 | write_end: yes, unlocks exclusive |
| 228 | bmap: | 228 | bmap: |
| 229 | invalidatepage: yes | 229 | invalidatepage: yes |
| 230 | releasepage: yes | 230 | releasepage: 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. | |||
| 480 | Note: this does not protect the file->f_pos against concurrent modifications | 481 | Note: this does not protect the file->f_pos against concurrent modifications |
| 481 | since this is something the userspace has to take care about. | 482 | since 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. |
| 484 | Most instances call fasync_helper(), which does that maintenance, so it's | 489 | Most instances call fasync_helper(), which does that maintenance, so it's |
| 485 | not normally something one needs to worry about. Return values > 0 will be | 490 | not normally something one needs to worry about. Return values > 0 will be |
