aboutsummaryrefslogtreecommitdiffstats
path: root/fs/notify
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2014-12-10 19:10:49 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2014-12-10 19:10:49 -0500
commitcbfe0de303a55ed96d8831c2d5f56f8131cd6612 (patch)
treeb327762303c6a015421e4077e7c713b8a47a5e0e /fs/notify
parent8322b6fddfd2cee41a7732284e5f04750511f4b2 (diff)
parentba00410b8131b23edfb0e09f8b6dd26c8eb621fb (diff)
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull VFS changes from Al Viro: "First pile out of several (there _definitely_ will be more). Stuff in this one: - unification of d_splice_alias()/d_materialize_unique() - iov_iter rewrite - killing a bunch of ->f_path.dentry users (and f_dentry macro). Getting that completed will make life much simpler for unionmount/overlayfs, since then we'll be able to limit the places sensitive to file _dentry_ to reasonably few. Which allows to have file_inode(file) pointing to inode in a covered layer, with dentry pointing to (negative) dentry in union one. Still not complete, but much closer now. - crapectomy in lustre (dead code removal, mostly) - "let's make seq_printf return nothing" preparations - assorted cleanups and fixes There _definitely_ will be more piles" * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: (63 commits) copy_from_iter_nocache() new helper: iov_iter_kvec() csum_and_copy_..._iter() iov_iter.c: handle ITER_KVEC directly iov_iter.c: convert copy_to_iter() to iterate_and_advance iov_iter.c: convert copy_from_iter() to iterate_and_advance iov_iter.c: get rid of bvec_copy_page_{to,from}_iter() iov_iter.c: convert iov_iter_zero() to iterate_and_advance iov_iter.c: convert iov_iter_get_pages_alloc() to iterate_all_kinds iov_iter.c: convert iov_iter_get_pages() to iterate_all_kinds iov_iter.c: convert iov_iter_npages() to iterate_all_kinds iov_iter.c: iterate_and_advance iov_iter.c: macros for iterating over iov_iter kill f_dentry macro dcache: fix kmemcheck warning in switch_names new helper: audit_file() nfsd_vfs_write(): use file_inode() ncpfs: use file_inode() kill f_dentry uses lockd: get rid of ->f_path.dentry->d_sb ...
Diffstat (limited to 'fs/notify')
-rw-r--r--fs/notify/fdinfo.c78
-rw-r--r--fs/notify/fdinfo.h4
-rw-r--r--fs/notify/fsnotify.c4
3 files changed, 36 insertions, 50 deletions
diff --git a/fs/notify/fdinfo.c b/fs/notify/fdinfo.c
index 9d7e2b9659cb..6ffd220eb14d 100644
--- a/fs/notify/fdinfo.c
+++ b/fs/notify/fdinfo.c
@@ -20,25 +20,24 @@
20 20
21#if defined(CONFIG_INOTIFY_USER) || defined(CONFIG_FANOTIFY) 21#if defined(CONFIG_INOTIFY_USER) || defined(CONFIG_FANOTIFY)
22 22
23static int show_fdinfo(struct seq_file *m, struct file *f, 23static void show_fdinfo(struct seq_file *m, struct file *f,
24 int (*show)(struct seq_file *m, struct fsnotify_mark *mark)) 24 void (*show)(struct seq_file *m,
25 struct fsnotify_mark *mark))
25{ 26{
26 struct fsnotify_group *group = f->private_data; 27 struct fsnotify_group *group = f->private_data;
27 struct fsnotify_mark *mark; 28 struct fsnotify_mark *mark;
28 int ret = 0;
29 29
30 mutex_lock(&group->mark_mutex); 30 mutex_lock(&group->mark_mutex);
31 list_for_each_entry(mark, &group->marks_list, g_list) { 31 list_for_each_entry(mark, &group->marks_list, g_list) {
32 ret = show(m, mark); 32 show(m, mark);
33 if (ret) 33 if (seq_has_overflowed(m))
34 break; 34 break;
35 } 35 }
36 mutex_unlock(&group->mark_mutex); 36 mutex_unlock(&group->mark_mutex);
37 return ret;
38} 37}
39 38
40#if defined(CONFIG_EXPORTFS) 39#if defined(CONFIG_EXPORTFS)
41static int show_mark_fhandle(struct seq_file *m, struct inode *inode) 40static void show_mark_fhandle(struct seq_file *m, struct inode *inode)
42{ 41{
43 struct { 42 struct {
44 struct file_handle handle; 43 struct file_handle handle;
@@ -52,71 +51,62 @@ static int show_mark_fhandle(struct seq_file *m, struct inode *inode)
52 ret = exportfs_encode_inode_fh(inode, (struct fid *)f.handle.f_handle, &size, 0); 51 ret = exportfs_encode_inode_fh(inode, (struct fid *)f.handle.f_handle, &size, 0);
53 if ((ret == FILEID_INVALID) || (ret < 0)) { 52 if ((ret == FILEID_INVALID) || (ret < 0)) {
54 WARN_ONCE(1, "Can't encode file handler for inotify: %d\n", ret); 53 WARN_ONCE(1, "Can't encode file handler for inotify: %d\n", ret);
55 return 0; 54 return;
56 } 55 }
57 56
58 f.handle.handle_type = ret; 57 f.handle.handle_type = ret;
59 f.handle.handle_bytes = size * sizeof(u32); 58 f.handle.handle_bytes = size * sizeof(u32);
60 59
61 ret = seq_printf(m, "fhandle-bytes:%x fhandle-type:%x f_handle:", 60 seq_printf(m, "fhandle-bytes:%x fhandle-type:%x f_handle:",
62 f.handle.handle_bytes, f.handle.handle_type); 61 f.handle.handle_bytes, f.handle.handle_type);
63 62
64 for (i = 0; i < f.handle.handle_bytes; i++) 63 for (i = 0; i < f.handle.handle_bytes; i++)
65 ret |= seq_printf(m, "%02x", (int)f.handle.f_handle[i]); 64 seq_printf(m, "%02x", (int)f.handle.f_handle[i]);
66
67 return ret;
68} 65}
69#else 66#else
70static int show_mark_fhandle(struct seq_file *m, struct inode *inode) 67static void show_mark_fhandle(struct seq_file *m, struct inode *inode)
71{ 68{
72 return 0;
73} 69}
74#endif 70#endif
75 71
76#ifdef CONFIG_INOTIFY_USER 72#ifdef CONFIG_INOTIFY_USER
77 73
78static int inotify_fdinfo(struct seq_file *m, struct fsnotify_mark *mark) 74static void inotify_fdinfo(struct seq_file *m, struct fsnotify_mark *mark)
79{ 75{
80 struct inotify_inode_mark *inode_mark; 76 struct inotify_inode_mark *inode_mark;
81 struct inode *inode; 77 struct inode *inode;
82 int ret = 0;
83 78
84 if (!(mark->flags & (FSNOTIFY_MARK_FLAG_ALIVE | FSNOTIFY_MARK_FLAG_INODE))) 79 if (!(mark->flags & (FSNOTIFY_MARK_FLAG_ALIVE | FSNOTIFY_MARK_FLAG_INODE)))
85 return 0; 80 return;
86 81
87 inode_mark = container_of(mark, struct inotify_inode_mark, fsn_mark); 82 inode_mark = container_of(mark, struct inotify_inode_mark, fsn_mark);
88 inode = igrab(mark->i.inode); 83 inode = igrab(mark->i.inode);
89 if (inode) { 84 if (inode) {
90 ret = seq_printf(m, "inotify wd:%x ino:%lx sdev:%x " 85 seq_printf(m, "inotify wd:%x ino:%lx sdev:%x mask:%x ignored_mask:%x ",
91 "mask:%x ignored_mask:%x ", 86 inode_mark->wd, inode->i_ino, inode->i_sb->s_dev,
92 inode_mark->wd, inode->i_ino, 87 mark->mask, mark->ignored_mask);
93 inode->i_sb->s_dev, 88 show_mark_fhandle(m, inode);
94 mark->mask, mark->ignored_mask); 89 seq_putc(m, '\n');
95 ret |= show_mark_fhandle(m, inode);
96 ret |= seq_putc(m, '\n');
97 iput(inode); 90 iput(inode);
98 } 91 }
99
100 return ret;
101} 92}
102 93
103int inotify_show_fdinfo(struct seq_file *m, struct file *f) 94void inotify_show_fdinfo(struct seq_file *m, struct file *f)
104{ 95{
105 return show_fdinfo(m, f, inotify_fdinfo); 96 show_fdinfo(m, f, inotify_fdinfo);
106} 97}
107 98
108#endif /* CONFIG_INOTIFY_USER */ 99#endif /* CONFIG_INOTIFY_USER */
109 100
110#ifdef CONFIG_FANOTIFY 101#ifdef CONFIG_FANOTIFY
111 102
112static int fanotify_fdinfo(struct seq_file *m, struct fsnotify_mark *mark) 103static void fanotify_fdinfo(struct seq_file *m, struct fsnotify_mark *mark)
113{ 104{
114 unsigned int mflags = 0; 105 unsigned int mflags = 0;
115 struct inode *inode; 106 struct inode *inode;
116 int ret = 0;
117 107
118 if (!(mark->flags & FSNOTIFY_MARK_FLAG_ALIVE)) 108 if (!(mark->flags & FSNOTIFY_MARK_FLAG_ALIVE))
119 return 0; 109 return;
120 110
121 if (mark->flags & FSNOTIFY_MARK_FLAG_IGNORED_SURV_MODIFY) 111 if (mark->flags & FSNOTIFY_MARK_FLAG_IGNORED_SURV_MODIFY)
122 mflags |= FAN_MARK_IGNORED_SURV_MODIFY; 112 mflags |= FAN_MARK_IGNORED_SURV_MODIFY;
@@ -124,26 +114,22 @@ static int fanotify_fdinfo(struct seq_file *m, struct fsnotify_mark *mark)
124 if (mark->flags & FSNOTIFY_MARK_FLAG_INODE) { 114 if (mark->flags & FSNOTIFY_MARK_FLAG_INODE) {
125 inode = igrab(mark->i.inode); 115 inode = igrab(mark->i.inode);
126 if (!inode) 116 if (!inode)
127 goto out; 117 return;
128 ret = seq_printf(m, "fanotify ino:%lx sdev:%x " 118 seq_printf(m, "fanotify ino:%lx sdev:%x mflags:%x mask:%x ignored_mask:%x ",
129 "mflags:%x mask:%x ignored_mask:%x ", 119 inode->i_ino, inode->i_sb->s_dev,
130 inode->i_ino, inode->i_sb->s_dev, 120 mflags, mark->mask, mark->ignored_mask);
131 mflags, mark->mask, mark->ignored_mask); 121 show_mark_fhandle(m, inode);
132 ret |= show_mark_fhandle(m, inode); 122 seq_putc(m, '\n');
133 ret |= seq_putc(m, '\n');
134 iput(inode); 123 iput(inode);
135 } else if (mark->flags & FSNOTIFY_MARK_FLAG_VFSMOUNT) { 124 } else if (mark->flags & FSNOTIFY_MARK_FLAG_VFSMOUNT) {
136 struct mount *mnt = real_mount(mark->m.mnt); 125 struct mount *mnt = real_mount(mark->m.mnt);
137 126
138 ret = seq_printf(m, "fanotify mnt_id:%x mflags:%x mask:%x " 127 seq_printf(m, "fanotify mnt_id:%x mflags:%x mask:%x ignored_mask:%x\n",
139 "ignored_mask:%x\n", mnt->mnt_id, mflags, 128 mnt->mnt_id, mflags, mark->mask, mark->ignored_mask);
140 mark->mask, mark->ignored_mask);
141 } 129 }
142out:
143 return ret;
144} 130}
145 131
146int fanotify_show_fdinfo(struct seq_file *m, struct file *f) 132void fanotify_show_fdinfo(struct seq_file *m, struct file *f)
147{ 133{
148 struct fsnotify_group *group = f->private_data; 134 struct fsnotify_group *group = f->private_data;
149 unsigned int flags = 0; 135 unsigned int flags = 0;
@@ -169,7 +155,7 @@ int fanotify_show_fdinfo(struct seq_file *m, struct file *f)
169 seq_printf(m, "fanotify flags:%x event-flags:%x\n", 155 seq_printf(m, "fanotify flags:%x event-flags:%x\n",
170 flags, group->fanotify_data.f_flags); 156 flags, group->fanotify_data.f_flags);
171 157
172 return show_fdinfo(m, f, fanotify_fdinfo); 158 show_fdinfo(m, f, fanotify_fdinfo);
173} 159}
174 160
175#endif /* CONFIG_FANOTIFY */ 161#endif /* CONFIG_FANOTIFY */
diff --git a/fs/notify/fdinfo.h b/fs/notify/fdinfo.h
index 556afda990e9..9664c4904d6b 100644
--- a/fs/notify/fdinfo.h
+++ b/fs/notify/fdinfo.h
@@ -10,11 +10,11 @@ struct file;
10#ifdef CONFIG_PROC_FS 10#ifdef CONFIG_PROC_FS
11 11
12#ifdef CONFIG_INOTIFY_USER 12#ifdef CONFIG_INOTIFY_USER
13extern int inotify_show_fdinfo(struct seq_file *m, struct file *f); 13void inotify_show_fdinfo(struct seq_file *m, struct file *f);
14#endif 14#endif
15 15
16#ifdef CONFIG_FANOTIFY 16#ifdef CONFIG_FANOTIFY
17extern int fanotify_show_fdinfo(struct seq_file *m, struct file *f); 17void fanotify_show_fdinfo(struct seq_file *m, struct file *f);
18#endif 18#endif
19 19
20#else /* CONFIG_PROC_FS */ 20#else /* CONFIG_PROC_FS */
diff --git a/fs/notify/fsnotify.c b/fs/notify/fsnotify.c
index 89326acd4561..41e39102743a 100644
--- a/fs/notify/fsnotify.c
+++ b/fs/notify/fsnotify.c
@@ -63,14 +63,14 @@ void __fsnotify_update_child_dentry_flags(struct inode *inode)
63 spin_lock(&inode->i_lock); 63 spin_lock(&inode->i_lock);
64 /* run all of the dentries associated with this inode. Since this is a 64 /* run all of the dentries associated with this inode. Since this is a
65 * directory, there damn well better only be one item on this list */ 65 * directory, there damn well better only be one item on this list */
66 hlist_for_each_entry(alias, &inode->i_dentry, d_alias) { 66 hlist_for_each_entry(alias, &inode->i_dentry, d_u.d_alias) {
67 struct dentry *child; 67 struct dentry *child;
68 68
69 /* run all of the children of the original inode and fix their 69 /* run all of the children of the original inode and fix their
70 * d_flags to indicate parental interest (their parent is the 70 * d_flags to indicate parental interest (their parent is the
71 * original inode) */ 71 * original inode) */
72 spin_lock(&alias->d_lock); 72 spin_lock(&alias->d_lock);
73 list_for_each_entry(child, &alias->d_subdirs, d_u.d_child) { 73 list_for_each_entry(child, &alias->d_subdirs, d_child) {
74 if (!child->d_inode) 74 if (!child->d_inode)
75 continue; 75 continue;
76 76