aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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