mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-06-17 20:25:19 +00:00
fsnotify: unify inode and mount marks handling
There's a lot of common code in inode and mount marks handling. Factor it out to a common helper function. Signed-off-by: Jan Kara <jack@suse.cz> Cc: Eric Paris <eparis@redhat.com> Cc: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
820c12d5d6
commit
0809ab69a2
11 changed files with 160 additions and 229 deletions
|
@ -174,9 +174,9 @@ static void insert_hash(struct audit_chunk *chunk)
|
|||
struct fsnotify_mark *entry = &chunk->mark;
|
||||
struct list_head *list;
|
||||
|
||||
if (!entry->i.inode)
|
||||
if (!entry->inode)
|
||||
return;
|
||||
list = chunk_hash(entry->i.inode);
|
||||
list = chunk_hash(entry->inode);
|
||||
list_add_rcu(&chunk->hash, list);
|
||||
}
|
||||
|
||||
|
@ -188,7 +188,7 @@ struct audit_chunk *audit_tree_lookup(const struct inode *inode)
|
|||
|
||||
list_for_each_entry_rcu(p, list, hash) {
|
||||
/* mark.inode may have gone NULL, but who cares? */
|
||||
if (p->mark.i.inode == inode) {
|
||||
if (p->mark.inode == inode) {
|
||||
atomic_long_inc(&p->refs);
|
||||
return p;
|
||||
}
|
||||
|
@ -231,7 +231,7 @@ static void untag_chunk(struct node *p)
|
|||
new = alloc_chunk(size);
|
||||
|
||||
spin_lock(&entry->lock);
|
||||
if (chunk->dead || !entry->i.inode) {
|
||||
if (chunk->dead || !entry->inode) {
|
||||
spin_unlock(&entry->lock);
|
||||
if (new)
|
||||
free_chunk(new);
|
||||
|
@ -258,7 +258,7 @@ static void untag_chunk(struct node *p)
|
|||
goto Fallback;
|
||||
|
||||
fsnotify_duplicate_mark(&new->mark, entry);
|
||||
if (fsnotify_add_mark(&new->mark, new->mark.group, new->mark.i.inode, NULL, 1)) {
|
||||
if (fsnotify_add_mark(&new->mark, new->mark.group, new->mark.inode, NULL, 1)) {
|
||||
fsnotify_put_mark(&new->mark);
|
||||
goto Fallback;
|
||||
}
|
||||
|
@ -386,7 +386,7 @@ static int tag_chunk(struct inode *inode, struct audit_tree *tree)
|
|||
chunk_entry = &chunk->mark;
|
||||
|
||||
spin_lock(&old_entry->lock);
|
||||
if (!old_entry->i.inode) {
|
||||
if (!old_entry->inode) {
|
||||
/* old_entry is being shot, lets just lie */
|
||||
spin_unlock(&old_entry->lock);
|
||||
fsnotify_put_mark(old_entry);
|
||||
|
@ -395,7 +395,7 @@ static int tag_chunk(struct inode *inode, struct audit_tree *tree)
|
|||
}
|
||||
|
||||
fsnotify_duplicate_mark(chunk_entry, old_entry);
|
||||
if (fsnotify_add_mark(chunk_entry, chunk_entry->group, chunk_entry->i.inode, NULL, 1)) {
|
||||
if (fsnotify_add_mark(chunk_entry, chunk_entry->group, chunk_entry->inode, NULL, 1)) {
|
||||
spin_unlock(&old_entry->lock);
|
||||
fsnotify_put_mark(chunk_entry);
|
||||
fsnotify_put_mark(old_entry);
|
||||
|
@ -611,7 +611,7 @@ void audit_trim_trees(void)
|
|||
list_for_each_entry(node, &tree->chunks, list) {
|
||||
struct audit_chunk *chunk = find_chunk(node);
|
||||
/* this could be NULL if the watch is dying else where... */
|
||||
struct inode *inode = chunk->mark.i.inode;
|
||||
struct inode *inode = chunk->mark.inode;
|
||||
node->index |= 1U<<31;
|
||||
if (iterate_mounts(compare_root, inode, root_mnt))
|
||||
node->index &= ~(1U<<31);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue