blob: 8362860e21a7d6b4db3595e83905b32b25e55ecf [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001 The text below describes the locking rules for VFS-related methods.
2It is (believed to be) up-to-date. *Please*, if you change anything in
3prototypes or locking protocols - update this file. And update the relevant
4instances in the tree, don't leave that to maintainers of filesystems/devices/
5etc. At the very least, put the list of dubious cases in the end of this file.
6Don't turn it into log - maintainers of out-of-the-tree code are supposed to
7be able to use diff(1).
8 Thing currently missing here: socket operations. Alexey?
9
10--------------------------- dentry_operations --------------------------
11prototypes:
12 int (*d_revalidate)(struct dentry *, int);
13 int (*d_hash) (struct dentry *, struct qstr *);
14 int (*d_compare) (struct dentry *, struct qstr *, struct qstr *);
15 int (*d_delete)(struct dentry *);
16 void (*d_release)(struct dentry *);
17 void (*d_iput)(struct dentry *, struct inode *);
Eric Dumazetc23fbb62007-05-08 00:26:18 -070018 char *(*d_dname)((struct dentry *dentry, char *buffer, int buflen);
Linus Torvalds1da177e2005-04-16 15:20:36 -070019
20locking rules:
21 none have BKL
22 dcache_lock rename_lock ->d_lock may block
23d_revalidate: no no no yes
24d_hash no no no yes
25d_compare: no yes no no
26d_delete: yes no yes no
27d_release: no no no yes
28d_iput: no no no yes
Eric Dumazetc23fbb62007-05-08 00:26:18 -070029d_dname: no no no no
Linus Torvalds1da177e2005-04-16 15:20:36 -070030
31--------------------------- inode_operations ---------------------------
32prototypes:
33 int (*create) (struct inode *,struct dentry *,int, struct nameidata *);
34 struct dentry * (*lookup) (struct inode *,struct dentry *, struct nameid
35ata *);
36 int (*link) (struct dentry *,struct inode *,struct dentry *);
37 int (*unlink) (struct inode *,struct dentry *);
38 int (*symlink) (struct inode *,struct dentry *,const char *);
39 int (*mkdir) (struct inode *,struct dentry *,int);
40 int (*rmdir) (struct inode *,struct dentry *);
41 int (*mknod) (struct inode *,struct dentry *,int,dev_t);
42 int (*rename) (struct inode *, struct dentry *,
43 struct inode *, struct dentry *);
44 int (*readlink) (struct dentry *, char __user *,int);
45 int (*follow_link) (struct dentry *, struct nameidata *);
46 void (*truncate) (struct inode *);
47 int (*permission) (struct inode *, int, struct nameidata *);
48 int (*setattr) (struct dentry *, struct iattr *);
49 int (*getattr) (struct vfsmount *, struct dentry *, struct kstat *);
50 int (*setxattr) (struct dentry *, const char *,const void *,size_t,int);
51 ssize_t (*getxattr) (struct dentry *, const char *, void *, size_t);
52 ssize_t (*listxattr) (struct dentry *, char *, size_t);
53 int (*removexattr) (struct dentry *, const char *);
54
55locking rules:
56 all may block, none have BKL
Artem Bityutskiya7bc02f2007-05-09 07:53:16 +020057 i_mutex(inode)
Linus Torvalds1da177e2005-04-16 15:20:36 -070058lookup: yes
59create: yes
60link: yes (both)
61mknod: yes
62symlink: yes
63mkdir: yes
64unlink: yes (both)
65rmdir: yes (both) (see below)
66rename: yes (all) (see below)
67readlink: no
68follow_link: no
69truncate: yes (see below)
70setattr: yes
71permission: no
72getattr: no
73setxattr: yes
74getxattr: no
75listxattr: no
76removexattr: yes
Artem Bityutskiya7bc02f2007-05-09 07:53:16 +020077 Additionally, ->rmdir(), ->unlink() and ->rename() have ->i_mutex on
Linus Torvalds1da177e2005-04-16 15:20:36 -070078victim.
79 cross-directory ->rename() has (per-superblock) ->s_vfs_rename_sem.
80 ->truncate() is never called directly - it's a callback, not a
81method. It's called by vmtruncate() - library function normally used by
82->setattr(). Locking information above applies to that call (i.e. is
83inherited from ->setattr() - vmtruncate() is used when ATTR_SIZE had been
84passed).
85
86See Documentation/filesystems/directory-locking for more detailed discussion
87of the locking scheme for directory operations.
88
89--------------------------- super_operations ---------------------------
90prototypes:
91 struct inode *(*alloc_inode)(struct super_block *sb);
92 void (*destroy_inode)(struct inode *);
Linus Torvalds1da177e2005-04-16 15:20:36 -070093 void (*dirty_inode) (struct inode *);
94 int (*write_inode) (struct inode *, int);
Linus Torvalds1da177e2005-04-16 15:20:36 -070095 void (*drop_inode) (struct inode *);
96 void (*delete_inode) (struct inode *);
97 void (*put_super) (struct super_block *);
98 void (*write_super) (struct super_block *);
99 int (*sync_fs)(struct super_block *sb, int wait);
100 void (*write_super_lockfs) (struct super_block *);
101 void (*unlockfs) (struct super_block *);
David Howells726c3342006-06-23 02:02:58 -0700102 int (*statfs) (struct dentry *, struct kstatfs *);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700103 int (*remount_fs) (struct super_block *, int *, char *);
104 void (*clear_inode) (struct inode *);
105 void (*umount_begin) (struct super_block *);
106 int (*show_options)(struct seq_file *, struct vfsmount *);
107 ssize_t (*quota_read)(struct super_block *, int, char *, size_t, loff_t);
108 ssize_t (*quota_write)(struct super_block *, int, const char *, size_t, loff_t);
109
110locking rules:
111 All may block.
112 BKL s_lock s_umount
113alloc_inode: no no no
114destroy_inode: no
Linus Torvalds1da177e2005-04-16 15:20:36 -0700115dirty_inode: no (must not sleep)
116write_inode: no
Linus Torvalds1da177e2005-04-16 15:20:36 -0700117drop_inode: no !!!inode_lock!!!
118delete_inode: no
119put_super: yes yes no
120write_super: no yes read
121sync_fs: no no read
122write_super_lockfs: ?
123unlockfs: ?
124statfs: no no no
Vasily Averin70888bd2006-12-06 20:37:23 -0800125remount_fs: yes yes maybe (see below)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700126clear_inode: no
127umount_begin: yes no no
128show_options: no (vfsmount->sem)
129quota_read: no no no (see below)
130quota_write: no no no (see below)
131
Linus Torvalds1da177e2005-04-16 15:20:36 -0700132->remount_fs() will have the s_umount lock if it's already mounted.
133When called from get_sb_single, it does NOT have the s_umount lock.
134->quota_read() and ->quota_write() functions are both guaranteed to
135be the only ones operating on the quota file by the quota code (via
136dqio_sem) (unless an admin really wants to screw up something and
137writes to quota files with quotas on). For other details about locking
138see also dquot_operations section.
139
140--------------------------- file_system_type ---------------------------
141prototypes:
Jonathan Corbet5d8b2eb2006-07-10 04:44:07 -0700142 int (*get_sb) (struct file_system_type *, int,
143 const char *, void *, struct vfsmount *);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700144 void (*kill_sb) (struct super_block *);
145locking rules:
146 may block BKL
Christoph Hellwigadaae722008-09-09 20:02:01 +0200147get_sb yes no
148kill_sb yes no
Linus Torvalds1da177e2005-04-16 15:20:36 -0700149
David Howells454e2392006-06-23 02:02:57 -0700150->get_sb() returns error or 0 with locked superblock attached to the vfsmount
151(exclusive on ->s_umount).
Linus Torvalds1da177e2005-04-16 15:20:36 -0700152->kill_sb() takes a write-locked superblock, does all shutdown work on it,
153unlocks and drops the reference.
154
155--------------------------- address_space_operations --------------------------
156prototypes:
157 int (*writepage)(struct page *page, struct writeback_control *wbc);
158 int (*readpage)(struct file *, struct page *);
159 int (*sync_page)(struct page *);
160 int (*writepages)(struct address_space *, struct writeback_control *);
161 int (*set_page_dirty)(struct page *page);
162 int (*readpages)(struct file *filp, struct address_space *mapping,
163 struct list_head *pages, unsigned nr_pages);
164 int (*prepare_write)(struct file *, struct page *, unsigned, unsigned);
165 int (*commit_write)(struct file *, struct page *, unsigned, unsigned);
166 sector_t (*bmap)(struct address_space *, sector_t);
167 int (*invalidatepage) (struct page *, unsigned long);
168 int (*releasepage) (struct page *, int);
169 int (*direct_IO)(int, struct kiocb *, const struct iovec *iov,
170 loff_t offset, unsigned long nr_segs);
Trond Myklebuste3db7692007-01-10 23:15:39 -0800171 int (*launder_page) (struct page *);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700172
173locking rules:
174 All except set_page_dirty may block
175
Nick Pigginafddba42007-10-16 01:25:01 -0700176 BKL PageLocked(page) i_sem
Linus Torvalds1da177e2005-04-16 15:20:36 -0700177writepage: no yes, unlocks (see below)
178readpage: no yes, unlocks
179sync_page: no maybe
180writepages: no
181set_page_dirty no no
182readpages: no
Nick Pigginafddba42007-10-16 01:25:01 -0700183prepare_write: no yes yes
184commit_write: no yes yes
185write_begin: no locks the page yes
186write_end: no yes, unlocks yes
187perform_write: no n/a yes
Linus Torvalds1da177e2005-04-16 15:20:36 -0700188bmap: yes
189invalidatepage: no yes
190releasepage: no yes
191direct_IO: no
Trond Myklebuste3db7692007-01-10 23:15:39 -0800192launder_page: no yes
Linus Torvalds1da177e2005-04-16 15:20:36 -0700193
194 ->prepare_write(), ->commit_write(), ->sync_page() and ->readpage()
195may be called from the request handler (/dev/loop).
196
197 ->readpage() unlocks the page, either synchronously or via I/O
198completion.
199
200 ->readpages() populates the pagecache with the passed pages and starts
201I/O against them. They come unlocked upon I/O completion.
202
203 ->writepage() is used for two purposes: for "memory cleansing" and for
204"sync". These are quite different operations and the behaviour may differ
205depending upon the mode.
206
207If writepage is called for sync (wbc->sync_mode != WBC_SYNC_NONE) then
208it *must* start I/O against the page, even if that would involve
209blocking on in-progress I/O.
210
211If writepage is called for memory cleansing (sync_mode ==
212WBC_SYNC_NONE) then its role is to get as much writeout underway as
213possible. So writepage should try to avoid blocking against
214currently-in-progress I/O.
215
216If the filesystem is not called for "sync" and it determines that it
217would need to block against in-progress I/O to be able to start new I/O
218against the page the filesystem should redirty the page with
219redirty_page_for_writepage(), then unlock the page and return zero.
220This may also be done to avoid internal deadlocks, but rarely.
221
Robert P. J. Day3a4fa0a2007-10-19 23:10:43 +0200222If the filesystem is called for sync then it must wait on any
Linus Torvalds1da177e2005-04-16 15:20:36 -0700223in-progress I/O and then start new I/O.
224
Nikita Danilov20546062005-05-01 08:58:37 -0700225The filesystem should unlock the page synchronously, before returning to the
226caller, unless ->writepage() returns special WRITEPAGE_ACTIVATE
227value. WRITEPAGE_ACTIVATE means that page cannot really be written out
228currently, and VM should stop calling ->writepage() on this page for some
229time. VM does this by moving page to the head of the active list, hence the
230name.
Linus Torvalds1da177e2005-04-16 15:20:36 -0700231
232Unless the filesystem is going to redirty_page_for_writepage(), unlock the page
233and return zero, writepage *must* run set_page_writeback() against the page,
234followed by unlocking it. Once set_page_writeback() has been run against the
235page, write I/O can be submitted and the write I/O completion handler must run
236end_page_writeback() once the I/O is complete. If no I/O is submitted, the
237filesystem must run end_page_writeback() against the page before returning from
238writepage.
239
240That is: after 2.5.12, pages which are under writeout are *not* locked. Note,
241if the filesystem needs the page to be locked during writeout, that is ok, too,
242the page is allowed to be unlocked at any point in time between the calls to
243set_page_writeback() and end_page_writeback().
244
245Note, failure to run either redirty_page_for_writepage() or the combination of
246set_page_writeback()/end_page_writeback() on a page submitted to writepage
247will leave the page itself marked clean but it will be tagged as dirty in the
248radix tree. This incoherency can lead to all sorts of hard-to-debug problems
249in the filesystem like having dirty inodes at umount and losing written data.
250
251 ->sync_page() locking rules are not well-defined - usually it is called
252with lock on page, but that is not guaranteed. Considering the currently
253existing instances of this method ->sync_page() itself doesn't look
254well-defined...
255
256 ->writepages() is used for periodic writeback and for syscall-initiated
257sync operations. The address_space should start I/O against at least
258*nr_to_write pages. *nr_to_write must be decremented for each page which is
259written. The address_space implementation may write more (or less) pages
260than *nr_to_write asks for, but it should try to be reasonably close. If
261nr_to_write is NULL, all dirty pages must be written.
262
263writepages should _only_ write pages which are present on
264mapping->io_pages.
265
266 ->set_page_dirty() is called from various places in the kernel
267when the target page is marked as needing writeback. It may be called
268under spinlock (it cannot block) and is sometimes called with the page
269not locked.
270
271 ->bmap() is currently used by legacy ioctl() (FIBMAP) provided by some
272filesystems and by the swapper. The latter will eventually go away. All
273instances do not actually need the BKL. Please, keep it that way and don't
274breed new callers.
275
276 ->invalidatepage() is called when the filesystem must attempt to drop
277some or all of the buffers from the page when it is being truncated. It
278returns zero on success. If ->invalidatepage is zero, the kernel uses
279block_invalidatepage() instead.
280
281 ->releasepage() is called when the kernel is about to try to drop the
282buffers from the page in preparation for freeing it. It returns zero to
283indicate that the buffers are (or may be) freeable. If ->releasepage is zero,
284the kernel assumes that the fs has no private interest in the buffers.
285
Trond Myklebuste3db7692007-01-10 23:15:39 -0800286 ->launder_page() may be called prior to releasing a page if
287it is still found to be dirty. It returns zero if the page was successfully
288cleaned, or an error value if not. Note that in order to prevent the page
289getting mapped back in and redirtied, it needs to be kept locked
290across the entire operation.
291
Linus Torvalds1da177e2005-04-16 15:20:36 -0700292 Note: currently almost all instances of address_space methods are
293using BKL for internal serialization and that's one of the worst sources
294of contention. Normally they are calling library functions (in fs/buffer.c)
295and pass foo_get_block() as a callback (on local block-based filesystems,
296indeed). BKL is not needed for library stuff and is usually taken by
297foo_get_block(). It's an overkill, since block bitmaps can be protected by
298internal fs locking and real critical areas are much smaller than the areas
299filesystems protect now.
300
301----------------------- file_lock_operations ------------------------------
302prototypes:
303 void (*fl_insert)(struct file_lock *); /* lock insertion callback */
304 void (*fl_remove)(struct file_lock *); /* lock removal callback */
305 void (*fl_copy_lock)(struct file_lock *, struct file_lock *);
306 void (*fl_release_private)(struct file_lock *);
307
308
309locking rules:
310 BKL may block
311fl_insert: yes no
312fl_remove: yes no
313fl_copy_lock: yes no
314fl_release_private: yes yes
315
316----------------------- lock_manager_operations ---------------------------
317prototypes:
318 int (*fl_compare_owner)(struct file_lock *, struct file_lock *);
319 void (*fl_notify)(struct file_lock *); /* unblock callback */
320 void (*fl_copy_lock)(struct file_lock *, struct file_lock *);
321 void (*fl_release_private)(struct file_lock *);
322 void (*fl_break)(struct file_lock *); /* break_lease callback */
323
324locking rules:
325 BKL may block
326fl_compare_owner: yes no
327fl_notify: yes no
328fl_copy_lock: yes no
329fl_release_private: yes yes
330fl_break: yes no
331
332 Currently only NFSD and NLM provide instances of this class. None of the
333them block. If you have out-of-tree instances - please, show up. Locking
334in that area will change.
335--------------------------- buffer_head -----------------------------------
336prototypes:
337 void (*b_end_io)(struct buffer_head *bh, int uptodate);
338
339locking rules:
340 called from interrupts. In other words, extreme care is needed here.
341bh is locked, but that's all warranties we have here. Currently only RAID1,
342highmem, fs/buffer.c, and fs/ntfs/aops.c are providing these. Block devices
343call this method upon the IO completion.
344
345--------------------------- block_device_operations -----------------------
346prototypes:
347 int (*open) (struct inode *, struct file *);
348 int (*release) (struct inode *, struct file *);
349 int (*ioctl) (struct inode *, struct file *, unsigned, unsigned long);
350 int (*media_changed) (struct gendisk *);
351 int (*revalidate_disk) (struct gendisk *);
352
353locking rules:
354 BKL bd_sem
355open: yes yes
356release: yes yes
357ioctl: yes no
358media_changed: no no
359revalidate_disk: no no
360
361The last two are called only from check_disk_change().
362
363--------------------------- file_operations -------------------------------
364prototypes:
365 loff_t (*llseek) (struct file *, loff_t, int);
366 ssize_t (*read) (struct file *, char __user *, size_t, loff_t *);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700367 ssize_t (*write) (struct file *, const char __user *, size_t, loff_t *);
Badari Pulavarty027445c2006-09-30 23:28:46 -0700368 ssize_t (*aio_read) (struct kiocb *, const struct iovec *, unsigned long, loff_t);
369 ssize_t (*aio_write) (struct kiocb *, const struct iovec *, unsigned long, loff_t);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700370 int (*readdir) (struct file *, void *, filldir_t);
371 unsigned int (*poll) (struct file *, struct poll_table_struct *);
372 int (*ioctl) (struct inode *, struct file *, unsigned int,
373 unsigned long);
374 long (*unlocked_ioctl) (struct file *, unsigned int, unsigned long);
375 long (*compat_ioctl) (struct file *, unsigned int, unsigned long);
376 int (*mmap) (struct file *, struct vm_area_struct *);
377 int (*open) (struct inode *, struct file *);
378 int (*flush) (struct file *);
379 int (*release) (struct inode *, struct file *);
380 int (*fsync) (struct file *, struct dentry *, int datasync);
381 int (*aio_fsync) (struct kiocb *, int datasync);
382 int (*fasync) (int, struct file *, int);
383 int (*lock) (struct file *, int, struct file_lock *);
384 ssize_t (*readv) (struct file *, const struct iovec *, unsigned long,
385 loff_t *);
386 ssize_t (*writev) (struct file *, const struct iovec *, unsigned long,
387 loff_t *);
388 ssize_t (*sendfile) (struct file *, loff_t *, size_t, read_actor_t,
389 void __user *);
390 ssize_t (*sendpage) (struct file *, struct page *, int, size_t,
391 loff_t *, int);
392 unsigned long (*get_unmapped_area)(struct file *, unsigned long,
393 unsigned long, unsigned long, unsigned long);
394 int (*check_flags)(int);
395 int (*dir_notify)(struct file *, unsigned long);
396};
397
398locking rules:
399 All except ->poll() may block.
400 BKL
401llseek: no (see below)
402read: no
403aio_read: no
404write: no
405aio_write: no
406readdir: no
407poll: no
408ioctl: yes (see below)
409unlocked_ioctl: no (see below)
410compat_ioctl: no
411mmap: no
Christoph Hellwigadaae722008-09-09 20:02:01 +0200412open: no
Linus Torvalds1da177e2005-04-16 15:20:36 -0700413flush: no
414release: no
415fsync: no (see below)
416aio_fsync: no
Christoph Hellwigadaae722008-09-09 20:02:01 +0200417fasync: no
Linus Torvalds1da177e2005-04-16 15:20:36 -0700418lock: yes
419readv: no
420writev: no
421sendfile: no
422sendpage: no
423get_unmapped_area: no
424check_flags: no
425dir_notify: no
426
427->llseek() locking has moved from llseek to the individual llseek
428implementations. If your fs is not using generic_file_llseek, you
429need to acquire and release the appropriate locks in your ->llseek().
430For many filesystems, it is probably safe to acquire the inode
431semaphore. Note some filesystems (i.e. remote ones) provide no
432protection for i_size so you will need to use the BKL.
433
Linus Torvalds1da177e2005-04-16 15:20:36 -0700434Note: ext2_release() was *the* source of contention on fs-intensive
435loads and dropping BKL on ->release() helps to get rid of that (we still
436grab BKL for cases when we close a file that had been opened r/w, but that
437can and should be done using the internal locking with smaller critical areas).
438Current worst offender is ext2_get_block()...
439
440->fasync() is a mess. This area needs a big cleanup and that will probably
441affect locking.
442
443->readdir() and ->ioctl() on directories must be changed. Ideally we would
444move ->readdir() to inode_operations and use a separate method for directory
445->ioctl() or kill the latter completely. One of the problems is that for
446anything that resembles union-mount we won't have a struct file for all
447components. And there are other reasons why the current interface is a mess...
448
449->ioctl() on regular files is superceded by the ->unlocked_ioctl() that
450doesn't take the BKL.
451
452->read on directories probably must go away - we should just enforce -EISDIR
453in sys_read() and friends.
454
Artem Bityutskiya7bc02f2007-05-09 07:53:16 +0200455->fsync() has i_mutex on inode.
Linus Torvalds1da177e2005-04-16 15:20:36 -0700456
457--------------------------- dquot_operations -------------------------------
458prototypes:
459 int (*initialize) (struct inode *, int);
460 int (*drop) (struct inode *);
461 int (*alloc_space) (struct inode *, qsize_t, int);
462 int (*alloc_inode) (const struct inode *, unsigned long);
463 int (*free_space) (struct inode *, qsize_t);
464 int (*free_inode) (const struct inode *, unsigned long);
465 int (*transfer) (struct inode *, struct iattr *);
466 int (*write_dquot) (struct dquot *);
467 int (*acquire_dquot) (struct dquot *);
468 int (*release_dquot) (struct dquot *);
469 int (*mark_dirty) (struct dquot *);
470 int (*write_info) (struct super_block *, int);
471
472These operations are intended to be more or less wrapping functions that ensure
473a proper locking wrt the filesystem and call the generic quota operations.
474
475What filesystem should expect from the generic quota functions:
476
477 FS recursion Held locks when called
478initialize: yes maybe dqonoff_sem
479drop: yes -
480alloc_space: ->mark_dirty() -
481alloc_inode: ->mark_dirty() -
482free_space: ->mark_dirty() -
483free_inode: ->mark_dirty() -
484transfer: yes -
485write_dquot: yes dqonoff_sem or dqptr_sem
486acquire_dquot: yes dqonoff_sem or dqptr_sem
487release_dquot: yes dqonoff_sem or dqptr_sem
488mark_dirty: no -
489write_info: yes dqonoff_sem
490
491FS recursion means calling ->quota_read() and ->quota_write() from superblock
492operations.
493
494->alloc_space(), ->alloc_inode(), ->free_space(), ->free_inode() are called
495only directly by the filesystem and do not call any fs functions only
496the ->mark_dirty() operation.
497
498More details about quota locking can be found in fs/dquot.c.
499
500--------------------------- vm_operations_struct -----------------------------
501prototypes:
502 void (*open)(struct vm_area_struct*);
503 void (*close)(struct vm_area_struct*);
Nick Piggind0217ac2007-07-19 01:47:03 -0700504 int (*fault)(struct vm_area_struct*, struct vm_fault *);
Mark Fashehed2f2f92007-07-19 01:47:01 -0700505 int (*page_mkwrite)(struct vm_area_struct *, struct page *);
Rik van Riel28b2ee22008-07-23 21:27:05 -0700506 int (*access)(struct vm_area_struct *, unsigned long, void*, int, int);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700507
508locking rules:
Mark Fashehed2f2f92007-07-19 01:47:01 -0700509 BKL mmap_sem PageLocked(page)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700510open: no yes
511close: no yes
Nick Piggin54cb8822007-07-19 01:46:59 -0700512fault: no yes
Mark Fashehed2f2f92007-07-19 01:47:01 -0700513page_mkwrite: no yes no
Rik van Riel28b2ee22008-07-23 21:27:05 -0700514access: no yes
Mark Fashehed2f2f92007-07-19 01:47:01 -0700515
516 ->page_mkwrite() is called when a previously read-only page is
517about to become writeable. The file system is responsible for
518protecting against truncate races. Once appropriate action has been
519taking to lock out truncate, the page range should be verified to be
520within i_size. The page mapping should also be checked that it is not
521NULL.
Linus Torvalds1da177e2005-04-16 15:20:36 -0700522
Rik van Riel28b2ee22008-07-23 21:27:05 -0700523 ->access() is called when get_user_pages() fails in
524acces_process_vm(), typically used to debug a process through
525/proc/pid/mem or ptrace. This function is needed only for
526VM_IO | VM_PFNMAP VMAs.
527
Linus Torvalds1da177e2005-04-16 15:20:36 -0700528================================================================================
529 Dubious stuff
530
531(if you break something or notice that it is broken and do not fix it yourself
532- at least put it here)
533
534ipc/shm.c::shm_delete() - may need BKL.
535->read() and ->write() in many drivers are (probably) missing BKL.