aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-07-03 12:10:19 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2013-07-03 12:10:19 -0400
commit790eac5640abf7a57fa3a644386df330e18c11b0 (patch)
tree08de20bde44f59e51b91ff473a71047c2957e8c9 /include
parent0b0585c3e192967cb2ef0ac0816eb8a8c8d99840 (diff)
parent48bde8d3620f5f3c6ae9ff599eb404055ae51664 (diff)
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull second set of VFS changes from Al Viro: "Assorted f_pos race fixes, making do_splice_direct() safe to call with i_mutex on parent, O_TMPFILE support, Jeff's locks.c series, ->d_hash/->d_compare calling conventions changes from Linus, misc stuff all over the place." * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: (63 commits) Document ->tmpfile() ext4: ->tmpfile() support vfs: export lseek_execute() to modules lseek_execute() doesn't need an inode passed to it block_dev: switch to fixed_size_llseek() cpqphp_sysfs: switch to fixed_size_llseek() tile-srom: switch to fixed_size_llseek() proc_powerpc: switch to fixed_size_llseek() ubi/cdev: switch to fixed_size_llseek() pci/proc: switch to fixed_size_llseek() isapnp: switch to fixed_size_llseek() lpfc: switch to fixed_size_llseek() locks: give the blocked_hash its own spinlock locks: add a new "lm_owner_key" lock operation locks: turn the blocked_list into a hashtable locks: convert fl_link to a hlist_node locks: avoid taking global lock if possible when waking up blocked waiters locks: protect most of the file_lock handling with i_lock locks: encapsulate the fl_link list handling locks: make "added" in __posix_lock_file a bool ...
Diffstat (limited to 'include')
-rw-r--r--include/linux/dcache.h11
-rw-r--r--include/linux/fs.h49
-rw-r--r--include/linux/fsnotify.h8
-rw-r--r--include/uapi/asm-generic/fcntl.h4
4 files changed, 40 insertions, 32 deletions
diff --git a/include/linux/dcache.h b/include/linux/dcache.h
index 1a6bb81f0fe5..f42dbe145479 100644
--- a/include/linux/dcache.h
+++ b/include/linux/dcache.h
@@ -146,10 +146,8 @@ enum dentry_d_lock_class
146struct dentry_operations { 146struct dentry_operations {
147 int (*d_revalidate)(struct dentry *, unsigned int); 147 int (*d_revalidate)(struct dentry *, unsigned int);
148 int (*d_weak_revalidate)(struct dentry *, unsigned int); 148 int (*d_weak_revalidate)(struct dentry *, unsigned int);
149 int (*d_hash)(const struct dentry *, const struct inode *, 149 int (*d_hash)(const struct dentry *, struct qstr *);
150 struct qstr *); 150 int (*d_compare)(const struct dentry *, const struct dentry *,
151 int (*d_compare)(const struct dentry *, const struct inode *,
152 const struct dentry *, const struct inode *,
153 unsigned int, const char *, const struct qstr *); 151 unsigned int, const char *, const struct qstr *);
154 int (*d_delete)(const struct dentry *); 152 int (*d_delete)(const struct dentry *);
155 void (*d_release)(struct dentry *); 153 void (*d_release)(struct dentry *);
@@ -246,6 +244,8 @@ extern struct dentry * d_make_root(struct inode *);
246/* <clickety>-<click> the ramfs-type tree */ 244/* <clickety>-<click> the ramfs-type tree */
247extern void d_genocide(struct dentry *); 245extern void d_genocide(struct dentry *);
248 246
247extern void d_tmpfile(struct dentry *, struct inode *);
248
249extern struct dentry *d_find_alias(struct inode *); 249extern struct dentry *d_find_alias(struct inode *);
250extern void d_prune_aliases(struct inode *); 250extern void d_prune_aliases(struct inode *);
251 251
@@ -300,8 +300,7 @@ extern struct dentry *d_lookup(const struct dentry *, const struct qstr *);
300extern struct dentry *d_hash_and_lookup(struct dentry *, struct qstr *); 300extern struct dentry *d_hash_and_lookup(struct dentry *, struct qstr *);
301extern struct dentry *__d_lookup(const struct dentry *, const struct qstr *); 301extern struct dentry *__d_lookup(const struct dentry *, const struct qstr *);
302extern struct dentry *__d_lookup_rcu(const struct dentry *parent, 302extern struct dentry *__d_lookup_rcu(const struct dentry *parent,
303 const struct qstr *name, 303 const struct qstr *name, unsigned *seq);
304 unsigned *seq, struct inode *inode);
305 304
306/** 305/**
307 * __d_rcu_to_refcount - take a refcount on dentry if sequence check is ok 306 * __d_rcu_to_refcount - take a refcount on dentry if sequence check is ok
diff --git a/include/linux/fs.h b/include/linux/fs.h
index f8a5240541b7..2b82c8041490 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -908,6 +908,7 @@ struct file_lock_operations {
908 908
909struct lock_manager_operations { 909struct lock_manager_operations {
910 int (*lm_compare_owner)(struct file_lock *, struct file_lock *); 910 int (*lm_compare_owner)(struct file_lock *, struct file_lock *);
911 unsigned long (*lm_owner_key)(struct file_lock *);
911 void (*lm_notify)(struct file_lock *); /* unblock callback */ 912 void (*lm_notify)(struct file_lock *); /* unblock callback */
912 int (*lm_grant)(struct file_lock *, struct file_lock *, int); 913 int (*lm_grant)(struct file_lock *, struct file_lock *, int);
913 void (*lm_break)(struct file_lock *); 914 void (*lm_break)(struct file_lock *);
@@ -926,9 +927,27 @@ int locks_in_grace(struct net *);
926/* that will die - we need it for nfs_lock_info */ 927/* that will die - we need it for nfs_lock_info */
927#include <linux/nfs_fs_i.h> 928#include <linux/nfs_fs_i.h>
928 929
930/*
931 * struct file_lock represents a generic "file lock". It's used to represent
932 * POSIX byte range locks, BSD (flock) locks, and leases. It's important to
933 * note that the same struct is used to represent both a request for a lock and
934 * the lock itself, but the same object is never used for both.
935 *
936 * FIXME: should we create a separate "struct lock_request" to help distinguish
937 * these two uses?
938 *
939 * The i_flock list is ordered by:
940 *
941 * 1) lock type -- FL_LEASEs first, then FL_FLOCK, and finally FL_POSIX
942 * 2) lock owner
943 * 3) lock range start
944 * 4) lock range end
945 *
946 * Obviously, the last two criteria only matter for POSIX locks.
947 */
929struct file_lock { 948struct file_lock {
930 struct file_lock *fl_next; /* singly linked list for this inode */ 949 struct file_lock *fl_next; /* singly linked list for this inode */
931 struct list_head fl_link; /* doubly linked list of all locks */ 950 struct hlist_node fl_link; /* node in global lists */
932 struct list_head fl_block; /* circular list of blocked processes */ 951 struct list_head fl_block; /* circular list of blocked processes */
933 fl_owner_t fl_owner; 952 fl_owner_t fl_owner;
934 unsigned int fl_flags; 953 unsigned int fl_flags;
@@ -994,7 +1013,7 @@ extern void locks_release_private(struct file_lock *);
994extern void posix_test_lock(struct file *, struct file_lock *); 1013extern void posix_test_lock(struct file *, struct file_lock *);
995extern int posix_lock_file(struct file *, struct file_lock *, struct file_lock *); 1014extern int posix_lock_file(struct file *, struct file_lock *, struct file_lock *);
996extern int posix_lock_file_wait(struct file *, struct file_lock *); 1015extern int posix_lock_file_wait(struct file *, struct file_lock *);
997extern int posix_unblock_lock(struct file *, struct file_lock *); 1016extern int posix_unblock_lock(struct file_lock *);
998extern int vfs_test_lock(struct file *, struct file_lock *); 1017extern int vfs_test_lock(struct file *, struct file_lock *);
999extern int vfs_lock_file(struct file *, unsigned int, struct file_lock *, struct file_lock *); 1018extern int vfs_lock_file(struct file *, unsigned int, struct file_lock *, struct file_lock *);
1000extern int vfs_cancel_lock(struct file *filp, struct file_lock *fl); 1019extern int vfs_cancel_lock(struct file *filp, struct file_lock *fl);
@@ -1006,9 +1025,6 @@ extern int vfs_setlease(struct file *, long, struct file_lock **);
1006extern int lease_modify(struct file_lock **, int); 1025extern int lease_modify(struct file_lock **, int);
1007extern int lock_may_read(struct inode *, loff_t start, unsigned long count); 1026extern int lock_may_read(struct inode *, loff_t start, unsigned long count);
1008extern int lock_may_write(struct inode *, loff_t start, unsigned long count); 1027extern int lock_may_write(struct inode *, loff_t start, unsigned long count);
1009extern void locks_delete_block(struct file_lock *waiter);
1010extern void lock_flocks(void);
1011extern void unlock_flocks(void);
1012#else /* !CONFIG_FILE_LOCKING */ 1028#else /* !CONFIG_FILE_LOCKING */
1013static inline int fcntl_getlk(struct file *file, struct flock __user *user) 1029static inline int fcntl_getlk(struct file *file, struct flock __user *user)
1014{ 1030{
@@ -1084,8 +1100,7 @@ static inline int posix_lock_file_wait(struct file *filp, struct file_lock *fl)
1084 return -ENOLCK; 1100 return -ENOLCK;
1085} 1101}
1086 1102
1087static inline int posix_unblock_lock(struct file *filp, 1103static inline int posix_unblock_lock(struct file_lock *waiter)
1088 struct file_lock *waiter)
1089{ 1104{
1090 return -ENOENT; 1105 return -ENOENT;
1091} 1106}
@@ -1150,19 +1165,6 @@ static inline int lock_may_write(struct inode *inode, loff_t start,
1150{ 1165{
1151 return 1; 1166 return 1;
1152} 1167}
1153
1154static inline void locks_delete_block(struct file_lock *waiter)
1155{
1156}
1157
1158static inline void lock_flocks(void)
1159{
1160}
1161
1162static inline void unlock_flocks(void)
1163{
1164}
1165
1166#endif /* !CONFIG_FILE_LOCKING */ 1168#endif /* !CONFIG_FILE_LOCKING */
1167 1169
1168 1170
@@ -1580,6 +1582,7 @@ struct inode_operations {
1580 int (*atomic_open)(struct inode *, struct dentry *, 1582 int (*atomic_open)(struct inode *, struct dentry *,
1581 struct file *, unsigned open_flag, 1583 struct file *, unsigned open_flag,
1582 umode_t create_mode, int *opened); 1584 umode_t create_mode, int *opened);
1585 int (*tmpfile) (struct inode *, struct dentry *, umode_t);
1583} ____cacheline_aligned; 1586} ____cacheline_aligned;
1584 1587
1585ssize_t rw_copy_check_uvector(int type, const struct iovec __user * uvector, 1588ssize_t rw_copy_check_uvector(int type, const struct iovec __user * uvector,
@@ -1743,6 +1746,7 @@ struct super_operations {
1743#define I_REFERENCED (1 << 8) 1746#define I_REFERENCED (1 << 8)
1744#define __I_DIO_WAKEUP 9 1747#define __I_DIO_WAKEUP 9
1745#define I_DIO_WAKEUP (1 << I_DIO_WAKEUP) 1748#define I_DIO_WAKEUP (1 << I_DIO_WAKEUP)
1749#define I_LINKABLE (1 << 10)
1746 1750
1747#define I_DIRTY (I_DIRTY_SYNC | I_DIRTY_DATASYNC | I_DIRTY_PAGES) 1751#define I_DIRTY (I_DIRTY_SYNC | I_DIRTY_DATASYNC | I_DIRTY_PAGES)
1748 1752
@@ -1896,7 +1900,6 @@ extern int current_umask(void);
1896extern struct kobject *fs_kobj; 1900extern struct kobject *fs_kobj;
1897 1901
1898#define MAX_RW_COUNT (INT_MAX & PAGE_CACHE_MASK) 1902#define MAX_RW_COUNT (INT_MAX & PAGE_CACHE_MASK)
1899extern int rw_verify_area(int, struct file *, loff_t *, size_t);
1900 1903
1901#define FLOCK_VERIFY_READ 1 1904#define FLOCK_VERIFY_READ 1
1902#define FLOCK_VERIFY_WRITE 2 1905#define FLOCK_VERIFY_WRITE 2
@@ -2309,7 +2312,6 @@ extern struct file * open_exec(const char *);
2309/* fs/dcache.c -- generic fs support functions */ 2312/* fs/dcache.c -- generic fs support functions */
2310extern int is_subdir(struct dentry *, struct dentry *); 2313extern int is_subdir(struct dentry *, struct dentry *);
2311extern int path_is_under(struct path *, struct path *); 2314extern int path_is_under(struct path *, struct path *);
2312extern ino_t find_inode_number(struct dentry *, struct qstr *);
2313 2315
2314#include <linux/err.h> 2316#include <linux/err.h>
2315 2317
@@ -2424,9 +2426,12 @@ extern void
2424file_ra_state_init(struct file_ra_state *ra, struct address_space *mapping); 2426file_ra_state_init(struct file_ra_state *ra, struct address_space *mapping);
2425extern loff_t noop_llseek(struct file *file, loff_t offset, int whence); 2427extern loff_t noop_llseek(struct file *file, loff_t offset, int whence);
2426extern loff_t no_llseek(struct file *file, loff_t offset, int whence); 2428extern loff_t no_llseek(struct file *file, loff_t offset, int whence);
2429extern loff_t vfs_setpos(struct file *file, loff_t offset, loff_t maxsize);
2427extern loff_t generic_file_llseek(struct file *file, loff_t offset, int whence); 2430extern loff_t generic_file_llseek(struct file *file, loff_t offset, int whence);
2428extern loff_t generic_file_llseek_size(struct file *file, loff_t offset, 2431extern loff_t generic_file_llseek_size(struct file *file, loff_t offset,
2429 int whence, loff_t maxsize, loff_t eof); 2432 int whence, loff_t maxsize, loff_t eof);
2433extern loff_t fixed_size_llseek(struct file *file, loff_t offset,
2434 int whence, loff_t size);
2430extern int generic_file_open(struct inode * inode, struct file * filp); 2435extern int generic_file_open(struct inode * inode, struct file * filp);
2431extern int nonseekable_open(struct inode * inode, struct file * filp); 2436extern int nonseekable_open(struct inode * inode, struct file * filp);
2432 2437
diff --git a/include/linux/fsnotify.h b/include/linux/fsnotify.h
index a78680a92dba..1c804b057fb1 100644
--- a/include/linux/fsnotify.h
+++ b/include/linux/fsnotify.h
@@ -38,7 +38,7 @@ static inline int fsnotify_parent(struct path *path, struct dentry *dentry, __u3
38static inline int fsnotify_perm(struct file *file, int mask) 38static inline int fsnotify_perm(struct file *file, int mask)
39{ 39{
40 struct path *path = &file->f_path; 40 struct path *path = &file->f_path;
41 struct inode *inode = path->dentry->d_inode; 41 struct inode *inode = file_inode(file);
42 __u32 fsnotify_mask = 0; 42 __u32 fsnotify_mask = 0;
43 int ret; 43 int ret;
44 44
@@ -192,7 +192,7 @@ static inline void fsnotify_mkdir(struct inode *inode, struct dentry *dentry)
192static inline void fsnotify_access(struct file *file) 192static inline void fsnotify_access(struct file *file)
193{ 193{
194 struct path *path = &file->f_path; 194 struct path *path = &file->f_path;
195 struct inode *inode = path->dentry->d_inode; 195 struct inode *inode = file_inode(file);
196 __u32 mask = FS_ACCESS; 196 __u32 mask = FS_ACCESS;
197 197
198 if (S_ISDIR(inode->i_mode)) 198 if (S_ISDIR(inode->i_mode))
@@ -210,7 +210,7 @@ static inline void fsnotify_access(struct file *file)
210static inline void fsnotify_modify(struct file *file) 210static inline void fsnotify_modify(struct file *file)
211{ 211{
212 struct path *path = &file->f_path; 212 struct path *path = &file->f_path;
213 struct inode *inode = path->dentry->d_inode; 213 struct inode *inode = file_inode(file);
214 __u32 mask = FS_MODIFY; 214 __u32 mask = FS_MODIFY;
215 215
216 if (S_ISDIR(inode->i_mode)) 216 if (S_ISDIR(inode->i_mode))
@@ -228,7 +228,7 @@ static inline void fsnotify_modify(struct file *file)
228static inline void fsnotify_open(struct file *file) 228static inline void fsnotify_open(struct file *file)
229{ 229{
230 struct path *path = &file->f_path; 230 struct path *path = &file->f_path;
231 struct inode *inode = path->dentry->d_inode; 231 struct inode *inode = file_inode(file);
232 __u32 mask = FS_OPEN; 232 __u32 mask = FS_OPEN;
233 233
234 if (S_ISDIR(inode->i_mode)) 234 if (S_ISDIR(inode->i_mode))
diff --git a/include/uapi/asm-generic/fcntl.h b/include/uapi/asm-generic/fcntl.h
index a48937d4a5ea..06632beaa6d5 100644
--- a/include/uapi/asm-generic/fcntl.h
+++ b/include/uapi/asm-generic/fcntl.h
@@ -84,6 +84,10 @@
84#define O_PATH 010000000 84#define O_PATH 010000000
85#endif 85#endif
86 86
87#ifndef O_TMPFILE
88#define O_TMPFILE 020000000
89#endif
90
87#ifndef O_NDELAY 91#ifndef O_NDELAY
88#define O_NDELAY O_NONBLOCK 92#define O_NDELAY O_NONBLOCK
89#endif 93#endif