aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/fs.h
diff options
context:
space:
mode:
authorJ. Bruce Fields <bfields@redhat.com>2012-03-05 13:18:59 -0500
committerAl Viro <viro@zeniv.linux.org.uk>2013-11-09 00:16:41 -0500
commitdf4e8d2c1d2bbbbace706bfe5417320c9e3fbee3 (patch)
tree0a56a71e11f39a638be30064411dc6c3363114b6 /include/linux/fs.h
parent617588d5186c887eb94321b021bb5a46f896f4b3 (diff)
locks: implement delegations
Implement NFSv4 delegations at the vfs level using the new FL_DELEG lock type. Note nfsd is the only delegation user and is only using read delegations. Warn on any attempt to set a write delegation for now. We'll come back to that case later. 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.h18
1 files changed, 15 insertions, 3 deletions
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 129e150f9e94..8e4be1be1a62 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -1022,7 +1022,7 @@ extern int vfs_test_lock(struct file *, struct file_lock *);
1022extern int vfs_lock_file(struct file *, unsigned int, struct file_lock *, struct file_lock *); 1022extern int vfs_lock_file(struct file *, unsigned int, struct file_lock *, struct file_lock *);
1023extern int vfs_cancel_lock(struct file *filp, struct file_lock *fl); 1023extern int vfs_cancel_lock(struct file *filp, struct file_lock *fl);
1024extern int flock_lock_file_wait(struct file *filp, struct file_lock *fl); 1024extern int flock_lock_file_wait(struct file *filp, struct file_lock *fl);
1025extern int __break_lease(struct inode *inode, unsigned int flags); 1025extern int __break_lease(struct inode *inode, unsigned int flags, unsigned int type);
1026extern void lease_get_mtime(struct inode *, struct timespec *time); 1026extern void lease_get_mtime(struct inode *, struct timespec *time);
1027extern int generic_setlease(struct file *, long, struct file_lock **); 1027extern int generic_setlease(struct file *, long, struct file_lock **);
1028extern int vfs_setlease(struct file *, long, struct file_lock **); 1028extern int vfs_setlease(struct file *, long, struct file_lock **);
@@ -1131,7 +1131,7 @@ static inline int flock_lock_file_wait(struct file *filp,
1131 return -ENOLCK; 1131 return -ENOLCK;
1132} 1132}
1133 1133
1134static inline int __break_lease(struct inode *inode, unsigned int mode) 1134static inline int __break_lease(struct inode *inode, unsigned int mode, unsigned int type)
1135{ 1135{
1136 return 0; 1136 return 0;
1137} 1137}
@@ -1961,9 +1961,17 @@ static inline int locks_verify_truncate(struct inode *inode,
1961static inline int break_lease(struct inode *inode, unsigned int mode) 1961static inline int break_lease(struct inode *inode, unsigned int mode)
1962{ 1962{
1963 if (inode->i_flock) 1963 if (inode->i_flock)
1964 return __break_lease(inode, mode); 1964 return __break_lease(inode, mode, FL_LEASE);
1965 return 0; 1965 return 0;
1966} 1966}
1967
1968static inline int break_deleg(struct inode *inode, unsigned int mode)
1969{
1970 if (inode->i_flock)
1971 return __break_lease(inode, mode, FL_DELEG);
1972 return 0;
1973}
1974
1967#else /* !CONFIG_FILE_LOCKING */ 1975#else /* !CONFIG_FILE_LOCKING */
1968static inline int locks_mandatory_locked(struct inode *inode) 1976static inline int locks_mandatory_locked(struct inode *inode)
1969{ 1977{
@@ -2003,6 +2011,10 @@ static inline int break_lease(struct inode *inode, unsigned int mode)
2003 return 0; 2011 return 0;
2004} 2012}
2005 2013
2014static inline int break_deleg(struct inode *inode, unsigned int mode)
2015{
2016 return 0;
2017}
2006#endif /* CONFIG_FILE_LOCKING */ 2018#endif /* CONFIG_FILE_LOCKING */
2007 2019
2008/* fs/open.c */ 2020/* fs/open.c */