aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/fs.h
diff options
context:
space:
mode:
authorJ. Bruce Fields <bfields@redhat.com>2012-08-28 10:50:40 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2013-11-09 00:16:42 -0500
commit5a14696c1795d3843673b5cf1982d0e5357a5bbf (patch)
tree8d0ec4f82f90fc5f3e50cfc8cdd78ee7a4fb2263 /include/linux/fs.h
parentb21996e36c8e3b92a84e972378bde80b43acd890 (diff)
locks: helper functions for delegation breaking
We'll need the same logic for rename and link. Acked-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'include/linux/fs.h')
-rw-r--r--include/linux/fs.h39
1 files changed, 37 insertions, 2 deletions
diff --git a/include/linux/fs.h b/include/linux/fs.h
index a5799233142a..931f919f44e1 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -1905,6 +1905,9 @@ extern bool fs_fully_visible(struct file_system_type *);
1905 1905
1906extern int current_umask(void); 1906extern int current_umask(void);
1907 1907
1908extern void ihold(struct inode * inode);
1909extern void iput(struct inode *);
1910
1908/* /sys/fs */ 1911/* /sys/fs */
1909extern struct kobject *fs_kobj; 1912extern struct kobject *fs_kobj;
1910 1913
@@ -1972,6 +1975,28 @@ static inline int break_deleg(struct inode *inode, unsigned int mode)
1972 return 0; 1975 return 0;
1973} 1976}
1974 1977
1978static inline int try_break_deleg(struct inode *inode, struct inode **delegated_inode)
1979{
1980 int ret;
1981
1982 ret = break_deleg(inode, O_WRONLY|O_NONBLOCK);
1983 if (ret == -EWOULDBLOCK && delegated_inode) {
1984 *delegated_inode = inode;
1985 ihold(inode);
1986 }
1987 return ret;
1988}
1989
1990static inline int break_deleg_wait(struct inode **delegated_inode)
1991{
1992 int ret;
1993
1994 ret = break_deleg(*delegated_inode, O_WRONLY);
1995 iput(*delegated_inode);
1996 *delegated_inode = NULL;
1997 return ret;
1998}
1999
1975#else /* !CONFIG_FILE_LOCKING */ 2000#else /* !CONFIG_FILE_LOCKING */
1976static inline int locks_mandatory_locked(struct inode *inode) 2001static inline int locks_mandatory_locked(struct inode *inode)
1977{ 2002{
@@ -2015,6 +2040,18 @@ static inline int break_deleg(struct inode *inode, unsigned int mode)
2015{ 2040{
2016 return 0; 2041 return 0;
2017} 2042}
2043
2044static inline int try_break_deleg(struct inode *inode, struct inode **delegated_inode)
2045{
2046 return 0;
2047}
2048
2049static inline int break_deleg_wait(struct inode **delegated_inode)
2050{
2051 BUG();
2052 return 0;
2053}
2054
2018#endif /* CONFIG_FILE_LOCKING */ 2055#endif /* CONFIG_FILE_LOCKING */
2019 2056
2020/* fs/open.c */ 2057/* fs/open.c */
@@ -2350,8 +2387,6 @@ extern loff_t vfs_llseek(struct file *file, loff_t offset, int whence);
2350extern int inode_init_always(struct super_block *, struct inode *); 2387extern int inode_init_always(struct super_block *, struct inode *);
2351extern void inode_init_once(struct inode *); 2388extern void inode_init_once(struct inode *);
2352extern void address_space_init_once(struct address_space *mapping); 2389extern void address_space_init_once(struct address_space *mapping);
2353extern void ihold(struct inode * inode);
2354extern void iput(struct inode *);
2355extern struct inode * igrab(struct inode *); 2390extern struct inode * igrab(struct inode *);
2356extern ino_t iunique(struct super_block *, ino_t); 2391extern ino_t iunique(struct super_block *, ino_t);
2357extern int inode_needs_sync(struct inode *inode); 2392extern int inode_needs_sync(struct inode *inode);