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