anolis: Revert "kernfs: switch kernfs to use an rwsem"
ANBZ: #18688
This reverts commit 16b029473f
.
[Fix conflict]
kernfs_iop_lookup() modified from "kernfs: don't create a negative
dentry if inactive node exists" and "kernfs: dont call d_splice_alias()
under kernfs node lock". Although we revert rwsem to mutex, these should
be reserved.
Signed-off-by: Ferry Meng <mengferry@linux.alibaba.com>
Reviewed-by: Joseph Qi <joseph.qi@linux.alibaba.com>
Link: https://gitee.com/anolis/cloud-kernel/pulls/4552
This commit is contained in:
parent
4699952bb9
commit
c4c4c42bb8
102
fs/kernfs/dir.c
102
fs/kernfs/dir.c
|
@ -17,7 +17,7 @@
|
|||
|
||||
#include "kernfs-internal.h"
|
||||
|
||||
DECLARE_RWSEM(kernfs_rwsem);
|
||||
DEFINE_MUTEX(kernfs_mutex);
|
||||
static DEFINE_SPINLOCK(kernfs_rename_lock); /* kn->parent and ->name */
|
||||
/*
|
||||
* Don't use rename_lock to piggy back on pr_cont_buf. We don't want to
|
||||
|
@ -34,7 +34,7 @@ static DEFINE_SPINLOCK(kernfs_idr_lock); /* root->ino_idr */
|
|||
|
||||
static bool kernfs_active(struct kernfs_node *kn)
|
||||
{
|
||||
lockdep_assert_held(&kernfs_rwsem);
|
||||
lockdep_assert_held(&kernfs_mutex);
|
||||
return atomic_read(&kn->active) >= 0;
|
||||
}
|
||||
|
||||
|
@ -348,7 +348,7 @@ static int kernfs_sd_compare(const struct kernfs_node *left,
|
|||
* @kn->parent->dir.children.
|
||||
*
|
||||
* Locking:
|
||||
* kernfs_rwsem held exclusive
|
||||
* mutex_lock(kernfs_mutex)
|
||||
*
|
||||
* RETURNS:
|
||||
* 0 on susccess -EEXIST on failure.
|
||||
|
@ -394,7 +394,7 @@ static int kernfs_link_sibling(struct kernfs_node *kn)
|
|||
* removed, %false if @kn wasn't on the rbtree.
|
||||
*
|
||||
* Locking:
|
||||
* kernfs_rwsem held exclusive
|
||||
* mutex_lock(kernfs_mutex)
|
||||
*/
|
||||
static bool kernfs_unlink_sibling(struct kernfs_node *kn)
|
||||
{
|
||||
|
@ -465,14 +465,14 @@ void kernfs_put_active(struct kernfs_node *kn)
|
|||
* return after draining is complete.
|
||||
*/
|
||||
static void kernfs_drain(struct kernfs_node *kn)
|
||||
__releases(&kernfs_rwsem) __acquires(&kernfs_rwsem)
|
||||
__releases(&kernfs_mutex) __acquires(&kernfs_mutex)
|
||||
{
|
||||
struct kernfs_root *root = kernfs_root(kn);
|
||||
|
||||
lockdep_assert_held_write(&kernfs_rwsem);
|
||||
lockdep_assert_held(&kernfs_mutex);
|
||||
WARN_ON_ONCE(kernfs_active(kn));
|
||||
|
||||
up_write(&kernfs_rwsem);
|
||||
mutex_unlock(&kernfs_mutex);
|
||||
|
||||
if (kernfs_lockdep(kn)) {
|
||||
rwsem_acquire(&kn->dep_map, 0, 0, _RET_IP_);
|
||||
|
@ -491,7 +491,7 @@ static void kernfs_drain(struct kernfs_node *kn)
|
|||
|
||||
kernfs_drain_open_files(kn);
|
||||
|
||||
down_write(&kernfs_rwsem);
|
||||
mutex_lock(&kernfs_mutex);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -745,7 +745,7 @@ int kernfs_add_one(struct kernfs_node *kn)
|
|||
bool has_ns;
|
||||
int ret;
|
||||
|
||||
down_write(&kernfs_rwsem);
|
||||
mutex_lock(&kernfs_mutex);
|
||||
|
||||
ret = -EINVAL;
|
||||
has_ns = kernfs_ns_enabled(parent);
|
||||
|
@ -776,7 +776,7 @@ int kernfs_add_one(struct kernfs_node *kn)
|
|||
ps_iattr->ia_mtime = ps_iattr->ia_ctime;
|
||||
}
|
||||
|
||||
up_write(&kernfs_rwsem);
|
||||
mutex_unlock(&kernfs_mutex);
|
||||
|
||||
/*
|
||||
* Activate the new node unless CREATE_DEACTIVATED is requested.
|
||||
|
@ -790,7 +790,7 @@ int kernfs_add_one(struct kernfs_node *kn)
|
|||
return 0;
|
||||
|
||||
out_unlock:
|
||||
up_write(&kernfs_rwsem);
|
||||
mutex_unlock(&kernfs_mutex);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -811,7 +811,7 @@ static struct kernfs_node *kernfs_find_ns(struct kernfs_node *parent,
|
|||
bool has_ns = kernfs_ns_enabled(parent);
|
||||
unsigned int hash;
|
||||
|
||||
lockdep_assert_held(&kernfs_rwsem);
|
||||
lockdep_assert_held(&kernfs_mutex);
|
||||
|
||||
if (has_ns != (bool)ns) {
|
||||
WARN(1, KERN_WARNING "kernfs: ns %s in '%s' for '%s'\n",
|
||||
|
@ -843,7 +843,7 @@ static struct kernfs_node *kernfs_walk_ns(struct kernfs_node *parent,
|
|||
size_t len;
|
||||
char *p, *name;
|
||||
|
||||
lockdep_assert_held_read(&kernfs_rwsem);
|
||||
lockdep_assert_held(&kernfs_mutex);
|
||||
|
||||
spin_lock_irq(&kernfs_pr_cont_lock);
|
||||
|
||||
|
@ -882,10 +882,10 @@ struct kernfs_node *kernfs_find_and_get_ns(struct kernfs_node *parent,
|
|||
{
|
||||
struct kernfs_node *kn;
|
||||
|
||||
down_read(&kernfs_rwsem);
|
||||
mutex_lock(&kernfs_mutex);
|
||||
kn = kernfs_find_ns(parent, name, ns);
|
||||
kernfs_get(kn);
|
||||
up_read(&kernfs_rwsem);
|
||||
mutex_unlock(&kernfs_mutex);
|
||||
|
||||
return kn;
|
||||
}
|
||||
|
@ -906,10 +906,10 @@ struct kernfs_node *kernfs_walk_and_get_ns(struct kernfs_node *parent,
|
|||
{
|
||||
struct kernfs_node *kn;
|
||||
|
||||
down_read(&kernfs_rwsem);
|
||||
mutex_lock(&kernfs_mutex);
|
||||
kn = kernfs_walk_ns(parent, path, ns);
|
||||
kernfs_get(kn);
|
||||
up_read(&kernfs_rwsem);
|
||||
mutex_unlock(&kernfs_mutex);
|
||||
|
||||
return kn;
|
||||
}
|
||||
|
@ -1068,18 +1068,18 @@ static int kernfs_dop_revalidate(struct dentry *dentry, unsigned int flags)
|
|||
/* If the kernfs parent node has changed discard and
|
||||
* proceed to ->lookup.
|
||||
*/
|
||||
down_read(&kernfs_rwsem);
|
||||
mutex_lock(&kernfs_mutex);
|
||||
spin_lock(&dentry->d_lock);
|
||||
parent = kernfs_dentry_node(dentry->d_parent);
|
||||
if (parent) {
|
||||
if (kernfs_dir_changed(parent, dentry)) {
|
||||
spin_unlock(&dentry->d_lock);
|
||||
up_read(&kernfs_rwsem);
|
||||
mutex_unlock(&kernfs_mutex);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
spin_unlock(&dentry->d_lock);
|
||||
up_read(&kernfs_rwsem);
|
||||
mutex_unlock(&kernfs_mutex);
|
||||
|
||||
/* The kernfs parent node hasn't changed, leave the
|
||||
* dentry negative and return success.
|
||||
|
@ -1088,7 +1088,7 @@ static int kernfs_dop_revalidate(struct dentry *dentry, unsigned int flags)
|
|||
}
|
||||
|
||||
kn = kernfs_dentry_node(dentry);
|
||||
down_read(&kernfs_rwsem);
|
||||
mutex_lock(&kernfs_mutex);
|
||||
|
||||
/* The kernfs node has been deactivated */
|
||||
if (!kernfs_active(kn))
|
||||
|
@ -1107,10 +1107,10 @@ static int kernfs_dop_revalidate(struct dentry *dentry, unsigned int flags)
|
|||
kernfs_info(dentry->d_sb)->ns != kn->ns)
|
||||
goto out_bad;
|
||||
|
||||
up_read(&kernfs_rwsem);
|
||||
mutex_unlock(&kernfs_mutex);
|
||||
return 1;
|
||||
out_bad:
|
||||
up_read(&kernfs_rwsem);
|
||||
mutex_unlock(&kernfs_mutex);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1127,7 +1127,7 @@ static struct dentry *kernfs_iop_lookup(struct inode *dir,
|
|||
struct inode *inode = NULL;
|
||||
const void *ns = NULL;
|
||||
|
||||
down_read(&kernfs_rwsem);
|
||||
mutex_lock(&kernfs_mutex);
|
||||
if (kernfs_ns_enabled(parent))
|
||||
ns = kernfs_info(dir->i_sb)->ns;
|
||||
|
||||
|
@ -1138,7 +1138,7 @@ static struct dentry *kernfs_iop_lookup(struct inode *dir,
|
|||
* create a negative.
|
||||
*/
|
||||
if (!kernfs_active(kn)) {
|
||||
up_read(&kernfs_rwsem);
|
||||
mutex_unlock(&kernfs_mutex);
|
||||
return NULL;
|
||||
}
|
||||
inode = kernfs_get_inode(dir->i_sb, kn);
|
||||
|
@ -1153,7 +1153,7 @@ static struct dentry *kernfs_iop_lookup(struct inode *dir,
|
|||
*/
|
||||
if (!IS_ERR(inode))
|
||||
kernfs_set_rev(parent, dentry);
|
||||
up_read(&kernfs_rwsem);
|
||||
mutex_unlock(&kernfs_mutex);
|
||||
|
||||
/* instantiate and hash (possibly negative) dentry */
|
||||
return d_splice_alias(inode, dentry);
|
||||
|
@ -1274,7 +1274,7 @@ static struct kernfs_node *kernfs_next_descendant_post(struct kernfs_node *pos,
|
|||
{
|
||||
struct rb_node *rbn;
|
||||
|
||||
lockdep_assert_held_write(&kernfs_rwsem);
|
||||
lockdep_assert_held(&kernfs_mutex);
|
||||
|
||||
/* if first iteration, visit leftmost descendant which may be root */
|
||||
if (!pos)
|
||||
|
@ -1310,7 +1310,7 @@ void kernfs_activate(struct kernfs_node *kn)
|
|||
{
|
||||
struct kernfs_node *pos;
|
||||
|
||||
down_write(&kernfs_rwsem);
|
||||
mutex_lock(&kernfs_mutex);
|
||||
|
||||
pos = NULL;
|
||||
while ((pos = kernfs_next_descendant_post(pos, kn))) {
|
||||
|
@ -1324,14 +1324,14 @@ void kernfs_activate(struct kernfs_node *kn)
|
|||
pos->flags |= KERNFS_ACTIVATED;
|
||||
}
|
||||
|
||||
up_write(&kernfs_rwsem);
|
||||
mutex_unlock(&kernfs_mutex);
|
||||
}
|
||||
|
||||
static void __kernfs_remove(struct kernfs_node *kn)
|
||||
{
|
||||
struct kernfs_node *pos;
|
||||
|
||||
lockdep_assert_held_write(&kernfs_rwsem);
|
||||
lockdep_assert_held(&kernfs_mutex);
|
||||
|
||||
/*
|
||||
* Short-circuit if non-root @kn has already finished removal.
|
||||
|
@ -1354,7 +1354,7 @@ static void __kernfs_remove(struct kernfs_node *kn)
|
|||
pos = kernfs_leftmost_descendant(kn);
|
||||
|
||||
/*
|
||||
* kernfs_drain() drops kernfs_rwsem temporarily and @pos's
|
||||
* kernfs_drain() drops kernfs_mutex temporarily and @pos's
|
||||
* base ref could have been put by someone else by the time
|
||||
* the function returns. Make sure it doesn't go away
|
||||
* underneath us.
|
||||
|
@ -1401,9 +1401,9 @@ static void __kernfs_remove(struct kernfs_node *kn)
|
|||
*/
|
||||
void kernfs_remove(struct kernfs_node *kn)
|
||||
{
|
||||
down_write(&kernfs_rwsem);
|
||||
mutex_lock(&kernfs_mutex);
|
||||
__kernfs_remove(kn);
|
||||
up_write(&kernfs_rwsem);
|
||||
mutex_unlock(&kernfs_mutex);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1490,17 +1490,17 @@ bool kernfs_remove_self(struct kernfs_node *kn)
|
|||
{
|
||||
bool ret;
|
||||
|
||||
down_write(&kernfs_rwsem);
|
||||
mutex_lock(&kernfs_mutex);
|
||||
kernfs_break_active_protection(kn);
|
||||
|
||||
/*
|
||||
* SUICIDAL is used to arbitrate among competing invocations. Only
|
||||
* the first one will actually perform removal. When the removal
|
||||
* is complete, SUICIDED is set and the active ref is restored
|
||||
* while kernfs_rwsem for held exclusive. The ones which lost
|
||||
* arbitration waits for SUICIDED && drained which can happen only
|
||||
* after the enclosing kernfs operation which executed the winning
|
||||
* instance of kernfs_remove_self() finished.
|
||||
* while holding kernfs_mutex. The ones which lost arbitration
|
||||
* waits for SUICDED && drained which can happen only after the
|
||||
* enclosing kernfs operation which executed the winning instance
|
||||
* of kernfs_remove_self() finished.
|
||||
*/
|
||||
if (!(kn->flags & KERNFS_SUICIDAL)) {
|
||||
kn->flags |= KERNFS_SUICIDAL;
|
||||
|
@ -1518,9 +1518,9 @@ bool kernfs_remove_self(struct kernfs_node *kn)
|
|||
atomic_read(&kn->active) == KN_DEACTIVATED_BIAS)
|
||||
break;
|
||||
|
||||
up_write(&kernfs_rwsem);
|
||||
mutex_unlock(&kernfs_mutex);
|
||||
schedule();
|
||||
down_write(&kernfs_rwsem);
|
||||
mutex_lock(&kernfs_mutex);
|
||||
}
|
||||
finish_wait(waitq, &wait);
|
||||
WARN_ON_ONCE(!RB_EMPTY_NODE(&kn->rb));
|
||||
|
@ -1528,12 +1528,12 @@ bool kernfs_remove_self(struct kernfs_node *kn)
|
|||
}
|
||||
|
||||
/*
|
||||
* This must be done while kernfs_rwsem held exclusive; otherwise,
|
||||
* waiting for SUICIDED && deactivated could finish prematurely.
|
||||
* This must be done while holding kernfs_mutex; otherwise, waiting
|
||||
* for SUICIDED && deactivated could finish prematurely.
|
||||
*/
|
||||
kernfs_unbreak_active_protection(kn);
|
||||
|
||||
up_write(&kernfs_rwsem);
|
||||
mutex_unlock(&kernfs_mutex);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -1557,7 +1557,7 @@ int kernfs_remove_by_name_ns(struct kernfs_node *parent, const char *name,
|
|||
return -ENOENT;
|
||||
}
|
||||
|
||||
down_write(&kernfs_rwsem);
|
||||
mutex_lock(&kernfs_mutex);
|
||||
|
||||
kn = kernfs_find_ns(parent, name, ns);
|
||||
if (kn) {
|
||||
|
@ -1566,7 +1566,7 @@ int kernfs_remove_by_name_ns(struct kernfs_node *parent, const char *name,
|
|||
kernfs_put(kn);
|
||||
}
|
||||
|
||||
up_write(&kernfs_rwsem);
|
||||
mutex_unlock(&kernfs_mutex);
|
||||
|
||||
if (kn)
|
||||
return 0;
|
||||
|
@ -1592,7 +1592,7 @@ int kernfs_rename_ns(struct kernfs_node *kn, struct kernfs_node *new_parent,
|
|||
if (!kn->parent)
|
||||
return -EINVAL;
|
||||
|
||||
down_write(&kernfs_rwsem);
|
||||
mutex_lock(&kernfs_mutex);
|
||||
|
||||
error = -ENOENT;
|
||||
if (!kernfs_active(kn) || !kernfs_active(new_parent) ||
|
||||
|
@ -1646,7 +1646,7 @@ int kernfs_rename_ns(struct kernfs_node *kn, struct kernfs_node *new_parent,
|
|||
|
||||
error = 0;
|
||||
out:
|
||||
up_write(&kernfs_rwsem);
|
||||
mutex_unlock(&kernfs_mutex);
|
||||
return error;
|
||||
}
|
||||
|
||||
|
@ -1721,7 +1721,7 @@ static int kernfs_fop_readdir(struct file *file, struct dir_context *ctx)
|
|||
|
||||
if (!dir_emit_dots(file, ctx))
|
||||
return 0;
|
||||
down_read(&kernfs_rwsem);
|
||||
mutex_lock(&kernfs_mutex);
|
||||
|
||||
if (kernfs_ns_enabled(parent))
|
||||
ns = kernfs_info(dentry->d_sb)->ns;
|
||||
|
@ -1738,12 +1738,12 @@ static int kernfs_fop_readdir(struct file *file, struct dir_context *ctx)
|
|||
file->private_data = pos;
|
||||
kernfs_get(pos);
|
||||
|
||||
up_read(&kernfs_rwsem);
|
||||
mutex_unlock(&kernfs_mutex);
|
||||
if (!dir_emit(ctx, name, len, ino, type))
|
||||
return 0;
|
||||
down_read(&kernfs_rwsem);
|
||||
mutex_lock(&kernfs_mutex);
|
||||
}
|
||||
up_read(&kernfs_rwsem);
|
||||
mutex_unlock(&kernfs_mutex);
|
||||
file->private_data = NULL;
|
||||
ctx->pos = INT_MAX;
|
||||
return 0;
|
||||
|
|
|
@ -860,7 +860,7 @@ repeat:
|
|||
spin_unlock_irq(&kernfs_notify_lock);
|
||||
|
||||
/* kick fsnotify */
|
||||
down_write(&kernfs_rwsem);
|
||||
mutex_lock(&kernfs_mutex);
|
||||
|
||||
list_for_each_entry(info, &kernfs_root(kn)->supers, node) {
|
||||
struct kernfs_node *parent;
|
||||
|
@ -898,7 +898,7 @@ repeat:
|
|||
iput(inode);
|
||||
}
|
||||
|
||||
up_write(&kernfs_rwsem);
|
||||
mutex_unlock(&kernfs_mutex);
|
||||
kernfs_put(kn);
|
||||
goto repeat;
|
||||
}
|
||||
|
|
|
@ -106,9 +106,9 @@ int kernfs_setattr(struct kernfs_node *kn, const struct iattr *iattr)
|
|||
{
|
||||
int ret;
|
||||
|
||||
down_write(&kernfs_rwsem);
|
||||
mutex_lock(&kernfs_mutex);
|
||||
ret = __kernfs_setattr(kn, iattr);
|
||||
up_write(&kernfs_rwsem);
|
||||
mutex_unlock(&kernfs_mutex);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -121,7 +121,7 @@ int kernfs_iop_setattr(struct dentry *dentry, struct iattr *iattr)
|
|||
if (!kn)
|
||||
return -EINVAL;
|
||||
|
||||
down_write(&kernfs_rwsem);
|
||||
mutex_lock(&kernfs_mutex);
|
||||
error = setattr_prepare(dentry, iattr);
|
||||
if (error)
|
||||
goto out;
|
||||
|
@ -134,7 +134,7 @@ int kernfs_iop_setattr(struct dentry *dentry, struct iattr *iattr)
|
|||
setattr_copy(inode, iattr);
|
||||
|
||||
out:
|
||||
up_write(&kernfs_rwsem);
|
||||
mutex_unlock(&kernfs_mutex);
|
||||
return error;
|
||||
}
|
||||
|
||||
|
@ -189,9 +189,9 @@ int kernfs_iop_getattr(const struct path *path, struct kstat *stat,
|
|||
struct inode *inode = d_inode(path->dentry);
|
||||
struct kernfs_node *kn = inode->i_private;
|
||||
|
||||
down_write(&kernfs_rwsem);
|
||||
mutex_lock(&kernfs_mutex);
|
||||
kernfs_refresh_inode(kn, inode);
|
||||
up_write(&kernfs_rwsem);
|
||||
mutex_unlock(&kernfs_mutex);
|
||||
|
||||
generic_fillattr(inode, stat);
|
||||
return 0;
|
||||
|
@ -281,9 +281,9 @@ int kernfs_iop_permission(struct inode *inode, int mask)
|
|||
|
||||
kn = inode->i_private;
|
||||
|
||||
down_write(&kernfs_rwsem);
|
||||
mutex_lock(&kernfs_mutex);
|
||||
kernfs_refresh_inode(kn, inode);
|
||||
up_write(&kernfs_rwsem);
|
||||
mutex_unlock(&kernfs_mutex);
|
||||
|
||||
return generic_permission(inode, mask);
|
||||
}
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
#include <linux/lockdep.h>
|
||||
#include <linux/fs.h>
|
||||
#include <linux/mutex.h>
|
||||
#include <linux/rwsem.h>
|
||||
#include <linux/xattr.h>
|
||||
|
||||
#include <linux/kernfs.h>
|
||||
|
@ -70,7 +69,7 @@ struct kernfs_super_info {
|
|||
*/
|
||||
const void *ns;
|
||||
|
||||
/* anchored at kernfs_root->supers, protected by kernfs_rwsem */
|
||||
/* anchored at kernfs_root->supers, protected by kernfs_mutex */
|
||||
struct list_head node;
|
||||
};
|
||||
#define kernfs_info(SB) ((struct kernfs_super_info *)(SB->s_fs_info))
|
||||
|
@ -119,7 +118,7 @@ int __kernfs_setattr(struct kernfs_node *kn, const struct iattr *iattr);
|
|||
/*
|
||||
* dir.c
|
||||
*/
|
||||
extern struct rw_semaphore kernfs_rwsem;
|
||||
extern struct mutex kernfs_mutex;
|
||||
extern const struct dentry_operations kernfs_dops;
|
||||
extern const struct file_operations kernfs_dir_fops;
|
||||
extern const struct inode_operations kernfs_dir_iops;
|
||||
|
|
|
@ -255,9 +255,9 @@ static int kernfs_fill_super(struct super_block *sb, struct kernfs_fs_context *k
|
|||
sb->s_shrink.seeks = 0;
|
||||
|
||||
/* get root inode, initialize and unlock it */
|
||||
down_write(&kernfs_rwsem);
|
||||
mutex_lock(&kernfs_mutex);
|
||||
inode = kernfs_get_inode(sb, info->root->kn);
|
||||
up_write(&kernfs_rwsem);
|
||||
mutex_unlock(&kernfs_mutex);
|
||||
if (!inode) {
|
||||
pr_debug("kernfs: could not get root inode\n");
|
||||
return -ENOMEM;
|
||||
|
@ -344,9 +344,9 @@ int kernfs_get_tree(struct fs_context *fc)
|
|||
}
|
||||
sb->s_flags |= SB_ACTIVE;
|
||||
|
||||
down_write(&kernfs_rwsem);
|
||||
mutex_lock(&kernfs_mutex);
|
||||
list_add(&info->node, &info->root->supers);
|
||||
up_write(&kernfs_rwsem);
|
||||
mutex_unlock(&kernfs_mutex);
|
||||
}
|
||||
|
||||
fc->root = dget(sb->s_root);
|
||||
|
@ -372,9 +372,9 @@ void kernfs_kill_sb(struct super_block *sb)
|
|||
{
|
||||
struct kernfs_super_info *info = kernfs_info(sb);
|
||||
|
||||
down_write(&kernfs_rwsem);
|
||||
mutex_lock(&kernfs_mutex);
|
||||
list_del(&info->node);
|
||||
up_write(&kernfs_rwsem);
|
||||
mutex_unlock(&kernfs_mutex);
|
||||
|
||||
/*
|
||||
* Remove the superblock from fs_supers/s_instances
|
||||
|
|
|
@ -116,9 +116,9 @@ static int kernfs_getlink(struct inode *inode, char *path)
|
|||
struct kernfs_node *target = kn->symlink.target_kn;
|
||||
int error;
|
||||
|
||||
down_read(&kernfs_rwsem);
|
||||
mutex_lock(&kernfs_mutex);
|
||||
error = kernfs_get_target_path(parent, target, path);
|
||||
up_read(&kernfs_rwsem);
|
||||
mutex_unlock(&kernfs_mutex);
|
||||
|
||||
return error;
|
||||
}
|
||||
|
|
|
@ -202,7 +202,7 @@ struct kernfs_root {
|
|||
u32 id_highbits;
|
||||
struct kernfs_syscall_ops *syscall_ops;
|
||||
|
||||
/* list of kernfs_super_info of this root, protected by kernfs_rwsem */
|
||||
/* list of kernfs_super_info of this root, protected by kernfs_mutex */
|
||||
struct list_head supers;
|
||||
|
||||
wait_queue_head_t deactivate_waitq;
|
||||
|
|
Loading…
Reference in New Issue