diff options
author | David Howells <dhowells@redhat.com> | 2015-03-17 18:26:12 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2015-04-15 15:06:58 -0400 |
commit | 75c3cfa855dcedc84e7964269c9b6baf26137959 (patch) | |
tree | 2ef6b8570069d7811542db376c88fbe208a5771d | |
parent | 2b0143b5c986be1ce8408b3aadc4709e0a94429d (diff) |
VFS: assorted weird filesystems: d_inode() annotations
Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r-- | arch/ia64/kernel/perfmon.c | 2 | ||||
-rw-r--r-- | arch/powerpc/platforms/cell/spufs/inode.c | 22 | ||||
-rw-r--r-- | arch/s390/hypfs/inode.c | 18 | ||||
-rw-r--r-- | drivers/base/devtmpfs.c | 32 | ||||
-rw-r--r-- | drivers/block/drbd/drbd_debugfs.c | 8 | ||||
-rw-r--r-- | drivers/infiniband/hw/ipath/ipath_fs.c | 16 | ||||
-rw-r--r-- | drivers/infiniband/hw/qib/qib_fs.c | 20 | ||||
-rw-r--r-- | drivers/oprofile/oprofilefs.c | 16 | ||||
-rw-r--r-- | drivers/usb/gadget/legacy/inode.c | 2 | ||||
-rw-r--r-- | fs/binfmt_misc.c | 16 | ||||
-rw-r--r-- | fs/nsfs.c | 4 | ||||
-rw-r--r-- | fs/pipe.c | 2 | ||||
-rw-r--r-- | ipc/mqueue.c | 22 | ||||
-rw-r--r-- | ipc/shm.c | 2 | ||||
-rw-r--r-- | mm/shmem.c | 30 |
15 files changed, 106 insertions, 106 deletions
diff --git a/arch/ia64/kernel/perfmon.c b/arch/ia64/kernel/perfmon.c index 5f4243f0acfa..60e02f7747ff 100644 --- a/arch/ia64/kernel/perfmon.c +++ b/arch/ia64/kernel/perfmon.c | |||
@@ -2159,7 +2159,7 @@ static const struct file_operations pfm_file_ops = { | |||
2159 | static char *pfmfs_dname(struct dentry *dentry, char *buffer, int buflen) | 2159 | static char *pfmfs_dname(struct dentry *dentry, char *buffer, int buflen) |
2160 | { | 2160 | { |
2161 | return dynamic_dname(dentry, buffer, buflen, "pfm:[%lu]", | 2161 | return dynamic_dname(dentry, buffer, buflen, "pfm:[%lu]", |
2162 | dentry->d_inode->i_ino); | 2162 | d_inode(dentry)->i_ino); |
2163 | } | 2163 | } |
2164 | 2164 | ||
2165 | static const struct dentry_operations pfmfs_dentry_operations = { | 2165 | static const struct dentry_operations pfmfs_dentry_operations = { |
diff --git a/arch/powerpc/platforms/cell/spufs/inode.c b/arch/powerpc/platforms/cell/spufs/inode.c index 1a3429e1ccb5..1ba6307be4db 100644 --- a/arch/powerpc/platforms/cell/spufs/inode.c +++ b/arch/powerpc/platforms/cell/spufs/inode.c | |||
@@ -111,7 +111,7 @@ out: | |||
111 | static int | 111 | static int |
112 | spufs_setattr(struct dentry *dentry, struct iattr *attr) | 112 | spufs_setattr(struct dentry *dentry, struct iattr *attr) |
113 | { | 113 | { |
114 | struct inode *inode = dentry->d_inode; | 114 | struct inode *inode = d_inode(dentry); |
115 | 115 | ||
116 | if ((attr->ia_valid & ATTR_SIZE) && | 116 | if ((attr->ia_valid & ATTR_SIZE) && |
117 | (attr->ia_size != inode->i_size)) | 117 | (attr->ia_size != inode->i_size)) |
@@ -163,14 +163,14 @@ static void spufs_prune_dir(struct dentry *dir) | |||
163 | { | 163 | { |
164 | struct dentry *dentry, *tmp; | 164 | struct dentry *dentry, *tmp; |
165 | 165 | ||
166 | mutex_lock(&dir->d_inode->i_mutex); | 166 | mutex_lock(&d_inode(dir)->i_mutex); |
167 | list_for_each_entry_safe(dentry, tmp, &dir->d_subdirs, d_child) { | 167 | list_for_each_entry_safe(dentry, tmp, &dir->d_subdirs, d_child) { |
168 | spin_lock(&dentry->d_lock); | 168 | spin_lock(&dentry->d_lock); |
169 | if (!(d_unhashed(dentry)) && dentry->d_inode) { | 169 | if (!(d_unhashed(dentry)) && d_really_is_positive(dentry)) { |
170 | dget_dlock(dentry); | 170 | dget_dlock(dentry); |
171 | __d_drop(dentry); | 171 | __d_drop(dentry); |
172 | spin_unlock(&dentry->d_lock); | 172 | spin_unlock(&dentry->d_lock); |
173 | simple_unlink(dir->d_inode, dentry); | 173 | simple_unlink(d_inode(dir), dentry); |
174 | /* XXX: what was dcache_lock protecting here? Other | 174 | /* XXX: what was dcache_lock protecting here? Other |
175 | * filesystems (IB, configfs) release dcache_lock | 175 | * filesystems (IB, configfs) release dcache_lock |
176 | * before unlink */ | 176 | * before unlink */ |
@@ -180,7 +180,7 @@ static void spufs_prune_dir(struct dentry *dir) | |||
180 | } | 180 | } |
181 | } | 181 | } |
182 | shrink_dcache_parent(dir); | 182 | shrink_dcache_parent(dir); |
183 | mutex_unlock(&dir->d_inode->i_mutex); | 183 | mutex_unlock(&d_inode(dir)->i_mutex); |
184 | } | 184 | } |
185 | 185 | ||
186 | /* Caller must hold parent->i_mutex */ | 186 | /* Caller must hold parent->i_mutex */ |
@@ -192,7 +192,7 @@ static int spufs_rmdir(struct inode *parent, struct dentry *dir) | |||
192 | d_drop(dir); | 192 | d_drop(dir); |
193 | res = simple_rmdir(parent, dir); | 193 | res = simple_rmdir(parent, dir); |
194 | /* We have to give up the mm_struct */ | 194 | /* We have to give up the mm_struct */ |
195 | spu_forget(SPUFS_I(dir->d_inode)->i_ctx); | 195 | spu_forget(SPUFS_I(d_inode(dir))->i_ctx); |
196 | return res; | 196 | return res; |
197 | } | 197 | } |
198 | 198 | ||
@@ -222,8 +222,8 @@ static int spufs_dir_close(struct inode *inode, struct file *file) | |||
222 | int ret; | 222 | int ret; |
223 | 223 | ||
224 | dir = file->f_path.dentry; | 224 | dir = file->f_path.dentry; |
225 | parent = dir->d_parent->d_inode; | 225 | parent = d_inode(dir->d_parent); |
226 | ctx = SPUFS_I(dir->d_inode)->i_ctx; | 226 | ctx = SPUFS_I(d_inode(dir))->i_ctx; |
227 | 227 | ||
228 | mutex_lock_nested(&parent->i_mutex, I_MUTEX_PARENT); | 228 | mutex_lock_nested(&parent->i_mutex, I_MUTEX_PARENT); |
229 | ret = spufs_rmdir(parent, dir); | 229 | ret = spufs_rmdir(parent, dir); |
@@ -460,7 +460,7 @@ spufs_create_context(struct inode *inode, struct dentry *dentry, | |||
460 | goto out_aff_unlock; | 460 | goto out_aff_unlock; |
461 | 461 | ||
462 | if (affinity) { | 462 | if (affinity) { |
463 | spufs_set_affinity(flags, SPUFS_I(dentry->d_inode)->i_ctx, | 463 | spufs_set_affinity(flags, SPUFS_I(d_inode(dentry))->i_ctx, |
464 | neighbor); | 464 | neighbor); |
465 | if (neighbor) | 465 | if (neighbor) |
466 | put_spu_context(neighbor); | 466 | put_spu_context(neighbor); |
@@ -504,7 +504,7 @@ spufs_mkgang(struct inode *dir, struct dentry *dentry, umode_t mode) | |||
504 | 504 | ||
505 | d_instantiate(dentry, inode); | 505 | d_instantiate(dentry, inode); |
506 | inc_nlink(dir); | 506 | inc_nlink(dir); |
507 | inc_nlink(dentry->d_inode); | 507 | inc_nlink(d_inode(dentry)); |
508 | return ret; | 508 | return ret; |
509 | 509 | ||
510 | out_iput: | 510 | out_iput: |
@@ -561,7 +561,7 @@ static struct file_system_type spufs_type; | |||
561 | long spufs_create(struct path *path, struct dentry *dentry, | 561 | long spufs_create(struct path *path, struct dentry *dentry, |
562 | unsigned int flags, umode_t mode, struct file *filp) | 562 | unsigned int flags, umode_t mode, struct file *filp) |
563 | { | 563 | { |
564 | struct inode *dir = path->dentry->d_inode; | 564 | struct inode *dir = d_inode(path->dentry); |
565 | int ret; | 565 | int ret; |
566 | 566 | ||
567 | /* check if we are on spufs */ | 567 | /* check if we are on spufs */ |
diff --git a/arch/s390/hypfs/inode.c b/arch/s390/hypfs/inode.c index 3f5c799b7fb5..d3f896a35b98 100644 --- a/arch/s390/hypfs/inode.c +++ b/arch/s390/hypfs/inode.c | |||
@@ -48,7 +48,7 @@ static struct dentry *hypfs_last_dentry; | |||
48 | static void hypfs_update_update(struct super_block *sb) | 48 | static void hypfs_update_update(struct super_block *sb) |
49 | { | 49 | { |
50 | struct hypfs_sb_info *sb_info = sb->s_fs_info; | 50 | struct hypfs_sb_info *sb_info = sb->s_fs_info; |
51 | struct inode *inode = sb_info->update_file->d_inode; | 51 | struct inode *inode = d_inode(sb_info->update_file); |
52 | 52 | ||
53 | sb_info->last_update = get_seconds(); | 53 | sb_info->last_update = get_seconds(); |
54 | inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; | 54 | inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; |
@@ -64,7 +64,7 @@ static void hypfs_add_dentry(struct dentry *dentry) | |||
64 | 64 | ||
65 | static inline int hypfs_positive(struct dentry *dentry) | 65 | static inline int hypfs_positive(struct dentry *dentry) |
66 | { | 66 | { |
67 | return dentry->d_inode && !d_unhashed(dentry); | 67 | return d_really_is_positive(dentry) && !d_unhashed(dentry); |
68 | } | 68 | } |
69 | 69 | ||
70 | static void hypfs_remove(struct dentry *dentry) | 70 | static void hypfs_remove(struct dentry *dentry) |
@@ -72,16 +72,16 @@ static void hypfs_remove(struct dentry *dentry) | |||
72 | struct dentry *parent; | 72 | struct dentry *parent; |
73 | 73 | ||
74 | parent = dentry->d_parent; | 74 | parent = dentry->d_parent; |
75 | mutex_lock(&parent->d_inode->i_mutex); | 75 | mutex_lock(&d_inode(parent)->i_mutex); |
76 | if (hypfs_positive(dentry)) { | 76 | if (hypfs_positive(dentry)) { |
77 | if (d_is_dir(dentry)) | 77 | if (d_is_dir(dentry)) |
78 | simple_rmdir(parent->d_inode, dentry); | 78 | simple_rmdir(d_inode(parent), dentry); |
79 | else | 79 | else |
80 | simple_unlink(parent->d_inode, dentry); | 80 | simple_unlink(d_inode(parent), dentry); |
81 | } | 81 | } |
82 | d_delete(dentry); | 82 | d_delete(dentry); |
83 | dput(dentry); | 83 | dput(dentry); |
84 | mutex_unlock(&parent->d_inode->i_mutex); | 84 | mutex_unlock(&d_inode(parent)->i_mutex); |
85 | } | 85 | } |
86 | 86 | ||
87 | static void hypfs_delete_tree(struct dentry *root) | 87 | static void hypfs_delete_tree(struct dentry *root) |
@@ -336,7 +336,7 @@ static struct dentry *hypfs_create_file(struct dentry *parent, const char *name, | |||
336 | struct dentry *dentry; | 336 | struct dentry *dentry; |
337 | struct inode *inode; | 337 | struct inode *inode; |
338 | 338 | ||
339 | mutex_lock(&parent->d_inode->i_mutex); | 339 | mutex_lock(&d_inode(parent)->i_mutex); |
340 | dentry = lookup_one_len(name, parent, strlen(name)); | 340 | dentry = lookup_one_len(name, parent, strlen(name)); |
341 | if (IS_ERR(dentry)) { | 341 | if (IS_ERR(dentry)) { |
342 | dentry = ERR_PTR(-ENOMEM); | 342 | dentry = ERR_PTR(-ENOMEM); |
@@ -357,14 +357,14 @@ static struct dentry *hypfs_create_file(struct dentry *parent, const char *name, | |||
357 | } else if (S_ISDIR(mode)) { | 357 | } else if (S_ISDIR(mode)) { |
358 | inode->i_op = &simple_dir_inode_operations; | 358 | inode->i_op = &simple_dir_inode_operations; |
359 | inode->i_fop = &simple_dir_operations; | 359 | inode->i_fop = &simple_dir_operations; |
360 | inc_nlink(parent->d_inode); | 360 | inc_nlink(d_inode(parent)); |
361 | } else | 361 | } else |
362 | BUG(); | 362 | BUG(); |
363 | inode->i_private = data; | 363 | inode->i_private = data; |
364 | d_instantiate(dentry, inode); | 364 | d_instantiate(dentry, inode); |
365 | dget(dentry); | 365 | dget(dentry); |
366 | fail: | 366 | fail: |
367 | mutex_unlock(&parent->d_inode->i_mutex); | 367 | mutex_unlock(&d_inode(parent)->i_mutex); |
368 | return dentry; | 368 | return dentry; |
369 | } | 369 | } |
370 | 370 | ||
diff --git a/drivers/base/devtmpfs.c b/drivers/base/devtmpfs.c index 25798db14553..68f03141e432 100644 --- a/drivers/base/devtmpfs.c +++ b/drivers/base/devtmpfs.c | |||
@@ -157,10 +157,10 @@ static int dev_mkdir(const char *name, umode_t mode) | |||
157 | if (IS_ERR(dentry)) | 157 | if (IS_ERR(dentry)) |
158 | return PTR_ERR(dentry); | 158 | return PTR_ERR(dentry); |
159 | 159 | ||
160 | err = vfs_mkdir(path.dentry->d_inode, dentry, mode); | 160 | err = vfs_mkdir(d_inode(path.dentry), dentry, mode); |
161 | if (!err) | 161 | if (!err) |
162 | /* mark as kernel-created inode */ | 162 | /* mark as kernel-created inode */ |
163 | dentry->d_inode->i_private = &thread; | 163 | d_inode(dentry)->i_private = &thread; |
164 | done_path_create(&path, dentry); | 164 | done_path_create(&path, dentry); |
165 | return err; | 165 | return err; |
166 | } | 166 | } |
@@ -207,7 +207,7 @@ static int handle_create(const char *nodename, umode_t mode, kuid_t uid, | |||
207 | if (IS_ERR(dentry)) | 207 | if (IS_ERR(dentry)) |
208 | return PTR_ERR(dentry); | 208 | return PTR_ERR(dentry); |
209 | 209 | ||
210 | err = vfs_mknod(path.dentry->d_inode, dentry, mode, dev->devt); | 210 | err = vfs_mknod(d_inode(path.dentry), dentry, mode, dev->devt); |
211 | if (!err) { | 211 | if (!err) { |
212 | struct iattr newattrs; | 212 | struct iattr newattrs; |
213 | 213 | ||
@@ -215,12 +215,12 @@ static int handle_create(const char *nodename, umode_t mode, kuid_t uid, | |||
215 | newattrs.ia_uid = uid; | 215 | newattrs.ia_uid = uid; |
216 | newattrs.ia_gid = gid; | 216 | newattrs.ia_gid = gid; |
217 | newattrs.ia_valid = ATTR_MODE|ATTR_UID|ATTR_GID; | 217 | newattrs.ia_valid = ATTR_MODE|ATTR_UID|ATTR_GID; |
218 | mutex_lock(&dentry->d_inode->i_mutex); | 218 | mutex_lock(&d_inode(dentry)->i_mutex); |
219 | notify_change(dentry, &newattrs, NULL); | 219 | notify_change(dentry, &newattrs, NULL); |
220 | mutex_unlock(&dentry->d_inode->i_mutex); | 220 | mutex_unlock(&d_inode(dentry)->i_mutex); |
221 | 221 | ||
222 | /* mark as kernel-created inode */ | 222 | /* mark as kernel-created inode */ |
223 | dentry->d_inode->i_private = &thread; | 223 | d_inode(dentry)->i_private = &thread; |
224 | } | 224 | } |
225 | done_path_create(&path, dentry); | 225 | done_path_create(&path, dentry); |
226 | return err; | 226 | return err; |
@@ -235,16 +235,16 @@ static int dev_rmdir(const char *name) | |||
235 | dentry = kern_path_locked(name, &parent); | 235 | dentry = kern_path_locked(name, &parent); |
236 | if (IS_ERR(dentry)) | 236 | if (IS_ERR(dentry)) |
237 | return PTR_ERR(dentry); | 237 | return PTR_ERR(dentry); |
238 | if (dentry->d_inode) { | 238 | if (d_really_is_positive(dentry)) { |
239 | if (dentry->d_inode->i_private == &thread) | 239 | if (d_inode(dentry)->i_private == &thread) |
240 | err = vfs_rmdir(parent.dentry->d_inode, dentry); | 240 | err = vfs_rmdir(d_inode(parent.dentry), dentry); |
241 | else | 241 | else |
242 | err = -EPERM; | 242 | err = -EPERM; |
243 | } else { | 243 | } else { |
244 | err = -ENOENT; | 244 | err = -ENOENT; |
245 | } | 245 | } |
246 | dput(dentry); | 246 | dput(dentry); |
247 | mutex_unlock(&parent.dentry->d_inode->i_mutex); | 247 | mutex_unlock(&d_inode(parent.dentry)->i_mutex); |
248 | path_put(&parent); | 248 | path_put(&parent); |
249 | return err; | 249 | return err; |
250 | } | 250 | } |
@@ -306,11 +306,11 @@ static int handle_remove(const char *nodename, struct device *dev) | |||
306 | if (IS_ERR(dentry)) | 306 | if (IS_ERR(dentry)) |
307 | return PTR_ERR(dentry); | 307 | return PTR_ERR(dentry); |
308 | 308 | ||
309 | if (dentry->d_inode) { | 309 | if (d_really_is_positive(dentry)) { |
310 | struct kstat stat; | 310 | struct kstat stat; |
311 | struct path p = {.mnt = parent.mnt, .dentry = dentry}; | 311 | struct path p = {.mnt = parent.mnt, .dentry = dentry}; |
312 | err = vfs_getattr(&p, &stat); | 312 | err = vfs_getattr(&p, &stat); |
313 | if (!err && dev_mynode(dev, dentry->d_inode, &stat)) { | 313 | if (!err && dev_mynode(dev, d_inode(dentry), &stat)) { |
314 | struct iattr newattrs; | 314 | struct iattr newattrs; |
315 | /* | 315 | /* |
316 | * before unlinking this node, reset permissions | 316 | * before unlinking this node, reset permissions |
@@ -321,10 +321,10 @@ static int handle_remove(const char *nodename, struct device *dev) | |||
321 | newattrs.ia_mode = stat.mode & ~0777; | 321 | newattrs.ia_mode = stat.mode & ~0777; |
322 | newattrs.ia_valid = | 322 | newattrs.ia_valid = |
323 | ATTR_UID|ATTR_GID|ATTR_MODE; | 323 | ATTR_UID|ATTR_GID|ATTR_MODE; |
324 | mutex_lock(&dentry->d_inode->i_mutex); | 324 | mutex_lock(&d_inode(dentry)->i_mutex); |
325 | notify_change(dentry, &newattrs, NULL); | 325 | notify_change(dentry, &newattrs, NULL); |
326 | mutex_unlock(&dentry->d_inode->i_mutex); | 326 | mutex_unlock(&d_inode(dentry)->i_mutex); |
327 | err = vfs_unlink(parent.dentry->d_inode, dentry, NULL); | 327 | err = vfs_unlink(d_inode(parent.dentry), dentry, NULL); |
328 | if (!err || err == -ENOENT) | 328 | if (!err || err == -ENOENT) |
329 | deleted = 1; | 329 | deleted = 1; |
330 | } | 330 | } |
@@ -332,7 +332,7 @@ static int handle_remove(const char *nodename, struct device *dev) | |||
332 | err = -ENOENT; | 332 | err = -ENOENT; |
333 | } | 333 | } |
334 | dput(dentry); | 334 | dput(dentry); |
335 | mutex_unlock(&parent.dentry->d_inode->i_mutex); | 335 | mutex_unlock(&d_inode(parent.dentry)->i_mutex); |
336 | 336 | ||
337 | path_put(&parent); | 337 | path_put(&parent); |
338 | if (deleted && strchr(nodename, '/')) | 338 | if (deleted && strchr(nodename, '/')) |
diff --git a/drivers/block/drbd/drbd_debugfs.c b/drivers/block/drbd/drbd_debugfs.c index 9a950022ff88..a6ee3d750c30 100644 --- a/drivers/block/drbd/drbd_debugfs.c +++ b/drivers/block/drbd/drbd_debugfs.c | |||
@@ -424,7 +424,7 @@ static int in_flight_summary_show(struct seq_file *m, void *pos) | |||
424 | * So we have our own inline version of it above. :-( */ | 424 | * So we have our own inline version of it above. :-( */ |
425 | static inline int debugfs_positive(struct dentry *dentry) | 425 | static inline int debugfs_positive(struct dentry *dentry) |
426 | { | 426 | { |
427 | return dentry->d_inode && !d_unhashed(dentry); | 427 | return d_really_is_positive(dentry) && !d_unhashed(dentry); |
428 | } | 428 | } |
429 | 429 | ||
430 | /* make sure at *open* time that the respective object won't go away. */ | 430 | /* make sure at *open* time that the respective object won't go away. */ |
@@ -439,15 +439,15 @@ static int drbd_single_open(struct file *file, int (*show)(struct seq_file *, vo | |||
439 | * or has debugfs_remove() already been called? */ | 439 | * or has debugfs_remove() already been called? */ |
440 | parent = file->f_path.dentry->d_parent; | 440 | parent = file->f_path.dentry->d_parent; |
441 | /* not sure if this can happen: */ | 441 | /* not sure if this can happen: */ |
442 | if (!parent || !parent->d_inode) | 442 | if (!parent || d_really_is_negative(parent)) |
443 | goto out; | 443 | goto out; |
444 | /* serialize with d_delete() */ | 444 | /* serialize with d_delete() */ |
445 | mutex_lock(&parent->d_inode->i_mutex); | 445 | mutex_lock(&d_inode(parent)->i_mutex); |
446 | /* Make sure the object is still alive */ | 446 | /* Make sure the object is still alive */ |
447 | if (debugfs_positive(file->f_path.dentry) | 447 | if (debugfs_positive(file->f_path.dentry) |
448 | && kref_get_unless_zero(kref)) | 448 | && kref_get_unless_zero(kref)) |
449 | ret = 0; | 449 | ret = 0; |
450 | mutex_unlock(&parent->d_inode->i_mutex); | 450 | mutex_unlock(&d_inode(parent)->i_mutex); |
451 | if (!ret) { | 451 | if (!ret) { |
452 | ret = single_open(file, show, data); | 452 | ret = single_open(file, show, data); |
453 | if (ret) | 453 | if (ret) |
diff --git a/drivers/infiniband/hw/ipath/ipath_fs.c b/drivers/infiniband/hw/ipath/ipath_fs.c index 33c45dfcbd88..1ca8e32a9592 100644 --- a/drivers/infiniband/hw/ipath/ipath_fs.c +++ b/drivers/infiniband/hw/ipath/ipath_fs.c | |||
@@ -82,14 +82,14 @@ static int create_file(const char *name, umode_t mode, | |||
82 | { | 82 | { |
83 | int error; | 83 | int error; |
84 | 84 | ||
85 | mutex_lock(&parent->d_inode->i_mutex); | 85 | mutex_lock(&d_inode(parent)->i_mutex); |
86 | *dentry = lookup_one_len(name, parent, strlen(name)); | 86 | *dentry = lookup_one_len(name, parent, strlen(name)); |
87 | if (!IS_ERR(*dentry)) | 87 | if (!IS_ERR(*dentry)) |
88 | error = ipathfs_mknod(parent->d_inode, *dentry, | 88 | error = ipathfs_mknod(d_inode(parent), *dentry, |
89 | mode, fops, data); | 89 | mode, fops, data); |
90 | else | 90 | else |
91 | error = PTR_ERR(*dentry); | 91 | error = PTR_ERR(*dentry); |
92 | mutex_unlock(&parent->d_inode->i_mutex); | 92 | mutex_unlock(&d_inode(parent)->i_mutex); |
93 | 93 | ||
94 | return error; | 94 | return error; |
95 | } | 95 | } |
@@ -277,11 +277,11 @@ static int remove_file(struct dentry *parent, char *name) | |||
277 | } | 277 | } |
278 | 278 | ||
279 | spin_lock(&tmp->d_lock); | 279 | spin_lock(&tmp->d_lock); |
280 | if (!d_unhashed(tmp) && tmp->d_inode) { | 280 | if (!d_unhashed(tmp) && d_really_is_positive(tmp)) { |
281 | dget_dlock(tmp); | 281 | dget_dlock(tmp); |
282 | __d_drop(tmp); | 282 | __d_drop(tmp); |
283 | spin_unlock(&tmp->d_lock); | 283 | spin_unlock(&tmp->d_lock); |
284 | simple_unlink(parent->d_inode, tmp); | 284 | simple_unlink(d_inode(parent), tmp); |
285 | } else | 285 | } else |
286 | spin_unlock(&tmp->d_lock); | 286 | spin_unlock(&tmp->d_lock); |
287 | 287 | ||
@@ -302,7 +302,7 @@ static int remove_device_files(struct super_block *sb, | |||
302 | int ret; | 302 | int ret; |
303 | 303 | ||
304 | root = dget(sb->s_root); | 304 | root = dget(sb->s_root); |
305 | mutex_lock(&root->d_inode->i_mutex); | 305 | mutex_lock(&d_inode(root)->i_mutex); |
306 | snprintf(unit, sizeof unit, "%02d", dd->ipath_unit); | 306 | snprintf(unit, sizeof unit, "%02d", dd->ipath_unit); |
307 | dir = lookup_one_len(unit, root, strlen(unit)); | 307 | dir = lookup_one_len(unit, root, strlen(unit)); |
308 | 308 | ||
@@ -315,10 +315,10 @@ static int remove_device_files(struct super_block *sb, | |||
315 | remove_file(dir, "flash"); | 315 | remove_file(dir, "flash"); |
316 | remove_file(dir, "atomic_counters"); | 316 | remove_file(dir, "atomic_counters"); |
317 | d_delete(dir); | 317 | d_delete(dir); |
318 | ret = simple_rmdir(root->d_inode, dir); | 318 | ret = simple_rmdir(d_inode(root), dir); |
319 | 319 | ||
320 | bail: | 320 | bail: |
321 | mutex_unlock(&root->d_inode->i_mutex); | 321 | mutex_unlock(&d_inode(root)->i_mutex); |
322 | dput(root); | 322 | dput(root); |
323 | return ret; | 323 | return ret; |
324 | } | 324 | } |
diff --git a/drivers/infiniband/hw/qib/qib_fs.c b/drivers/infiniband/hw/qib/qib_fs.c index 650897a8591e..bdd5d3857203 100644 --- a/drivers/infiniband/hw/qib/qib_fs.c +++ b/drivers/infiniband/hw/qib/qib_fs.c | |||
@@ -89,14 +89,14 @@ static int create_file(const char *name, umode_t mode, | |||
89 | { | 89 | { |
90 | int error; | 90 | int error; |
91 | 91 | ||
92 | mutex_lock(&parent->d_inode->i_mutex); | 92 | mutex_lock(&d_inode(parent)->i_mutex); |
93 | *dentry = lookup_one_len(name, parent, strlen(name)); | 93 | *dentry = lookup_one_len(name, parent, strlen(name)); |
94 | if (!IS_ERR(*dentry)) | 94 | if (!IS_ERR(*dentry)) |
95 | error = qibfs_mknod(parent->d_inode, *dentry, | 95 | error = qibfs_mknod(d_inode(parent), *dentry, |
96 | mode, fops, data); | 96 | mode, fops, data); |
97 | else | 97 | else |
98 | error = PTR_ERR(*dentry); | 98 | error = PTR_ERR(*dentry); |
99 | mutex_unlock(&parent->d_inode->i_mutex); | 99 | mutex_unlock(&d_inode(parent)->i_mutex); |
100 | 100 | ||
101 | return error; | 101 | return error; |
102 | } | 102 | } |
@@ -455,10 +455,10 @@ static int remove_file(struct dentry *parent, char *name) | |||
455 | } | 455 | } |
456 | 456 | ||
457 | spin_lock(&tmp->d_lock); | 457 | spin_lock(&tmp->d_lock); |
458 | if (!d_unhashed(tmp) && tmp->d_inode) { | 458 | if (!d_unhashed(tmp) && d_really_is_positive(tmp)) { |
459 | __d_drop(tmp); | 459 | __d_drop(tmp); |
460 | spin_unlock(&tmp->d_lock); | 460 | spin_unlock(&tmp->d_lock); |
461 | simple_unlink(parent->d_inode, tmp); | 461 | simple_unlink(d_inode(parent), tmp); |
462 | } else { | 462 | } else { |
463 | spin_unlock(&tmp->d_lock); | 463 | spin_unlock(&tmp->d_lock); |
464 | } | 464 | } |
@@ -481,7 +481,7 @@ static int remove_device_files(struct super_block *sb, | |||
481 | int ret, i; | 481 | int ret, i; |
482 | 482 | ||
483 | root = dget(sb->s_root); | 483 | root = dget(sb->s_root); |
484 | mutex_lock(&root->d_inode->i_mutex); | 484 | mutex_lock(&d_inode(root)->i_mutex); |
485 | snprintf(unit, sizeof(unit), "%u", dd->unit); | 485 | snprintf(unit, sizeof(unit), "%u", dd->unit); |
486 | dir = lookup_one_len(unit, root, strlen(unit)); | 486 | dir = lookup_one_len(unit, root, strlen(unit)); |
487 | 487 | ||
@@ -491,7 +491,7 @@ static int remove_device_files(struct super_block *sb, | |||
491 | goto bail; | 491 | goto bail; |
492 | } | 492 | } |
493 | 493 | ||
494 | mutex_lock(&dir->d_inode->i_mutex); | 494 | mutex_lock(&d_inode(dir)->i_mutex); |
495 | remove_file(dir, "counters"); | 495 | remove_file(dir, "counters"); |
496 | remove_file(dir, "counter_names"); | 496 | remove_file(dir, "counter_names"); |
497 | remove_file(dir, "portcounter_names"); | 497 | remove_file(dir, "portcounter_names"); |
@@ -506,13 +506,13 @@ static int remove_device_files(struct super_block *sb, | |||
506 | } | 506 | } |
507 | } | 507 | } |
508 | remove_file(dir, "flash"); | 508 | remove_file(dir, "flash"); |
509 | mutex_unlock(&dir->d_inode->i_mutex); | 509 | mutex_unlock(&d_inode(dir)->i_mutex); |
510 | ret = simple_rmdir(root->d_inode, dir); | 510 | ret = simple_rmdir(d_inode(root), dir); |
511 | d_delete(dir); | 511 | d_delete(dir); |
512 | dput(dir); | 512 | dput(dir); |
513 | 513 | ||
514 | bail: | 514 | bail: |
515 | mutex_unlock(&root->d_inode->i_mutex); | 515 | mutex_unlock(&d_inode(root)->i_mutex); |
516 | dput(root); | 516 | dput(root); |
517 | return ret; | 517 | return ret; |
518 | } | 518 | } |
diff --git a/drivers/oprofile/oprofilefs.c b/drivers/oprofile/oprofilefs.c index 3f493459378f..dd92c5edf219 100644 --- a/drivers/oprofile/oprofilefs.c +++ b/drivers/oprofile/oprofilefs.c | |||
@@ -138,22 +138,22 @@ static int __oprofilefs_create_file(struct dentry *root, char const *name, | |||
138 | struct dentry *dentry; | 138 | struct dentry *dentry; |
139 | struct inode *inode; | 139 | struct inode *inode; |
140 | 140 | ||
141 | mutex_lock(&root->d_inode->i_mutex); | 141 | mutex_lock(&d_inode(root)->i_mutex); |
142 | dentry = d_alloc_name(root, name); | 142 | dentry = d_alloc_name(root, name); |
143 | if (!dentry) { | 143 | if (!dentry) { |
144 | mutex_unlock(&root->d_inode->i_mutex); | 144 | mutex_unlock(&d_inode(root)->i_mutex); |
145 | return -ENOMEM; | 145 | return -ENOMEM; |
146 | } | 146 | } |
147 | inode = oprofilefs_get_inode(root->d_sb, S_IFREG | perm); | 147 | inode = oprofilefs_get_inode(root->d_sb, S_IFREG | perm); |
148 | if (!inode) { | 148 | if (!inode) { |
149 | dput(dentry); | 149 | dput(dentry); |
150 | mutex_unlock(&root->d_inode->i_mutex); | 150 | mutex_unlock(&d_inode(root)->i_mutex); |
151 | return -ENOMEM; | 151 | return -ENOMEM; |
152 | } | 152 | } |
153 | inode->i_fop = fops; | 153 | inode->i_fop = fops; |
154 | inode->i_private = priv; | 154 | inode->i_private = priv; |
155 | d_add(dentry, inode); | 155 | d_add(dentry, inode); |
156 | mutex_unlock(&root->d_inode->i_mutex); | 156 | mutex_unlock(&d_inode(root)->i_mutex); |
157 | return 0; | 157 | return 0; |
158 | } | 158 | } |
159 | 159 | ||
@@ -215,22 +215,22 @@ struct dentry *oprofilefs_mkdir(struct dentry *parent, char const *name) | |||
215 | struct dentry *dentry; | 215 | struct dentry *dentry; |
216 | struct inode *inode; | 216 | struct inode *inode; |
217 | 217 | ||
218 | mutex_lock(&parent->d_inode->i_mutex); | 218 | mutex_lock(&d_inode(parent)->i_mutex); |
219 | dentry = d_alloc_name(parent, name); | 219 | dentry = d_alloc_name(parent, name); |
220 | if (!dentry) { | 220 | if (!dentry) { |
221 | mutex_unlock(&parent->d_inode->i_mutex); | 221 | mutex_unlock(&d_inode(parent)->i_mutex); |
222 | return NULL; | 222 | return NULL; |
223 | } | 223 | } |
224 | inode = oprofilefs_get_inode(parent->d_sb, S_IFDIR | 0755); | 224 | inode = oprofilefs_get_inode(parent->d_sb, S_IFDIR | 0755); |
225 | if (!inode) { | 225 | if (!inode) { |
226 | dput(dentry); | 226 | dput(dentry); |
227 | mutex_unlock(&parent->d_inode->i_mutex); | 227 | mutex_unlock(&d_inode(parent)->i_mutex); |
228 | return NULL; | 228 | return NULL; |
229 | } | 229 | } |
230 | inode->i_op = &simple_dir_inode_operations; | 230 | inode->i_op = &simple_dir_inode_operations; |
231 | inode->i_fop = &simple_dir_operations; | 231 | inode->i_fop = &simple_dir_operations; |
232 | d_add(dentry, inode); | 232 | d_add(dentry, inode); |
233 | mutex_unlock(&parent->d_inode->i_mutex); | 233 | mutex_unlock(&d_inode(parent)->i_mutex); |
234 | return dentry; | 234 | return dentry; |
235 | } | 235 | } |
236 | 236 | ||
diff --git a/drivers/usb/gadget/legacy/inode.c b/drivers/usb/gadget/legacy/inode.c index 6af58c6dba5e..2030565c6789 100644 --- a/drivers/usb/gadget/legacy/inode.c +++ b/drivers/usb/gadget/legacy/inode.c | |||
@@ -1505,7 +1505,7 @@ static void destroy_ep_files (struct dev_data *dev) | |||
1505 | list_del_init (&ep->epfiles); | 1505 | list_del_init (&ep->epfiles); |
1506 | dentry = ep->dentry; | 1506 | dentry = ep->dentry; |
1507 | ep->dentry = NULL; | 1507 | ep->dentry = NULL; |
1508 | parent = dentry->d_parent->d_inode; | 1508 | parent = d_inode(dentry->d_parent); |
1509 | 1509 | ||
1510 | /* break link to controller */ | 1510 | /* break link to controller */ |
1511 | if (ep->state == STATE_EP_ENABLED) | 1511 | if (ep->state == STATE_EP_ENABLED) |
diff --git a/fs/binfmt_misc.c b/fs/binfmt_misc.c index 97aff2879cda..71a93012a182 100644 --- a/fs/binfmt_misc.c +++ b/fs/binfmt_misc.c | |||
@@ -603,7 +603,7 @@ static void kill_node(Node *e) | |||
603 | write_unlock(&entries_lock); | 603 | write_unlock(&entries_lock); |
604 | 604 | ||
605 | if (dentry) { | 605 | if (dentry) { |
606 | drop_nlink(dentry->d_inode); | 606 | drop_nlink(d_inode(dentry)); |
607 | d_drop(dentry); | 607 | d_drop(dentry); |
608 | dput(dentry); | 608 | dput(dentry); |
609 | simple_release_fs(&bm_mnt, &entry_count); | 609 | simple_release_fs(&bm_mnt, &entry_count); |
@@ -650,11 +650,11 @@ static ssize_t bm_entry_write(struct file *file, const char __user *buffer, | |||
650 | case 3: | 650 | case 3: |
651 | /* Delete this handler. */ | 651 | /* Delete this handler. */ |
652 | root = dget(file->f_path.dentry->d_sb->s_root); | 652 | root = dget(file->f_path.dentry->d_sb->s_root); |
653 | mutex_lock(&root->d_inode->i_mutex); | 653 | mutex_lock(&d_inode(root)->i_mutex); |
654 | 654 | ||
655 | kill_node(e); | 655 | kill_node(e); |
656 | 656 | ||
657 | mutex_unlock(&root->d_inode->i_mutex); | 657 | mutex_unlock(&d_inode(root)->i_mutex); |
658 | dput(root); | 658 | dput(root); |
659 | break; | 659 | break; |
660 | default: | 660 | default: |
@@ -687,14 +687,14 @@ static ssize_t bm_register_write(struct file *file, const char __user *buffer, | |||
687 | return PTR_ERR(e); | 687 | return PTR_ERR(e); |
688 | 688 | ||
689 | root = dget(sb->s_root); | 689 | root = dget(sb->s_root); |
690 | mutex_lock(&root->d_inode->i_mutex); | 690 | mutex_lock(&d_inode(root)->i_mutex); |
691 | dentry = lookup_one_len(e->name, root, strlen(e->name)); | 691 | dentry = lookup_one_len(e->name, root, strlen(e->name)); |
692 | err = PTR_ERR(dentry); | 692 | err = PTR_ERR(dentry); |
693 | if (IS_ERR(dentry)) | 693 | if (IS_ERR(dentry)) |
694 | goto out; | 694 | goto out; |
695 | 695 | ||
696 | err = -EEXIST; | 696 | err = -EEXIST; |
697 | if (dentry->d_inode) | 697 | if (d_really_is_positive(dentry)) |
698 | goto out2; | 698 | goto out2; |
699 | 699 | ||
700 | inode = bm_get_inode(sb, S_IFREG | 0644); | 700 | inode = bm_get_inode(sb, S_IFREG | 0644); |
@@ -723,7 +723,7 @@ static ssize_t bm_register_write(struct file *file, const char __user *buffer, | |||
723 | out2: | 723 | out2: |
724 | dput(dentry); | 724 | dput(dentry); |
725 | out: | 725 | out: |
726 | mutex_unlock(&root->d_inode->i_mutex); | 726 | mutex_unlock(&d_inode(root)->i_mutex); |
727 | dput(root); | 727 | dput(root); |
728 | 728 | ||
729 | if (err) { | 729 | if (err) { |
@@ -766,12 +766,12 @@ static ssize_t bm_status_write(struct file *file, const char __user *buffer, | |||
766 | case 3: | 766 | case 3: |
767 | /* Delete all handlers. */ | 767 | /* Delete all handlers. */ |
768 | root = dget(file->f_path.dentry->d_sb->s_root); | 768 | root = dget(file->f_path.dentry->d_sb->s_root); |
769 | mutex_lock(&root->d_inode->i_mutex); | 769 | mutex_lock(&d_inode(root)->i_mutex); |
770 | 770 | ||
771 | while (!list_empty(&entries)) | 771 | while (!list_empty(&entries)) |
772 | kill_node(list_entry(entries.next, Node, list)); | 772 | kill_node(list_entry(entries.next, Node, list)); |
773 | 773 | ||
774 | mutex_unlock(&root->d_inode->i_mutex); | 774 | mutex_unlock(&d_inode(root)->i_mutex); |
775 | dput(root); | 775 | dput(root); |
776 | break; | 776 | break; |
777 | default: | 777 | default: |
@@ -13,7 +13,7 @@ static const struct file_operations ns_file_operations = { | |||
13 | 13 | ||
14 | static char *ns_dname(struct dentry *dentry, char *buffer, int buflen) | 14 | static char *ns_dname(struct dentry *dentry, char *buffer, int buflen) |
15 | { | 15 | { |
16 | struct inode *inode = dentry->d_inode; | 16 | struct inode *inode = d_inode(dentry); |
17 | const struct proc_ns_operations *ns_ops = dentry->d_fsdata; | 17 | const struct proc_ns_operations *ns_ops = dentry->d_fsdata; |
18 | 18 | ||
19 | return dynamic_dname(dentry, buffer, buflen, "%s:[%lu]", | 19 | return dynamic_dname(dentry, buffer, buflen, "%s:[%lu]", |
@@ -22,7 +22,7 @@ static char *ns_dname(struct dentry *dentry, char *buffer, int buflen) | |||
22 | 22 | ||
23 | static void ns_prune_dentry(struct dentry *dentry) | 23 | static void ns_prune_dentry(struct dentry *dentry) |
24 | { | 24 | { |
25 | struct inode *inode = dentry->d_inode; | 25 | struct inode *inode = d_inode(dentry); |
26 | if (inode) { | 26 | if (inode) { |
27 | struct ns_common *ns = inode->i_private; | 27 | struct ns_common *ns = inode->i_private; |
28 | atomic_long_set(&ns->stashed, 0); | 28 | atomic_long_set(&ns->stashed, 0); |
@@ -627,7 +627,7 @@ static struct vfsmount *pipe_mnt __read_mostly; | |||
627 | static char *pipefs_dname(struct dentry *dentry, char *buffer, int buflen) | 627 | static char *pipefs_dname(struct dentry *dentry, char *buffer, int buflen) |
628 | { | 628 | { |
629 | return dynamic_dname(dentry, buffer, buflen, "pipe:[%lu]", | 629 | return dynamic_dname(dentry, buffer, buflen, "pipe:[%lu]", |
630 | dentry->d_inode->i_ino); | 630 | d_inode(dentry)->i_ino); |
631 | } | 631 | } |
632 | 632 | ||
633 | static const struct dentry_operations pipefs_dentry_operations = { | 633 | static const struct dentry_operations pipefs_dentry_operations = { |
diff --git a/ipc/mqueue.c b/ipc/mqueue.c index 7635a1cf99f3..3aaea7ffd077 100644 --- a/ipc/mqueue.c +++ b/ipc/mqueue.c | |||
@@ -466,7 +466,7 @@ out_unlock: | |||
466 | 466 | ||
467 | static int mqueue_unlink(struct inode *dir, struct dentry *dentry) | 467 | static int mqueue_unlink(struct inode *dir, struct dentry *dentry) |
468 | { | 468 | { |
469 | struct inode *inode = dentry->d_inode; | 469 | struct inode *inode = d_inode(dentry); |
470 | 470 | ||
471 | dir->i_ctime = dir->i_mtime = dir->i_atime = CURRENT_TIME; | 471 | dir->i_ctime = dir->i_mtime = dir->i_atime = CURRENT_TIME; |
472 | dir->i_size -= DIRENT_SIZE; | 472 | dir->i_size -= DIRENT_SIZE; |
@@ -770,7 +770,7 @@ static struct file *do_open(struct path *path, int oflag) | |||
770 | if ((oflag & O_ACCMODE) == (O_RDWR | O_WRONLY)) | 770 | if ((oflag & O_ACCMODE) == (O_RDWR | O_WRONLY)) |
771 | return ERR_PTR(-EINVAL); | 771 | return ERR_PTR(-EINVAL); |
772 | acc = oflag2acc[oflag & O_ACCMODE]; | 772 | acc = oflag2acc[oflag & O_ACCMODE]; |
773 | if (inode_permission(path->dentry->d_inode, acc)) | 773 | if (inode_permission(d_inode(path->dentry), acc)) |
774 | return ERR_PTR(-EACCES); | 774 | return ERR_PTR(-EACCES); |
775 | return dentry_open(path, oflag, current_cred()); | 775 | return dentry_open(path, oflag, current_cred()); |
776 | } | 776 | } |
@@ -802,7 +802,7 @@ SYSCALL_DEFINE4(mq_open, const char __user *, u_name, int, oflag, umode_t, mode, | |||
802 | 802 | ||
803 | ro = mnt_want_write(mnt); /* we'll drop it in any case */ | 803 | ro = mnt_want_write(mnt); /* we'll drop it in any case */ |
804 | error = 0; | 804 | error = 0; |
805 | mutex_lock(&root->d_inode->i_mutex); | 805 | mutex_lock(&d_inode(root)->i_mutex); |
806 | path.dentry = lookup_one_len(name->name, root, strlen(name->name)); | 806 | path.dentry = lookup_one_len(name->name, root, strlen(name->name)); |
807 | if (IS_ERR(path.dentry)) { | 807 | if (IS_ERR(path.dentry)) { |
808 | error = PTR_ERR(path.dentry); | 808 | error = PTR_ERR(path.dentry); |
@@ -811,7 +811,7 @@ SYSCALL_DEFINE4(mq_open, const char __user *, u_name, int, oflag, umode_t, mode, | |||
811 | path.mnt = mntget(mnt); | 811 | path.mnt = mntget(mnt); |
812 | 812 | ||
813 | if (oflag & O_CREAT) { | 813 | if (oflag & O_CREAT) { |
814 | if (path.dentry->d_inode) { /* entry already exists */ | 814 | if (d_really_is_positive(path.dentry)) { /* entry already exists */ |
815 | audit_inode(name, path.dentry, 0); | 815 | audit_inode(name, path.dentry, 0); |
816 | if (oflag & O_EXCL) { | 816 | if (oflag & O_EXCL) { |
817 | error = -EEXIST; | 817 | error = -EEXIST; |
@@ -824,12 +824,12 @@ SYSCALL_DEFINE4(mq_open, const char __user *, u_name, int, oflag, umode_t, mode, | |||
824 | goto out; | 824 | goto out; |
825 | } | 825 | } |
826 | audit_inode_parent_hidden(name, root); | 826 | audit_inode_parent_hidden(name, root); |
827 | filp = do_create(ipc_ns, root->d_inode, | 827 | filp = do_create(ipc_ns, d_inode(root), |
828 | &path, oflag, mode, | 828 | &path, oflag, mode, |
829 | u_attr ? &attr : NULL); | 829 | u_attr ? &attr : NULL); |
830 | } | 830 | } |
831 | } else { | 831 | } else { |
832 | if (!path.dentry->d_inode) { | 832 | if (d_really_is_negative(path.dentry)) { |
833 | error = -ENOENT; | 833 | error = -ENOENT; |
834 | goto out; | 834 | goto out; |
835 | } | 835 | } |
@@ -848,7 +848,7 @@ out_putfd: | |||
848 | put_unused_fd(fd); | 848 | put_unused_fd(fd); |
849 | fd = error; | 849 | fd = error; |
850 | } | 850 | } |
851 | mutex_unlock(&root->d_inode->i_mutex); | 851 | mutex_unlock(&d_inode(root)->i_mutex); |
852 | if (!ro) | 852 | if (!ro) |
853 | mnt_drop_write(mnt); | 853 | mnt_drop_write(mnt); |
854 | out_putname: | 854 | out_putname: |
@@ -873,7 +873,7 @@ SYSCALL_DEFINE1(mq_unlink, const char __user *, u_name) | |||
873 | err = mnt_want_write(mnt); | 873 | err = mnt_want_write(mnt); |
874 | if (err) | 874 | if (err) |
875 | goto out_name; | 875 | goto out_name; |
876 | mutex_lock_nested(&mnt->mnt_root->d_inode->i_mutex, I_MUTEX_PARENT); | 876 | mutex_lock_nested(&d_inode(mnt->mnt_root)->i_mutex, I_MUTEX_PARENT); |
877 | dentry = lookup_one_len(name->name, mnt->mnt_root, | 877 | dentry = lookup_one_len(name->name, mnt->mnt_root, |
878 | strlen(name->name)); | 878 | strlen(name->name)); |
879 | if (IS_ERR(dentry)) { | 879 | if (IS_ERR(dentry)) { |
@@ -881,17 +881,17 @@ SYSCALL_DEFINE1(mq_unlink, const char __user *, u_name) | |||
881 | goto out_unlock; | 881 | goto out_unlock; |
882 | } | 882 | } |
883 | 883 | ||
884 | inode = dentry->d_inode; | 884 | inode = d_inode(dentry); |
885 | if (!inode) { | 885 | if (!inode) { |
886 | err = -ENOENT; | 886 | err = -ENOENT; |
887 | } else { | 887 | } else { |
888 | ihold(inode); | 888 | ihold(inode); |
889 | err = vfs_unlink(dentry->d_parent->d_inode, dentry, NULL); | 889 | err = vfs_unlink(d_inode(dentry->d_parent), dentry, NULL); |
890 | } | 890 | } |
891 | dput(dentry); | 891 | dput(dentry); |
892 | 892 | ||
893 | out_unlock: | 893 | out_unlock: |
894 | mutex_unlock(&mnt->mnt_root->d_inode->i_mutex); | 894 | mutex_unlock(&d_inode(mnt->mnt_root)->i_mutex); |
895 | if (inode) | 895 | if (inode) |
896 | iput(inode); | 896 | iput(inode); |
897 | mnt_drop_write(mnt); | 897 | mnt_drop_write(mnt); |
@@ -1132,7 +1132,7 @@ long do_shmat(int shmid, char __user *shmaddr, int shmflg, ulong *raddr, | |||
1132 | path = shp->shm_file->f_path; | 1132 | path = shp->shm_file->f_path; |
1133 | path_get(&path); | 1133 | path_get(&path); |
1134 | shp->shm_nattch++; | 1134 | shp->shm_nattch++; |
1135 | size = i_size_read(path.dentry->d_inode); | 1135 | size = i_size_read(d_inode(path.dentry)); |
1136 | ipc_unlock_object(&shp->shm_perm); | 1136 | ipc_unlock_object(&shp->shm_perm); |
1137 | rcu_read_unlock(); | 1137 | rcu_read_unlock(); |
1138 | 1138 | ||
diff --git a/mm/shmem.c b/mm/shmem.c index 1ea2400b5245..de981370fbc5 100644 --- a/mm/shmem.c +++ b/mm/shmem.c | |||
@@ -544,7 +544,7 @@ EXPORT_SYMBOL_GPL(shmem_truncate_range); | |||
544 | 544 | ||
545 | static int shmem_setattr(struct dentry *dentry, struct iattr *attr) | 545 | static int shmem_setattr(struct dentry *dentry, struct iattr *attr) |
546 | { | 546 | { |
547 | struct inode *inode = dentry->d_inode; | 547 | struct inode *inode = d_inode(dentry); |
548 | struct shmem_inode_info *info = SHMEM_I(inode); | 548 | struct shmem_inode_info *info = SHMEM_I(inode); |
549 | int error; | 549 | int error; |
550 | 550 | ||
@@ -2274,7 +2274,7 @@ static int shmem_create(struct inode *dir, struct dentry *dentry, umode_t mode, | |||
2274 | */ | 2274 | */ |
2275 | static int shmem_link(struct dentry *old_dentry, struct inode *dir, struct dentry *dentry) | 2275 | static int shmem_link(struct dentry *old_dentry, struct inode *dir, struct dentry *dentry) |
2276 | { | 2276 | { |
2277 | struct inode *inode = old_dentry->d_inode; | 2277 | struct inode *inode = d_inode(old_dentry); |
2278 | int ret; | 2278 | int ret; |
2279 | 2279 | ||
2280 | /* | 2280 | /* |
@@ -2298,7 +2298,7 @@ out: | |||
2298 | 2298 | ||
2299 | static int shmem_unlink(struct inode *dir, struct dentry *dentry) | 2299 | static int shmem_unlink(struct inode *dir, struct dentry *dentry) |
2300 | { | 2300 | { |
2301 | struct inode *inode = dentry->d_inode; | 2301 | struct inode *inode = d_inode(dentry); |
2302 | 2302 | ||
2303 | if (inode->i_nlink > 1 && !S_ISDIR(inode->i_mode)) | 2303 | if (inode->i_nlink > 1 && !S_ISDIR(inode->i_mode)) |
2304 | shmem_free_inode(inode->i_sb); | 2304 | shmem_free_inode(inode->i_sb); |
@@ -2315,7 +2315,7 @@ static int shmem_rmdir(struct inode *dir, struct dentry *dentry) | |||
2315 | if (!simple_empty(dentry)) | 2315 | if (!simple_empty(dentry)) |
2316 | return -ENOTEMPTY; | 2316 | return -ENOTEMPTY; |
2317 | 2317 | ||
2318 | drop_nlink(dentry->d_inode); | 2318 | drop_nlink(d_inode(dentry)); |
2319 | drop_nlink(dir); | 2319 | drop_nlink(dir); |
2320 | return shmem_unlink(dir, dentry); | 2320 | return shmem_unlink(dir, dentry); |
2321 | } | 2321 | } |
@@ -2336,8 +2336,8 @@ static int shmem_exchange(struct inode *old_dir, struct dentry *old_dentry, stru | |||
2336 | } | 2336 | } |
2337 | old_dir->i_ctime = old_dir->i_mtime = | 2337 | old_dir->i_ctime = old_dir->i_mtime = |
2338 | new_dir->i_ctime = new_dir->i_mtime = | 2338 | new_dir->i_ctime = new_dir->i_mtime = |
2339 | old_dentry->d_inode->i_ctime = | 2339 | d_inode(old_dentry)->i_ctime = |
2340 | new_dentry->d_inode->i_ctime = CURRENT_TIME; | 2340 | d_inode(new_dentry)->i_ctime = CURRENT_TIME; |
2341 | 2341 | ||
2342 | return 0; | 2342 | return 0; |
2343 | } | 2343 | } |
@@ -2376,7 +2376,7 @@ static int shmem_whiteout(struct inode *old_dir, struct dentry *old_dentry) | |||
2376 | */ | 2376 | */ |
2377 | static int shmem_rename2(struct inode *old_dir, struct dentry *old_dentry, struct inode *new_dir, struct dentry *new_dentry, unsigned int flags) | 2377 | static int shmem_rename2(struct inode *old_dir, struct dentry *old_dentry, struct inode *new_dir, struct dentry *new_dentry, unsigned int flags) |
2378 | { | 2378 | { |
2379 | struct inode *inode = old_dentry->d_inode; | 2379 | struct inode *inode = d_inode(old_dentry); |
2380 | int they_are_dirs = S_ISDIR(inode->i_mode); | 2380 | int they_are_dirs = S_ISDIR(inode->i_mode); |
2381 | 2381 | ||
2382 | if (flags & ~(RENAME_NOREPLACE | RENAME_EXCHANGE | RENAME_WHITEOUT)) | 2382 | if (flags & ~(RENAME_NOREPLACE | RENAME_EXCHANGE | RENAME_WHITEOUT)) |
@@ -2396,10 +2396,10 @@ static int shmem_rename2(struct inode *old_dir, struct dentry *old_dentry, struc | |||
2396 | return error; | 2396 | return error; |
2397 | } | 2397 | } |
2398 | 2398 | ||
2399 | if (new_dentry->d_inode) { | 2399 | if (d_really_is_positive(new_dentry)) { |
2400 | (void) shmem_unlink(new_dir, new_dentry); | 2400 | (void) shmem_unlink(new_dir, new_dentry); |
2401 | if (they_are_dirs) { | 2401 | if (they_are_dirs) { |
2402 | drop_nlink(new_dentry->d_inode); | 2402 | drop_nlink(d_inode(new_dentry)); |
2403 | drop_nlink(old_dir); | 2403 | drop_nlink(old_dir); |
2404 | } | 2404 | } |
2405 | } else if (they_are_dirs) { | 2405 | } else if (they_are_dirs) { |
@@ -2476,14 +2476,14 @@ static int shmem_symlink(struct inode *dir, struct dentry *dentry, const char *s | |||
2476 | 2476 | ||
2477 | static void *shmem_follow_short_symlink(struct dentry *dentry, struct nameidata *nd) | 2477 | static void *shmem_follow_short_symlink(struct dentry *dentry, struct nameidata *nd) |
2478 | { | 2478 | { |
2479 | nd_set_link(nd, SHMEM_I(dentry->d_inode)->symlink); | 2479 | nd_set_link(nd, SHMEM_I(d_inode(dentry))->symlink); |
2480 | return NULL; | 2480 | return NULL; |
2481 | } | 2481 | } |
2482 | 2482 | ||
2483 | static void *shmem_follow_link(struct dentry *dentry, struct nameidata *nd) | 2483 | static void *shmem_follow_link(struct dentry *dentry, struct nameidata *nd) |
2484 | { | 2484 | { |
2485 | struct page *page = NULL; | 2485 | struct page *page = NULL; |
2486 | int error = shmem_getpage(dentry->d_inode, 0, &page, SGP_READ, NULL); | 2486 | int error = shmem_getpage(d_inode(dentry), 0, &page, SGP_READ, NULL); |
2487 | nd_set_link(nd, error ? ERR_PTR(error) : kmap(page)); | 2487 | nd_set_link(nd, error ? ERR_PTR(error) : kmap(page)); |
2488 | if (page) | 2488 | if (page) |
2489 | unlock_page(page); | 2489 | unlock_page(page); |
@@ -2574,7 +2574,7 @@ static int shmem_xattr_validate(const char *name) | |||
2574 | static ssize_t shmem_getxattr(struct dentry *dentry, const char *name, | 2574 | static ssize_t shmem_getxattr(struct dentry *dentry, const char *name, |
2575 | void *buffer, size_t size) | 2575 | void *buffer, size_t size) |
2576 | { | 2576 | { |
2577 | struct shmem_inode_info *info = SHMEM_I(dentry->d_inode); | 2577 | struct shmem_inode_info *info = SHMEM_I(d_inode(dentry)); |
2578 | int err; | 2578 | int err; |
2579 | 2579 | ||
2580 | /* | 2580 | /* |
@@ -2595,7 +2595,7 @@ static ssize_t shmem_getxattr(struct dentry *dentry, const char *name, | |||
2595 | static int shmem_setxattr(struct dentry *dentry, const char *name, | 2595 | static int shmem_setxattr(struct dentry *dentry, const char *name, |
2596 | const void *value, size_t size, int flags) | 2596 | const void *value, size_t size, int flags) |
2597 | { | 2597 | { |
2598 | struct shmem_inode_info *info = SHMEM_I(dentry->d_inode); | 2598 | struct shmem_inode_info *info = SHMEM_I(d_inode(dentry)); |
2599 | int err; | 2599 | int err; |
2600 | 2600 | ||
2601 | /* | 2601 | /* |
@@ -2615,7 +2615,7 @@ static int shmem_setxattr(struct dentry *dentry, const char *name, | |||
2615 | 2615 | ||
2616 | static int shmem_removexattr(struct dentry *dentry, const char *name) | 2616 | static int shmem_removexattr(struct dentry *dentry, const char *name) |
2617 | { | 2617 | { |
2618 | struct shmem_inode_info *info = SHMEM_I(dentry->d_inode); | 2618 | struct shmem_inode_info *info = SHMEM_I(d_inode(dentry)); |
2619 | int err; | 2619 | int err; |
2620 | 2620 | ||
2621 | /* | 2621 | /* |
@@ -2635,7 +2635,7 @@ static int shmem_removexattr(struct dentry *dentry, const char *name) | |||
2635 | 2635 | ||
2636 | static ssize_t shmem_listxattr(struct dentry *dentry, char *buffer, size_t size) | 2636 | static ssize_t shmem_listxattr(struct dentry *dentry, char *buffer, size_t size) |
2637 | { | 2637 | { |
2638 | struct shmem_inode_info *info = SHMEM_I(dentry->d_inode); | 2638 | struct shmem_inode_info *info = SHMEM_I(d_inode(dentry)); |
2639 | return simple_xattr_list(&info->xattrs, buffer, size); | 2639 | return simple_xattr_list(&info->xattrs, buffer, size); |
2640 | } | 2640 | } |
2641 | #endif /* CONFIG_TMPFS_XATTR */ | 2641 | #endif /* CONFIG_TMPFS_XATTR */ |