aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeff Layton <jeff.layton@primarydata.com>2015-01-16 15:05:58 -0500
committerJeff Layton <jeff.layton@primarydata.com>2015-01-16 16:08:50 -0500
commit3d8e560de4a076b302cb0cc17e998aaace2b176a (patch)
treed63c4b03e7e1c5e937b49385d7f630b7921f1119
parent9bd0f45b7037fcfa8b575c7e27d0431d6e6dc3bb (diff)
locks: consolidate NULL i_flctx checks in locks_remove_file
We have each of the locks_remove_* variants doing this individually. Have the caller do it instead, and have locks_remove_flock and locks_remove_lease just assume that it's a valid pointer. Signed-off-by: Jeff Layton <jlayton@primarydata.com>
-rw-r--r--fs/locks.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/fs/locks.c b/fs/locks.c
index bd578700342d..2fc36b3772a0 100644
--- a/fs/locks.c
+++ b/fs/locks.c
@@ -2400,6 +2400,7 @@ void locks_remove_posix(struct file *filp, fl_owner_t owner)
2400 2400
2401EXPORT_SYMBOL(locks_remove_posix); 2401EXPORT_SYMBOL(locks_remove_posix);
2402 2402
2403/* The i_flctx must be valid when calling into here */
2403static void 2404static void
2404locks_remove_flock(struct file *filp) 2405locks_remove_flock(struct file *filp)
2405{ 2406{
@@ -2413,7 +2414,7 @@ locks_remove_flock(struct file *filp)
2413 }; 2414 };
2414 struct file_lock_context *flctx = file_inode(filp)->i_flctx; 2415 struct file_lock_context *flctx = file_inode(filp)->i_flctx;
2415 2416
2416 if (!flctx || list_empty(&flctx->flc_flock)) 2417 if (list_empty(&flctx->flc_flock))
2417 return; 2418 return;
2418 2419
2419 if (filp->f_op->flock) 2420 if (filp->f_op->flock)
@@ -2425,6 +2426,7 @@ locks_remove_flock(struct file *filp)
2425 fl.fl_ops->fl_release_private(&fl); 2426 fl.fl_ops->fl_release_private(&fl);
2426} 2427}
2427 2428
2429/* The i_flctx must be valid when calling into here */
2428static void 2430static void
2429locks_remove_lease(struct file *filp) 2431locks_remove_lease(struct file *filp)
2430{ 2432{
@@ -2433,7 +2435,7 @@ locks_remove_lease(struct file *filp)
2433 struct file_lock *fl, *tmp; 2435 struct file_lock *fl, *tmp;
2434 LIST_HEAD(dispose); 2436 LIST_HEAD(dispose);
2435 2437
2436 if (!ctx || list_empty(&ctx->flc_lease)) 2438 if (list_empty(&ctx->flc_lease))
2437 return; 2439 return;
2438 2440
2439 spin_lock(&ctx->flc_lock); 2441 spin_lock(&ctx->flc_lock);
@@ -2448,6 +2450,9 @@ locks_remove_lease(struct file *filp)
2448 */ 2450 */
2449void locks_remove_file(struct file *filp) 2451void locks_remove_file(struct file *filp)
2450{ 2452{
2453 if (!file_inode(filp)->i_flctx)
2454 return;
2455
2451 /* remove any OFD locks */ 2456 /* remove any OFD locks */
2452 locks_remove_posix(filp, filp); 2457 locks_remove_posix(filp, filp);
2453 2458