diff options
Diffstat (limited to 'Documentation/filesystems/Locking')
-rw-r--r-- | Documentation/filesystems/Locking | 43 |
1 files changed, 28 insertions, 15 deletions
diff --git a/Documentation/filesystems/Locking b/Documentation/filesystems/Locking index 0706d32a61e6..fe7afe225381 100644 --- a/Documentation/filesystems/Locking +++ b/Documentation/filesystems/Locking | |||
@@ -11,10 +11,8 @@ be able to use diff(1). | |||
11 | prototypes: | 11 | prototypes: |
12 | int (*d_revalidate)(struct dentry *, unsigned int); | 12 | int (*d_revalidate)(struct dentry *, unsigned int); |
13 | int (*d_weak_revalidate)(struct dentry *, unsigned int); | 13 | int (*d_weak_revalidate)(struct dentry *, unsigned int); |
14 | int (*d_hash)(const struct dentry *, const struct inode *, | 14 | int (*d_hash)(const struct dentry *, struct qstr *); |
15 | struct qstr *); | 15 | int (*d_compare)(const struct dentry *, const struct dentry *, |
16 | int (*d_compare)(const struct dentry *, const struct inode *, | ||
17 | const struct dentry *, const struct inode *, | ||
18 | unsigned int, const char *, const struct qstr *); | 16 | unsigned int, const char *, const struct qstr *); |
19 | int (*d_delete)(struct dentry *); | 17 | int (*d_delete)(struct dentry *); |
20 | void (*d_release)(struct dentry *); | 18 | void (*d_release)(struct dentry *); |
@@ -66,6 +64,7 @@ prototypes: | |||
66 | int (*atomic_open)(struct inode *, struct dentry *, | 64 | int (*atomic_open)(struct inode *, struct dentry *, |
67 | struct file *, unsigned open_flag, | 65 | struct file *, unsigned open_flag, |
68 | umode_t create_mode, int *opened); | 66 | umode_t create_mode, int *opened); |
67 | int (*tmpfile) (struct inode *, struct dentry *, umode_t); | ||
69 | 68 | ||
70 | locking rules: | 69 | locking rules: |
71 | all may block | 70 | all may block |
@@ -93,6 +92,7 @@ removexattr: yes | |||
93 | fiemap: no | 92 | fiemap: no |
94 | update_time: no | 93 | update_time: no |
95 | atomic_open: yes | 94 | atomic_open: yes |
95 | tmpfile: no | ||
96 | 96 | ||
97 | Additionally, ->rmdir(), ->unlink() and ->rename() have ->i_mutex on | 97 | Additionally, ->rmdir(), ->unlink() and ->rename() have ->i_mutex on |
98 | victim. | 98 | victim. |
@@ -189,7 +189,7 @@ prototypes: | |||
189 | loff_t pos, unsigned len, unsigned copied, | 189 | loff_t pos, unsigned len, unsigned copied, |
190 | struct page *page, void *fsdata); | 190 | struct page *page, void *fsdata); |
191 | sector_t (*bmap)(struct address_space *, sector_t); | 191 | sector_t (*bmap)(struct address_space *, sector_t); |
192 | int (*invalidatepage) (struct page *, unsigned long); | 192 | void (*invalidatepage) (struct page *, unsigned int, unsigned int); |
193 | int (*releasepage) (struct page *, int); | 193 | int (*releasepage) (struct page *, int); |
194 | void (*freepage)(struct page *); | 194 | void (*freepage)(struct page *); |
195 | int (*direct_IO)(int, struct kiocb *, const struct iovec *iov, | 195 | int (*direct_IO)(int, struct kiocb *, const struct iovec *iov, |
@@ -310,8 +310,8 @@ filesystems and by the swapper. The latter will eventually go away. Please, | |||
310 | keep it that way and don't breed new callers. | 310 | keep it that way and don't breed new callers. |
311 | 311 | ||
312 | ->invalidatepage() is called when the filesystem must attempt to drop | 312 | ->invalidatepage() is called when the filesystem must attempt to drop |
313 | some or all of the buffers from the page when it is being truncated. It | 313 | some or all of the buffers from the page when it is being truncated. It |
314 | returns zero on success. If ->invalidatepage is zero, the kernel uses | 314 | returns zero on success. If ->invalidatepage is zero, the kernel uses |
315 | block_invalidatepage() instead. | 315 | block_invalidatepage() instead. |
316 | 316 | ||
317 | ->releasepage() is called when the kernel is about to try to drop the | 317 | ->releasepage() is called when the kernel is about to try to drop the |
@@ -344,25 +344,38 @@ prototypes: | |||
344 | 344 | ||
345 | 345 | ||
346 | locking rules: | 346 | locking rules: |
347 | file_lock_lock may block | 347 | inode->i_lock may block |
348 | fl_copy_lock: yes no | 348 | fl_copy_lock: yes no |
349 | fl_release_private: maybe no | 349 | fl_release_private: maybe no |
350 | 350 | ||
351 | ----------------------- lock_manager_operations --------------------------- | 351 | ----------------------- lock_manager_operations --------------------------- |
352 | prototypes: | 352 | prototypes: |
353 | int (*lm_compare_owner)(struct file_lock *, struct file_lock *); | 353 | int (*lm_compare_owner)(struct file_lock *, struct file_lock *); |
354 | unsigned long (*lm_owner_key)(struct file_lock *); | ||
354 | void (*lm_notify)(struct file_lock *); /* unblock callback */ | 355 | void (*lm_notify)(struct file_lock *); /* unblock callback */ |
355 | int (*lm_grant)(struct file_lock *, struct file_lock *, int); | 356 | int (*lm_grant)(struct file_lock *, struct file_lock *, int); |
356 | void (*lm_break)(struct file_lock *); /* break_lease callback */ | 357 | void (*lm_break)(struct file_lock *); /* break_lease callback */ |
357 | int (*lm_change)(struct file_lock **, int); | 358 | int (*lm_change)(struct file_lock **, int); |
358 | 359 | ||
359 | locking rules: | 360 | locking rules: |
360 | file_lock_lock may block | 361 | |
361 | lm_compare_owner: yes no | 362 | inode->i_lock blocked_lock_lock may block |
362 | lm_notify: yes no | 363 | lm_compare_owner: yes[1] maybe no |
363 | lm_grant: no no | 364 | lm_owner_key yes[1] yes no |
364 | lm_break: yes no | 365 | lm_notify: yes yes no |
365 | lm_change yes no | 366 | lm_grant: no no no |
367 | lm_break: yes no no | ||
368 | lm_change yes no no | ||
369 | |||
370 | [1]: ->lm_compare_owner and ->lm_owner_key are generally called with | ||
371 | *an* inode->i_lock held. It may not be the i_lock of the inode | ||
372 | associated with either file_lock argument! This is the case with deadlock | ||
373 | detection, since the code has to chase down the owners of locks that may | ||
374 | be entirely unrelated to the one on which the lock is being acquired. | ||
375 | For deadlock detection however, the blocked_lock_lock is also held. The | ||
376 | fact that these locks are held ensures that the file_locks do not | ||
377 | disappear out from under you while doing the comparison or generating an | ||
378 | owner key. | ||
366 | 379 | ||
367 | --------------------------- buffer_head ----------------------------------- | 380 | --------------------------- buffer_head ----------------------------------- |
368 | prototypes: | 381 | prototypes: |
@@ -414,7 +427,7 @@ prototypes: | |||
414 | ssize_t (*write) (struct file *, const char __user *, size_t, loff_t *); | 427 | ssize_t (*write) (struct file *, const char __user *, size_t, loff_t *); |
415 | ssize_t (*aio_read) (struct kiocb *, const struct iovec *, unsigned long, loff_t); | 428 | ssize_t (*aio_read) (struct kiocb *, const struct iovec *, unsigned long, loff_t); |
416 | ssize_t (*aio_write) (struct kiocb *, const struct iovec *, unsigned long, loff_t); | 429 | ssize_t (*aio_write) (struct kiocb *, const struct iovec *, unsigned long, loff_t); |
417 | int (*readdir) (struct file *, void *, filldir_t); | 430 | int (*iterate) (struct file *, struct dir_context *); |
418 | unsigned int (*poll) (struct file *, struct poll_table_struct *); | 431 | unsigned int (*poll) (struct file *, struct poll_table_struct *); |
419 | long (*unlocked_ioctl) (struct file *, unsigned int, unsigned long); | 432 | long (*unlocked_ioctl) (struct file *, unsigned int, unsigned long); |
420 | long (*compat_ioctl) (struct file *, unsigned int, unsigned long); | 433 | long (*compat_ioctl) (struct file *, unsigned int, unsigned long); |