]> git.baikalelectronics.ru Git - kernel.git/commit
vfs: add i_op->atomic_open()
authorMiklos Szeredi <mszeredi@suse.cz>
Tue, 5 Jun 2012 13:10:17 +0000 (15:10 +0200)
committerAl Viro <viro@zeniv.linux.org.uk>
Sat, 14 Jul 2012 12:33:04 +0000 (16:33 +0400)
commitc0864ba75f0553cc9daf6a4b9dbbae5e4e0ca7c2
tree6bbb29aea7e931b603bd4cea3cc74a0eda7b6379
parent72c3b35cf0f9848791d741b834450ec968d93527
vfs: add i_op->atomic_open()

Add a new inode operation which is called on the last component of an open.
Using this the filesystem can look up, possibly create and open the file in one
atomic operation.  If it cannot perform this (e.g. the file type turned out to
be wrong) it may signal this by returning NULL instead of an open struct file
pointer.

i_op->atomic_open() is only called if the last component is negative or needs
lookup.  Handling cached positive dentries here doesn't add much value: these
can be opened using f_op->open().  If the cached file turns out to be invalid,
the open can be retried, this time using ->atomic_open() with a fresh dentry.

For now leave the old way of using open intents in lookup and revalidate in
place.  This will be removed once all the users are converted.

David Howells noticed that if ->atomic_open() opens the file but does not create
it, handle_truncate() will be called on it even if it is not a regular file.
Fix this by checking the file type in this case too.

Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Documentation/filesystems/Locking
Documentation/filesystems/vfs.txt
fs/internal.h
fs/namei.c
fs/open.c
include/linux/fs.h