diff options
author | J. Bruce Fields <bfields@redhat.com> | 2010-10-31 00:04:44 -0400 |
---|---|---|
committer | J. Bruce Fields <bfields@redhat.com> | 2011-01-04 16:49:28 -0500 |
commit | c45821d263a8a5109d69a9e8942b8d65bcd5f31a (patch) | |
tree | 816e9b7f98f0eb174557dfd093526b165f274348 | |
parent | c84d500bc41658165ceb0dd04dc6a75249940fba (diff) |
locks: eliminate fl_mylease callback
The nfs server only supports read delegations for now, so we don't care
how conflicts are determined. All we care is that unlocks are
recognized as matching the leases they are meant to remove. After the
last patch, a comparison of struct files will work for that purpose. So
we no longer need this callback.
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
-rw-r--r-- | fs/locks.c | 8 | ||||
-rw-r--r-- | fs/nfsd/nfs4state.c | 21 | ||||
-rw-r--r-- | include/linux/fs.h | 1 |
3 files changed, 2 insertions, 28 deletions
diff --git a/fs/locks.c b/fs/locks.c index 8729347bcd1a..5cb65062281a 100644 --- a/fs/locks.c +++ b/fs/locks.c | |||
@@ -444,15 +444,9 @@ static void lease_release_private_callback(struct file_lock *fl) | |||
444 | fl->fl_file->f_owner.signum = 0; | 444 | fl->fl_file->f_owner.signum = 0; |
445 | } | 445 | } |
446 | 446 | ||
447 | static int lease_mylease_callback(struct file_lock *fl, struct file_lock *try) | ||
448 | { | ||
449 | return fl->fl_file == try->fl_file; | ||
450 | } | ||
451 | |||
452 | static const struct lock_manager_operations lease_manager_ops = { | 447 | static const struct lock_manager_operations lease_manager_ops = { |
453 | .fl_break = lease_break_callback, | 448 | .fl_break = lease_break_callback, |
454 | .fl_release_private = lease_release_private_callback, | 449 | .fl_release_private = lease_release_private_callback, |
455 | .fl_mylease = lease_mylease_callback, | ||
456 | .fl_change = lease_modify, | 450 | .fl_change = lease_modify, |
457 | }; | 451 | }; |
458 | 452 | ||
@@ -1405,7 +1399,7 @@ int generic_setlease(struct file *filp, long arg, struct file_lock **flp) | |||
1405 | for (before = &inode->i_flock; | 1399 | for (before = &inode->i_flock; |
1406 | ((fl = *before) != NULL) && IS_LEASE(fl); | 1400 | ((fl = *before) != NULL) && IS_LEASE(fl); |
1407 | before = &fl->fl_next) { | 1401 | before = &fl->fl_next) { |
1408 | if (lease->fl_lmops->fl_mylease(fl, lease)) | 1402 | if (fl->fl_file == lease->fl_file) |
1409 | my_before = before; | 1403 | my_before = before; |
1410 | else if (fl->fl_type == (F_INPROGRESS | F_UNLCK)) | 1404 | else if (fl->fl_type == (F_INPROGRESS | F_UNLCK)) |
1411 | /* | 1405 | /* |
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index cbe1b81c147d..87d4c48b6069 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c | |||
@@ -2295,24 +2295,6 @@ void nfsd_break_deleg_cb(struct file_lock *fl) | |||
2295 | nfsd4_cb_recall(dp); | 2295 | nfsd4_cb_recall(dp); |
2296 | } | 2296 | } |
2297 | 2297 | ||
2298 | /* | ||
2299 | * Called from setlease() with lock_flocks() held | ||
2300 | */ | ||
2301 | static | ||
2302 | int nfsd_same_client_deleg_cb(struct file_lock *onlist, struct file_lock *try) | ||
2303 | { | ||
2304 | struct nfs4_delegation *onlistd = | ||
2305 | (struct nfs4_delegation *)onlist->fl_owner; | ||
2306 | struct nfs4_delegation *tryd = | ||
2307 | (struct nfs4_delegation *)try->fl_owner; | ||
2308 | |||
2309 | if (onlist->fl_lmops != try->fl_lmops) | ||
2310 | return 0; | ||
2311 | |||
2312 | return onlistd->dl_client == tryd->dl_client; | ||
2313 | } | ||
2314 | |||
2315 | |||
2316 | static | 2298 | static |
2317 | int nfsd_change_deleg_cb(struct file_lock **onlist, int arg) | 2299 | int nfsd_change_deleg_cb(struct file_lock **onlist, int arg) |
2318 | { | 2300 | { |
@@ -2324,7 +2306,6 @@ int nfsd_change_deleg_cb(struct file_lock **onlist, int arg) | |||
2324 | 2306 | ||
2325 | static const struct lock_manager_operations nfsd_lease_mng_ops = { | 2307 | static const struct lock_manager_operations nfsd_lease_mng_ops = { |
2326 | .fl_break = nfsd_break_deleg_cb, | 2308 | .fl_break = nfsd_break_deleg_cb, |
2327 | .fl_mylease = nfsd_same_client_deleg_cb, | ||
2328 | .fl_change = nfsd_change_deleg_cb, | 2309 | .fl_change = nfsd_change_deleg_cb, |
2329 | }; | 2310 | }; |
2330 | 2311 | ||
@@ -2630,7 +2611,7 @@ nfs4_open_delegation(struct svc_fh *fh, struct nfsd4_open *open, struct nfs4_sta | |||
2630 | dp->dl_flock = fl; | 2611 | dp->dl_flock = fl; |
2631 | 2612 | ||
2632 | /* vfs_setlease checks to see if delegation should be handed out. | 2613 | /* vfs_setlease checks to see if delegation should be handed out. |
2633 | * the lock_manager callbacks fl_mylease and fl_change are used | 2614 | * the lock_manager callback fl_change is used |
2634 | */ | 2615 | */ |
2635 | if ((status = vfs_setlease(fl->fl_file, fl->fl_type, &fl))) { | 2616 | if ((status = vfs_setlease(fl->fl_file, fl->fl_type, &fl))) { |
2636 | dprintk("NFSD: setlease failed [%d], no delegation\n", status); | 2617 | dprintk("NFSD: setlease failed [%d], no delegation\n", status); |
diff --git a/include/linux/fs.h b/include/linux/fs.h index 090f0eacde29..73ce69f728e1 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
@@ -1059,7 +1059,6 @@ struct lock_manager_operations { | |||
1059 | int (*fl_grant)(struct file_lock *, struct file_lock *, int); | 1059 | int (*fl_grant)(struct file_lock *, struct file_lock *, int); |
1060 | void (*fl_release_private)(struct file_lock *); | 1060 | void (*fl_release_private)(struct file_lock *); |
1061 | void (*fl_break)(struct file_lock *); | 1061 | void (*fl_break)(struct file_lock *); |
1062 | int (*fl_mylease)(struct file_lock *, struct file_lock *); | ||
1063 | int (*fl_change)(struct file_lock **, int); | 1062 | int (*fl_change)(struct file_lock **, int); |
1064 | }; | 1063 | }; |
1065 | 1064 | ||