Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/gerg/m68knommu
[firefly-linux-kernel-4.4.55.git] / fs / nfs / file.c
index 29f4a48a0ee605ab3f19f62181b7f33303bbbeb5..a87a44f8411304218986faa171f40de1f9564cd2 100644 (file)
@@ -744,6 +744,7 @@ static int
 do_unlk(struct file *filp, int cmd, struct file_lock *fl, int is_local)
 {
        struct inode *inode = filp->f_mapping->host;
+       struct nfs_lock_context *l_ctx;
        int status;
 
        /*
@@ -752,6 +753,14 @@ do_unlk(struct file *filp, int cmd, struct file_lock *fl, int is_local)
         */
        nfs_sync_mapping(filp->f_mapping);
 
+       l_ctx = nfs_get_lock_context(nfs_file_open_context(filp));
+       if (!IS_ERR(l_ctx)) {
+               status = nfs_iocounter_wait(&l_ctx->io_count);
+               nfs_put_lock_context(l_ctx);
+               if (status < 0)
+                       return status;
+       }
+
        /* NOTE: special case
         *      If we're signalled while cleaning up locks on process exit, we
         *      still need to complete the unlock.