aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/staging/lustre/lustre/llite/file.c17
-rw-r--r--fs/9p/vfs_file.c3
-rw-r--r--fs/afs/flock.c4
-rw-r--r--fs/ceph/locks.c10
-rw-r--r--fs/fuse/file.c1
-rw-r--r--fs/locks.c4
-rw-r--r--fs/nfs/file.c4
7 files changed, 11 insertions, 32 deletions
diff --git a/drivers/staging/lustre/lustre/llite/file.c b/drivers/staging/lustre/lustre/llite/file.c
index 8e844a6371e0..760ccd83f1f7 100644
--- a/drivers/staging/lustre/lustre/llite/file.c
+++ b/drivers/staging/lustre/lustre/llite/file.c
@@ -2691,20 +2691,15 @@ int ll_file_flock(struct file *file, int cmd, struct file_lock *file_lock)
2691 2691
2692 ll_stats_ops_tally(ll_i2sbi(inode), LPROC_LL_FLOCK, 1); 2692 ll_stats_ops_tally(ll_i2sbi(inode), LPROC_LL_FLOCK, 1);
2693 2693
2694 if (file_lock->fl_flags & FL_FLOCK) { 2694 if (file_lock->fl_flags & FL_FLOCK)
2695 LASSERT((cmd == F_SETLKW) || (cmd == F_SETLK)); 2695 LASSERT((cmd == F_SETLKW) || (cmd == F_SETLK));
2696 /* flocks are whole-file locks */ 2696 else if (!(file_lock->fl_flags & FL_POSIX))
2697 flock.l_flock.end = OFFSET_MAX;
2698 /* For flocks owner is determined by the local file descriptor*/
2699 flock.l_flock.owner = (unsigned long)file_lock->fl_file;
2700 } else if (file_lock->fl_flags & FL_POSIX) {
2701 flock.l_flock.owner = (unsigned long)file_lock->fl_owner;
2702 flock.l_flock.start = file_lock->fl_start;
2703 flock.l_flock.end = file_lock->fl_end;
2704 } else {
2705 return -EINVAL; 2697 return -EINVAL;
2706 } 2698
2699 flock.l_flock.owner = (unsigned long)file_lock->fl_owner;
2707 flock.l_flock.pid = file_lock->fl_pid; 2700 flock.l_flock.pid = file_lock->fl_pid;
2701 flock.l_flock.start = file_lock->fl_start;
2702 flock.l_flock.end = file_lock->fl_end;
2708 2703
2709 /* Somewhat ugly workaround for svc lockd. 2704 /* Somewhat ugly workaround for svc lockd.
2710 * lockd installs custom fl_lmops->lm_compare_owner that checks 2705 * lockd installs custom fl_lmops->lm_compare_owner that checks
diff --git a/fs/9p/vfs_file.c b/fs/9p/vfs_file.c
index d8223209d4b1..59e3fe3d56c0 100644
--- a/fs/9p/vfs_file.c
+++ b/fs/9p/vfs_file.c
@@ -352,9 +352,6 @@ static int v9fs_file_flock_dotl(struct file *filp, int cmd,
352 invalidate_mapping_pages(&inode->i_data, 0, -1); 352 invalidate_mapping_pages(&inode->i_data, 0, -1);
353 } 353 }
354 /* Convert flock to posix lock */ 354 /* Convert flock to posix lock */
355 fl->fl_owner = (fl_owner_t)filp;
356 fl->fl_start = 0;
357 fl->fl_end = OFFSET_MAX;
358 fl->fl_flags |= FL_POSIX; 355 fl->fl_flags |= FL_POSIX;
359 fl->fl_flags ^= FL_FLOCK; 356 fl->fl_flags ^= FL_FLOCK;
360 357
diff --git a/fs/afs/flock.c b/fs/afs/flock.c
index a8cf2cff836c..4baf1d2b39e4 100644
--- a/fs/afs/flock.c
+++ b/fs/afs/flock.c
@@ -555,10 +555,6 @@ int afs_flock(struct file *file, int cmd, struct file_lock *fl)
555 return -ENOLCK; 555 return -ENOLCK;
556 556
557 /* we're simulating flock() locks using posix locks on the server */ 557 /* we're simulating flock() locks using posix locks on the server */
558 fl->fl_owner = (fl_owner_t) file;
559 fl->fl_start = 0;
560 fl->fl_end = OFFSET_MAX;
561
562 if (fl->fl_type == F_UNLCK) 558 if (fl->fl_type == F_UNLCK)
563 return afs_do_unlk(file, fl); 559 return afs_do_unlk(file, fl);
564 return afs_do_setlk(file, fl); 560 return afs_do_setlk(file, fl);
diff --git a/fs/ceph/locks.c b/fs/ceph/locks.c
index 191398852a2e..fbc39c47bacd 100644
--- a/fs/ceph/locks.c
+++ b/fs/ceph/locks.c
@@ -53,10 +53,7 @@ static int ceph_lock_message(u8 lock_type, u16 operation, struct file *file,
53 else 53 else
54 length = fl->fl_end - fl->fl_start + 1; 54 length = fl->fl_end - fl->fl_start + 1;
55 55
56 if (lock_type == CEPH_LOCK_FCNTL) 56 owner = secure_addr(fl->fl_owner);
57 owner = secure_addr(fl->fl_owner);
58 else
59 owner = secure_addr(fl->fl_file);
60 57
61 dout("ceph_lock_message: rule: %d, op: %d, owner: %llx, pid: %llu, " 58 dout("ceph_lock_message: rule: %d, op: %d, owner: %llx, pid: %llu, "
62 "start: %llu, length: %llu, wait: %d, type: %d", (int)lock_type, 59 "start: %llu, length: %llu, wait: %d, type: %d", (int)lock_type,
@@ -314,10 +311,7 @@ int lock_to_ceph_filelock(struct file_lock *lock,
314 cephlock->length = cpu_to_le64(lock->fl_end - lock->fl_start + 1); 311 cephlock->length = cpu_to_le64(lock->fl_end - lock->fl_start + 1);
315 cephlock->client = cpu_to_le64(0); 312 cephlock->client = cpu_to_le64(0);
316 cephlock->pid = cpu_to_le64((u64)lock->fl_pid); 313 cephlock->pid = cpu_to_le64((u64)lock->fl_pid);
317 if (lock->fl_flags & FL_POSIX) 314 cephlock->owner = cpu_to_le64(secure_addr(lock->fl_owner));
318 cephlock->owner = cpu_to_le64(secure_addr(lock->fl_owner));
319 else
320 cephlock->owner = cpu_to_le64(secure_addr(lock->fl_file));
321 315
322 switch (lock->fl_type) { 316 switch (lock->fl_type) {
323 case F_RDLCK: 317 case F_RDLCK:
diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index 96d513e01a5d..f680d2c44e97 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -2304,7 +2304,6 @@ static int fuse_file_flock(struct file *file, int cmd, struct file_lock *fl)
2304 struct fuse_file *ff = file->private_data; 2304 struct fuse_file *ff = file->private_data;
2305 2305
2306 /* emulate flock with POSIX locks */ 2306 /* emulate flock with POSIX locks */
2307 fl->fl_owner = (fl_owner_t) file;
2308 ff->flock = true; 2307 ff->flock = true;
2309 err = fuse_setlk(file, fl, 1); 2308 err = fuse_setlk(file, fl, 1);
2310 } 2309 }
diff --git a/fs/locks.c b/fs/locks.c
index e390bd9ae068..77aff897fef3 100644
--- a/fs/locks.c
+++ b/fs/locks.c
@@ -322,6 +322,7 @@ static int flock_make_lock(struct file *filp, struct file_lock **lock,
322 return -ENOMEM; 322 return -ENOMEM;
323 323
324 fl->fl_file = filp; 324 fl->fl_file = filp;
325 fl->fl_owner = (fl_owner_t)filp;
325 fl->fl_pid = current->tgid; 326 fl->fl_pid = current->tgid;
326 fl->fl_flags = FL_FLOCK; 327 fl->fl_flags = FL_FLOCK;
327 fl->fl_type = type; 328 fl->fl_type = type;
@@ -427,7 +428,7 @@ static int lease_init(struct file *filp, long type, struct file_lock *fl)
427 if (assign_type(fl, type) != 0) 428 if (assign_type(fl, type) != 0)
428 return -EINVAL; 429 return -EINVAL;
429 430
430 fl->fl_owner = current->files; 431 fl->fl_owner = (fl_owner_t)filp;
431 fl->fl_pid = current->tgid; 432 fl->fl_pid = current->tgid;
432 433
433 fl->fl_file = filp; 434 fl->fl_file = filp;
@@ -2316,6 +2317,7 @@ void locks_remove_file(struct file *filp)
2316 2317
2317 if (filp->f_op->flock) { 2318 if (filp->f_op->flock) {
2318 struct file_lock fl = { 2319 struct file_lock fl = {
2320 .fl_owner = (fl_owner_t)filp,
2319 .fl_pid = current->tgid, 2321 .fl_pid = current->tgid,
2320 .fl_file = filp, 2322 .fl_file = filp,
2321 .fl_flags = FL_FLOCK, 2323 .fl_flags = FL_FLOCK,
diff --git a/fs/nfs/file.c b/fs/nfs/file.c
index 284ca901fe16..c1edf7336315 100644
--- a/fs/nfs/file.c
+++ b/fs/nfs/file.c
@@ -916,10 +916,6 @@ int nfs_flock(struct file *filp, int cmd, struct file_lock *fl)
916 is_local = 1; 916 is_local = 1;
917 917
918 /* We're simulating flock() locks using posix locks on the server */ 918 /* We're simulating flock() locks using posix locks on the server */
919 fl->fl_owner = (fl_owner_t)filp;
920 fl->fl_start = 0;
921 fl->fl_end = OFFSET_MAX;
922
923 if (fl->fl_type == F_UNLCK) 919 if (fl->fl_type == F_UNLCK)
924 return do_unlk(filp, cmd, fl, is_local); 920 return do_unlk(filp, cmd, fl, is_local);
925 return do_setlk(filp, cmd, fl, is_local); 921 return do_setlk(filp, cmd, fl, is_local);