diff options
author | Amy Griffis <amy.griffis@hp.com> | 2005-11-03 10:57:06 -0500 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2006-03-20 14:08:53 -0500 |
commit | f38aa94224c5517a40ba56d453779f70d3229803 (patch) | |
tree | 30d0f7390cb2f1cf33a55080cb6c0676727af1fa | |
parent | 90d526c074ae5db484388da56c399acf892b6c17 (diff) |
[PATCH] Pass dentry, not just name, in fsnotify creation hooks.
The audit hooks (to be added shortly) will want to see dentry->d_inode
too, not just the name.
Signed-off-by: Amy Griffis <amy.griffis@hp.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
-rw-r--r-- | fs/namei.c | 10 | ||||
-rw-r--r-- | include/linux/fsnotify.h | 9 | ||||
-rw-r--r-- | kernel/auditsc.c | 2 |
3 files changed, 11 insertions, 10 deletions
diff --git a/fs/namei.c b/fs/namei.c index 8dc2b038d5d9..f6619af9e957 100644 --- a/fs/namei.c +++ b/fs/namei.c | |||
@@ -1472,7 +1472,7 @@ int vfs_create(struct inode *dir, struct dentry *dentry, int mode, | |||
1472 | DQUOT_INIT(dir); | 1472 | DQUOT_INIT(dir); |
1473 | error = dir->i_op->create(dir, dentry, mode, nd); | 1473 | error = dir->i_op->create(dir, dentry, mode, nd); |
1474 | if (!error) | 1474 | if (!error) |
1475 | fsnotify_create(dir, dentry->d_name.name); | 1475 | fsnotify_create(dir, dentry); |
1476 | return error; | 1476 | return error; |
1477 | } | 1477 | } |
1478 | 1478 | ||
@@ -1793,7 +1793,7 @@ int vfs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t dev) | |||
1793 | DQUOT_INIT(dir); | 1793 | DQUOT_INIT(dir); |
1794 | error = dir->i_op->mknod(dir, dentry, mode, dev); | 1794 | error = dir->i_op->mknod(dir, dentry, mode, dev); |
1795 | if (!error) | 1795 | if (!error) |
1796 | fsnotify_create(dir, dentry->d_name.name); | 1796 | fsnotify_create(dir, dentry); |
1797 | return error; | 1797 | return error; |
1798 | } | 1798 | } |
1799 | 1799 | ||
@@ -1870,7 +1870,7 @@ int vfs_mkdir(struct inode *dir, struct dentry *dentry, int mode) | |||
1870 | DQUOT_INIT(dir); | 1870 | DQUOT_INIT(dir); |
1871 | error = dir->i_op->mkdir(dir, dentry, mode); | 1871 | error = dir->i_op->mkdir(dir, dentry, mode); |
1872 | if (!error) | 1872 | if (!error) |
1873 | fsnotify_mkdir(dir, dentry->d_name.name); | 1873 | fsnotify_mkdir(dir, dentry); |
1874 | return error; | 1874 | return error; |
1875 | } | 1875 | } |
1876 | 1876 | ||
@@ -2133,7 +2133,7 @@ int vfs_symlink(struct inode *dir, struct dentry *dentry, const char *oldname, i | |||
2133 | DQUOT_INIT(dir); | 2133 | DQUOT_INIT(dir); |
2134 | error = dir->i_op->symlink(dir, dentry, oldname); | 2134 | error = dir->i_op->symlink(dir, dentry, oldname); |
2135 | if (!error) | 2135 | if (!error) |
2136 | fsnotify_create(dir, dentry->d_name.name); | 2136 | fsnotify_create(dir, dentry); |
2137 | return error; | 2137 | return error; |
2138 | } | 2138 | } |
2139 | 2139 | ||
@@ -2210,7 +2210,7 @@ int vfs_link(struct dentry *old_dentry, struct inode *dir, struct dentry *new_de | |||
2210 | error = dir->i_op->link(old_dentry, dir, new_dentry); | 2210 | error = dir->i_op->link(old_dentry, dir, new_dentry); |
2211 | mutex_unlock(&old_dentry->d_inode->i_mutex); | 2211 | mutex_unlock(&old_dentry->d_inode->i_mutex); |
2212 | if (!error) | 2212 | if (!error) |
2213 | fsnotify_create(dir, new_dentry->d_name.name); | 2213 | fsnotify_create(dir, new_dentry); |
2214 | return error; | 2214 | return error; |
2215 | } | 2215 | } |
2216 | 2216 | ||
diff --git a/include/linux/fsnotify.h b/include/linux/fsnotify.h index 03b8e7932b83..b5ff64d2f092 100644 --- a/include/linux/fsnotify.h +++ b/include/linux/fsnotify.h | |||
@@ -70,19 +70,20 @@ static inline void fsnotify_inoderemove(struct inode *inode) | |||
70 | /* | 70 | /* |
71 | * fsnotify_create - 'name' was linked in | 71 | * fsnotify_create - 'name' was linked in |
72 | */ | 72 | */ |
73 | static inline void fsnotify_create(struct inode *inode, const char *name) | 73 | static inline void fsnotify_create(struct inode *inode, struct dentry *dentry) |
74 | { | 74 | { |
75 | inode_dir_notify(inode, DN_CREATE); | 75 | inode_dir_notify(inode, DN_CREATE); |
76 | inotify_inode_queue_event(inode, IN_CREATE, 0, name); | 76 | inotify_inode_queue_event(inode, IN_CREATE, 0, dentry->d_name.name); |
77 | } | 77 | } |
78 | 78 | ||
79 | /* | 79 | /* |
80 | * fsnotify_mkdir - directory 'name' was created | 80 | * fsnotify_mkdir - directory 'name' was created |
81 | */ | 81 | */ |
82 | static inline void fsnotify_mkdir(struct inode *inode, const char *name) | 82 | static inline void fsnotify_mkdir(struct inode *inode, struct dentry *dentry) |
83 | { | 83 | { |
84 | inode_dir_notify(inode, DN_CREATE); | 84 | inode_dir_notify(inode, DN_CREATE); |
85 | inotify_inode_queue_event(inode, IN_CREATE | IN_ISDIR, 0, name); | 85 | inotify_inode_queue_event(inode, IN_CREATE | IN_ISDIR, 0, |
86 | dentry->d_name.name); | ||
86 | } | 87 | } |
87 | 88 | ||
88 | /* | 89 | /* |
diff --git a/kernel/auditsc.c b/kernel/auditsc.c index 95076fa12202..55ba331757c5 100644 --- a/kernel/auditsc.c +++ b/kernel/auditsc.c | |||
@@ -515,7 +515,7 @@ static int audit_filter_rules(struct task_struct *tsk, | |||
515 | case AUDIT_INODE: | 515 | case AUDIT_INODE: |
516 | if (ctx) { | 516 | if (ctx) { |
517 | for (j = 0; j < ctx->name_count; j++) { | 517 | for (j = 0; j < ctx->name_count; j++) { |
518 | if (audit_comparator(ctx->names[j].ino, op, value)) { | 518 | if ( audit_comparator(ctx->names[j].ino, op, value)) { |
519 | ++result; | 519 | ++result; |
520 | break; | 520 | break; |
521 | } | 521 | } |