Merge remote-tracking branch 'regmap/fix/debugfs' into regmap-linus
[firefly-linux-kernel-4.4.55.git] / fs / nfs / inode.c
index 1f941674b08967e4204d67f92d66cd6650bbc9a1..c1c7a9d78722257867846f39c74780536b28d0c5 100644 (file)
@@ -561,20 +561,22 @@ static void nfs_init_lock_context(struct nfs_lock_context *l_ctx)
        l_ctx->lockowner.l_owner = current->files;
        l_ctx->lockowner.l_pid = current->tgid;
        INIT_LIST_HEAD(&l_ctx->list);
+       nfs_iocounter_init(&l_ctx->io_count);
 }
 
 static struct nfs_lock_context *__nfs_find_lock_context(struct nfs_open_context *ctx)
 {
-       struct nfs_lock_context *pos;
+       struct nfs_lock_context *head = &ctx->lock_context;
+       struct nfs_lock_context *pos = head;
 
-       list_for_each_entry(pos, &ctx->lock_context.list, list) {
+       do {
                if (pos->lockowner.l_owner != current->files)
                        continue;
                if (pos->lockowner.l_pid != current->tgid)
                        continue;
                atomic_inc(&pos->count);
                return pos;
-       }
+       } while ((pos = list_entry(pos->list.next, typeof(*pos), list)) != head);
        return NULL;
 }