diff options
Diffstat (limited to 'fs/locks.c')
-rw-r--r-- | fs/locks.c | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/fs/locks.c b/fs/locks.c index baa564841c03..dab4e72f8bff 100644 --- a/fs/locks.c +++ b/fs/locks.c | |||
@@ -139,11 +139,6 @@ | |||
139 | #define IS_OFDLCK(fl) (fl->fl_flags & FL_OFDLCK) | 139 | #define IS_OFDLCK(fl) (fl->fl_flags & FL_OFDLCK) |
140 | #define IS_REMOTELCK(fl) (fl->fl_pid <= 0) | 140 | #define IS_REMOTELCK(fl) (fl->fl_pid <= 0) |
141 | 141 | ||
142 | static inline bool is_remote_lock(struct file *filp) | ||
143 | { | ||
144 | return likely(!(filp->f_path.dentry->d_sb->s_flags & SB_NOREMOTELOCK)); | ||
145 | } | ||
146 | |||
147 | static bool lease_breaking(struct file_lock *fl) | 142 | static bool lease_breaking(struct file_lock *fl) |
148 | { | 143 | { |
149 | return fl->fl_flags & (FL_UNLOCK_PENDING | FL_DOWNGRADE_PENDING); | 144 | return fl->fl_flags & (FL_UNLOCK_PENDING | FL_DOWNGRADE_PENDING); |
@@ -1875,7 +1870,7 @@ EXPORT_SYMBOL(generic_setlease); | |||
1875 | int | 1870 | int |
1876 | vfs_setlease(struct file *filp, long arg, struct file_lock **lease, void **priv) | 1871 | vfs_setlease(struct file *filp, long arg, struct file_lock **lease, void **priv) |
1877 | { | 1872 | { |
1878 | if (filp->f_op->setlease && is_remote_lock(filp)) | 1873 | if (filp->f_op->setlease) |
1879 | return filp->f_op->setlease(filp, arg, lease, priv); | 1874 | return filp->f_op->setlease(filp, arg, lease, priv); |
1880 | else | 1875 | else |
1881 | return generic_setlease(filp, arg, lease, priv); | 1876 | return generic_setlease(filp, arg, lease, priv); |
@@ -2022,7 +2017,7 @@ SYSCALL_DEFINE2(flock, unsigned int, fd, unsigned int, cmd) | |||
2022 | if (error) | 2017 | if (error) |
2023 | goto out_free; | 2018 | goto out_free; |
2024 | 2019 | ||
2025 | if (f.file->f_op->flock && is_remote_lock(f.file)) | 2020 | if (f.file->f_op->flock) |
2026 | error = f.file->f_op->flock(f.file, | 2021 | error = f.file->f_op->flock(f.file, |
2027 | (can_sleep) ? F_SETLKW : F_SETLK, | 2022 | (can_sleep) ? F_SETLKW : F_SETLK, |
2028 | lock); | 2023 | lock); |
@@ -2048,7 +2043,7 @@ SYSCALL_DEFINE2(flock, unsigned int, fd, unsigned int, cmd) | |||
2048 | */ | 2043 | */ |
2049 | int vfs_test_lock(struct file *filp, struct file_lock *fl) | 2044 | int vfs_test_lock(struct file *filp, struct file_lock *fl) |
2050 | { | 2045 | { |
2051 | if (filp->f_op->lock && is_remote_lock(filp)) | 2046 | if (filp->f_op->lock) |
2052 | return filp->f_op->lock(filp, F_GETLK, fl); | 2047 | return filp->f_op->lock(filp, F_GETLK, fl); |
2053 | posix_test_lock(filp, fl); | 2048 | posix_test_lock(filp, fl); |
2054 | return 0; | 2049 | return 0; |
@@ -2191,7 +2186,7 @@ out: | |||
2191 | */ | 2186 | */ |
2192 | int vfs_lock_file(struct file *filp, unsigned int cmd, struct file_lock *fl, struct file_lock *conf) | 2187 | int vfs_lock_file(struct file *filp, unsigned int cmd, struct file_lock *fl, struct file_lock *conf) |
2193 | { | 2188 | { |
2194 | if (filp->f_op->lock && is_remote_lock(filp)) | 2189 | if (filp->f_op->lock) |
2195 | return filp->f_op->lock(filp, cmd, fl); | 2190 | return filp->f_op->lock(filp, cmd, fl); |
2196 | else | 2191 | else |
2197 | return posix_lock_file(filp, fl, conf); | 2192 | return posix_lock_file(filp, fl, conf); |
@@ -2513,7 +2508,7 @@ locks_remove_flock(struct file *filp, struct file_lock_context *flctx) | |||
2513 | if (list_empty(&flctx->flc_flock)) | 2508 | if (list_empty(&flctx->flc_flock)) |
2514 | return; | 2509 | return; |
2515 | 2510 | ||
2516 | if (filp->f_op->flock && is_remote_lock(filp)) | 2511 | if (filp->f_op->flock) |
2517 | filp->f_op->flock(filp, F_SETLKW, &fl); | 2512 | filp->f_op->flock(filp, F_SETLKW, &fl); |
2518 | else | 2513 | else |
2519 | flock_lock_inode(inode, &fl); | 2514 | flock_lock_inode(inode, &fl); |
@@ -2600,7 +2595,7 @@ EXPORT_SYMBOL(posix_unblock_lock); | |||
2600 | */ | 2595 | */ |
2601 | int vfs_cancel_lock(struct file *filp, struct file_lock *fl) | 2596 | int vfs_cancel_lock(struct file *filp, struct file_lock *fl) |
2602 | { | 2597 | { |
2603 | if (filp->f_op->lock && is_remote_lock(filp)) | 2598 | if (filp->f_op->lock) |
2604 | return filp->f_op->lock(filp, F_CANCELLK, fl); | 2599 | return filp->f_op->lock(filp, F_CANCELLK, fl); |
2605 | return 0; | 2600 | return 0; |
2606 | } | 2601 | } |