Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b249f5be authored by Amir Goldstein's avatar Amir Goldstein Committed by Jan Kara
Browse files

fsnotify: add fsnotify_add_inode_mark() wrappers



Before changing the arguments of the functions fsnotify_add_mark()
and fsnotify_add_mark_locked(), convert most callers to use a wrapper.

Signed-off-by: default avatarAmir Goldstein <amir73il@gmail.com>
Signed-off-by: default avatarJan Kara <jack@suse.cz>
parent 837a3934
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -319,7 +319,7 @@ int fcntl_dirnotify(int fd, struct file *filp, unsigned long arg)
		dn_mark = container_of(fsn_mark, struct dnotify_mark, fsn_mark);
		dn_mark = container_of(fsn_mark, struct dnotify_mark, fsn_mark);
		spin_lock(&fsn_mark->lock);
		spin_lock(&fsn_mark->lock);
	} else {
	} else {
		error = fsnotify_add_mark_locked(new_fsn_mark, inode, NULL, 0);
		error = fsnotify_add_inode_mark_locked(new_fsn_mark, inode, 0);
		if (error) {
		if (error) {
			mutex_unlock(&dnotify_group->mark_mutex);
			mutex_unlock(&dnotify_group->mark_mutex);
			goto out_err;
			goto out_err;
+1 −1
Original line number Original line Diff line number Diff line
@@ -582,7 +582,7 @@ static int inotify_new_watch(struct fsnotify_group *group,
	}
	}


	/* we are on the idr, now get on the inode */
	/* we are on the idr, now get on the inode */
	ret = fsnotify_add_mark_locked(&tmp_i_mark->fsn_mark, inode, NULL, 0);
	ret = fsnotify_add_inode_mark_locked(&tmp_i_mark->fsn_mark, inode, 0);
	if (ret) {
	if (ret) {
		/* we failed to get on the inode, get off the idr */
		/* we failed to get on the inode, get off the idr */
		inotify_remove_from_idr(group, tmp_i_mark);
		inotify_remove_from_idr(group, tmp_i_mark);
+15 −1
Original line number Original line Diff line number Diff line
@@ -401,7 +401,21 @@ extern struct fsnotify_mark *fsnotify_find_mark(
extern int fsnotify_add_mark(struct fsnotify_mark *mark, struct inode *inode,
extern int fsnotify_add_mark(struct fsnotify_mark *mark, struct inode *inode,
			     struct vfsmount *mnt, int allow_dups);
			     struct vfsmount *mnt, int allow_dups);
extern int fsnotify_add_mark_locked(struct fsnotify_mark *mark,
extern int fsnotify_add_mark_locked(struct fsnotify_mark *mark,
				    struct inode *inode, struct vfsmount *mnt, int allow_dups);
				    struct inode *inode, struct vfsmount *mnt,
				    int allow_dups);
/* attach the mark to the inode */
static inline int fsnotify_add_inode_mark(struct fsnotify_mark *mark,
					  struct inode *inode,
					  int allow_dups)
{
	return fsnotify_add_mark(mark, inode, NULL, allow_dups);
}
static inline int fsnotify_add_inode_mark_locked(struct fsnotify_mark *mark,
						 struct inode *inode,
						 int allow_dups)
{
	return fsnotify_add_mark_locked(mark, inode, NULL, allow_dups);
}
/* given a group and a mark, flag mark to be freed when all references are dropped */
/* given a group and a mark, flag mark to be freed when all references are dropped */
extern void fsnotify_destroy_mark(struct fsnotify_mark *mark,
extern void fsnotify_destroy_mark(struct fsnotify_mark *mark,
				  struct fsnotify_group *group);
				  struct fsnotify_group *group);
+1 −1
Original line number Original line Diff line number Diff line
@@ -109,7 +109,7 @@ struct audit_fsnotify_mark *audit_alloc_mark(struct audit_krule *krule, char *pa
	audit_update_mark(audit_mark, dentry->d_inode);
	audit_update_mark(audit_mark, dentry->d_inode);
	audit_mark->rule = krule;
	audit_mark->rule = krule;


	ret = fsnotify_add_mark(&audit_mark->mark, inode, NULL, true);
	ret = fsnotify_add_inode_mark(&audit_mark->mark, inode, true);
	if (ret < 0) {
	if (ret < 0) {
		fsnotify_put_mark(&audit_mark->mark);
		fsnotify_put_mark(&audit_mark->mark);
		audit_mark = ERR_PTR(ret);
		audit_mark = ERR_PTR(ret);
+5 −5
Original line number Original line Diff line number Diff line
@@ -288,8 +288,8 @@ static void untag_chunk(struct node *p)
	if (!new)
	if (!new)
		goto Fallback;
		goto Fallback;


	if (fsnotify_add_mark_locked(&new->mark, entry->connector->inode,
	if (fsnotify_add_inode_mark_locked(&new->mark, entry->connector->inode,
				     NULL, 1)) {
					   1)) {
		fsnotify_put_mark(&new->mark);
		fsnotify_put_mark(&new->mark);
		goto Fallback;
		goto Fallback;
	}
	}
@@ -354,7 +354,7 @@ static int create_chunk(struct inode *inode, struct audit_tree *tree)
		return -ENOMEM;
		return -ENOMEM;


	entry = &chunk->mark;
	entry = &chunk->mark;
	if (fsnotify_add_mark(entry, inode, NULL, 0)) {
	if (fsnotify_add_inode_mark(entry, inode, 0)) {
		fsnotify_put_mark(entry);
		fsnotify_put_mark(entry);
		return -ENOSPC;
		return -ENOSPC;
	}
	}
@@ -434,8 +434,8 @@ static int tag_chunk(struct inode *inode, struct audit_tree *tree)
		return -ENOENT;
		return -ENOENT;
	}
	}


	if (fsnotify_add_mark_locked(chunk_entry,
	if (fsnotify_add_inode_mark_locked(chunk_entry,
			     old_entry->connector->inode, NULL, 1)) {
			     old_entry->connector->inode, 1)) {
		spin_unlock(&old_entry->lock);
		spin_unlock(&old_entry->lock);
		mutex_unlock(&old_entry->group->mark_mutex);
		mutex_unlock(&old_entry->group->mark_mutex);
		fsnotify_put_mark(chunk_entry);
		fsnotify_put_mark(chunk_entry);
Loading