diff options
-rw-r--r-- | fs/locks.c | 2 | ||||
-rw-r--r-- | include/linux/fs.h | 6 |
2 files changed, 7 insertions, 1 deletions
diff --git a/fs/locks.c b/fs/locks.c index da57c9b7e844..717fbc404e6b 100644 --- a/fs/locks.c +++ b/fs/locks.c | |||
@@ -431,7 +431,7 @@ static int lease_init(struct file *filp, long type, struct file_lock *fl) | |||
431 | if (assign_type(fl, type) != 0) | 431 | if (assign_type(fl, type) != 0) |
432 | return -EINVAL; | 432 | return -EINVAL; |
433 | 433 | ||
434 | fl->fl_owner = (fl_owner_t)filp; | 434 | fl->fl_owner = (fl_owner_t)current->files; |
435 | fl->fl_pid = current->tgid; | 435 | fl->fl_pid = current->tgid; |
436 | 436 | ||
437 | fl->fl_file = filp; | 437 | fl->fl_file = filp; |
diff --git a/include/linux/fs.h b/include/linux/fs.h index 338e6f758c6d..e11d60cc867b 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
@@ -1921,6 +1921,12 @@ static inline int break_lease(struct inode *inode, unsigned int mode) | |||
1921 | 1921 | ||
1922 | static inline int break_deleg(struct inode *inode, unsigned int mode) | 1922 | static inline int break_deleg(struct inode *inode, unsigned int mode) |
1923 | { | 1923 | { |
1924 | /* | ||
1925 | * Since this check is lockless, we must ensure that any refcounts | ||
1926 | * taken are done before checking inode->i_flock. Otherwise, we could | ||
1927 | * end up racing with tasks trying to set a new lease on this file. | ||
1928 | */ | ||
1929 | smp_mb(); | ||
1924 | if (inode->i_flock) | 1930 | if (inode->i_flock) |
1925 | return __break_lease(inode, mode, FL_DELEG); | 1931 | return __break_lease(inode, mode, FL_DELEG); |
1926 | return 0; | 1932 | return 0; |