aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZhi Zhang <willzzhang@tencent.com>2019-03-22 02:16:33 -0400
committerIlya Dryomov <idryomov@gmail.com>2019-05-07 13:22:36 -0400
commit1b52931ca9b5b87e237c591f99201b6254c00809 (patch)
treef5c5638dd718a54547c5fd19759496d806d418a4
parente93c9c99a629c61837d5a7fc2120cd2b6c70dbdd (diff)
ceph: remove duplicated filelock ref increase
Inode i_filelock_ref is increased in ceph_lock or ceph_flock, but it is increased again in ceph_lock_message. This results in this ref won't become zero. If CEPH_I_ERROR_FILELOCK flag is set in remove_session_caps once, this flag can't be cleared even if client is back to normal. So further file lock will return EIO. Signed-off-by: Zhi Zhang <zhang.david2011@gmail.com> Reviewed-by: "Yan, Zheng" <zyan@redhat.com> Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
-rw-r--r--fs/ceph/locks.c13
1 files changed, 0 insertions, 13 deletions
diff --git a/fs/ceph/locks.c b/fs/ceph/locks.c
index 9dae2ec7e1fa..ac9b53b89365 100644
--- a/fs/ceph/locks.c
+++ b/fs/ceph/locks.c
@@ -237,15 +237,6 @@ int ceph_lock(struct file *file, int cmd, struct file_lock *fl)
237 spin_lock(&ci->i_ceph_lock); 237 spin_lock(&ci->i_ceph_lock);
238 if (ci->i_ceph_flags & CEPH_I_ERROR_FILELOCK) { 238 if (ci->i_ceph_flags & CEPH_I_ERROR_FILELOCK) {
239 err = -EIO; 239 err = -EIO;
240 } else if (op == CEPH_MDS_OP_SETFILELOCK) {
241 /*
242 * increasing i_filelock_ref closes race window between
243 * handling request reply and adding file_lock struct to
244 * inode. Otherwise, i_auth_cap may get trimmed in the
245 * window. Caller function will decrease the counter.
246 */
247 fl->fl_ops = &ceph_fl_lock_ops;
248 atomic_inc(&ci->i_filelock_ref);
249 } 240 }
250 spin_unlock(&ci->i_ceph_lock); 241 spin_unlock(&ci->i_ceph_lock);
251 if (err < 0) { 242 if (err < 0) {
@@ -299,10 +290,6 @@ int ceph_flock(struct file *file, int cmd, struct file_lock *fl)
299 spin_lock(&ci->i_ceph_lock); 290 spin_lock(&ci->i_ceph_lock);
300 if (ci->i_ceph_flags & CEPH_I_ERROR_FILELOCK) { 291 if (ci->i_ceph_flags & CEPH_I_ERROR_FILELOCK) {
301 err = -EIO; 292 err = -EIO;
302 } else {
303 /* see comment in ceph_lock */
304 fl->fl_ops = &ceph_fl_lock_ops;
305 atomic_inc(&ci->i_filelock_ref);
306 } 293 }
307 spin_unlock(&ci->i_ceph_lock); 294 spin_unlock(&ci->i_ceph_lock);
308 if (err < 0) { 295 if (err < 0) {