Commit d27fb65b authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'work.dcache' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs

Pull misc dcache updates from Al Viro:
 "Most of this pile is putting name length into struct name_snapshot and
  making use of it.

  The beginning of this series ("ovl_lookup_real_one(): don't bother
  with strlen()") ought to have been split in two (separate switch of
  name_snapshot to struct qstr from overlayfs reaping the trivial
  benefits of that), but I wanted to avoid a rebase - by the time I'd
  spotted that it was (a) in -next and (b) close to 5.1-final ;-/"

* 'work.dcache' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
  audit_compare_dname_path(): switch to const struct qstr *
  audit_update_watch(): switch to const struct qstr *
  inotify_handle_event(): don't bother with strlen()
  fsnotify: switch send_to_group() and ->handle_event to const struct qstr *
  fsnotify(): switch to passing const struct qstr * for file_name
  switch fsnotify_move() to passing const struct qstr * for old_name
  ovl_lookup_real_one(): don't bother with strlen()
  sysv: bury the broken "quietly truncate the long filenames" logics
  nsfs: unobfuscate
  unexport d_alloc_pseudo()
parents d3511f53 795d673a
...@@ -668,3 +668,8 @@ in your dentry operations instead. ...@@ -668,3 +668,8 @@ in your dentry operations instead.
DCACHE_RCUACCESS is gone; having an RCU delay on dentry freeing is the DCACHE_RCUACCESS is gone; having an RCU delay on dentry freeing is the
default. DCACHE_NORCU opts out, and only d_alloc_pseudo() has any default. DCACHE_NORCU opts out, and only d_alloc_pseudo() has any
business doing so. business doing so.
--
[mandatory]
d_alloc_pseudo() is internal-only; uses outside of alloc_file_pseudo() are
very suspect (and won't work in modules). Such uses are very likely to
be misspelled d_alloc_anon().
...@@ -284,25 +284,23 @@ static inline int dname_external(const struct dentry *dentry) ...@@ -284,25 +284,23 @@ static inline int dname_external(const struct dentry *dentry)
void take_dentry_name_snapshot(struct name_snapshot *name, struct dentry *dentry) void take_dentry_name_snapshot(struct name_snapshot *name, struct dentry *dentry)
{ {
spin_lock(&dentry->d_lock); spin_lock(&dentry->d_lock);
name->name = dentry->d_name;
if (unlikely(dname_external(dentry))) { if (unlikely(dname_external(dentry))) {
struct external_name *p = external_name(dentry); atomic_inc(&external_name(dentry)->u.count);
atomic_inc(&p->u.count);
spin_unlock(&dentry->d_lock);
name->name = p->name;
} else { } else {
memcpy(name->inline_name, dentry->d_iname, memcpy(name->inline_name, dentry->d_iname,
dentry->d_name.len + 1); dentry->d_name.len + 1);
spin_unlock(&dentry->d_lock); name->name.name = name->inline_name;
name->name = name->inline_name;
} }
spin_unlock(&dentry->d_lock);
} }
EXPORT_SYMBOL(take_dentry_name_snapshot); EXPORT_SYMBOL(take_dentry_name_snapshot);
void release_dentry_name_snapshot(struct name_snapshot *name) void release_dentry_name_snapshot(struct name_snapshot *name)
{ {
if (unlikely(name->name != name->inline_name)) { if (unlikely(name->name.name != name->inline_name)) {
struct external_name *p; struct external_name *p;
p = container_of(name->name, struct external_name, name[0]); p = container_of(name->name.name, struct external_name, name[0]);
if (unlikely(atomic_dec_and_test(&p->u.count))) if (unlikely(atomic_dec_and_test(&p->u.count)))
kfree_rcu(p, u.head); kfree_rcu(p, u.head);
} }
...@@ -1742,6 +1740,9 @@ struct dentry *d_alloc_cursor(struct dentry * parent) ...@@ -1742,6 +1740,9 @@ struct dentry *d_alloc_cursor(struct dentry * parent)
* never be anyone's children or parents. Unlike all other * never be anyone's children or parents. Unlike all other
* dentries, these will not have RCU delay between dropping the * dentries, these will not have RCU delay between dropping the
* last reference and freeing them. * last reference and freeing them.
*
* The only user is alloc_file_pseudo() and that's what should
* be considered a public interface. Don't use directly.
*/ */
struct dentry *d_alloc_pseudo(struct super_block *sb, const struct qstr *name) struct dentry *d_alloc_pseudo(struct super_block *sb, const struct qstr *name)
{ {
...@@ -1750,7 +1751,6 @@ struct dentry *d_alloc_pseudo(struct super_block *sb, const struct qstr *name) ...@@ -1750,7 +1751,6 @@ struct dentry *d_alloc_pseudo(struct super_block *sb, const struct qstr *name)
dentry->d_flags |= DCACHE_NORCU; dentry->d_flags |= DCACHE_NORCU;
return dentry; return dentry;
} }
EXPORT_SYMBOL(d_alloc_pseudo);
struct dentry *d_alloc_name(struct dentry *parent, const char *name) struct dentry *d_alloc_name(struct dentry *parent, const char *name)
{ {
......
...@@ -818,7 +818,7 @@ struct dentry *debugfs_rename(struct dentry *old_dir, struct dentry *old_dentry, ...@@ -818,7 +818,7 @@ struct dentry *debugfs_rename(struct dentry *old_dir, struct dentry *old_dentry,
goto exit; goto exit;
} }
d_move(old_dentry, dentry); d_move(old_dentry, dentry);
fsnotify_move(d_inode(old_dir), d_inode(new_dir), old_name.name, fsnotify_move(d_inode(old_dir), d_inode(new_dir), &old_name.name,
d_is_dir(old_dentry), d_is_dir(old_dentry),
NULL, old_dentry); NULL, old_dentry);
release_dentry_name_snapshot(&old_name); release_dentry_name_snapshot(&old_name);
......
...@@ -155,6 +155,7 @@ extern struct dentry *__d_alloc(struct super_block *, const struct qstr *); ...@@ -155,6 +155,7 @@ extern struct dentry *__d_alloc(struct super_block *, const struct qstr *);
extern int d_set_mounted(struct dentry *dentry); extern int d_set_mounted(struct dentry *dentry);
extern long prune_dcache_sb(struct super_block *sb, struct shrink_control *sc); extern long prune_dcache_sb(struct super_block *sb, struct shrink_control *sc);
extern struct dentry *d_alloc_cursor(struct dentry *); extern struct dentry *d_alloc_cursor(struct dentry *);
extern struct dentry * d_alloc_pseudo(struct super_block *, const struct qstr *);
/* /*
* read_write.c * read_write.c
......
...@@ -885,6 +885,7 @@ static void kernfs_notify_workfn(struct work_struct *work) ...@@ -885,6 +885,7 @@ static void kernfs_notify_workfn(struct work_struct *work)
list_for_each_entry(info, &kernfs_root(kn)->supers, node) { list_for_each_entry(info, &kernfs_root(kn)->supers, node) {
struct kernfs_node *parent; struct kernfs_node *parent;
struct inode *inode; struct inode *inode;
struct qstr name;
/* /*
* We want fsnotify_modify() on @kn but as the * We want fsnotify_modify() on @kn but as the
...@@ -896,6 +897,7 @@ static void kernfs_notify_workfn(struct work_struct *work) ...@@ -896,6 +897,7 @@ static void kernfs_notify_workfn(struct work_struct *work)
if (!inode) if (!inode)
continue; continue;
name = (struct qstr)QSTR_INIT(kn->name, strlen(kn->name));
parent = kernfs_get_parent(kn); parent = kernfs_get_parent(kn);
if (parent) { if (parent) {
struct inode *p_inode; struct inode *p_inode;
...@@ -903,7 +905,7 @@ static void kernfs_notify_workfn(struct work_struct *work) ...@@ -903,7 +905,7 @@ static void kernfs_notify_workfn(struct work_struct *work)
p_inode = ilookup(info->sb, parent->id.ino); p_inode = ilookup(info->sb, parent->id.ino);
if (p_inode) { if (p_inode) {
fsnotify(p_inode, FS_MODIFY | FS_EVENT_ON_CHILD, fsnotify(p_inode, FS_MODIFY | FS_EVENT_ON_CHILD,
inode, FSNOTIFY_EVENT_INODE, kn->name, 0); inode, FSNOTIFY_EVENT_INODE, &name, 0);
iput(p_inode); iput(p_inode);
} }
...@@ -911,7 +913,7 @@ static void kernfs_notify_workfn(struct work_struct *work) ...@@ -911,7 +913,7 @@ static void kernfs_notify_workfn(struct work_struct *work)
} }
fsnotify(inode, FS_MODIFY, inode, FSNOTIFY_EVENT_INODE, fsnotify(inode, FS_MODIFY, inode, FSNOTIFY_EVENT_INODE,
kn->name, 0); &name, 0);
iput(inode); iput(inode);
} }
......
...@@ -4498,10 +4498,10 @@ int vfs_rename(struct inode *old_dir, struct dentry *old_dentry, ...@@ -4498,10 +4498,10 @@ int vfs_rename(struct inode *old_dir, struct dentry *old_dentry,
inode_unlock(target); inode_unlock(target);
dput(new_dentry); dput(new_dentry);
if (!error) { if (!error) {
fsnotify_move(old_dir, new_dir, old_name.name, is_dir, fsnotify_move(old_dir, new_dir, &old_name.name, is_dir,
!(flags & RENAME_EXCHANGE) ? target : NULL, old_dentry); !(flags & RENAME_EXCHANGE) ? target : NULL, old_dentry);
if (flags & RENAME_EXCHANGE) { if (flags & RENAME_EXCHANGE) {
fsnotify_move(new_dir, old_dir, old_dentry->d_name.name, fsnotify_move(new_dir, old_dir, &old_dentry->d_name,
new_is_dir, NULL, new_dentry); new_is_dir, NULL, new_dentry);
} }
} }
......
...@@ -81,7 +81,7 @@ static void dnotify_recalc_inode_mask(struct fsnotify_mark *fsn_mark) ...@@ -81,7 +81,7 @@ static void dnotify_recalc_inode_mask(struct fsnotify_mark *fsn_mark)
static int dnotify_handle_event(struct fsnotify_group *group, static int dnotify_handle_event(struct fsnotify_group *group,
struct inode *inode, struct inode *inode,
u32 mask, const void *data, int data_type, u32 mask, const void *data, int data_type,
const unsigned char *file_name, u32 cookie, const struct qstr *file_name, u32 cookie,
struct fsnotify_iter_info *iter_info) struct fsnotify_iter_info *iter_info)
{ {
struct fsnotify_mark *inode_mark = fsnotify_iter_inode_mark(iter_info); struct fsnotify_mark *inode_mark = fsnotify_iter_inode_mark(iter_info);
......
...@@ -367,7 +367,7 @@ static __kernel_fsid_t fanotify_get_fsid(struct fsnotify_iter_info *iter_info) ...@@ -367,7 +367,7 @@ static __kernel_fsid_t fanotify_get_fsid(struct fsnotify_iter_info *iter_info)
static int fanotify_handle_event(struct fsnotify_group *group, static int fanotify_handle_event(struct fsnotify_group *group,
struct inode *inode, struct inode *inode,
u32 mask, const void *data, int data_type, u32 mask, const void *data, int data_type,
const unsigned char *file_name, u32 cookie, const struct qstr *file_name, u32 cookie,
struct fsnotify_iter_info *iter_info) struct fsnotify_iter_info *iter_info)
{ {
int ret = 0; int ret = 0;
......
...@@ -179,10 +179,10 @@ int __fsnotify_parent(const struct path *path, struct dentry *dentry, __u32 mask ...@@ -179,10 +179,10 @@ int __fsnotify_parent(const struct path *path, struct dentry *dentry, __u32 mask
take_dentry_name_snapshot(&name, dentry); take_dentry_name_snapshot(&name, dentry);
if (path) if (path)
ret = fsnotify(p_inode, mask, path, FSNOTIFY_EVENT_PATH, ret = fsnotify(p_inode, mask, path, FSNOTIFY_EVENT_PATH,
name.name, 0); &name.name, 0);
else else
ret = fsnotify(p_inode, mask, dentry->d_inode, FSNOTIFY_EVENT_INODE, ret = fsnotify(p_inode, mask, dentry->d_inode, FSNOTIFY_EVENT_INODE,
name.name, 0); &name.name, 0);
release_dentry_name_snapshot(&name); release_dentry_name_snapshot(&name);
} }
...@@ -195,7 +195,7 @@ EXPORT_SYMBOL_GPL(__fsnotify_parent); ...@@ -195,7 +195,7 @@ EXPORT_SYMBOL_GPL(__fsnotify_parent);
static int send_to_group(struct inode *to_tell, static int send_to_group(struct inode *to_tell,
__u32 mask, const void *data, __u32 mask, const void *data,
int data_is, u32 cookie, int data_is, u32 cookie,
const unsigned char *file_name, const struct qstr *file_name,
struct fsnotify_iter_info *iter_info) struct fsnotify_iter_info *iter_info)
{ {
struct fsnotify_group *group = NULL; struct fsnotify_group *group = NULL;
...@@ -325,7 +325,7 @@ static void fsnotify_iter_next(struct fsnotify_iter_info *iter_info) ...@@ -325,7 +325,7 @@ static void fsnotify_iter_next(struct fsnotify_iter_info *iter_info)
* notification event in whatever means they feel necessary. * notification event in whatever means they feel necessary.
*/ */
int fsnotify(struct inode *to_tell, __u32 mask, const void *data, int data_is, int fsnotify(struct inode *to_tell, __u32 mask, const void *data, int data_is,
const unsigned char *file_name, u32 cookie) const struct qstr *file_name, u32 cookie)
{ {
struct fsnotify_iter_info iter_info = {}; struct fsnotify_iter_info iter_info = {};
struct super_block *sb = to_tell->i_sb; struct super_block *sb = to_tell->i_sb;
......
...@@ -27,7 +27,7 @@ extern void inotify_ignored_and_remove_idr(struct fsnotify_mark *fsn_mark, ...@@ -27,7 +27,7 @@ extern void inotify_ignored_and_remove_idr(struct fsnotify_mark *fsn_mark,
extern int inotify_handle_event(struct fsnotify_group *group, extern int inotify_handle_event(struct fsnotify_group *group,
struct inode *inode, struct inode *inode,
u32 mask, const void *data, int data_type, u32 mask, const void *data, int data_type,
const unsigned char *file_name, u32 cookie, const struct qstr *file_name, u32 cookie,
struct fsnotify_iter_info *iter_info); struct fsnotify_iter_info *iter_info);
extern const struct fsnotify_ops inotify_fsnotify_ops; extern const struct fsnotify_ops inotify_fsnotify_ops;
......
...@@ -67,7 +67,7 @@ static int inotify_merge(struct list_head *list, ...@@ -67,7 +67,7 @@ static int inotify_merge(struct list_head *list,
int inotify_handle_event(struct fsnotify_group *group, int inotify_handle_event(struct fsnotify_group *group,
struct inode *inode, struct inode *inode,
u32 mask, const void *data, int data_type, u32 mask, const void *data, int data_type,
const unsigned char *file_name, u32 cookie, const struct qstr *file_name, u32 cookie,
struct fsnotify_iter_info *iter_info) struct fsnotify_iter_info *iter_info)
{ {
struct fsnotify_mark *inode_mark = fsnotify_iter_inode_mark(iter_info); struct fsnotify_mark *inode_mark = fsnotify_iter_inode_mark(iter_info);
...@@ -89,7 +89,7 @@ int inotify_handle_event(struct fsnotify_group *group, ...@@ -89,7 +89,7 @@ int inotify_handle_event(struct fsnotify_group *group,
return 0; return 0;
} }
if (file_name) { if (file_name) {
len = strlen(file_name); len = file_name->len;
alloc_len += len + 1; alloc_len += len + 1;
} }
...@@ -129,7 +129,7 @@ int inotify_handle_event(struct fsnotify_group *group, ...@@ -129,7 +129,7 @@ int inotify_handle_event(struct fsnotify_group *group,
event->sync_cookie = cookie; event->sync_cookie = cookie;
event->name_len = len; event->name_len = len;
if (len) if (len)
strcpy(event->name, file_name); strcpy(event->name, file_name->name);
ret = fsnotify_add_event(group, fsn_event, inotify_merge); ret = fsnotify_add_event(group, fsn_event, inotify_merge);
if (ret) { if (ret) {
......
...@@ -105,17 +105,16 @@ static void *__ns_get_path(struct path *path, struct ns_common *ns) ...@@ -105,17 +105,16 @@ static void *__ns_get_path(struct path *path, struct ns_common *ns)
void *ns_get_path_cb(struct path *path, ns_get_path_helper_t *ns_get_cb, void *ns_get_path_cb(struct path *path, ns_get_path_helper_t *ns_get_cb,
void *private_data) void *private_data)
{ {
struct ns_common *ns;
void *ret; void *ret;
again: do {
ns = ns_get_cb(private_data); struct ns_common *ns = ns_get_cb(private_data);
if (!ns) if (!ns)
return ERR_PTR(-ENOENT); return ERR_PTR(-ENOENT);
ret = __ns_get_path(path, ns);
} while (ret == ERR_PTR(-EAGAIN));
ret = __ns_get_path(path, ns);
if (IS_ERR(ret) && PTR_ERR(ret) == -EAGAIN)
goto again;
return ret; return ret;
} }
...@@ -154,7 +153,7 @@ int open_related_ns(struct ns_common *ns, ...@@ -154,7 +153,7 @@ int open_related_ns(struct ns_common *ns,
if (fd < 0) if (fd < 0)
return fd; return fd;
while (1) { do {
struct ns_common *relative; struct ns_common *relative;
relative = get_ns(ns); relative = get_ns(ns);
...@@ -164,10 +163,8 @@ int open_related_ns(struct ns_common *ns, ...@@ -164,10 +163,8 @@ int open_related_ns(struct ns_common *ns,
} }
err = __ns_get_path(&path, relative); err = __ns_get_path(&path, relative);
if (IS_ERR(err) && PTR_ERR(err) == -EAGAIN) } while (err == ERR_PTR(-EAGAIN));
continue;
break;
}
if (IS_ERR(err)) { if (IS_ERR(err)) {
put_unused_fd(fd); put_unused_fd(fd);
return PTR_ERR(err); return PTR_ERR(err);
......
...@@ -398,7 +398,7 @@ static struct dentry *ovl_lookup_real_one(struct dentry *connected, ...@@ -398,7 +398,7 @@ static struct dentry *ovl_lookup_real_one(struct dentry *connected,
* pointer because we hold no lock on the real dentry. * pointer because we hold no lock on the real dentry.
*/ */
take_dentry_name_snapshot(&name, real); take_dentry_name_snapshot(&name, real);
this = lookup_one_len(name.name, connected, strlen(name.name)); this = lookup_one_len(name.name.name, connected, name.name.len);
err = PTR_ERR(this); err = PTR_ERR(this);
if (IS_ERR(this)) { if (IS_ERR(this)) {
goto fail; goto fail;
......
...@@ -28,21 +28,6 @@ static int add_nondir(struct dentry *dentry, struct inode *inode) ...@@ -28,21 +28,6 @@ static int add_nondir(struct dentry *dentry, struct inode *inode)
return err; return err;
} }
static int sysv_hash(const struct dentry *dentry, struct qstr *qstr)
{
/* Truncate the name in place, avoids having to define a compare
function. */
if (qstr->len > SYSV_NAMELEN) {
qstr->len = SYSV_NAMELEN;
qstr->hash = full_name_hash(dentry, qstr->name, qstr->len);
}
return 0;
}
const struct dentry_operations sysv_dentry_operations = {
.d_hash = sysv_hash,
};
static struct dentry *sysv_lookup(struct inode * dir, struct dentry * dentry, unsigned int flags) static struct dentry *sysv_lookup(struct inode * dir, struct dentry * dentry, unsigned int flags)
{ {
struct inode * inode = NULL; struct inode * inode = NULL;
......
...@@ -312,7 +312,6 @@ static int complete_read_super(struct super_block *sb, int silent, int size) ...@@ -312,7 +312,6 @@ static int complete_read_super(struct super_block *sb, int silent, int size)
flavour_setup[sbi->s_type](sbi, &sb->s_max_links); flavour_setup[sbi->s_type](sbi, &sb->s_max_links);
sbi->s_truncate = 1;
sbi->s_ndatazones = sbi->s_nzones - sbi->s_firstdatazone; sbi->s_ndatazones = sbi->s_nzones - sbi->s_firstdatazone;
sbi->s_inodes_per_block = bsize >> 6; sbi->s_inodes_per_block = bsize >> 6;
sbi->s_inodes_per_block_1 = (bsize >> 6)-1; sbi->s_inodes_per_block_1 = (bsize >> 6)-1;
...@@ -334,8 +333,6 @@ static int complete_read_super(struct super_block *sb, int silent, int size) ...@@ -334,8 +333,6 @@ static int complete_read_super(struct super_block *sb, int silent, int size)
sb->s_op = &sysv_sops; sb->s_op = &sysv_sops;
if (sbi->s_forced_ro) if (sbi->s_forced_ro)
sb->s_flags |= SB_RDONLY; sb->s_flags |= SB_RDONLY;
if (sbi->s_truncate)
sb->s_d_op = &sysv_dentry_operations;
root_inode = sysv_iget(sb, SYSV_ROOT_INO); root_inode = sysv_iget(sb, SYSV_ROOT_INO);
if (IS_ERR(root_inode)) { if (IS_ERR(root_inode)) {
printk("SysV FS: get root inode failed\n"); printk("SysV FS: get root inode failed\n");
......
...@@ -23,8 +23,6 @@ struct sysv_sb_info { ...@@ -23,8 +23,6 @@ struct sysv_sb_info {
struct super_block *s_sb; /* VFS superblock */ struct super_block *s_sb; /* VFS superblock */
int s_type; /* file system type: FSTYPE_{XENIX|SYSV|COH} */ int s_type; /* file system type: FSTYPE_{XENIX|SYSV|COH} */
char s_bytesex; /* bytesex (le/be/pdp) */ char s_bytesex; /* bytesex (le/be/pdp) */
char s_truncate; /* if 1: names > SYSV_NAMELEN chars are truncated */
/* if 0: they are disallowed (ENAMETOOLONG) */
unsigned int s_inodes_per_block; /* number of inodes per block */ unsigned int s_inodes_per_block; /* number of inodes per block */
unsigned int s_inodes_per_block_1; /* inodes_per_block - 1 */ unsigned int s_inodes_per_block_1; /* inodes_per_block - 1 */
unsigned int s_inodes_per_block_bits; /* log2(inodes_per_block) */ unsigned int s_inodes_per_block_bits; /* log2(inodes_per_block) */
...@@ -166,7 +164,6 @@ extern const struct file_operations sysv_file_operations; ...@@ -166,7 +164,6 @@ extern const struct file_operations sysv_file_operations;
extern const struct file_operations sysv_dir_operations; extern const struct file_operations sysv_dir_operations;
extern const struct address_space_operations sysv_aops; extern const struct address_space_operations sysv_aops;
extern const struct super_operations sysv_sops; extern const struct super_operations sysv_sops;
extern const struct dentry_operations sysv_dentry_operations;
enum { enum {
......
...@@ -235,7 +235,6 @@ extern void d_set_d_op(struct dentry *dentry, const struct dentry_operations *op ...@@ -235,7 +235,6 @@ extern void d_set_d_op(struct dentry *dentry, const struct dentry_operations *op
/* allocate/de-allocate */ /* allocate/de-allocate */
extern struct dentry * d_alloc(struct dentry *, const struct qstr *); extern struct dentry * d_alloc(struct dentry *, const struct qstr *);
extern struct dentry * d_alloc_anon(struct super_block *); extern struct dentry * d_alloc_anon(struct super_block *);
extern struct dentry * d_alloc_pseudo(struct super_block *, const struct qstr *);
extern struct dentry * d_alloc_parallel(struct dentry *, const struct qstr *, extern struct dentry * d_alloc_parallel(struct dentry *, const struct qstr *,
wait_queue_head_t *); wait_queue_head_t *);
extern struct dentry * d_splice_alias(struct inode *, struct dentry *); extern struct dentry * d_splice_alias(struct inode *, struct dentry *);
...@@ -594,7 +593,7 @@ static inline struct inode *d_real_inode(const struct dentry *dentry) ...@@ -594,7 +593,7 @@ static inline struct inode *d_real_inode(const struct dentry *dentry)
} }
struct name_snapshot { struct name_snapshot {
const unsigned char *name; struct qstr name;
unsigned char inline_name[DNAME_INLINE_LEN]; unsigned char inline_name[DNAME_INLINE_LEN];
}; };
void take_dentry_name_snapshot(struct name_snapshot *, struct dentry *); void take_dentry_name_snapshot(struct name_snapshot *, struct dentry *);
......
...@@ -27,7 +27,7 @@ static inline int fsnotify_dirent(struct inode *dir, struct dentry *dentry, ...@@ -27,7 +27,7 @@ static inline int fsnotify_dirent(struct inode *dir, struct dentry *dentry,
__u32 mask) __u32 mask)
{ {
return fsnotify(dir, mask, d_inode(dentry), FSNOTIFY_EVENT_INODE, return fsnotify(dir, mask, d_inode(dentry), FSNOTIFY_EVENT_INODE,
dentry->d_name.name, 0); &dentry->d_name, 0);
} }
/* Notify this dentry's parent about a child's events. */ /* Notify this dentry's parent about a child's events. */
...@@ -102,7 +102,7 @@ static inline void fsnotify_link_count(struct inode *inode) ...@@ -102,7 +102,7 @@ static inline void fsnotify_link_count(struct inode *inode)
* fsnotify_move - file old_name at old_dir was moved to new_name at new_dir * fsnotify_move - file old_name at old_dir was moved to new_name at new_dir
*/ */
static inline void fsnotify_move(struct inode *old_dir, struct inode *new_dir, static inline void fsnotify_move(struct inode *old_dir, struct inode *new_dir,
const unsigned char *old_name, const struct qstr *old_name,
int isdir, struct inode *target, int isdir, struct inode *target,
struct dentry *moved) struct dentry *moved)
{ {
...@@ -111,7 +111,7 @@ static inline void fsnotify_move(struct inode *old_dir, struct inode *new_dir, ...@@ -111,7 +111,7 @@ static inline void fsnotify_move(struct inode *old_dir, struct inode *new_dir,
__u32 old_dir_mask = FS_MOVED_FROM; __u32 old_dir_mask = FS_MOVED_FROM;
__u32 new_dir_mask = FS_MOVED_TO; __u32 new_dir_mask = FS_MOVED_TO;
__u32 mask = FS_MOVE_SELF; __u32 mask = FS_MOVE_SELF;
const unsigned char *new_name = moved->d_name.name; const struct qstr *new_name = &moved->d_name;
if (old_dir == new_dir) if (old_dir == new_dir)
old_dir_mask |= FS_DN_RENAME; old_dir_mask |= FS_DN_RENAME;
...@@ -178,7 +178,7 @@ static inline void fsnotify_nameremove(struct dentry *dentry, int isdir) ...@@ -178,7 +178,7 @@ static inline void fsnotify_nameremove(struct dentry *dentry, int isdir)
take_dentry_name_snapshot(&name, dentry); take_dentry_name_snapshot(&name, dentry);
fsnotify(d_inode(parent), mask, d_inode(dentry), FSNOTIFY_EVENT_INODE, fsnotify(d_inode(parent), mask, d_inode(dentry), FSNOTIFY_EVENT_INODE,
name.name, 0); &name.name, 0);
release_dentry_name_snapshot(&name); release_dentry_name_snapshot(&name);
dput(parent); dput(parent);
...@@ -218,7 +218,7 @@ static inline void fsnotify_link(struct inode *dir, struct inode *inode, struct ...@@ -218,7 +218,7 @@ static inline void fsnotify_link(struct inode *dir, struct inode *inode, struct
fsnotify_link_count(inode); fsnotify_link_count(inode);
audit_inode_child(dir, new_dentry, AUDIT_TYPE_CHILD_CREATE); audit_inode_child(dir, new_dentry, AUDIT_TYPE_CHILD_CREATE);
fsnotify(dir, FS_CREATE, inode, FSNOTIFY_EVENT_INODE, new_dentry->d_name.name, 0); fsnotify(dir, FS_CREATE, inode, FSNOTIFY_EVENT_INODE, &new_dentry->d_name, 0);
} }
/* /*
......
...@@ -117,7 +117,7 @@ struct fsnotify_ops { ...@@ -117,7 +117,7 @@ struct fsnotify_ops {
int (*handle_event)(struct fsnotify_group *group, int (*handle_event)(struct fsnotify_group *group,
struct inode *inode, struct inode *inode,
u32 mask, const void *data, int data_type, u32 mask, const void *data, int data_type,
const unsigned char *file_name, u32 cookie, const struct qstr *file_name, u32 cookie,
struct fsnotify_iter_info *iter_info); struct fsnotify_iter_info *iter_info);
void (*free_group_priv)(struct fsnotify_group *group); void (*free_group_priv)(struct fsnotify_group *group);
void (*freeing_mark)(struct fsnotify_mark *mark, struct fsnotify_group *group); void (*freeing_mark)(struct fsnotify_mark *mark, struct fsnotify_group *group);
...@@ -350,7 +350,7 @@ struct fsnotify_mark { ...@@ -350,7 +350,7 @@ struct fsnotify_mark {
/* main fsnotify call to send events */ /* main fsnotify call to send events */
extern int fsnotify(struct inode *to_tell, __u32 mask, const void *data, int data_is, extern int fsnotify(struct inode *to_tell, __u32 mask, const void *data, int data_is,
const unsigned char *name, u32 cookie); const struct qstr *name, u32 cookie);
extern int __fsnotify_parent(const struct path *path, struct dentry *dentry, __u32 mask); extern int __fsnotify_parent(const struct path *path, struct dentry *dentry, __u32 mask);
extern void __fsnotify_inode_delete(struct inode *inode); extern void __fsnotify_inode_delete(struct inode *inode);
extern void __fsnotify_vfsmount_delete(struct vfsmount *mnt); extern void __fsnotify_vfsmount_delete(struct vfsmount *mnt);
...@@ -505,7 +505,7 @@ static inline void fsnotify_init_event(struct fsnotify_event *event, ...@@ -505,7 +505,7 @@ static inline void fsnotify_init_event(struct fsnotify_event *event,
#else #else
static inline int fsnotify(struct inode *to_tell, __u32 mask, const void *data, int data_is, static inline int fsnotify(struct inode *to_tell, __u32 mask, const void *data, int data_is,
const unsigned char *name, u32 cookie) const struct qstr *name, u32 cookie)
{ {
return 0; return 0;
} }
......
...@@ -231,7 +231,7 @@ extern int audit_comparator(const u32 left, const u32 op, const u32 right); ...@@ -231,7 +231,7 @@ extern int audit_comparator(const u32 left, const u32 op, const u32 right);
extern int audit_uid_comparator(kuid_t left, u32 op, kuid_t right); extern int audit_uid_comparator(kuid_t left, u32 op, kuid_t right);
extern int audit_gid_comparator(kgid_t left, u32 op, kgid_t right); extern int audit_gid_comparator(kgid_t left, u32 op, kgid_t right);
extern int parent_len(const char *path); extern int parent_len(const char *path);
extern int audit_compare_dname_path(const char *dname, const char *path, int plen); extern int audit_compare_dname_path(const struct qstr *dname, const char *path, int plen);
extern struct sk_buff *audit_make_reply(int seq, int type, int done, int multi, extern struct sk_buff *audit_make_reply(int seq, int type, int done, int multi,
const void *payload, int size); const void *payload, int size);
extern void audit_panic(const char *message); extern void audit_panic(const char *message);
......
...@@ -164,7 +164,7 @@ static void audit_autoremove_mark_rule(struct audit_fsnotify_mark *audit_mark) ...@@ -164,7 +164,7 @@ static void audit_autoremove_mark_rule(struct audit_fsnotify_mark *audit_mark)
static int audit_mark_handle_event(struct fsnotify_group *group, static int audit_mark_handle_event(struct fsnotify_group *group,
struct inode *to_tell, struct inode *to_tell,
u32 mask, const void *data, int data_type, u32 mask, const void *data, int data_type,
const unsigned char *dname, u32 cookie, const struct qstr *dname, u32 cookie,
struct fsnotify_iter_info *iter_info) struct fsnotify_iter_info *iter_info)
{ {
struct fsnotify_mark *inode_mark = fsnotify_iter_inode_mark(iter_info); struct fsnotify_mark *inode_mark = fsnotify_iter_inode_mark(iter_info);
......
...@@ -1040,7 +1040,7 @@ static void evict_chunk(struct audit_chunk *chunk) ...@@ -1040,7 +1040,7 @@ static void evict_chunk(struct audit_chunk *chunk)
static int audit_tree_handle_event(struct fsnotify_group *group, static int audit_tree_handle_event(struct fsnotify_group *group,
struct inode *to_tell, struct inode *to_tell,
u32 mask, const void *data, int data_type, u32 mask, const void *data, int data_type,
const unsigned char *file_name, u32 cookie, const struct qstr *file_name, u32 cookie,
struct fsnotify_iter_info *iter_info) struct fsnotify_iter_info *iter_info)
{ {
return 0; return 0;
......
...@@ -255,7 +255,7 @@ static void audit_watch_log_rule_change(struct audit_krule *r, struct audit_watc ...@@ -255,7 +255,7 @@ static void audit_watch_log_rule_change(struct audit_krule *r, struct audit_watc
/* Update inode info in audit rules based on filesystem event. */ /* Update inode info in audit rules based on filesystem event. */
static void audit_update_watch(struct audit_parent *parent, static void audit_update_watch(struct audit_parent *parent,
const char *dname, dev_t dev, const struct qstr *dname, dev_t dev,
unsigned long ino, unsigned invalidating) unsigned long ino, unsigned invalidating)
{ {
struct audit_watch *owatch, *nwatch, *nextw; struct audit_watch *owatch, *nwatch, *nextw;
...@@ -482,7 +482,7 @@ void audit_remove_watch_rule(struct audit_krule *krule) ...@@ -482,7 +482,7 @@ void audit_remove_watch_rule(struct audit_krule *krule)
static int audit_watch_handle_event(struct fsnotify_group *group, static int audit_watch_handle_event(struct fsnotify_group *group,
struct inode *to_tell, struct inode *to_tell,
u32 mask, const void *data, int data_type, u32 mask, const void *data, int data_type,
const unsigned char *dname, u32 cookie, const struct qstr *dname, u32 cookie,
struct fsnotify_iter_info *iter_info) struct fsnotify_iter_info *iter_info)
{ {
struct fsnotify_mark *inode_mark = fsnotify_iter_inode_mark(iter_info); struct fsnotify_mark *inode_mark = fsnotify_iter_inode_mark(iter_info);
......
...@@ -1292,12 +1292,12 @@ int parent_len(const char *path) ...@@ -1292,12 +1292,12 @@ int parent_len(const char *path)
* @parentlen: length of the parent if known. Passing in AUDIT_NAME_FULL * @parentlen: length of the parent if known. Passing in AUDIT_NAME_FULL
* here indicates that we must compute this value. * here indicates that we must compute this value.
*/ */
int audit_compare_dname_path(const char *dname, const char *path, int parentlen) int audit_compare_dname_path(const struct qstr *dname, const char *path, int parentlen)
{ {
int dlen, pathlen; int dlen, pathlen;
const char *p; const char *p;
dlen = strlen(dname); dlen = dname->len;
pathlen = strlen(path); pathlen = strlen(path);
if (pathlen < dlen) if (pathlen < dlen)
return 1; return 1;
...@@ -1308,7 +1308,7 @@ int audit_compare_dname_path(const char *dname, const char *path, int parentlen) ...@@ -1308,7 +1308,7 @@ int audit_compare_dname_path(const char *dname, const char *path, int parentlen)
p = path + parentlen; p = path + parentlen;
return strncmp(p, dname, dlen); return strncmp(p, dname->name, dlen);
} }
int audit_filter(int msgtype, unsigned int listtype) int audit_filter(int msgtype, unsigned int listtype)
......
...@@ -2047,7 +2047,7 @@ void __audit_inode_child(struct inode *parent, ...@@ -2047,7 +2047,7 @@ void __audit_inode_child(struct inode *parent,
{ {
struct audit_context *context = audit_context(); struct audit_context *context = audit_context();
struct inode *inode = d_backing_inode(dentry); struct inode *inode = d_backing_inode(dentry);
const char *dname = dentry->d_name.name; const struct qstr *dname = &dentry->d_name;
struct audit_names *n, *found_parent = NULL, *found_child = NULL; struct audit_names *n, *found_parent = NULL, *found_child = NULL;
struct audit_entry *e; struct audit_entry *e;
struct list_head *list = &audit_filter_list[AUDIT_FILTER_FS]; struct list_head *list = &audit_filter_list[AUDIT_FILTER_FS];
...@@ -2099,7 +2099,7 @@ void __audit_inode_child(struct inode *parent, ...@@ -2099,7 +2099,7 @@ void __audit_inode_child(struct inode *parent,
(n->type != type && n->type != AUDIT_TYPE_UNKNOWN)) (n->type != type && n->type != AUDIT_TYPE_UNKNOWN))
continue; continue;
if (!strcmp(dname, n->name->name) || if (!strcmp(dname->name, n->name->name) ||
!audit_compare_dname_path(dname, n->name->name, !audit_compare_dname_path(dname, n->name->name,
found_parent ? found_parent ?
found_parent->name_len : found_parent->name_len :
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment