ASoC: SOF: ipc4-loader: remove the CPC check warnings
[platform/kernel/linux-starfive.git] / fs / kernfs / dir.c
index 6609958..8b2bd65 100644 (file)
@@ -383,9 +383,11 @@ static int kernfs_link_sibling(struct kernfs_node *kn)
        rb_insert_color(&kn->rb, &kn->parent->dir.children);
 
        /* successfully added, account subdir number */
+       down_write(&kernfs_root(kn)->kernfs_iattr_rwsem);
        if (kernfs_type(kn) == KERNFS_DIR)
                kn->parent->dir.subdirs++;
        kernfs_inc_rev(kn->parent);
+       up_write(&kernfs_root(kn)->kernfs_iattr_rwsem);
 
        return 0;
 }
@@ -408,9 +410,11 @@ static bool kernfs_unlink_sibling(struct kernfs_node *kn)
        if (RB_EMPTY_NODE(&kn->rb))
                return false;
 
+       down_write(&kernfs_root(kn)->kernfs_iattr_rwsem);
        if (kernfs_type(kn) == KERNFS_DIR)
                kn->parent->dir.subdirs--;
        kernfs_inc_rev(kn->parent);
+       up_write(&kernfs_root(kn)->kernfs_iattr_rwsem);
 
        rb_erase(&kn->rb, &kn->parent->dir.children);
        RB_CLEAR_NODE(&kn->rb);