aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation/filesystems/Locking
diff options
context:
space:
mode:
Diffstat (limited to 'Documentation/filesystems/Locking')
-rw-r--r--Documentation/filesystems/Locking35
1 files changed, 24 insertions, 11 deletions
diff --git a/Documentation/filesystems/Locking b/Documentation/filesystems/Locking
index 9858f337529c..fe7afe225381 100644
--- a/Documentation/filesystems/Locking
+++ b/Documentation/filesystems/Locking
@@ -11,10 +11,8 @@ be able to use diff(1).
11prototypes: 11prototypes:
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
70locking rules: 69locking rules:
71 all may block 70 all may block
@@ -93,6 +92,7 @@ removexattr: yes
93fiemap: no 92fiemap: no
94update_time: no 93update_time: no
95atomic_open: yes 94atomic_open: yes
95tmpfile: no
96 96
97 Additionally, ->rmdir(), ->unlink() and ->rename() have ->i_mutex on 97 Additionally, ->rmdir(), ->unlink() and ->rename() have ->i_mutex on
98victim. 98victim.
@@ -344,25 +344,38 @@ prototypes:
344 344
345 345
346locking rules: 346locking rules:
347 file_lock_lock may block 347 inode->i_lock may block
348fl_copy_lock: yes no 348fl_copy_lock: yes no
349fl_release_private: maybe no 349fl_release_private: maybe no
350 350
351----------------------- lock_manager_operations --------------------------- 351----------------------- lock_manager_operations ---------------------------
352prototypes: 352prototypes:
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
359locking rules: 360locking rules:
360 file_lock_lock may block 361
361lm_compare_owner: yes no 362 inode->i_lock blocked_lock_lock may block
362lm_notify: yes no 363lm_compare_owner: yes[1] maybe no
363lm_grant: no no 364lm_owner_key yes[1] yes no
364lm_break: yes no 365lm_notify: yes yes no
365lm_change yes no 366lm_grant: no no no
367lm_break: yes no no
368lm_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
372associated with either file_lock argument! This is the case with deadlock
373detection, since the code has to chase down the owners of locks that may
374be entirely unrelated to the one on which the lock is being acquired.
375For deadlock detection however, the blocked_lock_lock is also held. The
376fact that these locks are held ensures that the file_locks do not
377disappear out from under you while doing the comparison or generating an
378owner key.
366 379
367--------------------------- buffer_head ----------------------------------- 380--------------------------- buffer_head -----------------------------------
368prototypes: 381prototypes: