]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-client.git/commit
ceph: fix duplicate increment of opened_inodes metric
authorHu Weiwen <sehuww@mail.scut.edu.cn>
Mon, 22 Nov 2021 14:22:12 +0000 (22:22 +0800)
committerJeff Layton <jlayton@kernel.org>
Tue, 23 Nov 2021 11:14:47 +0000 (06:14 -0500)
commit9d89c5df91d8f2f90caba9f9dd6b92513672e669
treee36a748f7c1945fcc3f5e54c575db67368a01615
parent8a6ea527345d54db456a54da551aa381fd1bbed9
ceph: fix duplicate increment of opened_inodes metric

opened_inodes is incremented twice when the same inode is opened twice
with O_RDONLY and O_WRONLY respectively.

To reproduce, run this python script, then check the metrics:

import os
for _ in range(10000):
    fd_r = os.open('a', os.O_RDONLY)
    fd_w = os.open('a', os.O_WRONLY)
    os.close(fd_r)
    os.close(fd_w)

Fixes: 1dd8d4708136 ("ceph: metrics for opened files, pinned caps and opened inodes")
Reviewed-by: Xiubo Li <xiubli@redhat.com>
Signed-off-by: Hu Weiwen <sehuww@mail.scut.edu.cn>
Signed-off-by: Jeff Layton <jlayton@kernel.org>
fs/ceph/caps.c