]> git.baikalelectronics.ru Git - kernel.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)
committerIlya Dryomov <idryomov@gmail.com>
Wed, 1 Dec 2021 16:08:26 +0000 (17:08 +0100)
commit8d8d080219c6b6e5a89e5bf472ecb0ba2439cf1a
treec4cf2d4ccbdaa812bfa6a48621a7bddd52f8294c
parentff04131966d1a79c1b3cf26997a8e7d1433f1b7d
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: 4d8699381965 ("ceph: metrics for opened files, pinned caps and opened inodes")
Signed-off-by: Hu Weiwen <sehuww@mail.scut.edu.cn>
Reviewed-by: Xiubo Li <xiubli@redhat.com>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
fs/ceph/caps.c