Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 83431
b: refs/heads/master
c: ece9591
h: refs/heads/master
i:
  83429: b75113c
  83427: 3872087
  83423: f28ac45
v: v3
  • Loading branch information
Jan Kara authored and Linus Torvalds committed Feb 6, 2008
1 parent d1c9eae commit f0cb681
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 6d9851618104a21dbf5ee8260b5f2d4b5229c77e
refs/heads/master: ece95912db94d98e202cbedb8f35206deb29d83d
3 changes: 2 additions & 1 deletion trunk/fs/namei.c
Original file line number Diff line number Diff line change
Expand Up @@ -2188,6 +2188,7 @@ int vfs_unlink(struct inode *dir, struct dentry *dentry)

/* We don't d_delete() NFS sillyrenamed files--they still exist. */
if (!error && !(dentry->d_flags & DCACHE_NFSFS_RENAMED)) {
fsnotify_link_count(dentry->d_inode);
d_delete(dentry);
}

Expand Down Expand Up @@ -2360,7 +2361,7 @@ int vfs_link(struct dentry *old_dentry, struct inode *dir, struct dentry *new_de
error = dir->i_op->link(old_dentry, dir, new_dentry);
mutex_unlock(&old_dentry->d_inode->i_mutex);
if (!error)
fsnotify_create(dir, new_dentry);
fsnotify_link(dir, old_dentry->d_inode, new_dentry);
return error;
}

Expand Down
22 changes: 22 additions & 0 deletions trunk/include/linux/fsnotify.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,14 @@ static inline void fsnotify_inoderemove(struct inode *inode)
inotify_inode_is_dead(inode);
}

/*
* fsnotify_link_count - inode's link count changed
*/
static inline void fsnotify_link_count(struct inode *inode)
{
inotify_inode_queue_event(inode, IN_ATTRIB, 0, NULL, NULL);
}

/*
* fsnotify_create - 'name' was linked in
*/
Expand All @@ -102,6 +110,20 @@ static inline void fsnotify_create(struct inode *inode, struct dentry *dentry)
audit_inode_child(dentry->d_name.name, dentry, inode);
}

/*
* fsnotify_link - new hardlink in 'inode' directory
* Note: We have to pass also the linked inode ptr as some filesystems leave
* new_dentry->d_inode NULL and instantiate inode pointer later
*/
static inline void fsnotify_link(struct inode *dir, struct inode *inode, struct dentry *new_dentry)
{
inode_dir_notify(dir, DN_CREATE);
inotify_inode_queue_event(dir, IN_CREATE, 0, new_dentry->d_name.name,
inode);
fsnotify_link_count(inode);
audit_inode_child(new_dentry->d_name.name, new_dentry, dir);
}

/*
* fsnotify_mkdir - directory 'name' was created
*/
Expand Down

0 comments on commit f0cb681

Please sign in to comment.