aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/namei.c3
-rw-r--r--include/linux/fsnotify.h22
2 files changed, 24 insertions, 1 deletions
diff --git a/fs/namei.c b/fs/namei.c
index 73e2e665817a..241cff423653 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -2188,6 +2188,7 @@ int vfs_unlink(struct inode *dir, struct dentry *dentry)
2188 2188
2189 /* We don't d_delete() NFS sillyrenamed files--they still exist. */ 2189 /* We don't d_delete() NFS sillyrenamed files--they still exist. */
2190 if (!error && !(dentry->d_flags & DCACHE_NFSFS_RENAMED)) { 2190 if (!error && !(dentry->d_flags & DCACHE_NFSFS_RENAMED)) {
2191 fsnotify_link_count(dentry->d_inode);
2191 d_delete(dentry); 2192 d_delete(dentry);
2192 } 2193 }
2193 2194
@@ -2360,7 +2361,7 @@ int vfs_link(struct dentry *old_dentry, struct inode *dir, struct dentry *new_de
2360 error = dir->i_op->link(old_dentry, dir, new_dentry); 2361 error = dir->i_op->link(old_dentry, dir, new_dentry);
2361 mutex_unlock(&old_dentry->d_inode->i_mutex); 2362 mutex_unlock(&old_dentry->d_inode->i_mutex);
2362 if (!error) 2363 if (!error)
2363 fsnotify_create(dir, new_dentry); 2364 fsnotify_link(dir, old_dentry->d_inode, new_dentry);
2364 return error; 2365 return error;
2365} 2366}
2366 2367
diff --git a/include/linux/fsnotify.h b/include/linux/fsnotify.h
index 2bd31fa623b6..d4b7c4ac72e6 100644
--- a/include/linux/fsnotify.h
+++ b/include/linux/fsnotify.h
@@ -92,6 +92,14 @@ static inline void fsnotify_inoderemove(struct inode *inode)
92} 92}
93 93
94/* 94/*
95 * fsnotify_link_count - inode's link count changed
96 */
97static inline void fsnotify_link_count(struct inode *inode)
98{
99 inotify_inode_queue_event(inode, IN_ATTRIB, 0, NULL, NULL);
100}
101
102/*
95 * fsnotify_create - 'name' was linked in 103 * fsnotify_create - 'name' was linked in
96 */ 104 */
97static inline void fsnotify_create(struct inode *inode, struct dentry *dentry) 105static inline void fsnotify_create(struct inode *inode, struct dentry *dentry)
@@ -103,6 +111,20 @@ static inline void fsnotify_create(struct inode *inode, struct dentry *dentry)
103} 111}
104 112
105/* 113/*
114 * fsnotify_link - new hardlink in 'inode' directory
115 * Note: We have to pass also the linked inode ptr as some filesystems leave
116 * new_dentry->d_inode NULL and instantiate inode pointer later
117 */
118static inline void fsnotify_link(struct inode *dir, struct inode *inode, struct dentry *new_dentry)
119{
120 inode_dir_notify(dir, DN_CREATE);
121 inotify_inode_queue_event(dir, IN_CREATE, 0, new_dentry->d_name.name,
122 inode);
123 fsnotify_link_count(inode);
124 audit_inode_child(new_dentry->d_name.name, new_dentry, dir);
125}
126
127/*
106 * fsnotify_mkdir - directory 'name' was created 128 * fsnotify_mkdir - directory 'name' was created
107 */ 129 */
108static inline void fsnotify_mkdir(struct inode *inode, struct dentry *dentry) 130static inline void fsnotify_mkdir(struct inode *inode, struct dentry *dentry)