2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2024-12-26 22:24:09 +08:00

locks: add missing memory barrier in break_deleg

break_deleg is subject to the same potential race as break_lease. Add
a memory barrier to prevent it.

Signed-off-by: Jeff Layton <jlayton@primarydata.com>
This commit is contained in:
Jeff Layton 2014-06-10 12:24:40 -04:00
parent 64b2d1fbbf
commit 962bd40bc3

View File

@ -1914,6 +1914,12 @@ static inline int break_lease(struct inode *inode, unsigned int mode)
static inline int break_deleg(struct inode *inode, unsigned int mode) static inline int break_deleg(struct inode *inode, unsigned int mode)
{ {
/*
* Since this check is lockless, we must ensure that any refcounts
* taken are done before checking inode->i_flock. Otherwise, we could
* end up racing with tasks trying to set a new lease on this file.
*/
smp_mb();
if (inode->i_flock) if (inode->i_flock)
return __break_lease(inode, mode, FL_DELEG); return __break_lease(inode, mode, FL_DELEG);
return 0; return 0;