diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2013-07-03 12:10:19 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-07-03 12:10:19 -0400 |
| commit | 790eac5640abf7a57fa3a644386df330e18c11b0 (patch) | |
| tree | 08de20bde44f59e51b91ff473a71047c2957e8c9 /include/linux/fs.h | |
| parent | 0b0585c3e192967cb2ef0ac0816eb8a8c8d99840 (diff) | |
| parent | 48bde8d3620f5f3c6ae9ff599eb404055ae51664 (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/linux/fs.h')
| -rw-r--r-- | include/linux/fs.h | 49 |
1 files changed, 27 insertions, 22 deletions
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 | ||
| 909 | struct lock_manager_operations { | 909 | struct 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 | */ | ||
| 929 | struct file_lock { | 948 | struct 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 *); | |||
| 994 | extern void posix_test_lock(struct file *, struct file_lock *); | 1013 | extern void posix_test_lock(struct file *, struct file_lock *); |
| 995 | extern int posix_lock_file(struct file *, struct file_lock *, struct file_lock *); | 1014 | extern int posix_lock_file(struct file *, struct file_lock *, struct file_lock *); |
| 996 | extern int posix_lock_file_wait(struct file *, struct file_lock *); | 1015 | extern int posix_lock_file_wait(struct file *, struct file_lock *); |
| 997 | extern int posix_unblock_lock(struct file *, struct file_lock *); | 1016 | extern int posix_unblock_lock(struct file_lock *); |
| 998 | extern int vfs_test_lock(struct file *, struct file_lock *); | 1017 | extern int vfs_test_lock(struct file *, struct file_lock *); |
| 999 | extern int vfs_lock_file(struct file *, unsigned int, struct file_lock *, struct file_lock *); | 1018 | extern int vfs_lock_file(struct file *, unsigned int, struct file_lock *, struct file_lock *); |
| 1000 | extern int vfs_cancel_lock(struct file *filp, struct file_lock *fl); | 1019 | extern 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 **); | |||
| 1006 | extern int lease_modify(struct file_lock **, int); | 1025 | extern int lease_modify(struct file_lock **, int); |
| 1007 | extern int lock_may_read(struct inode *, loff_t start, unsigned long count); | 1026 | extern int lock_may_read(struct inode *, loff_t start, unsigned long count); |
| 1008 | extern int lock_may_write(struct inode *, loff_t start, unsigned long count); | 1027 | extern int lock_may_write(struct inode *, loff_t start, unsigned long count); |
| 1009 | extern void locks_delete_block(struct file_lock *waiter); | ||
| 1010 | extern void lock_flocks(void); | ||
| 1011 | extern void unlock_flocks(void); | ||
| 1012 | #else /* !CONFIG_FILE_LOCKING */ | 1028 | #else /* !CONFIG_FILE_LOCKING */ |
| 1013 | static inline int fcntl_getlk(struct file *file, struct flock __user *user) | 1029 | static 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 | ||
| 1087 | static inline int posix_unblock_lock(struct file *filp, | 1103 | static 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 | |||
| 1154 | static inline void locks_delete_block(struct file_lock *waiter) | ||
| 1155 | { | ||
| 1156 | } | ||
| 1157 | |||
| 1158 | static inline void lock_flocks(void) | ||
| 1159 | { | ||
| 1160 | } | ||
| 1161 | |||
| 1162 | static 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 | ||
| 1585 | ssize_t rw_copy_check_uvector(int type, const struct iovec __user * uvector, | 1588 | ssize_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); | |||
| 1896 | extern struct kobject *fs_kobj; | 1900 | extern 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) |
| 1899 | extern 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 */ |
| 2310 | extern int is_subdir(struct dentry *, struct dentry *); | 2313 | extern int is_subdir(struct dentry *, struct dentry *); |
| 2311 | extern int path_is_under(struct path *, struct path *); | 2314 | extern int path_is_under(struct path *, struct path *); |
| 2312 | extern 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 | |||
| 2424 | file_ra_state_init(struct file_ra_state *ra, struct address_space *mapping); | 2426 | file_ra_state_init(struct file_ra_state *ra, struct address_space *mapping); |
| 2425 | extern loff_t noop_llseek(struct file *file, loff_t offset, int whence); | 2427 | extern loff_t noop_llseek(struct file *file, loff_t offset, int whence); |
| 2426 | extern loff_t no_llseek(struct file *file, loff_t offset, int whence); | 2428 | extern loff_t no_llseek(struct file *file, loff_t offset, int whence); |
| 2429 | extern loff_t vfs_setpos(struct file *file, loff_t offset, loff_t maxsize); | ||
| 2427 | extern loff_t generic_file_llseek(struct file *file, loff_t offset, int whence); | 2430 | extern loff_t generic_file_llseek(struct file *file, loff_t offset, int whence); |
| 2428 | extern loff_t generic_file_llseek_size(struct file *file, loff_t offset, | 2431 | extern 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); |
| 2433 | extern loff_t fixed_size_llseek(struct file *file, loff_t offset, | ||
| 2434 | int whence, loff_t size); | ||
| 2430 | extern int generic_file_open(struct inode * inode, struct file * filp); | 2435 | extern int generic_file_open(struct inode * inode, struct file * filp); |
| 2431 | extern int nonseekable_open(struct inode * inode, struct file * filp); | 2436 | extern int nonseekable_open(struct inode * inode, struct file * filp); |
| 2432 | 2437 | ||
