aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorJ. Bruce Fields <bfields@redhat.com>2011-07-20 20:21:59 -0400
committerJ. Bruce Fields <bfields@redhat.com>2011-07-20 20:23:19 -0400
commit8fb47a4fbf858a164e973b8ea8ef5e83e61f2e50 (patch)
treed3b55fbce0e7ba5708a55b91b1ab4079ad192db6 /fs
parentc46556c6be057da79f51b1a8325ec4c27938bd49 (diff)
locks: rename lock-manager ops
Both the filesystem and the lock manager can associate operations with a lock. Confusingly, one of them (fl_release_private) actually has the same name in both operation structures. It would save some confusion to give the lock-manager ops different names. Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/dlm/plock.c10
-rw-r--r--fs/fuse/file.c2
-rw-r--r--fs/lockd/svclock.c8
-rw-r--r--fs/locks.c34
-rw-r--r--fs/nfsd/nfs4state.c4
5 files changed, 29 insertions, 29 deletions
diff --git a/fs/dlm/plock.c b/fs/dlm/plock.c
index e2b878004364..01fd5c11a7fb 100644
--- a/fs/dlm/plock.c
+++ b/fs/dlm/plock.c
@@ -92,7 +92,7 @@ static void do_unlock_close(struct dlm_ls *ls, u64 number,
92 op->info.number = number; 92 op->info.number = number;
93 op->info.start = 0; 93 op->info.start = 0;
94 op->info.end = OFFSET_MAX; 94 op->info.end = OFFSET_MAX;
95 if (fl->fl_lmops && fl->fl_lmops->fl_grant) 95 if (fl->fl_lmops && fl->fl_lmops->lm_grant)
96 op->info.owner = (__u64) fl->fl_pid; 96 op->info.owner = (__u64) fl->fl_pid;
97 else 97 else
98 op->info.owner = (__u64)(long) fl->fl_owner; 98 op->info.owner = (__u64)(long) fl->fl_owner;
@@ -128,11 +128,11 @@ int dlm_posix_lock(dlm_lockspace_t *lockspace, u64 number, struct file *file,
128 op->info.number = number; 128 op->info.number = number;
129 op->info.start = fl->fl_start; 129 op->info.start = fl->fl_start;
130 op->info.end = fl->fl_end; 130 op->info.end = fl->fl_end;
131 if (fl->fl_lmops && fl->fl_lmops->fl_grant) { 131 if (fl->fl_lmops && fl->fl_lmops->lm_grant) {
132 /* fl_owner is lockd which doesn't distinguish 132 /* fl_owner is lockd which doesn't distinguish
133 processes on the nfs client */ 133 processes on the nfs client */
134 op->info.owner = (__u64) fl->fl_pid; 134 op->info.owner = (__u64) fl->fl_pid;
135 xop->callback = fl->fl_lmops->fl_grant; 135 xop->callback = fl->fl_lmops->lm_grant;
136 locks_init_lock(&xop->flc); 136 locks_init_lock(&xop->flc);
137 locks_copy_lock(&xop->flc, fl); 137 locks_copy_lock(&xop->flc, fl);
138 xop->fl = fl; 138 xop->fl = fl;
@@ -268,7 +268,7 @@ int dlm_posix_unlock(dlm_lockspace_t *lockspace, u64 number, struct file *file,
268 op->info.number = number; 268 op->info.number = number;
269 op->info.start = fl->fl_start; 269 op->info.start = fl->fl_start;
270 op->info.end = fl->fl_end; 270 op->info.end = fl->fl_end;
271 if (fl->fl_lmops && fl->fl_lmops->fl_grant) 271 if (fl->fl_lmops && fl->fl_lmops->lm_grant)
272 op->info.owner = (__u64) fl->fl_pid; 272 op->info.owner = (__u64) fl->fl_pid;
273 else 273 else
274 op->info.owner = (__u64)(long) fl->fl_owner; 274 op->info.owner = (__u64)(long) fl->fl_owner;
@@ -327,7 +327,7 @@ int dlm_posix_get(dlm_lockspace_t *lockspace, u64 number, struct file *file,
327 op->info.number = number; 327 op->info.number = number;
328 op->info.start = fl->fl_start; 328 op->info.start = fl->fl_start;
329 op->info.end = fl->fl_end; 329 op->info.end = fl->fl_end;
330 if (fl->fl_lmops && fl->fl_lmops->fl_grant) 330 if (fl->fl_lmops && fl->fl_lmops->lm_grant)
331 op->info.owner = (__u64) fl->fl_pid; 331 op->info.owner = (__u64) fl->fl_pid;
332 else 332 else
333 op->info.owner = (__u64)(long) fl->fl_owner; 333 op->info.owner = (__u64)(long) fl->fl_owner;
diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index 82a66466a24c..9150865a0c5b 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -1495,7 +1495,7 @@ static int fuse_setlk(struct file *file, struct file_lock *fl, int flock)
1495 pid_t pid = fl->fl_type != F_UNLCK ? current->tgid : 0; 1495 pid_t pid = fl->fl_type != F_UNLCK ? current->tgid : 0;
1496 int err; 1496 int err;
1497 1497
1498 if (fl->fl_lmops && fl->fl_lmops->fl_grant) { 1498 if (fl->fl_lmops && fl->fl_lmops->lm_grant) {
1499 /* NLM needs asynchronous locks, which we don't support yet */ 1499 /* NLM needs asynchronous locks, which we don't support yet */
1500 return -ENOLCK; 1500 return -ENOLCK;
1501 } 1501 }
diff --git a/fs/lockd/svclock.c b/fs/lockd/svclock.c
index 6e31695d046f..f0179c3745d2 100644
--- a/fs/lockd/svclock.c
+++ b/fs/lockd/svclock.c
@@ -632,7 +632,7 @@ nlmsvc_cancel_blocked(struct nlm_file *file, struct nlm_lock *lock)
632 632
633/* 633/*
634 * This is a callback from the filesystem for VFS file lock requests. 634 * This is a callback from the filesystem for VFS file lock requests.
635 * It will be used if fl_grant is defined and the filesystem can not 635 * It will be used if lm_grant is defined and the filesystem can not
636 * respond to the request immediately. 636 * respond to the request immediately.
637 * For GETLK request it will copy the reply to the nlm_block. 637 * For GETLK request it will copy the reply to the nlm_block.
638 * For SETLK or SETLKW request it will get the local posix lock. 638 * For SETLK or SETLKW request it will get the local posix lock.
@@ -719,9 +719,9 @@ static int nlmsvc_same_owner(struct file_lock *fl1, struct file_lock *fl2)
719} 719}
720 720
721const struct lock_manager_operations nlmsvc_lock_operations = { 721const struct lock_manager_operations nlmsvc_lock_operations = {
722 .fl_compare_owner = nlmsvc_same_owner, 722 .lm_compare_owner = nlmsvc_same_owner,
723 .fl_notify = nlmsvc_notify_blocked, 723 .lm_notify = nlmsvc_notify_blocked,
724 .fl_grant = nlmsvc_grant_deferred, 724 .lm_grant = nlmsvc_grant_deferred,
725}; 725};
726 726
727/* 727/*
diff --git a/fs/locks.c b/fs/locks.c
index 7ddab3f9df07..703f545097de 100644
--- a/fs/locks.c
+++ b/fs/locks.c
@@ -187,8 +187,8 @@ void locks_release_private(struct file_lock *fl)
187 fl->fl_ops = NULL; 187 fl->fl_ops = NULL;
188 } 188 }
189 if (fl->fl_lmops) { 189 if (fl->fl_lmops) {
190 if (fl->fl_lmops->fl_release_private) 190 if (fl->fl_lmops->lm_release_private)
191 fl->fl_lmops->fl_release_private(fl); 191 fl->fl_lmops->lm_release_private(fl);
192 fl->fl_lmops = NULL; 192 fl->fl_lmops = NULL;
193 } 193 }
194 194
@@ -423,9 +423,9 @@ static void lease_release_private_callback(struct file_lock *fl)
423} 423}
424 424
425static const struct lock_manager_operations lease_manager_ops = { 425static const struct lock_manager_operations lease_manager_ops = {
426 .fl_break = lease_break_callback, 426 .lm_break = lease_break_callback,
427 .fl_release_private = lease_release_private_callback, 427 .lm_release_private = lease_release_private_callback,
428 .fl_change = lease_modify, 428 .lm_change = lease_modify,
429}; 429};
430 430
431/* 431/*
@@ -478,9 +478,9 @@ static inline int locks_overlap(struct file_lock *fl1, struct file_lock *fl2)
478 */ 478 */
479static int posix_same_owner(struct file_lock *fl1, struct file_lock *fl2) 479static int posix_same_owner(struct file_lock *fl1, struct file_lock *fl2)
480{ 480{
481 if (fl1->fl_lmops && fl1->fl_lmops->fl_compare_owner) 481 if (fl1->fl_lmops && fl1->fl_lmops->lm_compare_owner)
482 return fl2->fl_lmops == fl1->fl_lmops && 482 return fl2->fl_lmops == fl1->fl_lmops &&
483 fl1->fl_lmops->fl_compare_owner(fl1, fl2); 483 fl1->fl_lmops->lm_compare_owner(fl1, fl2);
484 return fl1->fl_owner == fl2->fl_owner; 484 return fl1->fl_owner == fl2->fl_owner;
485} 485}
486 486
@@ -530,8 +530,8 @@ static void locks_wake_up_blocks(struct file_lock *blocker)
530 waiter = list_first_entry(&blocker->fl_block, 530 waiter = list_first_entry(&blocker->fl_block,
531 struct file_lock, fl_block); 531 struct file_lock, fl_block);
532 __locks_delete_block(waiter); 532 __locks_delete_block(waiter);
533 if (waiter->fl_lmops && waiter->fl_lmops->fl_notify) 533 if (waiter->fl_lmops && waiter->fl_lmops->lm_notify)
534 waiter->fl_lmops->fl_notify(waiter); 534 waiter->fl_lmops->lm_notify(waiter);
535 else 535 else
536 wake_up(&waiter->fl_wait); 536 wake_up(&waiter->fl_wait);
537 } 537 }
@@ -1218,7 +1218,7 @@ int __break_lease(struct inode *inode, unsigned int mode)
1218 fl->fl_type = future; 1218 fl->fl_type = future;
1219 fl->fl_break_time = break_time; 1219 fl->fl_break_time = break_time;
1220 /* lease must have lmops break callback */ 1220 /* lease must have lmops break callback */
1221 fl->fl_lmops->fl_break(fl); 1221 fl->fl_lmops->lm_break(fl);
1222 } 1222 }
1223 } 1223 }
1224 1224
@@ -1328,7 +1328,7 @@ int fcntl_getlease(struct file *filp)
1328 * @arg: type of lease to obtain 1328 * @arg: type of lease to obtain
1329 * @flp: input - file_lock to use, output - file_lock inserted 1329 * @flp: input - file_lock to use, output - file_lock inserted
1330 * 1330 *
1331 * The (input) flp->fl_lmops->fl_break function is required 1331 * The (input) flp->fl_lmops->lm_break function is required
1332 * by break_lease(). 1332 * by break_lease().
1333 * 1333 *
1334 * Called with file_lock_lock held. 1334 * Called with file_lock_lock held.
@@ -1354,7 +1354,7 @@ int generic_setlease(struct file *filp, long arg, struct file_lock **flp)
1354 1354
1355 time_out_leases(inode); 1355 time_out_leases(inode);
1356 1356
1357 BUG_ON(!(*flp)->fl_lmops->fl_break); 1357 BUG_ON(!(*flp)->fl_lmops->lm_break);
1358 1358
1359 if (arg != F_UNLCK) { 1359 if (arg != F_UNLCK) {
1360 error = -EAGAIN; 1360 error = -EAGAIN;
@@ -1396,7 +1396,7 @@ int generic_setlease(struct file *filp, long arg, struct file_lock **flp)
1396 goto out; 1396 goto out;
1397 1397
1398 if (my_before != NULL) { 1398 if (my_before != NULL) {
1399 error = lease->fl_lmops->fl_change(my_before, arg); 1399 error = lease->fl_lmops->lm_change(my_before, arg);
1400 if (!error) 1400 if (!error)
1401 *flp = *my_before; 1401 *flp = *my_before;
1402 goto out; 1402 goto out;
@@ -1432,7 +1432,7 @@ static int __vfs_setlease(struct file *filp, long arg, struct file_lock **lease)
1432 * @lease: file_lock to use 1432 * @lease: file_lock to use
1433 * 1433 *
1434 * Call this to establish a lease on the file. 1434 * Call this to establish a lease on the file.
1435 * The (*lease)->fl_lmops->fl_break operation must be set; if not, 1435 * The (*lease)->fl_lmops->lm_break operation must be set; if not,
1436 * break_lease will oops! 1436 * break_lease will oops!
1437 * 1437 *
1438 * This will call the filesystem's setlease file method, if 1438 * This will call the filesystem's setlease file method, if
@@ -1730,10 +1730,10 @@ out:
1730 * To avoid blocking kernel daemons, such as lockd, that need to acquire POSIX 1730 * To avoid blocking kernel daemons, such as lockd, that need to acquire POSIX
1731 * locks, the ->lock() interface may return asynchronously, before the lock has 1731 * locks, the ->lock() interface may return asynchronously, before the lock has
1732 * been granted or denied by the underlying filesystem, if (and only if) 1732 * been granted or denied by the underlying filesystem, if (and only if)
1733 * fl_grant is set. Callers expecting ->lock() to return asynchronously 1733 * lm_grant is set. Callers expecting ->lock() to return asynchronously
1734 * will only use F_SETLK, not F_SETLKW; they will set FL_SLEEP if (and only if) 1734 * will only use F_SETLK, not F_SETLKW; they will set FL_SLEEP if (and only if)
1735 * the request is for a blocking lock. When ->lock() does return asynchronously, 1735 * the request is for a blocking lock. When ->lock() does return asynchronously,
1736 * it must return FILE_LOCK_DEFERRED, and call ->fl_grant() when the lock 1736 * it must return FILE_LOCK_DEFERRED, and call ->lm_grant() when the lock
1737 * request completes. 1737 * request completes.
1738 * If the request is for non-blocking lock the file system should return 1738 * If the request is for non-blocking lock the file system should return
1739 * FILE_LOCK_DEFERRED then try to get the lock and call the callback routine 1739 * FILE_LOCK_DEFERRED then try to get the lock and call the callback routine
@@ -1743,7 +1743,7 @@ out:
1743 * grants a lock so the VFS can find out which locks are locally held and do 1743 * grants a lock so the VFS can find out which locks are locally held and do
1744 * the correct lock cleanup when required. 1744 * the correct lock cleanup when required.
1745 * The underlying filesystem must not drop the kernel lock or call 1745 * The underlying filesystem must not drop the kernel lock or call
1746 * ->fl_grant() before returning to the caller with a FILE_LOCK_DEFERRED 1746 * ->lm_grant() before returning to the caller with a FILE_LOCK_DEFERRED
1747 * return code. 1747 * return code.
1748 */ 1748 */
1749int vfs_lock_file(struct file *filp, unsigned int cmd, struct file_lock *fl, struct file_lock *conf) 1749int vfs_lock_file(struct file *filp, unsigned int cmd, struct file_lock *fl, struct file_lock *conf)
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index 6a471af99dfd..47da52576e66 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -2425,8 +2425,8 @@ int nfsd_change_deleg_cb(struct file_lock **onlist, int arg)
2425} 2425}
2426 2426
2427static const struct lock_manager_operations nfsd_lease_mng_ops = { 2427static const struct lock_manager_operations nfsd_lease_mng_ops = {
2428 .fl_break = nfsd_break_deleg_cb, 2428 .lm_break = nfsd_break_deleg_cb,
2429 .fl_change = nfsd_change_deleg_cb, 2429 .lm_change = nfsd_change_deleg_cb,
2430}; 2430};
2431 2431
2432 2432