aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation/filesystems/Locking
diff options
context:
space:
mode:
Diffstat (limited to 'Documentation/filesystems/Locking')
-rw-r--r--Documentation/filesystems/Locking32
1 files changed, 16 insertions, 16 deletions
diff --git a/Documentation/filesystems/Locking b/Documentation/filesystems/Locking
index d9c37ec4c760..1b3c39a7de62 100644
--- a/Documentation/filesystems/Locking
+++ b/Documentation/filesystems/Locking
@@ -15,11 +15,14 @@ prototypes:
15 int (*d_compare)(const struct dentry *, const struct dentry *, 15 int (*d_compare)(const struct dentry *, const struct dentry *,
16 unsigned int, const char *, const struct qstr *); 16 unsigned int, const char *, const struct qstr *);
17 int (*d_delete)(struct dentry *); 17 int (*d_delete)(struct dentry *);
18 int (*d_init)(struct dentry *);
18 void (*d_release)(struct dentry *); 19 void (*d_release)(struct dentry *);
19 void (*d_iput)(struct dentry *, struct inode *); 20 void (*d_iput)(struct dentry *, struct inode *);
20 char *(*d_dname)((struct dentry *dentry, char *buffer, int buflen); 21 char *(*d_dname)((struct dentry *dentry, char *buffer, int buflen);
21 struct vfsmount *(*d_automount)(struct path *path); 22 struct vfsmount *(*d_automount)(struct path *path);
22 int (*d_manage)(struct dentry *, bool); 23 int (*d_manage)(struct dentry *, bool);
24 struct dentry *(*d_real)(struct dentry *, const struct inode *,
25 unsigned int);
23 26
24locking rules: 27locking rules:
25 rename_lock ->d_lock may block rcu-walk 28 rename_lock ->d_lock may block rcu-walk
@@ -28,12 +31,14 @@ d_weak_revalidate:no no yes no
28d_hash no no no maybe 31d_hash no no no maybe
29d_compare: yes no no maybe 32d_compare: yes no no maybe
30d_delete: no yes no no 33d_delete: no yes no no
34d_init: no no yes no
31d_release: no no yes no 35d_release: no no yes no
32d_prune: no yes no no 36d_prune: no yes no no
33d_iput: no no yes no 37d_iput: no no yes no
34d_dname: no no no no 38d_dname: no no no no
35d_automount: no no yes no 39d_automount: no no yes no
36d_manage: no no yes (ref-walk) maybe 40d_manage: no no yes (ref-walk) maybe
41d_real no no yes no
37 42
38--------------------------- inode_operations --------------------------- 43--------------------------- inode_operations ---------------------------
39prototypes: 44prototypes:
@@ -66,7 +71,6 @@ prototypes:
66 struct file *, unsigned open_flag, 71 struct file *, unsigned open_flag,
67 umode_t create_mode, int *opened); 72 umode_t create_mode, int *opened);
68 int (*tmpfile) (struct inode *, struct dentry *, umode_t); 73 int (*tmpfile) (struct inode *, struct dentry *, umode_t);
69 int (*dentry_open)(struct dentry *, struct file *, const struct cred *);
70 74
71locking rules: 75locking rules:
72 all may block 76 all may block
@@ -95,7 +99,6 @@ fiemap: no
95update_time: no 99update_time: no
96atomic_open: yes 100atomic_open: yes
97tmpfile: no 101tmpfile: no
98dentry_open: no
99 102
100 Additionally, ->rmdir(), ->unlink() and ->rename() have ->i_mutex on 103 Additionally, ->rmdir(), ->unlink() and ->rename() have ->i_mutex on
101victim. 104victim.
@@ -179,7 +182,6 @@ unlocks and drops the reference.
179prototypes: 182prototypes:
180 int (*writepage)(struct page *page, struct writeback_control *wbc); 183 int (*writepage)(struct page *page, struct writeback_control *wbc);
181 int (*readpage)(struct file *, struct page *); 184 int (*readpage)(struct file *, struct page *);
182 int (*sync_page)(struct page *);
183 int (*writepages)(struct address_space *, struct writeback_control *); 185 int (*writepages)(struct address_space *, struct writeback_control *);
184 int (*set_page_dirty)(struct page *page); 186 int (*set_page_dirty)(struct page *page);
185 int (*readpages)(struct file *filp, struct address_space *mapping, 187 int (*readpages)(struct file *filp, struct address_space *mapping,
@@ -195,7 +197,9 @@ prototypes:
195 int (*releasepage) (struct page *, int); 197 int (*releasepage) (struct page *, int);
196 void (*freepage)(struct page *); 198 void (*freepage)(struct page *);
197 int (*direct_IO)(struct kiocb *, struct iov_iter *iter); 199 int (*direct_IO)(struct kiocb *, struct iov_iter *iter);
200 bool (*isolate_page) (struct page *, isolate_mode_t);
198 int (*migratepage)(struct address_space *, struct page *, struct page *); 201 int (*migratepage)(struct address_space *, struct page *, struct page *);
202 void (*putback_page) (struct page *);
199 int (*launder_page)(struct page *); 203 int (*launder_page)(struct page *);
200 int (*is_partially_uptodate)(struct page *, unsigned long, unsigned long); 204 int (*is_partially_uptodate)(struct page *, unsigned long, unsigned long);
201 int (*error_remove_page)(struct address_space *, struct page *); 205 int (*error_remove_page)(struct address_space *, struct page *);
@@ -208,7 +212,6 @@ locking rules:
208 PageLocked(page) i_mutex 212 PageLocked(page) i_mutex
209writepage: yes, unlocks (see below) 213writepage: yes, unlocks (see below)
210readpage: yes, unlocks 214readpage: yes, unlocks
211sync_page: maybe
212writepages: 215writepages:
213set_page_dirty no 216set_page_dirty no
214readpages: 217readpages:
@@ -219,15 +222,17 @@ invalidatepage: yes
219releasepage: yes 222releasepage: yes
220freepage: yes 223freepage: yes
221direct_IO: 224direct_IO:
225isolate_page: yes
222migratepage: yes (both) 226migratepage: yes (both)
227putback_page: yes
223launder_page: yes 228launder_page: yes
224is_partially_uptodate: yes 229is_partially_uptodate: yes
225error_remove_page: yes 230error_remove_page: yes
226swap_activate: no 231swap_activate: no
227swap_deactivate: no 232swap_deactivate: no
228 233
229 ->write_begin(), ->write_end(), ->sync_page() and ->readpage() 234 ->write_begin(), ->write_end() and ->readpage() may be called from
230may be called from the request handler (/dev/loop). 235the request handler (/dev/loop).
231 236
232 ->readpage() unlocks the page, either synchronously or via I/O 237 ->readpage() unlocks the page, either synchronously or via I/O
233completion. 238completion.
@@ -283,11 +288,6 @@ will leave the page itself marked clean but it will be tagged as dirty in the
283radix tree. This incoherency can lead to all sorts of hard-to-debug problems 288radix tree. This incoherency can lead to all sorts of hard-to-debug problems
284in the filesystem like having dirty inodes at umount and losing written data. 289in the filesystem like having dirty inodes at umount and losing written data.
285 290
286 ->sync_page() locking rules are not well-defined - usually it is called
287with lock on page, but that is not guaranteed. Considering the currently
288existing instances of this method ->sync_page() itself doesn't look
289well-defined...
290
291 ->writepages() is used for periodic writeback and for syscall-initiated 291 ->writepages() is used for periodic writeback and for syscall-initiated
292sync operations. The address_space should start I/O against at least 292sync operations. The address_space should start I/O against at least
293*nr_to_write pages. *nr_to_write must be decremented for each page which is 293*nr_to_write pages. *nr_to_write must be decremented for each page which is
@@ -544,13 +544,13 @@ subsequent truncate), and then return with VM_FAULT_LOCKED, and the page
544locked. The VM will unlock the page. 544locked. The VM will unlock the page.
545 545
546 ->map_pages() is called when VM asks to map easy accessible pages. 546 ->map_pages() is called when VM asks to map easy accessible pages.
547Filesystem should find and map pages associated with offsets from "pgoff" 547Filesystem should find and map pages associated with offsets from "start_pgoff"
548till "max_pgoff". ->map_pages() is called with page table locked and must 548till "end_pgoff". ->map_pages() is called with page table locked and must
549not block. If it's not possible to reach a page without blocking, 549not block. If it's not possible to reach a page without blocking,
550filesystem should skip it. Filesystem should use do_set_pte() to setup 550filesystem should skip it. Filesystem should use do_set_pte() to setup
551page table entry. Pointer to entry associated with offset "pgoff" is 551page table entry. Pointer to entry associated with the page is passed in
552passed in "pte" field in vm_fault structure. Pointers to entries for other 552"pte" field in fault_env structure. Pointers to entries for other offsets
553offsets should be calculated relative to "pte". 553should be calculated relative to "pte".
554 554
555 ->page_mkwrite() is called when a previously read-only pte is 555 ->page_mkwrite() is called when a previously read-only pte is
556about to become writeable. The filesystem again must ensure that there are 556about to become writeable. The filesystem again must ensure that there are