aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
Diffstat (limited to 'fs')
-rw-r--r--fs/9p/vfs_inode.c2
-rw-r--r--fs/9p/vfs_inode_dotl.c4
-rw-r--r--fs/affs/amigaffs.c2
-rw-r--r--fs/affs/inode.c4
-rw-r--r--fs/affs/namei.c40
-rw-r--r--fs/afs/dir.c80
-rw-r--r--fs/afs/inode.c4
-rw-r--r--fs/afs/mntpt.c22
-rw-r--r--fs/afs/write.c9
-rw-r--r--fs/autofs4/expire.c42
-rw-r--r--fs/autofs4/root.c25
-rw-r--r--fs/befs/linuxvfs.c16
-rw-r--r--fs/binfmt_aout.c8
-rw-r--r--fs/btrfs/inode.c2
-rw-r--r--fs/btrfs/ioctl.c2
-rw-r--r--fs/cachefiles/namei.c21
-rw-r--r--fs/cachefiles/xattr.c15
-rw-r--r--fs/ceph/debugfs.c14
-rw-r--r--fs/ceph/dir.c56
-rw-r--r--fs/ceph/file.c6
-rw-r--r--fs/ceph/inode.c18
-rw-r--r--fs/cifs/cifsfs.c3
-rw-r--r--fs/cifs/cifsglob.h6
-rw-r--r--fs/cifs/file.c12
-rw-r--r--fs/cifs/inode.c2
-rw-r--r--fs/cifs/readdir.c10
-rw-r--r--fs/coda/cache.c2
-rw-r--r--fs/coda/coda_linux.c6
-rw-r--r--fs/coda/coda_linux.h1
-rw-r--r--fs/coda/dir.c12
-rw-r--r--fs/compat.c21
-rw-r--r--fs/configfs/dir.c2
-rw-r--r--fs/dcache.c271
-rw-r--r--fs/debugfs/file.c15
-rw-r--r--fs/debugfs/inode.c2
-rw-r--r--fs/dlm/debug_fs.c263
-rw-r--r--fs/ecryptfs/crypto.c2
-rw-r--r--fs/ecryptfs/file.c6
-rw-r--r--fs/ecryptfs/mmap.c2
-rw-r--r--fs/efivarfs/file.c4
-rw-r--r--fs/eventfd.c9
-rw-r--r--fs/eventpoll.c13
-rw-r--r--fs/exportfs/expfs.c7
-rw-r--r--fs/fat/dir.c5
-rw-r--r--fs/fuse/dir.c4
-rw-r--r--fs/fuse/file.c2
-rw-r--r--fs/gfs2/export.c8
-rw-r--r--fs/hppfs/hppfs.c5
-rw-r--r--fs/jfs/namei.c18
-rw-r--r--fs/kernfs/dir.c2
-rw-r--r--fs/libfs.c12
-rw-r--r--fs/lockd/svcsubs.c2
-rw-r--r--fs/ncpfs/dir.c12
-rw-r--r--fs/ncpfs/file.c14
-rw-r--r--fs/ncpfs/mmap.c4
-rw-r--r--fs/ncpfs/ncplib_kernel.h4
-rw-r--r--fs/nfs/blocklayout/rpc_pipefs.c2
-rw-r--r--fs/nfs/dir.c6
-rw-r--r--fs/nfs/getroot.c4
-rw-r--r--fs/nfsd/nfs4recover.c7
-rw-r--r--fs/nfsd/nfs4xdr.c2
-rw-r--r--fs/nfsd/nfsctl.c37
-rw-r--r--fs/nfsd/vfs.c16
-rw-r--r--fs/nfsd/vfs.h4
-rw-r--r--fs/notify/fdinfo.c78
-rw-r--r--fs/notify/fdinfo.h4
-rw-r--r--fs/notify/fsnotify.c4
-rw-r--r--fs/ntfs/namei.c4
-rw-r--r--fs/ocfs2/dcache.c20
-rw-r--r--fs/ocfs2/dir.c8
-rw-r--r--fs/ocfs2/dlmfs/dlmfs.c4
-rw-r--r--fs/ocfs2/dlmglue.c3
-rw-r--r--fs/ocfs2/journal.c8
-rw-r--r--fs/open.c4
-rw-r--r--fs/overlayfs/readdir.c8
-rw-r--r--fs/proc/base.c4
-rw-r--r--fs/proc/fd.c3
-rw-r--r--fs/readdir.c21
-rw-r--r--fs/reiserfs/xattr.c21
-rw-r--r--fs/seq_file.c15
-rw-r--r--fs/signalfd.c4
-rw-r--r--fs/sync.c2
-rw-r--r--fs/timerfd.c27
-rw-r--r--fs/xattr.c16
84 files changed, 642 insertions, 849 deletions
diff --git a/fs/9p/vfs_inode.c b/fs/9p/vfs_inode.c
index 296482fc77a9..9ee5343d4884 100644
--- a/fs/9p/vfs_inode.c
+++ b/fs/9p/vfs_inode.c
@@ -832,7 +832,7 @@ struct dentry *v9fs_vfs_lookup(struct inode *dir, struct dentry *dentry,
832 * moved b under k and client parallely did a lookup for 832 * moved b under k and client parallely did a lookup for
833 * k/b. 833 * k/b.
834 */ 834 */
835 res = d_materialise_unique(dentry, inode); 835 res = d_splice_alias(inode, dentry);
836 if (!res) 836 if (!res)
837 v9fs_fid_add(dentry, fid); 837 v9fs_fid_add(dentry, fid);
838 else if (!IS_ERR(res)) 838 else if (!IS_ERR(res))
diff --git a/fs/9p/vfs_inode_dotl.c b/fs/9p/vfs_inode_dotl.c
index 02b64f4e576a..6054c16b8fae 100644
--- a/fs/9p/vfs_inode_dotl.c
+++ b/fs/9p/vfs_inode_dotl.c
@@ -826,8 +826,8 @@ v9fs_vfs_mknod_dotl(struct inode *dir, struct dentry *dentry, umode_t omode,
826 struct dentry *dir_dentry; 826 struct dentry *dir_dentry;
827 struct posix_acl *dacl = NULL, *pacl = NULL; 827 struct posix_acl *dacl = NULL, *pacl = NULL;
828 828
829 p9_debug(P9_DEBUG_VFS, " %lu,%s mode: %hx MAJOR: %u MINOR: %u\n", 829 p9_debug(P9_DEBUG_VFS, " %lu,%pd mode: %hx MAJOR: %u MINOR: %u\n",
830 dir->i_ino, dentry->d_name.name, omode, 830 dir->i_ino, dentry, omode,
831 MAJOR(rdev), MINOR(rdev)); 831 MAJOR(rdev), MINOR(rdev));
832 832
833 if (!new_valid_dev(rdev)) 833 if (!new_valid_dev(rdev))
diff --git a/fs/affs/amigaffs.c b/fs/affs/amigaffs.c
index abc853968fed..937ce8754b24 100644
--- a/fs/affs/amigaffs.c
+++ b/fs/affs/amigaffs.c
@@ -125,7 +125,7 @@ affs_fix_dcache(struct inode *inode, u32 entry_ino)
125{ 125{
126 struct dentry *dentry; 126 struct dentry *dentry;
127 spin_lock(&inode->i_lock); 127 spin_lock(&inode->i_lock);
128 hlist_for_each_entry(dentry, &inode->i_dentry, d_alias) { 128 hlist_for_each_entry(dentry, &inode->i_dentry, d_u.d_alias) {
129 if (entry_ino == (u32)(long)dentry->d_fsdata) { 129 if (entry_ino == (u32)(long)dentry->d_fsdata) {
130 dentry->d_fsdata = (void *)inode->i_ino; 130 dentry->d_fsdata = (void *)inode->i_ino;
131 break; 131 break;
diff --git a/fs/affs/inode.c b/fs/affs/inode.c
index e217c511459b..d0609a282e1d 100644
--- a/fs/affs/inode.c
+++ b/fs/affs/inode.c
@@ -348,9 +348,9 @@ affs_add_entry(struct inode *dir, struct inode *inode, struct dentry *dentry, s3
348 u32 block = 0; 348 u32 block = 0;
349 int retval; 349 int retval;
350 350
351 pr_debug("%s(dir=%u, inode=%u, \"%*s\", type=%d)\n", 351 pr_debug("%s(dir=%u, inode=%u, \"%pd\", type=%d)\n",
352 __func__, (u32)dir->i_ino, 352 __func__, (u32)dir->i_ino,
353 (u32)inode->i_ino, (int)dentry->d_name.len, dentry->d_name.name, type); 353 (u32)inode->i_ino, dentry, type);
354 354
355 retval = -EIO; 355 retval = -EIO;
356 bh = affs_bread(sb, inode->i_ino); 356 bh = affs_bread(sb, inode->i_ino);
diff --git a/fs/affs/namei.c b/fs/affs/namei.c
index 035bd31556fc..bbc38530e924 100644
--- a/fs/affs/namei.c
+++ b/fs/affs/namei.c
@@ -190,8 +190,7 @@ affs_find_entry(struct inode *dir, struct dentry *dentry)
190 toupper_t toupper = affs_get_toupper(sb); 190 toupper_t toupper = affs_get_toupper(sb);
191 u32 key; 191 u32 key;
192 192
193 pr_debug("%s(\"%.*s\")\n", 193 pr_debug("%s(\"%pd\")\n", __func__, dentry);
194 __func__, (int)dentry->d_name.len, dentry->d_name.name);
195 194
196 bh = affs_bread(sb, dir->i_ino); 195 bh = affs_bread(sb, dir->i_ino);
197 if (!bh) 196 if (!bh)
@@ -219,8 +218,7 @@ affs_lookup(struct inode *dir, struct dentry *dentry, unsigned int flags)
219 struct buffer_head *bh; 218 struct buffer_head *bh;
220 struct inode *inode = NULL; 219 struct inode *inode = NULL;
221 220
222 pr_debug("%s(\"%.*s\")\n", 221 pr_debug("%s(\"%pd\")\n", __func__, dentry);
223 __func__, (int)dentry->d_name.len, dentry->d_name.name);
224 222
225 affs_lock_dir(dir); 223 affs_lock_dir(dir);
226 bh = affs_find_entry(dir, dentry); 224 bh = affs_find_entry(dir, dentry);
@@ -250,9 +248,9 @@ affs_lookup(struct inode *dir, struct dentry *dentry, unsigned int flags)
250int 248int
251affs_unlink(struct inode *dir, struct dentry *dentry) 249affs_unlink(struct inode *dir, struct dentry *dentry)
252{ 250{
253 pr_debug("%s(dir=%d, %lu \"%.*s\")\n", 251 pr_debug("%s(dir=%d, %lu \"%pd\")\n",
254 __func__, (u32)dir->i_ino, dentry->d_inode->i_ino, 252 __func__, (u32)dir->i_ino, dentry->d_inode->i_ino,
255 (int)dentry->d_name.len, dentry->d_name.name); 253 dentry);
256 254
257 return affs_remove_header(dentry); 255 return affs_remove_header(dentry);
258} 256}
@@ -264,9 +262,8 @@ affs_create(struct inode *dir, struct dentry *dentry, umode_t mode, bool excl)
264 struct inode *inode; 262 struct inode *inode;
265 int error; 263 int error;
266 264
267 pr_debug("%s(%lu,\"%.*s\",0%ho)\n", 265 pr_debug("%s(%lu,\"%pd\",0%ho)\n",
268 __func__, dir->i_ino, (int)dentry->d_name.len, 266 __func__, dir->i_ino, dentry, mode);
269 dentry->d_name.name,mode);
270 267
271 inode = affs_new_inode(dir); 268 inode = affs_new_inode(dir);
272 if (!inode) 269 if (!inode)
@@ -294,9 +291,8 @@ affs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
294 struct inode *inode; 291 struct inode *inode;
295 int error; 292 int error;
296 293
297 pr_debug("%s(%lu,\"%.*s\",0%ho)\n", 294 pr_debug("%s(%lu,\"%pd\",0%ho)\n",
298 __func__, dir->i_ino, (int)dentry->d_name.len, 295 __func__, dir->i_ino, dentry, mode);
299 dentry->d_name.name, mode);
300 296
301 inode = affs_new_inode(dir); 297 inode = affs_new_inode(dir);
302 if (!inode) 298 if (!inode)
@@ -321,9 +317,9 @@ affs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
321int 317int
322affs_rmdir(struct inode *dir, struct dentry *dentry) 318affs_rmdir(struct inode *dir, struct dentry *dentry)
323{ 319{
324 pr_debug("%s(dir=%u, %lu \"%.*s\")\n", 320 pr_debug("%s(dir=%u, %lu \"%pd\")\n",
325 __func__, (u32)dir->i_ino, dentry->d_inode->i_ino, 321 __func__, (u32)dir->i_ino, dentry->d_inode->i_ino,
326 (int)dentry->d_name.len, dentry->d_name.name); 322 dentry);
327 323
328 return affs_remove_header(dentry); 324 return affs_remove_header(dentry);
329} 325}
@@ -338,9 +334,8 @@ affs_symlink(struct inode *dir, struct dentry *dentry, const char *symname)
338 int i, maxlen, error; 334 int i, maxlen, error;
339 char c, lc; 335 char c, lc;
340 336
341 pr_debug("%s(%lu,\"%.*s\" -> \"%s\")\n", 337 pr_debug("%s(%lu,\"%pd\" -> \"%s\")\n",
342 __func__, dir->i_ino, (int)dentry->d_name.len, 338 __func__, dir->i_ino, dentry, symname);
343 dentry->d_name.name, symname);
344 339
345 maxlen = AFFS_SB(sb)->s_hashsize * sizeof(u32) - 1; 340 maxlen = AFFS_SB(sb)->s_hashsize * sizeof(u32) - 1;
346 inode = affs_new_inode(dir); 341 inode = affs_new_inode(dir);
@@ -409,9 +404,9 @@ affs_link(struct dentry *old_dentry, struct inode *dir, struct dentry *dentry)
409{ 404{
410 struct inode *inode = old_dentry->d_inode; 405 struct inode *inode = old_dentry->d_inode;
411 406
412 pr_debug("%s(%u, %u, \"%.*s\")\n", 407 pr_debug("%s(%u, %u, \"%pd\")\n",
413 __func__, (u32)inode->i_ino, (u32)dir->i_ino, 408 __func__, (u32)inode->i_ino, (u32)dir->i_ino,
414 (int)dentry->d_name.len,dentry->d_name.name); 409 dentry);
415 410
416 return affs_add_entry(dir, inode, dentry, ST_LINKFILE); 411 return affs_add_entry(dir, inode, dentry, ST_LINKFILE);
417} 412}
@@ -424,10 +419,9 @@ affs_rename(struct inode *old_dir, struct dentry *old_dentry,
424 struct buffer_head *bh = NULL; 419 struct buffer_head *bh = NULL;
425 int retval; 420 int retval;
426 421
427 pr_debug("%s(old=%u,\"%*s\" to new=%u,\"%*s\")\n", 422 pr_debug("%s(old=%u,\"%pd\" to new=%u,\"%pd\")\n",
428 __func__, (u32)old_dir->i_ino, (int)old_dentry->d_name.len, 423 __func__, (u32)old_dir->i_ino, old_dentry,
429 old_dentry->d_name.name, (u32)new_dir->i_ino, 424 (u32)new_dir->i_ino, new_dentry);
430 (int)new_dentry->d_name.len, new_dentry->d_name.name);
431 425
432 retval = affs_check_name(new_dentry->d_name.name, 426 retval = affs_check_name(new_dentry->d_name.name,
433 new_dentry->d_name.len, 427 new_dentry->d_name.len,
diff --git a/fs/afs/dir.c b/fs/afs/dir.c
index a1645b88fe8a..4ec35e9130e1 100644
--- a/fs/afs/dir.c
+++ b/fs/afs/dir.c
@@ -26,7 +26,7 @@ static int afs_readdir(struct file *file, struct dir_context *ctx);
26static int afs_d_revalidate(struct dentry *dentry, unsigned int flags); 26static int afs_d_revalidate(struct dentry *dentry, unsigned int flags);
27static int afs_d_delete(const struct dentry *dentry); 27static int afs_d_delete(const struct dentry *dentry);
28static void afs_d_release(struct dentry *dentry); 28static void afs_d_release(struct dentry *dentry);
29static int afs_lookup_filldir(void *_cookie, const char *name, int nlen, 29static int afs_lookup_filldir(struct dir_context *ctx, const char *name, int nlen,
30 loff_t fpos, u64 ino, unsigned dtype); 30 loff_t fpos, u64 ino, unsigned dtype);
31static int afs_create(struct inode *dir, struct dentry *dentry, umode_t mode, 31static int afs_create(struct inode *dir, struct dentry *dentry, umode_t mode,
32 bool excl); 32 bool excl);
@@ -391,10 +391,11 @@ static int afs_readdir(struct file *file, struct dir_context *ctx)
391 * - if afs_dir_iterate_block() spots this function, it'll pass the FID 391 * - if afs_dir_iterate_block() spots this function, it'll pass the FID
392 * uniquifier through dtype 392 * uniquifier through dtype
393 */ 393 */
394static int afs_lookup_filldir(void *_cookie, const char *name, int nlen, 394static int afs_lookup_filldir(struct dir_context *ctx, const char *name,
395 loff_t fpos, u64 ino, unsigned dtype) 395 int nlen, loff_t fpos, u64 ino, unsigned dtype)
396{ 396{
397 struct afs_lookup_cookie *cookie = _cookie; 397 struct afs_lookup_cookie *cookie =
398 container_of(ctx, struct afs_lookup_cookie, ctx);
398 399
399 _enter("{%s,%u},%s,%u,,%llu,%u", 400 _enter("{%s,%u},%s,%u,,%llu,%u",
400 cookie->name.name, cookie->name.len, name, nlen, 401 cookie->name.name, cookie->name.len, name, nlen,
@@ -433,7 +434,7 @@ static int afs_do_lookup(struct inode *dir, struct dentry *dentry,
433 }; 434 };
434 int ret; 435 int ret;
435 436
436 _enter("{%lu},%p{%s},", dir->i_ino, dentry, dentry->d_name.name); 437 _enter("{%lu},%p{%pd},", dir->i_ino, dentry, dentry);
437 438
438 /* search the directory */ 439 /* search the directory */
439 ret = afs_dir_iterate(dir, &cookie.ctx, key); 440 ret = afs_dir_iterate(dir, &cookie.ctx, key);
@@ -465,8 +466,8 @@ static struct inode *afs_try_auto_mntpt(
465 struct afs_vnode *vnode = AFS_FS_I(dir); 466 struct afs_vnode *vnode = AFS_FS_I(dir);
466 struct inode *inode; 467 struct inode *inode;
467 468
468 _enter("%d, %p{%s}, {%x:%u}, %p", 469 _enter("%d, %p{%pd}, {%x:%u}, %p",
469 ret, dentry, devname, vnode->fid.vid, vnode->fid.vnode, key); 470 ret, dentry, dentry, vnode->fid.vid, vnode->fid.vnode, key);
470 471
471 if (ret != -ENOENT || 472 if (ret != -ENOENT ||
472 !test_bit(AFS_VNODE_AUTOCELL, &vnode->flags)) 473 !test_bit(AFS_VNODE_AUTOCELL, &vnode->flags))
@@ -501,8 +502,8 @@ static struct dentry *afs_lookup(struct inode *dir, struct dentry *dentry,
501 502
502 vnode = AFS_FS_I(dir); 503 vnode = AFS_FS_I(dir);
503 504
504 _enter("{%x:%u},%p{%s},", 505 _enter("{%x:%u},%p{%pd},",
505 vnode->fid.vid, vnode->fid.vnode, dentry, dentry->d_name.name); 506 vnode->fid.vid, vnode->fid.vnode, dentry, dentry);
506 507
507 ASSERTCMP(dentry->d_inode, ==, NULL); 508 ASSERTCMP(dentry->d_inode, ==, NULL);
508 509
@@ -588,11 +589,11 @@ static int afs_d_revalidate(struct dentry *dentry, unsigned int flags)
588 vnode = AFS_FS_I(dentry->d_inode); 589 vnode = AFS_FS_I(dentry->d_inode);
589 590
590 if (dentry->d_inode) 591 if (dentry->d_inode)
591 _enter("{v={%x:%u} n=%s fl=%lx},", 592 _enter("{v={%x:%u} n=%pd fl=%lx},",
592 vnode->fid.vid, vnode->fid.vnode, dentry->d_name.name, 593 vnode->fid.vid, vnode->fid.vnode, dentry,
593 vnode->flags); 594 vnode->flags);
594 else 595 else
595 _enter("{neg n=%s}", dentry->d_name.name); 596 _enter("{neg n=%pd}", dentry);
596 597
597 key = afs_request_key(AFS_FS_S(dentry->d_sb)->volume->cell); 598 key = afs_request_key(AFS_FS_S(dentry->d_sb)->volume->cell);
598 if (IS_ERR(key)) 599 if (IS_ERR(key))
@@ -607,7 +608,7 @@ static int afs_d_revalidate(struct dentry *dentry, unsigned int flags)
607 afs_validate(dir, key); 608 afs_validate(dir, key);
608 609
609 if (test_bit(AFS_VNODE_DELETED, &dir->flags)) { 610 if (test_bit(AFS_VNODE_DELETED, &dir->flags)) {
610 _debug("%s: parent dir deleted", dentry->d_name.name); 611 _debug("%pd: parent dir deleted", dentry);
611 goto out_bad; 612 goto out_bad;
612 } 613 }
613 614
@@ -625,16 +626,16 @@ static int afs_d_revalidate(struct dentry *dentry, unsigned int flags)
625 if (!dentry->d_inode) 626 if (!dentry->d_inode)
626 goto out_bad; 627 goto out_bad;
627 if (is_bad_inode(dentry->d_inode)) { 628 if (is_bad_inode(dentry->d_inode)) {
628 printk("kAFS: afs_d_revalidate: %s/%s has bad inode\n", 629 printk("kAFS: afs_d_revalidate: %pd2 has bad inode\n",
629 parent->d_name.name, dentry->d_name.name); 630 dentry);
630 goto out_bad; 631 goto out_bad;
631 } 632 }
632 633
633 /* if the vnode ID has changed, then the dirent points to a 634 /* if the vnode ID has changed, then the dirent points to a
634 * different file */ 635 * different file */
635 if (fid.vnode != vnode->fid.vnode) { 636 if (fid.vnode != vnode->fid.vnode) {
636 _debug("%s: dirent changed [%u != %u]", 637 _debug("%pd: dirent changed [%u != %u]",
637 dentry->d_name.name, fid.vnode, 638 dentry, fid.vnode,
638 vnode->fid.vnode); 639 vnode->fid.vnode);
639 goto not_found; 640 goto not_found;
640 } 641 }
@@ -643,8 +644,8 @@ static int afs_d_revalidate(struct dentry *dentry, unsigned int flags)
643 * been deleted and replaced, and the original vnode ID has 644 * been deleted and replaced, and the original vnode ID has
644 * been reused */ 645 * been reused */
645 if (fid.unique != vnode->fid.unique) { 646 if (fid.unique != vnode->fid.unique) {
646 _debug("%s: file deleted (uq %u -> %u I:%u)", 647 _debug("%pd: file deleted (uq %u -> %u I:%u)",
647 dentry->d_name.name, fid.unique, 648 dentry, fid.unique,
648 vnode->fid.unique, 649 vnode->fid.unique,
649 dentry->d_inode->i_generation); 650 dentry->d_inode->i_generation);
650 spin_lock(&vnode->lock); 651 spin_lock(&vnode->lock);
@@ -656,14 +657,14 @@ static int afs_d_revalidate(struct dentry *dentry, unsigned int flags)
656 657
657 case -ENOENT: 658 case -ENOENT:
658 /* the filename is unknown */ 659 /* the filename is unknown */
659 _debug("%s: dirent not found", dentry->d_name.name); 660 _debug("%pd: dirent not found", dentry);
660 if (dentry->d_inode) 661 if (dentry->d_inode)
661 goto not_found; 662 goto not_found;
662 goto out_valid; 663 goto out_valid;
663 664
664 default: 665 default:
665 _debug("failed to iterate dir %s: %d", 666 _debug("failed to iterate dir %pd: %d",
666 parent->d_name.name, ret); 667 parent, ret);
667 goto out_bad; 668 goto out_bad;
668 } 669 }
669 670
@@ -681,8 +682,7 @@ not_found:
681 spin_unlock(&dentry->d_lock); 682 spin_unlock(&dentry->d_lock);
682 683
683out_bad: 684out_bad:
684 _debug("dropping dentry %s/%s", 685 _debug("dropping dentry %pd2", dentry);
685 parent->d_name.name, dentry->d_name.name);
686 dput(parent); 686 dput(parent);
687 key_put(key); 687 key_put(key);
688 688
@@ -698,7 +698,7 @@ out_bad:
698 */ 698 */
699static int afs_d_delete(const struct dentry *dentry) 699static int afs_d_delete(const struct dentry *dentry)
700{ 700{
701 _enter("%s", dentry->d_name.name); 701 _enter("%pd", dentry);
702 702
703 if (dentry->d_flags & DCACHE_NFSFS_RENAMED) 703 if (dentry->d_flags & DCACHE_NFSFS_RENAMED)
704 goto zap; 704 goto zap;
@@ -721,7 +721,7 @@ zap:
721 */ 721 */
722static void afs_d_release(struct dentry *dentry) 722static void afs_d_release(struct dentry *dentry)
723{ 723{
724 _enter("%s", dentry->d_name.name); 724 _enter("%pd", dentry);
725} 725}
726 726
727/* 727/*
@@ -740,8 +740,8 @@ static int afs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
740 740
741 dvnode = AFS_FS_I(dir); 741 dvnode = AFS_FS_I(dir);
742 742
743 _enter("{%x:%u},{%s},%ho", 743 _enter("{%x:%u},{%pd},%ho",
744 dvnode->fid.vid, dvnode->fid.vnode, dentry->d_name.name, mode); 744 dvnode->fid.vid, dvnode->fid.vnode, dentry, mode);
745 745
746 key = afs_request_key(dvnode->volume->cell); 746 key = afs_request_key(dvnode->volume->cell);
747 if (IS_ERR(key)) { 747 if (IS_ERR(key)) {
@@ -801,8 +801,8 @@ static int afs_rmdir(struct inode *dir, struct dentry *dentry)
801 801
802 dvnode = AFS_FS_I(dir); 802 dvnode = AFS_FS_I(dir);
803 803
804 _enter("{%x:%u},{%s}", 804 _enter("{%x:%u},{%pd}",
805 dvnode->fid.vid, dvnode->fid.vnode, dentry->d_name.name); 805 dvnode->fid.vid, dvnode->fid.vnode, dentry);
806 806
807 key = afs_request_key(dvnode->volume->cell); 807 key = afs_request_key(dvnode->volume->cell);
808 if (IS_ERR(key)) { 808 if (IS_ERR(key)) {
@@ -843,8 +843,8 @@ static int afs_unlink(struct inode *dir, struct dentry *dentry)
843 843
844 dvnode = AFS_FS_I(dir); 844 dvnode = AFS_FS_I(dir);
845 845
846 _enter("{%x:%u},{%s}", 846 _enter("{%x:%u},{%pd}",
847 dvnode->fid.vid, dvnode->fid.vnode, dentry->d_name.name); 847 dvnode->fid.vid, dvnode->fid.vnode, dentry);
848 848
849 ret = -ENAMETOOLONG; 849 ret = -ENAMETOOLONG;
850 if (dentry->d_name.len >= AFSNAMEMAX) 850 if (dentry->d_name.len >= AFSNAMEMAX)
@@ -917,8 +917,8 @@ static int afs_create(struct inode *dir, struct dentry *dentry, umode_t mode,
917 917
918 dvnode = AFS_FS_I(dir); 918 dvnode = AFS_FS_I(dir);
919 919
920 _enter("{%x:%u},{%s},%ho,", 920 _enter("{%x:%u},{%pd},%ho,",
921 dvnode->fid.vid, dvnode->fid.vnode, dentry->d_name.name, mode); 921 dvnode->fid.vid, dvnode->fid.vnode, dentry, mode);
922 922
923 key = afs_request_key(dvnode->volume->cell); 923 key = afs_request_key(dvnode->volume->cell);
924 if (IS_ERR(key)) { 924 if (IS_ERR(key)) {
@@ -980,10 +980,10 @@ static int afs_link(struct dentry *from, struct inode *dir,
980 vnode = AFS_FS_I(from->d_inode); 980 vnode = AFS_FS_I(from->d_inode);
981 dvnode = AFS_FS_I(dir); 981 dvnode = AFS_FS_I(dir);
982 982
983 _enter("{%x:%u},{%x:%u},{%s}", 983 _enter("{%x:%u},{%x:%u},{%pd}",
984 vnode->fid.vid, vnode->fid.vnode, 984 vnode->fid.vid, vnode->fid.vnode,
985 dvnode->fid.vid, dvnode->fid.vnode, 985 dvnode->fid.vid, dvnode->fid.vnode,
986 dentry->d_name.name); 986 dentry);
987 987
988 key = afs_request_key(dvnode->volume->cell); 988 key = afs_request_key(dvnode->volume->cell);
989 if (IS_ERR(key)) { 989 if (IS_ERR(key)) {
@@ -1025,8 +1025,8 @@ static int afs_symlink(struct inode *dir, struct dentry *dentry,
1025 1025
1026 dvnode = AFS_FS_I(dir); 1026 dvnode = AFS_FS_I(dir);
1027 1027
1028 _enter("{%x:%u},{%s},%s", 1028 _enter("{%x:%u},{%pd},%s",
1029 dvnode->fid.vid, dvnode->fid.vnode, dentry->d_name.name, 1029 dvnode->fid.vid, dvnode->fid.vnode, dentry,
1030 content); 1030 content);
1031 1031
1032 ret = -EINVAL; 1032 ret = -EINVAL;
@@ -1093,11 +1093,11 @@ static int afs_rename(struct inode *old_dir, struct dentry *old_dentry,
1093 orig_dvnode = AFS_FS_I(old_dir); 1093 orig_dvnode = AFS_FS_I(old_dir);
1094 new_dvnode = AFS_FS_I(new_dir); 1094 new_dvnode = AFS_FS_I(new_dir);
1095 1095
1096 _enter("{%x:%u},{%x:%u},{%x:%u},{%s}", 1096 _enter("{%x:%u},{%x:%u},{%x:%u},{%pd}",
1097 orig_dvnode->fid.vid, orig_dvnode->fid.vnode, 1097 orig_dvnode->fid.vid, orig_dvnode->fid.vnode,
1098 vnode->fid.vid, vnode->fid.vnode, 1098 vnode->fid.vid, vnode->fid.vnode,
1099 new_dvnode->fid.vid, new_dvnode->fid.vnode, 1099 new_dvnode->fid.vid, new_dvnode->fid.vnode,
1100 new_dentry->d_name.name); 1100 new_dentry);
1101 1101
1102 key = afs_request_key(orig_dvnode->volume->cell); 1102 key = afs_request_key(orig_dvnode->volume->cell);
1103 if (IS_ERR(key)) { 1103 if (IS_ERR(key)) {
diff --git a/fs/afs/inode.c b/fs/afs/inode.c
index 294671288449..8a1d38ef0fc2 100644
--- a/fs/afs/inode.c
+++ b/fs/afs/inode.c
@@ -462,8 +462,8 @@ int afs_setattr(struct dentry *dentry, struct iattr *attr)
462 struct key *key; 462 struct key *key;
463 int ret; 463 int ret;
464 464
465 _enter("{%x:%u},{n=%s},%x", 465 _enter("{%x:%u},{n=%pd},%x",
466 vnode->fid.vid, vnode->fid.vnode, dentry->d_name.name, 466 vnode->fid.vid, vnode->fid.vnode, dentry,
467 attr->ia_valid); 467 attr->ia_valid);
468 468
469 if (!(attr->ia_valid & (ATTR_SIZE | ATTR_MODE | ATTR_UID | ATTR_GID | 469 if (!(attr->ia_valid & (ATTR_SIZE | ATTR_MODE | ATTR_UID | ATTR_GID |
diff --git a/fs/afs/mntpt.c b/fs/afs/mntpt.c
index 9682c33d5daf..938c5ab06d5a 100644
--- a/fs/afs/mntpt.c
+++ b/fs/afs/mntpt.c
@@ -106,14 +106,7 @@ static struct dentry *afs_mntpt_lookup(struct inode *dir,
106 struct dentry *dentry, 106 struct dentry *dentry,
107 unsigned int flags) 107 unsigned int flags)
108{ 108{
109 _enter("%p,%p{%p{%s},%s}", 109 _enter("%p,%p{%pd2}", dir, dentry, dentry);
110 dir,
111 dentry,
112 dentry->d_parent,
113 dentry->d_parent ?
114 dentry->d_parent->d_name.name : (const unsigned char *) "",
115 dentry->d_name.name);
116
117 return ERR_PTR(-EREMOTE); 110 return ERR_PTR(-EREMOTE);
118} 111}
119 112
@@ -122,14 +115,7 @@ static struct dentry *afs_mntpt_lookup(struct inode *dir,
122 */ 115 */
123static int afs_mntpt_open(struct inode *inode, struct file *file) 116static int afs_mntpt_open(struct inode *inode, struct file *file)
124{ 117{
125 _enter("%p,%p{%p{%s},%s}", 118 _enter("%p,%p{%pD2}", inode, file, file);
126 inode, file,
127 file->f_path.dentry->d_parent,
128 file->f_path.dentry->d_parent ?
129 file->f_path.dentry->d_parent->d_name.name :
130 (const unsigned char *) "",
131 file->f_path.dentry->d_name.name);
132
133 return -EREMOTE; 119 return -EREMOTE;
134} 120}
135 121
@@ -146,7 +132,7 @@ static struct vfsmount *afs_mntpt_do_automount(struct dentry *mntpt)
146 bool rwpath = false; 132 bool rwpath = false;
147 int ret; 133 int ret;
148 134
149 _enter("{%s}", mntpt->d_name.name); 135 _enter("{%pd}", mntpt);
150 136
151 BUG_ON(!mntpt->d_inode); 137 BUG_ON(!mntpt->d_inode);
152 138
@@ -242,7 +228,7 @@ struct vfsmount *afs_d_automount(struct path *path)
242{ 228{
243 struct vfsmount *newmnt; 229 struct vfsmount *newmnt;
244 230
245 _enter("{%s}", path->dentry->d_name.name); 231 _enter("{%pd}", path->dentry);
246 232
247 newmnt = afs_mntpt_do_automount(path->dentry); 233 newmnt = afs_mntpt_do_automount(path->dentry);
248 if (IS_ERR(newmnt)) 234 if (IS_ERR(newmnt))
diff --git a/fs/afs/write.c b/fs/afs/write.c
index ab6adfd52516..c13cb08964ed 100644
--- a/fs/afs/write.c
+++ b/fs/afs/write.c
@@ -682,14 +682,13 @@ int afs_writeback_all(struct afs_vnode *vnode)
682 */ 682 */
683int afs_fsync(struct file *file, loff_t start, loff_t end, int datasync) 683int afs_fsync(struct file *file, loff_t start, loff_t end, int datasync)
684{ 684{
685 struct dentry *dentry = file->f_path.dentry; 685 struct inode *inode = file_inode(file);
686 struct inode *inode = file->f_mapping->host;
687 struct afs_writeback *wb, *xwb; 686 struct afs_writeback *wb, *xwb;
688 struct afs_vnode *vnode = AFS_FS_I(dentry->d_inode); 687 struct afs_vnode *vnode = AFS_FS_I(inode);
689 int ret; 688 int ret;
690 689
691 _enter("{%x:%u},{n=%s},%d", 690 _enter("{%x:%u},{n=%pD},%d",
692 vnode->fid.vid, vnode->fid.vnode, dentry->d_name.name, 691 vnode->fid.vid, vnode->fid.vnode, file,
693 datasync); 692 datasync);
694 693
695 ret = filemap_write_and_wait_range(inode->i_mapping, start, end); 694 ret = filemap_write_and_wait_range(inode->i_mapping, start, end);
diff --git a/fs/autofs4/expire.c b/fs/autofs4/expire.c
index 683a5b9ce22a..bfdbaba9c2ba 100644
--- a/fs/autofs4/expire.c
+++ b/fs/autofs4/expire.c
@@ -41,8 +41,7 @@ static int autofs4_mount_busy(struct vfsmount *mnt, struct dentry *dentry)
41 struct path path = {.mnt = mnt, .dentry = dentry}; 41 struct path path = {.mnt = mnt, .dentry = dentry};
42 int status = 1; 42 int status = 1;
43 43
44 DPRINTK("dentry %p %.*s", 44 DPRINTK("dentry %p %pd", dentry, dentry);
45 dentry, (int)dentry->d_name.len, dentry->d_name.name);
46 45
47 path_get(&path); 46 path_get(&path);
48 47
@@ -85,7 +84,7 @@ static struct dentry *get_next_positive_subdir(struct dentry *prev,
85 spin_lock(&root->d_lock); 84 spin_lock(&root->d_lock);
86 85
87 if (prev) 86 if (prev)
88 next = prev->d_u.d_child.next; 87 next = prev->d_child.next;
89 else { 88 else {
90 prev = dget_dlock(root); 89 prev = dget_dlock(root);
91 next = prev->d_subdirs.next; 90 next = prev->d_subdirs.next;
@@ -99,13 +98,13 @@ cont:
99 return NULL; 98 return NULL;
100 } 99 }
101 100
102 q = list_entry(next, struct dentry, d_u.d_child); 101 q = list_entry(next, struct dentry, d_child);
103 102
104 spin_lock_nested(&q->d_lock, DENTRY_D_LOCK_NESTED); 103 spin_lock_nested(&q->d_lock, DENTRY_D_LOCK_NESTED);
105 /* Already gone or negative dentry (under construction) - try next */ 104 /* Already gone or negative dentry (under construction) - try next */
106 if (!d_count(q) || !simple_positive(q)) { 105 if (!d_count(q) || !simple_positive(q)) {
107 spin_unlock(&q->d_lock); 106 spin_unlock(&q->d_lock);
108 next = q->d_u.d_child.next; 107 next = q->d_child.next;
109 goto cont; 108 goto cont;
110 } 109 }
111 dget_dlock(q); 110 dget_dlock(q);
@@ -155,13 +154,13 @@ again:
155 goto relock; 154 goto relock;
156 } 155 }
157 spin_unlock(&p->d_lock); 156 spin_unlock(&p->d_lock);
158 next = p->d_u.d_child.next; 157 next = p->d_child.next;
159 p = parent; 158 p = parent;
160 if (next != &parent->d_subdirs) 159 if (next != &parent->d_subdirs)
161 break; 160 break;
162 } 161 }
163 } 162 }
164 ret = list_entry(next, struct dentry, d_u.d_child); 163 ret = list_entry(next, struct dentry, d_child);
165 164
166 spin_lock_nested(&ret->d_lock, DENTRY_D_LOCK_NESTED); 165 spin_lock_nested(&ret->d_lock, DENTRY_D_LOCK_NESTED);
167 /* Negative dentry - try next */ 166 /* Negative dentry - try next */
@@ -192,8 +191,7 @@ static int autofs4_direct_busy(struct vfsmount *mnt,
192 unsigned long timeout, 191 unsigned long timeout,
193 int do_now) 192 int do_now)
194{ 193{
195 DPRINTK("top %p %.*s", 194 DPRINTK("top %p %pd", top, top);
196 top, (int) top->d_name.len, top->d_name.name);
197 195
198 /* If it's busy update the expiry counters */ 196 /* If it's busy update the expiry counters */
199 if (!may_umount_tree(mnt)) { 197 if (!may_umount_tree(mnt)) {
@@ -221,8 +219,7 @@ static int autofs4_tree_busy(struct vfsmount *mnt,
221 struct autofs_info *top_ino = autofs4_dentry_ino(top); 219 struct autofs_info *top_ino = autofs4_dentry_ino(top);
222 struct dentry *p; 220 struct dentry *p;
223 221
224 DPRINTK("top %p %.*s", 222 DPRINTK("top %p %pd", top, top);
225 top, (int)top->d_name.len, top->d_name.name);
226 223
227 /* Negative dentry - give up */ 224 /* Negative dentry - give up */
228 if (!simple_positive(top)) 225 if (!simple_positive(top))
@@ -230,8 +227,7 @@ static int autofs4_tree_busy(struct vfsmount *mnt,
230 227
231 p = NULL; 228 p = NULL;
232 while ((p = get_next_positive_dentry(p, top))) { 229 while ((p = get_next_positive_dentry(p, top))) {
233 DPRINTK("dentry %p %.*s", 230 DPRINTK("dentry %p %pd", p, p);
234 p, (int) p->d_name.len, p->d_name.name);
235 231
236 /* 232 /*
237 * Is someone visiting anywhere in the subtree ? 233 * Is someone visiting anywhere in the subtree ?
@@ -277,13 +273,11 @@ static struct dentry *autofs4_check_leaves(struct vfsmount *mnt,
277{ 273{
278 struct dentry *p; 274 struct dentry *p;
279 275
280 DPRINTK("parent %p %.*s", 276 DPRINTK("parent %p %pd", parent, parent);
281 parent, (int)parent->d_name.len, parent->d_name.name);
282 277
283 p = NULL; 278 p = NULL;
284 while ((p = get_next_positive_dentry(p, parent))) { 279 while ((p = get_next_positive_dentry(p, parent))) {
285 DPRINTK("dentry %p %.*s", 280 DPRINTK("dentry %p %pd", p, p);
286 p, (int) p->d_name.len, p->d_name.name);
287 281
288 if (d_mountpoint(p)) { 282 if (d_mountpoint(p)) {
289 /* Can we umount this guy */ 283 /* Can we umount this guy */
@@ -368,8 +362,7 @@ static struct dentry *should_expire(struct dentry *dentry,
368 * offset (autofs-5.0+). 362 * offset (autofs-5.0+).
369 */ 363 */
370 if (d_mountpoint(dentry)) { 364 if (d_mountpoint(dentry)) {
371 DPRINTK("checking mountpoint %p %.*s", 365 DPRINTK("checking mountpoint %p %pd", dentry, dentry);
372 dentry, (int)dentry->d_name.len, dentry->d_name.name);
373 366
374 /* Can we umount this guy */ 367 /* Can we umount this guy */
375 if (autofs4_mount_busy(mnt, dentry)) 368 if (autofs4_mount_busy(mnt, dentry))
@@ -382,8 +375,7 @@ static struct dentry *should_expire(struct dentry *dentry,
382 } 375 }
383 376
384 if (dentry->d_inode && S_ISLNK(dentry->d_inode->i_mode)) { 377 if (dentry->d_inode && S_ISLNK(dentry->d_inode->i_mode)) {
385 DPRINTK("checking symlink %p %.*s", 378 DPRINTK("checking symlink %p %pd", dentry, dentry);
386 dentry, (int)dentry->d_name.len, dentry->d_name.name);
387 /* 379 /*
388 * A symlink can't be "busy" in the usual sense so 380 * A symlink can't be "busy" in the usual sense so
389 * just check last used for expire timeout. 381 * just check last used for expire timeout.
@@ -479,8 +471,7 @@ struct dentry *autofs4_expire_indirect(struct super_block *sb,
479 return NULL; 471 return NULL;
480 472
481found: 473found:
482 DPRINTK("returning %p %.*s", 474 DPRINTK("returning %p %pd", expired, expired);
483 expired, (int)expired->d_name.len, expired->d_name.name);
484 ino->flags |= AUTOFS_INF_EXPIRING; 475 ino->flags |= AUTOFS_INF_EXPIRING;
485 smp_mb(); 476 smp_mb();
486 ino->flags &= ~AUTOFS_INF_NO_RCU; 477 ino->flags &= ~AUTOFS_INF_NO_RCU;
@@ -489,7 +480,7 @@ found:
489 spin_lock(&sbi->lookup_lock); 480 spin_lock(&sbi->lookup_lock);
490 spin_lock(&expired->d_parent->d_lock); 481 spin_lock(&expired->d_parent->d_lock);
491 spin_lock_nested(&expired->d_lock, DENTRY_D_LOCK_NESTED); 482 spin_lock_nested(&expired->d_lock, DENTRY_D_LOCK_NESTED);
492 list_move(&expired->d_parent->d_subdirs, &expired->d_u.d_child); 483 list_move(&expired->d_parent->d_subdirs, &expired->d_child);
493 spin_unlock(&expired->d_lock); 484 spin_unlock(&expired->d_lock);
494 spin_unlock(&expired->d_parent->d_lock); 485 spin_unlock(&expired->d_parent->d_lock);
495 spin_unlock(&sbi->lookup_lock); 486 spin_unlock(&sbi->lookup_lock);
@@ -512,8 +503,7 @@ int autofs4_expire_wait(struct dentry *dentry, int rcu_walk)
512 if (ino->flags & AUTOFS_INF_EXPIRING) { 503 if (ino->flags & AUTOFS_INF_EXPIRING) {
513 spin_unlock(&sbi->fs_lock); 504 spin_unlock(&sbi->fs_lock);
514 505
515 DPRINTK("waiting for expire %p name=%.*s", 506 DPRINTK("waiting for expire %p name=%pd", dentry, dentry);
516 dentry, dentry->d_name.len, dentry->d_name.name);
517 507
518 status = autofs4_wait(sbi, dentry, NFY_NONE); 508 status = autofs4_wait(sbi, dentry, NFY_NONE);
519 wait_for_completion(&ino->expire_complete); 509 wait_for_completion(&ino->expire_complete);
diff --git a/fs/autofs4/root.c b/fs/autofs4/root.c
index d76d083f2f06..dbb5b7212ce1 100644
--- a/fs/autofs4/root.c
+++ b/fs/autofs4/root.c
@@ -108,8 +108,7 @@ static int autofs4_dir_open(struct inode *inode, struct file *file)
108 struct dentry *dentry = file->f_path.dentry; 108 struct dentry *dentry = file->f_path.dentry;
109 struct autofs_sb_info *sbi = autofs4_sbi(dentry->d_sb); 109 struct autofs_sb_info *sbi = autofs4_sbi(dentry->d_sb);
110 110
111 DPRINTK("file=%p dentry=%p %.*s", 111 DPRINTK("file=%p dentry=%p %pD", file, dentry, dentry);
112 file, dentry, dentry->d_name.len, dentry->d_name.name);
113 112
114 if (autofs4_oz_mode(sbi)) 113 if (autofs4_oz_mode(sbi))
115 goto out; 114 goto out;
@@ -279,8 +278,7 @@ static int autofs4_mount_wait(struct dentry *dentry, bool rcu_walk)
279 if (ino->flags & AUTOFS_INF_PENDING) { 278 if (ino->flags & AUTOFS_INF_PENDING) {
280 if (rcu_walk) 279 if (rcu_walk)
281 return -ECHILD; 280 return -ECHILD;
282 DPRINTK("waiting for mount name=%.*s", 281 DPRINTK("waiting for mount name=%pd", dentry);
283 dentry->d_name.len, dentry->d_name.name);
284 status = autofs4_wait(sbi, dentry, NFY_MOUNT); 282 status = autofs4_wait(sbi, dentry, NFY_MOUNT);
285 DPRINTK("mount wait done status=%d", status); 283 DPRINTK("mount wait done status=%d", status);
286 } 284 }
@@ -340,8 +338,7 @@ static struct vfsmount *autofs4_d_automount(struct path *path)
340 struct autofs_info *ino = autofs4_dentry_ino(dentry); 338 struct autofs_info *ino = autofs4_dentry_ino(dentry);
341 int status; 339 int status;
342 340
343 DPRINTK("dentry=%p %.*s", 341 DPRINTK("dentry=%p %pd", dentry, dentry);
344 dentry, dentry->d_name.len, dentry->d_name.name);
345 342
346 /* The daemon never triggers a mount. */ 343 /* The daemon never triggers a mount. */
347 if (autofs4_oz_mode(sbi)) 344 if (autofs4_oz_mode(sbi))
@@ -428,8 +425,7 @@ static int autofs4_d_manage(struct dentry *dentry, bool rcu_walk)
428 struct autofs_info *ino = autofs4_dentry_ino(dentry); 425 struct autofs_info *ino = autofs4_dentry_ino(dentry);
429 int status; 426 int status;
430 427
431 DPRINTK("dentry=%p %.*s", 428 DPRINTK("dentry=%p %pd", dentry, dentry);
432 dentry, dentry->d_name.len, dentry->d_name.name);
433 429
434 /* The daemon never waits. */ 430 /* The daemon never waits. */
435 if (autofs4_oz_mode(sbi)) { 431 if (autofs4_oz_mode(sbi)) {
@@ -504,7 +500,7 @@ static struct dentry *autofs4_lookup(struct inode *dir, struct dentry *dentry, u
504 struct autofs_info *ino; 500 struct autofs_info *ino;
505 struct dentry *active; 501 struct dentry *active;
506 502
507 DPRINTK("name = %.*s", dentry->d_name.len, dentry->d_name.name); 503 DPRINTK("name = %pd", dentry);
508 504
509 /* File name too long to exist */ 505 /* File name too long to exist */
510 if (dentry->d_name.len > NAME_MAX) 506 if (dentry->d_name.len > NAME_MAX)
@@ -558,8 +554,7 @@ static int autofs4_dir_symlink(struct inode *dir,
558 size_t size = strlen(symname); 554 size_t size = strlen(symname);
559 char *cp; 555 char *cp;
560 556
561 DPRINTK("%s <- %.*s", symname, 557 DPRINTK("%s <- %pd", symname, dentry);
562 dentry->d_name.len, dentry->d_name.name);
563 558
564 if (!autofs4_oz_mode(sbi)) 559 if (!autofs4_oz_mode(sbi))
565 return -EACCES; 560 return -EACCES;
@@ -687,7 +682,7 @@ static void autofs_clear_leaf_automount_flags(struct dentry *dentry)
687 /* only consider parents below dentrys in the root */ 682 /* only consider parents below dentrys in the root */
688 if (IS_ROOT(parent->d_parent)) 683 if (IS_ROOT(parent->d_parent))
689 return; 684 return;
690 d_child = &dentry->d_u.d_child; 685 d_child = &dentry->d_child;
691 /* Set parent managed if it's becoming empty */ 686 /* Set parent managed if it's becoming empty */
692 if (d_child->next == &parent->d_subdirs && 687 if (d_child->next == &parent->d_subdirs &&
693 d_child->prev == &parent->d_subdirs) 688 d_child->prev == &parent->d_subdirs)
@@ -701,8 +696,7 @@ static int autofs4_dir_rmdir(struct inode *dir, struct dentry *dentry)
701 struct autofs_info *ino = autofs4_dentry_ino(dentry); 696 struct autofs_info *ino = autofs4_dentry_ino(dentry);
702 struct autofs_info *p_ino; 697 struct autofs_info *p_ino;
703 698
704 DPRINTK("dentry %p, removing %.*s", 699 DPRINTK("dentry %p, removing %pd", dentry, dentry);
705 dentry, dentry->d_name.len, dentry->d_name.name);
706 700
707 if (!autofs4_oz_mode(sbi)) 701 if (!autofs4_oz_mode(sbi))
708 return -EACCES; 702 return -EACCES;
@@ -744,8 +738,7 @@ static int autofs4_dir_mkdir(struct inode *dir, struct dentry *dentry, umode_t m
744 if (!autofs4_oz_mode(sbi)) 738 if (!autofs4_oz_mode(sbi))
745 return -EACCES; 739 return -EACCES;
746 740
747 DPRINTK("dentry %p, creating %.*s", 741 DPRINTK("dentry %p, creating %pd", dentry, dentry);
748 dentry, dentry->d_name.len, dentry->d_name.name);
749 742
750 BUG_ON(!ino); 743 BUG_ON(!ino);
751 744
diff --git a/fs/befs/linuxvfs.c b/fs/befs/linuxvfs.c
index 4cf61ec6b7a8..b94d1cc9cd30 100644
--- a/fs/befs/linuxvfs.c
+++ b/fs/befs/linuxvfs.c
@@ -172,8 +172,8 @@ befs_lookup(struct inode *dir, struct dentry *dentry, unsigned int flags)
172 char *utfname; 172 char *utfname;
173 const char *name = dentry->d_name.name; 173 const char *name = dentry->d_name.name;
174 174
175 befs_debug(sb, "---> %s name %s inode %ld", __func__, 175 befs_debug(sb, "---> %s name %pd inode %ld", __func__,
176 dentry->d_name.name, dir->i_ino); 176 dentry, dir->i_ino);
177 177
178 /* Convert to UTF-8 */ 178 /* Convert to UTF-8 */
179 if (BEFS_SB(sb)->nls) { 179 if (BEFS_SB(sb)->nls) {
@@ -191,8 +191,7 @@ befs_lookup(struct inode *dir, struct dentry *dentry, unsigned int flags)
191 } 191 }
192 192
193 if (ret == BEFS_BT_NOT_FOUND) { 193 if (ret == BEFS_BT_NOT_FOUND) {
194 befs_debug(sb, "<--- %s %s not found", __func__, 194 befs_debug(sb, "<--- %s %pd not found", __func__, dentry);
195 dentry->d_name.name);
196 return ERR_PTR(-ENOENT); 195 return ERR_PTR(-ENOENT);
197 196
198 } else if (ret != BEFS_OK || offset == 0) { 197 } else if (ret != BEFS_OK || offset == 0) {
@@ -222,10 +221,9 @@ befs_readdir(struct file *file, struct dir_context *ctx)
222 size_t keysize; 221 size_t keysize;
223 unsigned char d_type; 222 unsigned char d_type;
224 char keybuf[BEFS_NAME_LEN + 1]; 223 char keybuf[BEFS_NAME_LEN + 1];
225 const char *dirname = file->f_path.dentry->d_name.name;
226 224
227 befs_debug(sb, "---> %s name %s, inode %ld, ctx->pos %lld", 225 befs_debug(sb, "---> %s name %pD, inode %ld, ctx->pos %lld",
228 __func__, dirname, inode->i_ino, ctx->pos); 226 __func__, file, inode->i_ino, ctx->pos);
229 227
230more: 228more:
231 result = befs_btree_read(sb, ds, ctx->pos, BEFS_NAME_LEN + 1, 229 result = befs_btree_read(sb, ds, ctx->pos, BEFS_NAME_LEN + 1,
@@ -233,8 +231,8 @@ more:
233 231
234 if (result == BEFS_ERR) { 232 if (result == BEFS_ERR) {
235 befs_debug(sb, "<--- %s ERROR", __func__); 233 befs_debug(sb, "<--- %s ERROR", __func__);
236 befs_error(sb, "IO error reading %s (inode %lu)", 234 befs_error(sb, "IO error reading %pD (inode %lu)",
237 dirname, inode->i_ino); 235 file, inode->i_ino);
238 return -EIO; 236 return -EIO;
239 237
240 } else if (result == BEFS_BT_END) { 238 } else if (result == BEFS_BT_END) {
diff --git a/fs/binfmt_aout.c b/fs/binfmt_aout.c
index 929dec08c348..4c556680fa74 100644
--- a/fs/binfmt_aout.c
+++ b/fs/binfmt_aout.c
@@ -292,8 +292,8 @@ static int load_aout_binary(struct linux_binprm * bprm)
292 if ((fd_offset & ~PAGE_MASK) != 0 && printk_ratelimit()) 292 if ((fd_offset & ~PAGE_MASK) != 0 && printk_ratelimit())
293 { 293 {
294 printk(KERN_WARNING 294 printk(KERN_WARNING
295 "fd_offset is not page aligned. Please convert program: %s\n", 295 "fd_offset is not page aligned. Please convert program: %pD\n",
296 bprm->file->f_path.dentry->d_name.name); 296 bprm->file);
297 } 297 }
298 298
299 if (!bprm->file->f_op->mmap||((fd_offset & ~PAGE_MASK) != 0)) { 299 if (!bprm->file->f_op->mmap||((fd_offset & ~PAGE_MASK) != 0)) {
@@ -375,8 +375,8 @@ static int load_aout_library(struct file *file)
375 if (printk_ratelimit()) 375 if (printk_ratelimit())
376 { 376 {
377 printk(KERN_WARNING 377 printk(KERN_WARNING
378 "N_TXTOFF is not page aligned. Please convert library: %s\n", 378 "N_TXTOFF is not page aligned. Please convert library: %pD\n",
379 file->f_path.dentry->d_name.name); 379 file);
380 } 380 }
381 vm_brk(start_addr, ex.a_text + ex.a_data + ex.a_bss); 381 vm_brk(start_addr, ex.a_text + ex.a_data + ex.a_bss);
382 382
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index d23362f4464e..ff0dcc016b71 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -5303,7 +5303,7 @@ static struct dentry *btrfs_lookup(struct inode *dir, struct dentry *dentry,
5303 return ERR_CAST(inode); 5303 return ERR_CAST(inode);
5304 } 5304 }
5305 5305
5306 return d_materialise_unique(dentry, inode); 5306 return d_splice_alias(inode, dentry);
5307} 5307}
5308 5308
5309unsigned char btrfs_filetype_table[] = { 5309unsigned char btrfs_filetype_table[] = {
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index 4399f0c3a4ce..080fe66c0349 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -5296,7 +5296,7 @@ long btrfs_ioctl(struct file *file, unsigned int
5296 ret = btrfs_start_delalloc_roots(root->fs_info, 0, -1); 5296 ret = btrfs_start_delalloc_roots(root->fs_info, 0, -1);
5297 if (ret) 5297 if (ret)
5298 return ret; 5298 return ret;
5299 ret = btrfs_sync_fs(file->f_dentry->d_sb, 1); 5299 ret = btrfs_sync_fs(file_inode(file)->i_sb, 1);
5300 /* 5300 /*
5301 * The transaction thread may want to do more work, 5301 * The transaction thread may want to do more work,
5302 * namely it pokes the cleaner ktread that will start 5302 * namely it pokes the cleaner ktread that will start
diff --git a/fs/cachefiles/namei.c b/fs/cachefiles/namei.c
index e12f189d539b..7f8e83f9d74e 100644
--- a/fs/cachefiles/namei.c
+++ b/fs/cachefiles/namei.c
@@ -102,8 +102,7 @@ static void cachefiles_mark_object_buried(struct cachefiles_cache *cache,
102 struct cachefiles_object *object; 102 struct cachefiles_object *object;
103 struct rb_node *p; 103 struct rb_node *p;
104 104
105 _enter(",'%*.*s'", 105 _enter(",'%pd'", dentry);
106 dentry->d_name.len, dentry->d_name.len, dentry->d_name.name);
107 106
108 write_lock(&cache->active_lock); 107 write_lock(&cache->active_lock);
109 108
@@ -273,9 +272,7 @@ static int cachefiles_bury_object(struct cachefiles_cache *cache,
273 char nbuffer[8 + 8 + 1]; 272 char nbuffer[8 + 8 + 1];
274 int ret; 273 int ret;
275 274
276 _enter(",'%*.*s','%*.*s'", 275 _enter(",'%pd','%pd'", dir, rep);
277 dir->d_name.len, dir->d_name.len, dir->d_name.name,
278 rep->d_name.len, rep->d_name.len, rep->d_name.name);
279 276
280 _debug("remove %p from %p", rep, dir); 277 _debug("remove %p from %p", rep, dir);
281 278
@@ -597,8 +594,7 @@ lookup_again:
597 /* if we've found that the terminal object exists, then we need to 594 /* if we've found that the terminal object exists, then we need to
598 * check its attributes and delete it if it's out of date */ 595 * check its attributes and delete it if it's out of date */
599 if (!object->new) { 596 if (!object->new) {
600 _debug("validate '%*.*s'", 597 _debug("validate '%pd'", next);
601 next->d_name.len, next->d_name.len, next->d_name.name);
602 598
603 ret = cachefiles_check_object_xattr(object, auxdata); 599 ret = cachefiles_check_object_xattr(object, auxdata);
604 if (ret == -ESTALE) { 600 if (ret == -ESTALE) {
@@ -827,8 +823,8 @@ static struct dentry *cachefiles_check_active(struct cachefiles_cache *cache,
827 unsigned long start; 823 unsigned long start;
828 int ret; 824 int ret;
829 825
830 //_enter(",%*.*s/,%s", 826 //_enter(",%pd/,%s",
831 // dir->d_name.len, dir->d_name.len, dir->d_name.name, filename); 827 // dir, filename);
832 828
833 /* look up the victim */ 829 /* look up the victim */
834 mutex_lock_nested(&dir->d_inode->i_mutex, I_MUTEX_PARENT); 830 mutex_lock_nested(&dir->d_inode->i_mutex, I_MUTEX_PARENT);
@@ -910,8 +906,7 @@ int cachefiles_cull(struct cachefiles_cache *cache, struct dentry *dir,
910 struct dentry *victim; 906 struct dentry *victim;
911 int ret; 907 int ret;
912 908
913 _enter(",%*.*s/,%s", 909 _enter(",%pd/,%s", dir, filename);
914 dir->d_name.len, dir->d_name.len, dir->d_name.name, filename);
915 910
916 victim = cachefiles_check_active(cache, dir, filename); 911 victim = cachefiles_check_active(cache, dir, filename);
917 if (IS_ERR(victim)) 912 if (IS_ERR(victim))
@@ -969,8 +964,8 @@ int cachefiles_check_in_use(struct cachefiles_cache *cache, struct dentry *dir,
969{ 964{
970 struct dentry *victim; 965 struct dentry *victim;
971 966
972 //_enter(",%*.*s/,%s", 967 //_enter(",%pd/,%s",
973 // dir->d_name.len, dir->d_name.len, dir->d_name.name, filename); 968 // dir, filename);
974 969
975 victim = cachefiles_check_active(cache, dir, filename); 970 victim = cachefiles_check_active(cache, dir, filename);
976 if (IS_ERR(victim)) 971 if (IS_ERR(victim))
diff --git a/fs/cachefiles/xattr.c b/fs/cachefiles/xattr.c
index acbc1f094fb1..a8a68745e11d 100644
--- a/fs/cachefiles/xattr.c
+++ b/fs/cachefiles/xattr.c
@@ -51,9 +51,8 @@ int cachefiles_check_object_type(struct cachefiles_object *object)
51 } 51 }
52 52
53 if (ret != -EEXIST) { 53 if (ret != -EEXIST) {
54 pr_err("Can't set xattr on %*.*s [%lu] (err %d)\n", 54 pr_err("Can't set xattr on %pd [%lu] (err %d)\n",
55 dentry->d_name.len, dentry->d_name.len, 55 dentry, dentry->d_inode->i_ino,
56 dentry->d_name.name, dentry->d_inode->i_ino,
57 -ret); 56 -ret);
58 goto error; 57 goto error;
59 } 58 }
@@ -64,9 +63,8 @@ int cachefiles_check_object_type(struct cachefiles_object *object)
64 if (ret == -ERANGE) 63 if (ret == -ERANGE)
65 goto bad_type_length; 64 goto bad_type_length;
66 65
67 pr_err("Can't read xattr on %*.*s [%lu] (err %d)\n", 66 pr_err("Can't read xattr on %pd [%lu] (err %d)\n",
68 dentry->d_name.len, dentry->d_name.len, 67 dentry, dentry->d_inode->i_ino,
69 dentry->d_name.name, dentry->d_inode->i_ino,
70 -ret); 68 -ret);
71 goto error; 69 goto error;
72 } 70 }
@@ -92,9 +90,8 @@ bad_type_length:
92 90
93bad_type: 91bad_type:
94 xtype[2] = 0; 92 xtype[2] = 0;
95 pr_err("Cache object %*.*s [%lu] type %s not %s\n", 93 pr_err("Cache object %pd [%lu] type %s not %s\n",
96 dentry->d_name.len, dentry->d_name.len, 94 dentry, dentry->d_inode->i_ino,
97 dentry->d_name.name, dentry->d_inode->i_ino,
98 xtype, type); 95 xtype, type);
99 ret = -EIO; 96 ret = -EIO;
100 goto error; 97 goto error;
diff --git a/fs/ceph/debugfs.c b/fs/ceph/debugfs.c
index 5d5a4c8c8496..1b2355109b9f 100644
--- a/fs/ceph/debugfs.c
+++ b/fs/ceph/debugfs.c
@@ -83,10 +83,9 @@ static int mdsc_show(struct seq_file *s, void *p)
83 if (IS_ERR(path)) 83 if (IS_ERR(path))
84 path = NULL; 84 path = NULL;
85 spin_lock(&req->r_dentry->d_lock); 85 spin_lock(&req->r_dentry->d_lock);
86 seq_printf(s, " #%llx/%.*s (%s)", 86 seq_printf(s, " #%llx/%pd (%s)",
87 ceph_ino(req->r_dentry->d_parent->d_inode), 87 ceph_ino(req->r_dentry->d_parent->d_inode),
88 req->r_dentry->d_name.len, 88 req->r_dentry,
89 req->r_dentry->d_name.name,
90 path ? path : ""); 89 path ? path : "");
91 spin_unlock(&req->r_dentry->d_lock); 90 spin_unlock(&req->r_dentry->d_lock);
92 kfree(path); 91 kfree(path);
@@ -103,11 +102,10 @@ static int mdsc_show(struct seq_file *s, void *p)
103 if (IS_ERR(path)) 102 if (IS_ERR(path))
104 path = NULL; 103 path = NULL;
105 spin_lock(&req->r_old_dentry->d_lock); 104 spin_lock(&req->r_old_dentry->d_lock);
106 seq_printf(s, " #%llx/%.*s (%s)", 105 seq_printf(s, " #%llx/%pd (%s)",
107 req->r_old_dentry_dir ? 106 req->r_old_dentry_dir ?
108 ceph_ino(req->r_old_dentry_dir) : 0, 107 ceph_ino(req->r_old_dentry_dir) : 0,
109 req->r_old_dentry->d_name.len, 108 req->r_old_dentry,
110 req->r_old_dentry->d_name.name,
111 path ? path : ""); 109 path ? path : "");
112 spin_unlock(&req->r_old_dentry->d_lock); 110 spin_unlock(&req->r_old_dentry->d_lock);
113 kfree(path); 111 kfree(path);
@@ -150,8 +148,8 @@ static int dentry_lru_show(struct seq_file *s, void *ptr)
150 spin_lock(&mdsc->dentry_lru_lock); 148 spin_lock(&mdsc->dentry_lru_lock);
151 list_for_each_entry(di, &mdsc->dentry_lru, lru) { 149 list_for_each_entry(di, &mdsc->dentry_lru, lru) {
152 struct dentry *dentry = di->dentry; 150 struct dentry *dentry = di->dentry;
153 seq_printf(s, "%p %p\t%.*s\n", 151 seq_printf(s, "%p %p\t%pd\n",
154 di, dentry, dentry->d_name.len, dentry->d_name.name); 152 di, dentry, dentry);
155 } 153 }
156 spin_unlock(&mdsc->dentry_lru_lock); 154 spin_unlock(&mdsc->dentry_lru_lock);
157 155
diff --git a/fs/ceph/dir.c b/fs/ceph/dir.c
index e6d63f8f98c0..681a8537b64f 100644
--- a/fs/ceph/dir.c
+++ b/fs/ceph/dir.c
@@ -111,7 +111,7 @@ static int fpos_cmp(loff_t l, loff_t r)
111/* 111/*
112 * When possible, we try to satisfy a readdir by peeking at the 112 * When possible, we try to satisfy a readdir by peeking at the
113 * dcache. We make this work by carefully ordering dentries on 113 * dcache. We make this work by carefully ordering dentries on
114 * d_u.d_child when we initially get results back from the MDS, and 114 * d_child when we initially get results back from the MDS, and
115 * falling back to a "normal" sync readdir if any dentries in the dir 115 * falling back to a "normal" sync readdir if any dentries in the dir
116 * are dropped. 116 * are dropped.
117 * 117 *
@@ -123,7 +123,7 @@ static int __dcache_readdir(struct file *file, struct dir_context *ctx,
123 u32 shared_gen) 123 u32 shared_gen)
124{ 124{
125 struct ceph_file_info *fi = file->private_data; 125 struct ceph_file_info *fi = file->private_data;
126 struct dentry *parent = file->f_dentry; 126 struct dentry *parent = file->f_path.dentry;
127 struct inode *dir = parent->d_inode; 127 struct inode *dir = parent->d_inode;
128 struct list_head *p; 128 struct list_head *p;
129 struct dentry *dentry, *last; 129 struct dentry *dentry, *last;
@@ -147,11 +147,11 @@ static int __dcache_readdir(struct file *file, struct dir_context *ctx,
147 p = parent->d_subdirs.prev; 147 p = parent->d_subdirs.prev;
148 dout(" initial p %p/%p\n", p->prev, p->next); 148 dout(" initial p %p/%p\n", p->prev, p->next);
149 } else { 149 } else {
150 p = last->d_u.d_child.prev; 150 p = last->d_child.prev;
151 } 151 }
152 152
153more: 153more:
154 dentry = list_entry(p, struct dentry, d_u.d_child); 154 dentry = list_entry(p, struct dentry, d_child);
155 di = ceph_dentry(dentry); 155 di = ceph_dentry(dentry);
156 while (1) { 156 while (1) {
157 dout(" p %p/%p %s d_subdirs %p/%p\n", p->prev, p->next, 157 dout(" p %p/%p %s d_subdirs %p/%p\n", p->prev, p->next,
@@ -168,13 +168,13 @@ more:
168 ceph_ino(dentry->d_inode) != CEPH_INO_CEPH && 168 ceph_ino(dentry->d_inode) != CEPH_INO_CEPH &&
169 fpos_cmp(ctx->pos, di->offset) <= 0) 169 fpos_cmp(ctx->pos, di->offset) <= 0)
170 break; 170 break;
171 dout(" skipping %p %.*s at %llu (%llu)%s%s\n", dentry, 171 dout(" skipping %p %pd at %llu (%llu)%s%s\n", dentry,
172 dentry->d_name.len, dentry->d_name.name, di->offset, 172 dentry, di->offset,
173 ctx->pos, d_unhashed(dentry) ? " unhashed" : "", 173 ctx->pos, d_unhashed(dentry) ? " unhashed" : "",
174 !dentry->d_inode ? " null" : ""); 174 !dentry->d_inode ? " null" : "");
175 spin_unlock(&dentry->d_lock); 175 spin_unlock(&dentry->d_lock);
176 p = p->prev; 176 p = p->prev;
177 dentry = list_entry(p, struct dentry, d_u.d_child); 177 dentry = list_entry(p, struct dentry, d_child);
178 di = ceph_dentry(dentry); 178 di = ceph_dentry(dentry);
179 } 179 }
180 180
@@ -190,8 +190,8 @@ more:
190 goto out; 190 goto out;
191 } 191 }
192 192
193 dout(" %llu (%llu) dentry %p %.*s %p\n", di->offset, ctx->pos, 193 dout(" %llu (%llu) dentry %p %pd %p\n", di->offset, ctx->pos,
194 dentry, dentry->d_name.len, dentry->d_name.name, dentry->d_inode); 194 dentry, dentry, dentry->d_inode);
195 if (!dir_emit(ctx, dentry->d_name.name, 195 if (!dir_emit(ctx, dentry->d_name.name,
196 dentry->d_name.len, 196 dentry->d_name.len,
197 ceph_translate_ino(dentry->d_sb, dentry->d_inode->i_ino), 197 ceph_translate_ino(dentry->d_sb, dentry->d_inode->i_ino),
@@ -274,7 +274,7 @@ static int ceph_readdir(struct file *file, struct dir_context *ctx)
274 off = 1; 274 off = 1;
275 } 275 }
276 if (ctx->pos == 1) { 276 if (ctx->pos == 1) {
277 ino_t ino = parent_ino(file->f_dentry); 277 ino_t ino = parent_ino(file->f_path.dentry);
278 dout("readdir off 1 -> '..'\n"); 278 dout("readdir off 1 -> '..'\n");
279 if (!dir_emit(ctx, "..", 2, 279 if (!dir_emit(ctx, "..", 2,
280 ceph_translate_ino(inode->i_sb, ino), 280 ceph_translate_ino(inode->i_sb, ino),
@@ -337,7 +337,7 @@ more:
337 } 337 }
338 req->r_inode = inode; 338 req->r_inode = inode;
339 ihold(inode); 339 ihold(inode);
340 req->r_dentry = dget(file->f_dentry); 340 req->r_dentry = dget(file->f_path.dentry);
341 /* hints to request -> mds selection code */ 341 /* hints to request -> mds selection code */
342 req->r_direct_mode = USE_AUTH_MDS; 342 req->r_direct_mode = USE_AUTH_MDS;
343 req->r_direct_hash = ceph_frag_value(frag); 343 req->r_direct_hash = ceph_frag_value(frag);
@@ -538,8 +538,8 @@ int ceph_handle_snapdir(struct ceph_mds_request *req,
538 strcmp(dentry->d_name.name, 538 strcmp(dentry->d_name.name,
539 fsc->mount_options->snapdir_name) == 0) { 539 fsc->mount_options->snapdir_name) == 0) {
540 struct inode *inode = ceph_get_snapdir(parent); 540 struct inode *inode = ceph_get_snapdir(parent);
541 dout("ENOENT on snapdir %p '%.*s', linking to snapdir %p\n", 541 dout("ENOENT on snapdir %p '%pd', linking to snapdir %p\n",
542 dentry, dentry->d_name.len, dentry->d_name.name, inode); 542 dentry, dentry, inode);
543 BUG_ON(!d_unhashed(dentry)); 543 BUG_ON(!d_unhashed(dentry));
544 d_add(dentry, inode); 544 d_add(dentry, inode);
545 err = 0; 545 err = 0;
@@ -603,8 +603,8 @@ static struct dentry *ceph_lookup(struct inode *dir, struct dentry *dentry,
603 int op; 603 int op;
604 int err; 604 int err;
605 605
606 dout("lookup %p dentry %p '%.*s'\n", 606 dout("lookup %p dentry %p '%pd'\n",
607 dir, dentry, dentry->d_name.len, dentry->d_name.name); 607 dir, dentry, dentry);
608 608
609 if (dentry->d_name.len > NAME_MAX) 609 if (dentry->d_name.len > NAME_MAX)
610 return ERR_PTR(-ENAMETOOLONG); 610 return ERR_PTR(-ENAMETOOLONG);
@@ -774,8 +774,8 @@ static int ceph_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
774 if (ceph_snap(dir) == CEPH_SNAPDIR) { 774 if (ceph_snap(dir) == CEPH_SNAPDIR) {
775 /* mkdir .snap/foo is a MKSNAP */ 775 /* mkdir .snap/foo is a MKSNAP */
776 op = CEPH_MDS_OP_MKSNAP; 776 op = CEPH_MDS_OP_MKSNAP;
777 dout("mksnap dir %p snap '%.*s' dn %p\n", dir, 777 dout("mksnap dir %p snap '%pd' dn %p\n", dir,
778 dentry->d_name.len, dentry->d_name.name, dentry); 778 dentry, dentry);
779 } else if (ceph_snap(dir) == CEPH_NOSNAP) { 779 } else if (ceph_snap(dir) == CEPH_NOSNAP) {
780 dout("mkdir dir %p dn %p mode 0%ho\n", dir, dentry, mode); 780 dout("mkdir dir %p dn %p mode 0%ho\n", dir, dentry, mode);
781 op = CEPH_MDS_OP_MKDIR; 781 op = CEPH_MDS_OP_MKDIR;
@@ -888,8 +888,7 @@ static int ceph_unlink(struct inode *dir, struct dentry *dentry)
888 888
889 if (ceph_snap(dir) == CEPH_SNAPDIR) { 889 if (ceph_snap(dir) == CEPH_SNAPDIR) {
890 /* rmdir .snap/foo is RMSNAP */ 890 /* rmdir .snap/foo is RMSNAP */
891 dout("rmsnap dir %p '%.*s' dn %p\n", dir, dentry->d_name.len, 891 dout("rmsnap dir %p '%pd' dn %p\n", dir, dentry, dentry);
892 dentry->d_name.name, dentry);
893 op = CEPH_MDS_OP_RMSNAP; 892 op = CEPH_MDS_OP_RMSNAP;
894 } else if (ceph_snap(dir) == CEPH_NOSNAP) { 893 } else if (ceph_snap(dir) == CEPH_NOSNAP) {
895 dout("unlink/rmdir dir %p dn %p inode %p\n", 894 dout("unlink/rmdir dir %p dn %p inode %p\n",
@@ -1063,16 +1062,15 @@ static int ceph_d_revalidate(struct dentry *dentry, unsigned int flags)
1063 if (flags & LOOKUP_RCU) 1062 if (flags & LOOKUP_RCU)
1064 return -ECHILD; 1063 return -ECHILD;
1065 1064
1066 dout("d_revalidate %p '%.*s' inode %p offset %lld\n", dentry, 1065 dout("d_revalidate %p '%pd' inode %p offset %lld\n", dentry,
1067 dentry->d_name.len, dentry->d_name.name, dentry->d_inode, 1066 dentry, dentry->d_inode, ceph_dentry(dentry)->offset);
1068 ceph_dentry(dentry)->offset);
1069 1067
1070 dir = ceph_get_dentry_parent_inode(dentry); 1068 dir = ceph_get_dentry_parent_inode(dentry);
1071 1069
1072 /* always trust cached snapped dentries, snapdir dentry */ 1070 /* always trust cached snapped dentries, snapdir dentry */
1073 if (ceph_snap(dir) != CEPH_NOSNAP) { 1071 if (ceph_snap(dir) != CEPH_NOSNAP) {
1074 dout("d_revalidate %p '%.*s' inode %p is SNAPPED\n", dentry, 1072 dout("d_revalidate %p '%pd' inode %p is SNAPPED\n", dentry,
1075 dentry->d_name.len, dentry->d_name.name, dentry->d_inode); 1073 dentry, dentry->d_inode);
1076 valid = 1; 1074 valid = 1;
1077 } else if (dentry->d_inode && 1075 } else if (dentry->d_inode &&
1078 ceph_snap(dentry->d_inode) == CEPH_SNAPDIR) { 1076 ceph_snap(dentry->d_inode) == CEPH_SNAPDIR) {
@@ -1265,8 +1263,7 @@ void ceph_dentry_lru_add(struct dentry *dn)
1265 struct ceph_dentry_info *di = ceph_dentry(dn); 1263 struct ceph_dentry_info *di = ceph_dentry(dn);
1266 struct ceph_mds_client *mdsc; 1264 struct ceph_mds_client *mdsc;
1267 1265
1268 dout("dentry_lru_add %p %p '%.*s'\n", di, dn, 1266 dout("dentry_lru_add %p %p '%pd'\n", di, dn, dn);
1269 dn->d_name.len, dn->d_name.name);
1270 mdsc = ceph_sb_to_client(dn->d_sb)->mdsc; 1267 mdsc = ceph_sb_to_client(dn->d_sb)->mdsc;
1271 spin_lock(&mdsc->dentry_lru_lock); 1268 spin_lock(&mdsc->dentry_lru_lock);
1272 list_add_tail(&di->lru, &mdsc->dentry_lru); 1269 list_add_tail(&di->lru, &mdsc->dentry_lru);
@@ -1279,8 +1276,8 @@ void ceph_dentry_lru_touch(struct dentry *dn)
1279 struct ceph_dentry_info *di = ceph_dentry(dn); 1276 struct ceph_dentry_info *di = ceph_dentry(dn);
1280 struct ceph_mds_client *mdsc; 1277 struct ceph_mds_client *mdsc;
1281 1278
1282 dout("dentry_lru_touch %p %p '%.*s' (offset %lld)\n", di, dn, 1279 dout("dentry_lru_touch %p %p '%pd' (offset %lld)\n", di, dn, dn,
1283 dn->d_name.len, dn->d_name.name, di->offset); 1280 di->offset);
1284 mdsc = ceph_sb_to_client(dn->d_sb)->mdsc; 1281 mdsc = ceph_sb_to_client(dn->d_sb)->mdsc;
1285 spin_lock(&mdsc->dentry_lru_lock); 1282 spin_lock(&mdsc->dentry_lru_lock);
1286 list_move_tail(&di->lru, &mdsc->dentry_lru); 1283 list_move_tail(&di->lru, &mdsc->dentry_lru);
@@ -1292,8 +1289,7 @@ void ceph_dentry_lru_del(struct dentry *dn)
1292 struct ceph_dentry_info *di = ceph_dentry(dn); 1289 struct ceph_dentry_info *di = ceph_dentry(dn);
1293 struct ceph_mds_client *mdsc; 1290 struct ceph_mds_client *mdsc;
1294 1291
1295 dout("dentry_lru_del %p %p '%.*s'\n", di, dn, 1292 dout("dentry_lru_del %p %p '%pd'\n", di, dn, dn);
1296 dn->d_name.len, dn->d_name.name);
1297 mdsc = ceph_sb_to_client(dn->d_sb)->mdsc; 1293 mdsc = ceph_sb_to_client(dn->d_sb)->mdsc;
1298 spin_lock(&mdsc->dentry_lru_lock); 1294 spin_lock(&mdsc->dentry_lru_lock);
1299 list_del_init(&di->lru); 1295 list_del_init(&di->lru);
diff --git a/fs/ceph/file.c b/fs/ceph/file.c
index d7e0da8366e6..9f8e3572040e 100644
--- a/fs/ceph/file.c
+++ b/fs/ceph/file.c
@@ -211,7 +211,7 @@ int ceph_open(struct inode *inode, struct file *file)
211 211
212 req->r_num_caps = 1; 212 req->r_num_caps = 1;
213 if (flags & O_CREAT) 213 if (flags & O_CREAT)
214 parent_inode = ceph_get_dentry_parent_inode(file->f_dentry); 214 parent_inode = ceph_get_dentry_parent_inode(file->f_path.dentry);
215 err = ceph_mdsc_do_request(mdsc, parent_inode, req); 215 err = ceph_mdsc_do_request(mdsc, parent_inode, req);
216 iput(parent_inode); 216 iput(parent_inode);
217 if (!err) 217 if (!err)
@@ -238,8 +238,8 @@ int ceph_atomic_open(struct inode *dir, struct dentry *dentry,
238 struct ceph_acls_info acls = {}; 238 struct ceph_acls_info acls = {};
239 int err; 239 int err;
240 240
241 dout("atomic_open %p dentry %p '%.*s' %s flags %d mode 0%o\n", 241 dout("atomic_open %p dentry %p '%pd' %s flags %d mode 0%o\n",
242 dir, dentry, dentry->d_name.len, dentry->d_name.name, 242 dir, dentry, dentry,
243 d_unhashed(dentry) ? "unhashed" : "hashed", flags, mode); 243 d_unhashed(dentry) ? "unhashed" : "hashed", flags, mode);
244 244
245 if (dentry->d_name.len > NAME_MAX) 245 if (dentry->d_name.len > NAME_MAX)
diff --git a/fs/ceph/inode.c b/fs/ceph/inode.c
index 7b6139004401..a5593d51d035 100644
--- a/fs/ceph/inode.c
+++ b/fs/ceph/inode.c
@@ -967,7 +967,7 @@ static struct dentry *splice_dentry(struct dentry *dn, struct inode *in,
967 /* dn must be unhashed */ 967 /* dn must be unhashed */
968 if (!d_unhashed(dn)) 968 if (!d_unhashed(dn))
969 d_drop(dn); 969 d_drop(dn);
970 realdn = d_materialise_unique(dn, in); 970 realdn = d_splice_alias(in, dn);
971 if (IS_ERR(realdn)) { 971 if (IS_ERR(realdn)) {
972 pr_err("splice_dentry error %ld %p inode %p ino %llx.%llx\n", 972 pr_err("splice_dentry error %ld %p inode %p ino %llx.%llx\n",
973 PTR_ERR(realdn), dn, in, ceph_vinop(in)); 973 PTR_ERR(realdn), dn, in, ceph_vinop(in));
@@ -1186,20 +1186,18 @@ retry_lookup:
1186 struct inode *olddir = req->r_old_dentry_dir; 1186 struct inode *olddir = req->r_old_dentry_dir;
1187 BUG_ON(!olddir); 1187 BUG_ON(!olddir);
1188 1188
1189 dout(" src %p '%.*s' dst %p '%.*s'\n", 1189 dout(" src %p '%pd' dst %p '%pd'\n",
1190 req->r_old_dentry, 1190 req->r_old_dentry,
1191 req->r_old_dentry->d_name.len, 1191 req->r_old_dentry,
1192 req->r_old_dentry->d_name.name, 1192 dn, dn);
1193 dn, dn->d_name.len, dn->d_name.name);
1194 dout("fill_trace doing d_move %p -> %p\n", 1193 dout("fill_trace doing d_move %p -> %p\n",
1195 req->r_old_dentry, dn); 1194 req->r_old_dentry, dn);
1196 1195
1197 d_move(req->r_old_dentry, dn); 1196 d_move(req->r_old_dentry, dn);
1198 dout(" src %p '%.*s' dst %p '%.*s'\n", 1197 dout(" src %p '%pd' dst %p '%pd'\n",
1198 req->r_old_dentry,
1199 req->r_old_dentry, 1199 req->r_old_dentry,
1200 req->r_old_dentry->d_name.len, 1200 dn, dn);
1201 req->r_old_dentry->d_name.name,
1202 dn, dn->d_name.len, dn->d_name.name);
1203 1201
1204 /* ensure target dentry is invalidated, despite 1202 /* ensure target dentry is invalidated, despite
1205 rehashing bug in vfs_rename_dir */ 1203 rehashing bug in vfs_rename_dir */
@@ -1399,7 +1397,7 @@ retry_lookup:
1399 /* reorder parent's d_subdirs */ 1397 /* reorder parent's d_subdirs */
1400 spin_lock(&parent->d_lock); 1398 spin_lock(&parent->d_lock);
1401 spin_lock_nested(&dn->d_lock, DENTRY_D_LOCK_NESTED); 1399 spin_lock_nested(&dn->d_lock, DENTRY_D_LOCK_NESTED);
1402 list_move(&dn->d_u.d_child, &parent->d_subdirs); 1400 list_move(&dn->d_child, &parent->d_subdirs);
1403 spin_unlock(&dn->d_lock); 1401 spin_unlock(&dn->d_lock);
1404 spin_unlock(&parent->d_lock); 1402 spin_unlock(&parent->d_lock);
1405 } 1403 }
diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c
index 9d7996e8e793..d72fe37f5420 100644
--- a/fs/cifs/cifsfs.c
+++ b/fs/cifs/cifsfs.c
@@ -209,8 +209,7 @@ cifs_statfs(struct dentry *dentry, struct kstatfs *buf)
209 209
210static long cifs_fallocate(struct file *file, int mode, loff_t off, loff_t len) 210static long cifs_fallocate(struct file *file, int mode, loff_t off, loff_t len)
211{ 211{
212 struct super_block *sb = file->f_path.dentry->d_sb; 212 struct cifs_sb_info *cifs_sb = CIFS_FILE_SB(file);
213 struct cifs_sb_info *cifs_sb = CIFS_SB(sb);
214 struct cifs_tcon *tcon = cifs_sb_master_tcon(cifs_sb); 213 struct cifs_tcon *tcon = cifs_sb_master_tcon(cifs_sb);
215 struct TCP_Server_Info *server = tcon->ses->server; 214 struct TCP_Server_Info *server = tcon->ses->server;
216 215
diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h
index 02a33e529904..6e139111fdb2 100644
--- a/fs/cifs/cifsglob.h
+++ b/fs/cifs/cifsglob.h
@@ -1168,6 +1168,12 @@ CIFS_SB(struct super_block *sb)
1168 return sb->s_fs_info; 1168 return sb->s_fs_info;
1169} 1169}
1170 1170
1171static inline struct cifs_sb_info *
1172CIFS_FILE_SB(struct file *file)
1173{
1174 return CIFS_SB(file_inode(file)->i_sb);
1175}
1176
1171static inline char CIFS_DIR_SEP(const struct cifs_sb_info *cifs_sb) 1177static inline char CIFS_DIR_SEP(const struct cifs_sb_info *cifs_sb)
1172{ 1178{
1173 if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_POSIX_PATHS) 1179 if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_POSIX_PATHS)
diff --git a/fs/cifs/file.c b/fs/cifs/file.c
index 3e4d00a06c44..d535e168a9d3 100644
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -1586,7 +1586,7 @@ int cifs_lock(struct file *file, int cmd, struct file_lock *flock)
1586 cifs_read_flock(flock, &type, &lock, &unlock, &wait_flag, 1586 cifs_read_flock(flock, &type, &lock, &unlock, &wait_flag,
1587 tcon->ses->server); 1587 tcon->ses->server);
1588 1588
1589 cifs_sb = CIFS_SB(file->f_path.dentry->d_sb); 1589 cifs_sb = CIFS_FILE_SB(file);
1590 netfid = cfile->fid.netfid; 1590 netfid = cfile->fid.netfid;
1591 cinode = CIFS_I(file_inode(file)); 1591 cinode = CIFS_I(file_inode(file));
1592 1592
@@ -2305,7 +2305,7 @@ int cifs_fsync(struct file *file, loff_t start, loff_t end, int datasync)
2305 struct cifs_tcon *tcon; 2305 struct cifs_tcon *tcon;
2306 struct TCP_Server_Info *server; 2306 struct TCP_Server_Info *server;
2307 struct cifsFileInfo *smbfile = file->private_data; 2307 struct cifsFileInfo *smbfile = file->private_data;
2308 struct cifs_sb_info *cifs_sb = CIFS_SB(file->f_path.dentry->d_sb); 2308 struct cifs_sb_info *cifs_sb = CIFS_FILE_SB(file);
2309 struct inode *inode = file->f_mapping->host; 2309 struct inode *inode = file->f_mapping->host;
2310 2310
2311 rc = filemap_write_and_wait_range(inode->i_mapping, start, end); 2311 rc = filemap_write_and_wait_range(inode->i_mapping, start, end);
@@ -2585,7 +2585,7 @@ cifs_iovec_write(struct file *file, struct iov_iter *from, loff_t *poffset)
2585 iov_iter_truncate(from, len); 2585 iov_iter_truncate(from, len);
2586 2586
2587 INIT_LIST_HEAD(&wdata_list); 2587 INIT_LIST_HEAD(&wdata_list);
2588 cifs_sb = CIFS_SB(file->f_path.dentry->d_sb); 2588 cifs_sb = CIFS_FILE_SB(file);
2589 open_file = file->private_data; 2589 open_file = file->private_data;
2590 tcon = tlink_tcon(open_file->tlink); 2590 tcon = tlink_tcon(open_file->tlink);
2591 2591
@@ -3010,7 +3010,7 @@ ssize_t cifs_user_readv(struct kiocb *iocb, struct iov_iter *to)
3010 return 0; 3010 return 0;
3011 3011
3012 INIT_LIST_HEAD(&rdata_list); 3012 INIT_LIST_HEAD(&rdata_list);
3013 cifs_sb = CIFS_SB(file->f_path.dentry->d_sb); 3013 cifs_sb = CIFS_FILE_SB(file);
3014 open_file = file->private_data; 3014 open_file = file->private_data;
3015 tcon = tlink_tcon(open_file->tlink); 3015 tcon = tlink_tcon(open_file->tlink);
3016 3016
@@ -3155,7 +3155,7 @@ cifs_read(struct file *file, char *read_data, size_t read_size, loff_t *offset)
3155 __u32 pid; 3155 __u32 pid;
3156 3156
3157 xid = get_xid(); 3157 xid = get_xid();
3158 cifs_sb = CIFS_SB(file->f_path.dentry->d_sb); 3158 cifs_sb = CIFS_FILE_SB(file);
3159 3159
3160 /* FIXME: set up handlers for larger reads and/or convert to async */ 3160 /* FIXME: set up handlers for larger reads and/or convert to async */
3161 rsize = min_t(unsigned int, cifs_sb->rsize, CIFSMaxBufSize); 3161 rsize = min_t(unsigned int, cifs_sb->rsize, CIFSMaxBufSize);
@@ -3462,7 +3462,7 @@ static int cifs_readpages(struct file *file, struct address_space *mapping,
3462 int rc; 3462 int rc;
3463 struct list_head tmplist; 3463 struct list_head tmplist;
3464 struct cifsFileInfo *open_file = file->private_data; 3464 struct cifsFileInfo *open_file = file->private_data;
3465 struct cifs_sb_info *cifs_sb = CIFS_SB(file->f_path.dentry->d_sb); 3465 struct cifs_sb_info *cifs_sb = CIFS_FILE_SB(file);
3466 struct TCP_Server_Info *server; 3466 struct TCP_Server_Info *server;
3467 pid_t pid; 3467 pid_t pid;
3468 3468
diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c
index 197cb503d528..0c3ce464cae4 100644
--- a/fs/cifs/inode.c
+++ b/fs/cifs/inode.c
@@ -895,7 +895,7 @@ inode_has_hashed_dentries(struct inode *inode)
895 struct dentry *dentry; 895 struct dentry *dentry;
896 896
897 spin_lock(&inode->i_lock); 897 spin_lock(&inode->i_lock);
898 hlist_for_each_entry(dentry, &inode->i_dentry, d_alias) { 898 hlist_for_each_entry(dentry, &inode->i_dentry, d_u.d_alias) {
899 if (!d_unhashed(dentry) || IS_ROOT(dentry)) { 899 if (!d_unhashed(dentry) || IS_ROOT(dentry)) {
900 spin_unlock(&inode->i_lock); 900 spin_unlock(&inode->i_lock);
901 return true; 901 return true;
diff --git a/fs/cifs/readdir.c b/fs/cifs/readdir.c
index 803030c9ab68..8eaf20a80649 100644
--- a/fs/cifs/readdir.c
+++ b/fs/cifs/readdir.c
@@ -123,7 +123,7 @@ cifs_prime_dcache(struct dentry *parent, struct qstr *name,
123 if (!inode) 123 if (!inode)
124 goto out; 124 goto out;
125 125
126 alias = d_materialise_unique(dentry, inode); 126 alias = d_splice_alias(inode, dentry);
127 if (alias && !IS_ERR(alias)) 127 if (alias && !IS_ERR(alias))
128 dput(alias); 128 dput(alias);
129out: 129out:
@@ -261,7 +261,7 @@ initiate_cifs_search(const unsigned int xid, struct file *file)
261 int rc = 0; 261 int rc = 0;
262 char *full_path = NULL; 262 char *full_path = NULL;
263 struct cifsFileInfo *cifsFile; 263 struct cifsFileInfo *cifsFile;
264 struct cifs_sb_info *cifs_sb = CIFS_SB(file->f_path.dentry->d_sb); 264 struct cifs_sb_info *cifs_sb = CIFS_FILE_SB(file);
265 struct tcon_link *tlink = NULL; 265 struct tcon_link *tlink = NULL;
266 struct cifs_tcon *tcon; 266 struct cifs_tcon *tcon;
267 struct TCP_Server_Info *server; 267 struct TCP_Server_Info *server;
@@ -561,7 +561,7 @@ find_cifs_entry(const unsigned int xid, struct cifs_tcon *tcon, loff_t pos,
561 loff_t first_entry_in_buffer; 561 loff_t first_entry_in_buffer;
562 loff_t index_to_find = pos; 562 loff_t index_to_find = pos;
563 struct cifsFileInfo *cfile = file->private_data; 563 struct cifsFileInfo *cfile = file->private_data;
564 struct cifs_sb_info *cifs_sb = CIFS_SB(file->f_path.dentry->d_sb); 564 struct cifs_sb_info *cifs_sb = CIFS_FILE_SB(file);
565 struct TCP_Server_Info *server = tcon->ses->server; 565 struct TCP_Server_Info *server = tcon->ses->server;
566 /* check if index in the buffer */ 566 /* check if index in the buffer */
567 567
@@ -679,7 +679,7 @@ static int cifs_filldir(char *find_entry, struct file *file,
679 char *scratch_buf, unsigned int max_len) 679 char *scratch_buf, unsigned int max_len)
680{ 680{
681 struct cifsFileInfo *file_info = file->private_data; 681 struct cifsFileInfo *file_info = file->private_data;
682 struct super_block *sb = file->f_path.dentry->d_sb; 682 struct super_block *sb = file_inode(file)->i_sb;
683 struct cifs_sb_info *cifs_sb = CIFS_SB(sb); 683 struct cifs_sb_info *cifs_sb = CIFS_SB(sb);
684 struct cifs_dirent de = { NULL, }; 684 struct cifs_dirent de = { NULL, };
685 struct cifs_fattr fattr; 685 struct cifs_fattr fattr;
@@ -753,7 +753,7 @@ static int cifs_filldir(char *find_entry, struct file *file,
753 */ 753 */
754 fattr.cf_flags |= CIFS_FATTR_NEED_REVAL; 754 fattr.cf_flags |= CIFS_FATTR_NEED_REVAL;
755 755
756 cifs_prime_dcache(file->f_dentry, &name, &fattr); 756 cifs_prime_dcache(file->f_path.dentry, &name, &fattr);
757 757
758 ino = cifs_uniqueid_to_ino_t(fattr.cf_uniqueid); 758 ino = cifs_uniqueid_to_ino_t(fattr.cf_uniqueid);
759 return !dir_emit(ctx, name.name, name.len, ino, fattr.cf_dtype); 759 return !dir_emit(ctx, name.name, name.len, ino, fattr.cf_dtype);
diff --git a/fs/coda/cache.c b/fs/coda/cache.c
index 278f8fdeb9ef..46ee6f238985 100644
--- a/fs/coda/cache.c
+++ b/fs/coda/cache.c
@@ -92,7 +92,7 @@ static void coda_flag_children(struct dentry *parent, int flag)
92 struct dentry *de; 92 struct dentry *de;
93 93
94 spin_lock(&parent->d_lock); 94 spin_lock(&parent->d_lock);
95 list_for_each_entry(de, &parent->d_subdirs, d_u.d_child) { 95 list_for_each_entry(de, &parent->d_subdirs, d_child) {
96 /* don't know what to do with negative dentries */ 96 /* don't know what to do with negative dentries */
97 if (de->d_inode ) 97 if (de->d_inode )
98 coda_flag_inode(de->d_inode, flag); 98 coda_flag_inode(de->d_inode, flag);
diff --git a/fs/coda/coda_linux.c b/fs/coda/coda_linux.c
index 1326d38960db..f1714cfb589c 100644
--- a/fs/coda/coda_linux.c
+++ b/fs/coda/coda_linux.c
@@ -40,12 +40,6 @@ int coda_iscontrol(const char *name, size_t length)
40 (strncmp(name, CODA_CONTROL, CODA_CONTROLLEN) == 0)); 40 (strncmp(name, CODA_CONTROL, CODA_CONTROLLEN) == 0));
41} 41}
42 42
43/* recognize /coda inode */
44int coda_isroot(struct inode *i)
45{
46 return ( i->i_sb->s_root->d_inode == i );
47}
48
49unsigned short coda_flags_to_cflags(unsigned short flags) 43unsigned short coda_flags_to_cflags(unsigned short flags)
50{ 44{
51 unsigned short coda_flags = 0; 45 unsigned short coda_flags = 0;
diff --git a/fs/coda/coda_linux.h b/fs/coda/coda_linux.h
index d42b725b1d21..d6f7a76a1f5b 100644
--- a/fs/coda/coda_linux.h
+++ b/fs/coda/coda_linux.h
@@ -52,7 +52,6 @@ int coda_setattr(struct dentry *, struct iattr *);
52 52
53/* this file: heloers */ 53/* this file: heloers */
54char *coda_f2s(struct CodaFid *f); 54char *coda_f2s(struct CodaFid *f);
55int coda_isroot(struct inode *i);
56int coda_iscontrol(const char *name, size_t length); 55int coda_iscontrol(const char *name, size_t length);
57 56
58void coda_vattr_to_iattr(struct inode *, struct coda_vattr *); 57void coda_vattr_to_iattr(struct inode *, struct coda_vattr *);
diff --git a/fs/coda/dir.c b/fs/coda/dir.c
index 9c3dedc000d1..7ff025966e4f 100644
--- a/fs/coda/dir.c
+++ b/fs/coda/dir.c
@@ -107,7 +107,7 @@ static struct dentry *coda_lookup(struct inode *dir, struct dentry *entry, unsig
107 } 107 }
108 108
109 /* control object, create inode on the fly */ 109 /* control object, create inode on the fly */
110 if (coda_isroot(dir) && coda_iscontrol(name, length)) { 110 if (is_root_inode(dir) && coda_iscontrol(name, length)) {
111 inode = coda_cnode_makectl(sb); 111 inode = coda_cnode_makectl(sb);
112 type = CODA_NOCACHE; 112 type = CODA_NOCACHE;
113 } else { 113 } else {
@@ -195,7 +195,7 @@ static int coda_create(struct inode *dir, struct dentry *de, umode_t mode, bool
195 struct CodaFid newfid; 195 struct CodaFid newfid;
196 struct coda_vattr attrs; 196 struct coda_vattr attrs;
197 197
198 if (coda_isroot(dir) && coda_iscontrol(name, length)) 198 if (is_root_inode(dir) && coda_iscontrol(name, length))
199 return -EPERM; 199 return -EPERM;
200 200
201 error = venus_create(dir->i_sb, coda_i2f(dir), name, length, 201 error = venus_create(dir->i_sb, coda_i2f(dir), name, length,
@@ -227,7 +227,7 @@ static int coda_mkdir(struct inode *dir, struct dentry *de, umode_t mode)
227 int error; 227 int error;
228 struct CodaFid newfid; 228 struct CodaFid newfid;
229 229
230 if (coda_isroot(dir) && coda_iscontrol(name, len)) 230 if (is_root_inode(dir) && coda_iscontrol(name, len))
231 return -EPERM; 231 return -EPERM;
232 232
233 attrs.va_mode = mode; 233 attrs.va_mode = mode;
@@ -261,7 +261,7 @@ static int coda_link(struct dentry *source_de, struct inode *dir_inode,
261 int len = de->d_name.len; 261 int len = de->d_name.len;
262 int error; 262 int error;
263 263
264 if (coda_isroot(dir_inode) && coda_iscontrol(name, len)) 264 if (is_root_inode(dir_inode) && coda_iscontrol(name, len))
265 return -EPERM; 265 return -EPERM;
266 266
267 error = venus_link(dir_inode->i_sb, coda_i2f(inode), 267 error = venus_link(dir_inode->i_sb, coda_i2f(inode),
@@ -287,7 +287,7 @@ static int coda_symlink(struct inode *dir_inode, struct dentry *de,
287 int symlen; 287 int symlen;
288 int error; 288 int error;
289 289
290 if (coda_isroot(dir_inode) && coda_iscontrol(name, len)) 290 if (is_root_inode(dir_inode) && coda_iscontrol(name, len))
291 return -EPERM; 291 return -EPERM;
292 292
293 symlen = strlen(symname); 293 symlen = strlen(symname);
@@ -507,7 +507,7 @@ static int coda_dentry_revalidate(struct dentry *de, unsigned int flags)
507 return -ECHILD; 507 return -ECHILD;
508 508
509 inode = de->d_inode; 509 inode = de->d_inode;
510 if (!inode || coda_isroot(inode)) 510 if (!inode || is_root_inode(inode))
511 goto out; 511 goto out;
512 if (is_bad_inode(inode)) 512 if (is_bad_inode(inode))
513 goto bad; 513 goto bad;
diff --git a/fs/compat.c b/fs/compat.c
index b13df99f3534..6fd272d455e4 100644
--- a/fs/compat.c
+++ b/fs/compat.c
@@ -847,10 +847,12 @@ struct compat_readdir_callback {
847 int result; 847 int result;
848}; 848};
849 849
850static int compat_fillonedir(void *__buf, const char *name, int namlen, 850static int compat_fillonedir(struct dir_context *ctx, const char *name,
851 loff_t offset, u64 ino, unsigned int d_type) 851 int namlen, loff_t offset, u64 ino,
852 unsigned int d_type)
852{ 853{
853 struct compat_readdir_callback *buf = __buf; 854 struct compat_readdir_callback *buf =
855 container_of(ctx, struct compat_readdir_callback, ctx);
854 struct compat_old_linux_dirent __user *dirent; 856 struct compat_old_linux_dirent __user *dirent;
855 compat_ulong_t d_ino; 857 compat_ulong_t d_ino;
856 858
@@ -915,11 +917,12 @@ struct compat_getdents_callback {
915 int error; 917 int error;
916}; 918};
917 919
918static int compat_filldir(void *__buf, const char *name, int namlen, 920static int compat_filldir(struct dir_context *ctx, const char *name, int namlen,
919 loff_t offset, u64 ino, unsigned int d_type) 921 loff_t offset, u64 ino, unsigned int d_type)
920{ 922{
921 struct compat_linux_dirent __user * dirent; 923 struct compat_linux_dirent __user * dirent;
922 struct compat_getdents_callback *buf = __buf; 924 struct compat_getdents_callback *buf =
925 container_of(ctx, struct compat_getdents_callback, ctx);
923 compat_ulong_t d_ino; 926 compat_ulong_t d_ino;
924 int reclen = ALIGN(offsetof(struct compat_linux_dirent, d_name) + 927 int reclen = ALIGN(offsetof(struct compat_linux_dirent, d_name) +
925 namlen + 2, sizeof(compat_long_t)); 928 namlen + 2, sizeof(compat_long_t));
@@ -1001,11 +1004,13 @@ struct compat_getdents_callback64 {
1001 int error; 1004 int error;
1002}; 1005};
1003 1006
1004static int compat_filldir64(void * __buf, const char * name, int namlen, loff_t offset, 1007static int compat_filldir64(struct dir_context *ctx, const char *name,
1005 u64 ino, unsigned int d_type) 1008 int namlen, loff_t offset, u64 ino,
1009 unsigned int d_type)
1006{ 1010{
1007 struct linux_dirent64 __user *dirent; 1011 struct linux_dirent64 __user *dirent;
1008 struct compat_getdents_callback64 *buf = __buf; 1012 struct compat_getdents_callback64 *buf =
1013 container_of(ctx, struct compat_getdents_callback64, ctx);
1009 int reclen = ALIGN(offsetof(struct linux_dirent64, d_name) + namlen + 1, 1014 int reclen = ALIGN(offsetof(struct linux_dirent64, d_name) + namlen + 1,
1010 sizeof(u64)); 1015 sizeof(u64));
1011 u64 off; 1016 u64 off;
diff --git a/fs/configfs/dir.c b/fs/configfs/dir.c
index 668dcabc5695..c9c298bd3058 100644
--- a/fs/configfs/dir.c
+++ b/fs/configfs/dir.c
@@ -386,7 +386,7 @@ static void remove_dir(struct dentry * d)
386 if (d->d_inode) 386 if (d->d_inode)
387 simple_rmdir(parent->d_inode,d); 387 simple_rmdir(parent->d_inode,d);
388 388
389 pr_debug(" o %s removing done (%d)\n",d->d_name.name, d_count(d)); 389 pr_debug(" o %pd removing done (%d)\n", d, d_count(d));
390 390
391 dput(parent); 391 dput(parent);
392} 392}
diff --git a/fs/dcache.c b/fs/dcache.c
index 5bc72b07fde2..e368d4f412f9 100644
--- a/fs/dcache.c
+++ b/fs/dcache.c
@@ -44,7 +44,7 @@
44/* 44/*
45 * Usage: 45 * Usage:
46 * dcache->d_inode->i_lock protects: 46 * dcache->d_inode->i_lock protects:
47 * - i_dentry, d_alias, d_inode of aliases 47 * - i_dentry, d_u.d_alias, d_inode of aliases
48 * dcache_hash_bucket lock protects: 48 * dcache_hash_bucket lock protects:
49 * - the dcache hash table 49 * - the dcache hash table
50 * s_anon bl list spinlock protects: 50 * s_anon bl list spinlock protects:
@@ -59,7 +59,7 @@
59 * - d_unhashed() 59 * - d_unhashed()
60 * - d_parent and d_subdirs 60 * - d_parent and d_subdirs
61 * - childrens' d_child and d_parent 61 * - childrens' d_child and d_parent
62 * - d_alias, d_inode 62 * - d_u.d_alias, d_inode
63 * 63 *
64 * Ordering: 64 * Ordering:
65 * dentry->d_inode->i_lock 65 * dentry->d_inode->i_lock
@@ -252,14 +252,12 @@ static void __d_free(struct rcu_head *head)
252{ 252{
253 struct dentry *dentry = container_of(head, struct dentry, d_u.d_rcu); 253 struct dentry *dentry = container_of(head, struct dentry, d_u.d_rcu);
254 254
255 WARN_ON(!hlist_unhashed(&dentry->d_alias));
256 kmem_cache_free(dentry_cache, dentry); 255 kmem_cache_free(dentry_cache, dentry);
257} 256}
258 257
259static void __d_free_external(struct rcu_head *head) 258static void __d_free_external(struct rcu_head *head)
260{ 259{
261 struct dentry *dentry = container_of(head, struct dentry, d_u.d_rcu); 260 struct dentry *dentry = container_of(head, struct dentry, d_u.d_rcu);
262 WARN_ON(!hlist_unhashed(&dentry->d_alias));
263 kfree(external_name(dentry)); 261 kfree(external_name(dentry));
264 kmem_cache_free(dentry_cache, dentry); 262 kmem_cache_free(dentry_cache, dentry);
265} 263}
@@ -271,6 +269,7 @@ static inline int dname_external(const struct dentry *dentry)
271 269
272static void dentry_free(struct dentry *dentry) 270static void dentry_free(struct dentry *dentry)
273{ 271{
272 WARN_ON(!hlist_unhashed(&dentry->d_u.d_alias));
274 if (unlikely(dname_external(dentry))) { 273 if (unlikely(dname_external(dentry))) {
275 struct external_name *p = external_name(dentry); 274 struct external_name *p = external_name(dentry);
276 if (likely(atomic_dec_and_test(&p->u.count))) { 275 if (likely(atomic_dec_and_test(&p->u.count))) {
@@ -311,7 +310,7 @@ static void dentry_iput(struct dentry * dentry)
311 struct inode *inode = dentry->d_inode; 310 struct inode *inode = dentry->d_inode;
312 if (inode) { 311 if (inode) {
313 dentry->d_inode = NULL; 312 dentry->d_inode = NULL;
314 hlist_del_init(&dentry->d_alias); 313 hlist_del_init(&dentry->d_u.d_alias);
315 spin_unlock(&dentry->d_lock); 314 spin_unlock(&dentry->d_lock);
316 spin_unlock(&inode->i_lock); 315 spin_unlock(&inode->i_lock);
317 if (!inode->i_nlink) 316 if (!inode->i_nlink)
@@ -336,7 +335,7 @@ static void dentry_unlink_inode(struct dentry * dentry)
336 struct inode *inode = dentry->d_inode; 335 struct inode *inode = dentry->d_inode;
337 __d_clear_type(dentry); 336 __d_clear_type(dentry);
338 dentry->d_inode = NULL; 337 dentry->d_inode = NULL;
339 hlist_del_init(&dentry->d_alias); 338 hlist_del_init(&dentry->d_u.d_alias);
340 dentry_rcuwalk_barrier(dentry); 339 dentry_rcuwalk_barrier(dentry);
341 spin_unlock(&dentry->d_lock); 340 spin_unlock(&dentry->d_lock);
342 spin_unlock(&inode->i_lock); 341 spin_unlock(&inode->i_lock);
@@ -496,7 +495,7 @@ static void __dentry_kill(struct dentry *dentry)
496 } 495 }
497 /* if it was on the hash then remove it */ 496 /* if it was on the hash then remove it */
498 __d_drop(dentry); 497 __d_drop(dentry);
499 list_del(&dentry->d_u.d_child); 498 __list_del_entry(&dentry->d_child);
500 /* 499 /*
501 * Inform d_walk() that we are no longer attached to the 500 * Inform d_walk() that we are no longer attached to the
502 * dentry tree 501 * dentry tree
@@ -722,7 +721,7 @@ static struct dentry *__d_find_alias(struct inode *inode)
722 721
723again: 722again:
724 discon_alias = NULL; 723 discon_alias = NULL;
725 hlist_for_each_entry(alias, &inode->i_dentry, d_alias) { 724 hlist_for_each_entry(alias, &inode->i_dentry, d_u.d_alias) {
726 spin_lock(&alias->d_lock); 725 spin_lock(&alias->d_lock);
727 if (S_ISDIR(inode->i_mode) || !d_unhashed(alias)) { 726 if (S_ISDIR(inode->i_mode) || !d_unhashed(alias)) {
728 if (IS_ROOT(alias) && 727 if (IS_ROOT(alias) &&
@@ -772,7 +771,7 @@ void d_prune_aliases(struct inode *inode)
772 struct dentry *dentry; 771 struct dentry *dentry;
773restart: 772restart:
774 spin_lock(&inode->i_lock); 773 spin_lock(&inode->i_lock);
775 hlist_for_each_entry(dentry, &inode->i_dentry, d_alias) { 774 hlist_for_each_entry(dentry, &inode->i_dentry, d_u.d_alias) {
776 spin_lock(&dentry->d_lock); 775 spin_lock(&dentry->d_lock);
777 if (!dentry->d_lockref.count) { 776 if (!dentry->d_lockref.count) {
778 struct dentry *parent = lock_parent(dentry); 777 struct dentry *parent = lock_parent(dentry);
@@ -1051,7 +1050,7 @@ repeat:
1051resume: 1050resume:
1052 while (next != &this_parent->d_subdirs) { 1051 while (next != &this_parent->d_subdirs) {
1053 struct list_head *tmp = next; 1052 struct list_head *tmp = next;
1054 struct dentry *dentry = list_entry(tmp, struct dentry, d_u.d_child); 1053 struct dentry *dentry = list_entry(tmp, struct dentry, d_child);
1055 next = tmp->next; 1054 next = tmp->next;
1056 1055
1057 spin_lock_nested(&dentry->d_lock, DENTRY_D_LOCK_NESTED); 1056 spin_lock_nested(&dentry->d_lock, DENTRY_D_LOCK_NESTED);
@@ -1083,33 +1082,31 @@ resume:
1083 /* 1082 /*
1084 * All done at this level ... ascend and resume the search. 1083 * All done at this level ... ascend and resume the search.
1085 */ 1084 */
1085 rcu_read_lock();
1086ascend:
1086 if (this_parent != parent) { 1087 if (this_parent != parent) {
1087 struct dentry *child = this_parent; 1088 struct dentry *child = this_parent;
1088 this_parent = child->d_parent; 1089 this_parent = child->d_parent;
1089 1090
1090 rcu_read_lock();
1091 spin_unlock(&child->d_lock); 1091 spin_unlock(&child->d_lock);
1092 spin_lock(&this_parent->d_lock); 1092 spin_lock(&this_parent->d_lock);
1093 1093
1094 /* 1094 /* might go back up the wrong parent if we have had a rename. */
1095 * might go back up the wrong parent if we have had a rename 1095 if (need_seqretry(&rename_lock, seq))
1096 * or deletion
1097 */
1098 if (this_parent != child->d_parent ||
1099 (child->d_flags & DCACHE_DENTRY_KILLED) ||
1100 need_seqretry(&rename_lock, seq)) {
1101 spin_unlock(&this_parent->d_lock);
1102 rcu_read_unlock();
1103 goto rename_retry; 1096 goto rename_retry;
1097 next = child->d_child.next;
1098 while (unlikely(child->d_flags & DCACHE_DENTRY_KILLED)) {
1099 if (next == &this_parent->d_subdirs)
1100 goto ascend;
1101 child = list_entry(next, struct dentry, d_child);
1102 next = next->next;
1104 } 1103 }
1105 rcu_read_unlock(); 1104 rcu_read_unlock();
1106 next = child->d_u.d_child.next;
1107 goto resume; 1105 goto resume;
1108 } 1106 }
1109 if (need_seqretry(&rename_lock, seq)) { 1107 if (need_seqretry(&rename_lock, seq))
1110 spin_unlock(&this_parent->d_lock);
1111 goto rename_retry; 1108 goto rename_retry;
1112 } 1109 rcu_read_unlock();
1113 if (finish) 1110 if (finish)
1114 finish(data); 1111 finish(data);
1115 1112
@@ -1119,6 +1116,9 @@ out_unlock:
1119 return; 1116 return;
1120 1117
1121rename_retry: 1118rename_retry:
1119 spin_unlock(&this_parent->d_lock);
1120 rcu_read_unlock();
1121 BUG_ON(seq & 1);
1122 if (!retry) 1122 if (!retry)
1123 return; 1123 return;
1124 seq = 1; 1124 seq = 1;
@@ -1455,8 +1455,8 @@ struct dentry *__d_alloc(struct super_block *sb, const struct qstr *name)
1455 INIT_HLIST_BL_NODE(&dentry->d_hash); 1455 INIT_HLIST_BL_NODE(&dentry->d_hash);
1456 INIT_LIST_HEAD(&dentry->d_lru); 1456 INIT_LIST_HEAD(&dentry->d_lru);
1457 INIT_LIST_HEAD(&dentry->d_subdirs); 1457 INIT_LIST_HEAD(&dentry->d_subdirs);
1458 INIT_HLIST_NODE(&dentry->d_alias); 1458 INIT_HLIST_NODE(&dentry->d_u.d_alias);
1459 INIT_LIST_HEAD(&dentry->d_u.d_child); 1459 INIT_LIST_HEAD(&dentry->d_child);
1460 d_set_d_op(dentry, dentry->d_sb->s_d_op); 1460 d_set_d_op(dentry, dentry->d_sb->s_d_op);
1461 1461
1462 this_cpu_inc(nr_dentry); 1462 this_cpu_inc(nr_dentry);
@@ -1486,7 +1486,7 @@ struct dentry *d_alloc(struct dentry * parent, const struct qstr *name)
1486 */ 1486 */
1487 __dget_dlock(parent); 1487 __dget_dlock(parent);
1488 dentry->d_parent = parent; 1488 dentry->d_parent = parent;
1489 list_add(&dentry->d_u.d_child, &parent->d_subdirs); 1489 list_add(&dentry->d_child, &parent->d_subdirs);
1490 spin_unlock(&parent->d_lock); 1490 spin_unlock(&parent->d_lock);
1491 1491
1492 return dentry; 1492 return dentry;
@@ -1579,7 +1579,7 @@ static void __d_instantiate(struct dentry *dentry, struct inode *inode)
1579 spin_lock(&dentry->d_lock); 1579 spin_lock(&dentry->d_lock);
1580 __d_set_type(dentry, add_flags); 1580 __d_set_type(dentry, add_flags);
1581 if (inode) 1581 if (inode)
1582 hlist_add_head(&dentry->d_alias, &inode->i_dentry); 1582 hlist_add_head(&dentry->d_u.d_alias, &inode->i_dentry);
1583 dentry->d_inode = inode; 1583 dentry->d_inode = inode;
1584 dentry_rcuwalk_barrier(dentry); 1584 dentry_rcuwalk_barrier(dentry);
1585 spin_unlock(&dentry->d_lock); 1585 spin_unlock(&dentry->d_lock);
@@ -1603,7 +1603,7 @@ static void __d_instantiate(struct dentry *dentry, struct inode *inode)
1603 1603
1604void d_instantiate(struct dentry *entry, struct inode * inode) 1604void d_instantiate(struct dentry *entry, struct inode * inode)
1605{ 1605{
1606 BUG_ON(!hlist_unhashed(&entry->d_alias)); 1606 BUG_ON(!hlist_unhashed(&entry->d_u.d_alias));
1607 if (inode) 1607 if (inode)
1608 spin_lock(&inode->i_lock); 1608 spin_lock(&inode->i_lock);
1609 __d_instantiate(entry, inode); 1609 __d_instantiate(entry, inode);
@@ -1642,7 +1642,7 @@ static struct dentry *__d_instantiate_unique(struct dentry *entry,
1642 return NULL; 1642 return NULL;
1643 } 1643 }
1644 1644
1645 hlist_for_each_entry(alias, &inode->i_dentry, d_alias) { 1645 hlist_for_each_entry(alias, &inode->i_dentry, d_u.d_alias) {
1646 /* 1646 /*
1647 * Don't need alias->d_lock here, because aliases with 1647 * Don't need alias->d_lock here, because aliases with
1648 * d_parent == entry->d_parent are not subject to name or 1648 * d_parent == entry->d_parent are not subject to name or
@@ -1668,7 +1668,7 @@ struct dentry *d_instantiate_unique(struct dentry *entry, struct inode *inode)
1668{ 1668{
1669 struct dentry *result; 1669 struct dentry *result;
1670 1670
1671 BUG_ON(!hlist_unhashed(&entry->d_alias)); 1671 BUG_ON(!hlist_unhashed(&entry->d_u.d_alias));
1672 1672
1673 if (inode) 1673 if (inode)
1674 spin_lock(&inode->i_lock); 1674 spin_lock(&inode->i_lock);
@@ -1699,7 +1699,7 @@ EXPORT_SYMBOL(d_instantiate_unique);
1699 */ 1699 */
1700int d_instantiate_no_diralias(struct dentry *entry, struct inode *inode) 1700int d_instantiate_no_diralias(struct dentry *entry, struct inode *inode)
1701{ 1701{
1702 BUG_ON(!hlist_unhashed(&entry->d_alias)); 1702 BUG_ON(!hlist_unhashed(&entry->d_u.d_alias));
1703 1703
1704 spin_lock(&inode->i_lock); 1704 spin_lock(&inode->i_lock);
1705 if (S_ISDIR(inode->i_mode) && !hlist_empty(&inode->i_dentry)) { 1705 if (S_ISDIR(inode->i_mode) && !hlist_empty(&inode->i_dentry)) {
@@ -1738,7 +1738,7 @@ static struct dentry * __d_find_any_alias(struct inode *inode)
1738 1738
1739 if (hlist_empty(&inode->i_dentry)) 1739 if (hlist_empty(&inode->i_dentry))
1740 return NULL; 1740 return NULL;
1741 alias = hlist_entry(inode->i_dentry.first, struct dentry, d_alias); 1741 alias = hlist_entry(inode->i_dentry.first, struct dentry, d_u.d_alias);
1742 __dget(alias); 1742 __dget(alias);
1743 return alias; 1743 return alias;
1744} 1744}
@@ -1800,7 +1800,7 @@ static struct dentry *__d_obtain_alias(struct inode *inode, int disconnected)
1800 spin_lock(&tmp->d_lock); 1800 spin_lock(&tmp->d_lock);
1801 tmp->d_inode = inode; 1801 tmp->d_inode = inode;
1802 tmp->d_flags |= add_flags; 1802 tmp->d_flags |= add_flags;
1803 hlist_add_head(&tmp->d_alias, &inode->i_dentry); 1803 hlist_add_head(&tmp->d_u.d_alias, &inode->i_dentry);
1804 hlist_bl_lock(&tmp->d_sb->s_anon); 1804 hlist_bl_lock(&tmp->d_sb->s_anon);
1805 hlist_bl_add_head(&tmp->d_hash, &tmp->d_sb->s_anon); 1805 hlist_bl_add_head(&tmp->d_hash, &tmp->d_sb->s_anon);
1806 hlist_bl_unlock(&tmp->d_sb->s_anon); 1806 hlist_bl_unlock(&tmp->d_sb->s_anon);
@@ -1889,51 +1889,19 @@ struct dentry *d_add_ci(struct dentry *dentry, struct inode *inode,
1889 * if not go ahead and create it now. 1889 * if not go ahead and create it now.
1890 */ 1890 */
1891 found = d_hash_and_lookup(dentry->d_parent, name); 1891 found = d_hash_and_lookup(dentry->d_parent, name);
1892 if (unlikely(IS_ERR(found)))
1893 goto err_out;
1894 if (!found) { 1892 if (!found) {
1895 new = d_alloc(dentry->d_parent, name); 1893 new = d_alloc(dentry->d_parent, name);
1896 if (!new) { 1894 if (!new) {
1897 found = ERR_PTR(-ENOMEM); 1895 found = ERR_PTR(-ENOMEM);
1898 goto err_out; 1896 } else {
1899 } 1897 found = d_splice_alias(inode, new);
1900 1898 if (found) {
1901 found = d_splice_alias(inode, new); 1899 dput(new);
1902 if (found) { 1900 return found;
1903 dput(new); 1901 }
1904 return found; 1902 return new;
1905 }
1906 return new;
1907 }
1908
1909 /*
1910 * If a matching dentry exists, and it's not negative use it.
1911 *
1912 * Decrement the reference count to balance the iget() done
1913 * earlier on.
1914 */
1915 if (found->d_inode) {
1916 if (unlikely(found->d_inode != inode)) {
1917 /* This can't happen because bad inodes are unhashed. */
1918 BUG_ON(!is_bad_inode(inode));
1919 BUG_ON(!is_bad_inode(found->d_inode));
1920 } 1903 }
1921 iput(inode);
1922 return found;
1923 } 1904 }
1924
1925 /*
1926 * Negative dentry: instantiate it unless the inode is a directory and
1927 * already has a dentry.
1928 */
1929 new = d_splice_alias(inode, found);
1930 if (new) {
1931 dput(found);
1932 found = new;
1933 }
1934 return found;
1935
1936err_out:
1937 iput(inode); 1905 iput(inode);
1938 return found; 1906 return found;
1939} 1907}
@@ -2235,7 +2203,7 @@ int d_validate(struct dentry *dentry, struct dentry *dparent)
2235 struct dentry *child; 2203 struct dentry *child;
2236 2204
2237 spin_lock(&dparent->d_lock); 2205 spin_lock(&dparent->d_lock);
2238 list_for_each_entry(child, &dparent->d_subdirs, d_u.d_child) { 2206 list_for_each_entry(child, &dparent->d_subdirs, d_child) {
2239 if (dentry == child) { 2207 if (dentry == child) {
2240 spin_lock_nested(&dentry->d_lock, DENTRY_D_LOCK_NESTED); 2208 spin_lock_nested(&dentry->d_lock, DENTRY_D_LOCK_NESTED);
2241 __dget_dlock(dentry); 2209 __dget_dlock(dentry);
@@ -2393,6 +2361,8 @@ static void swap_names(struct dentry *dentry, struct dentry *target)
2393 */ 2361 */
2394 unsigned int i; 2362 unsigned int i;
2395 BUILD_BUG_ON(!IS_ALIGNED(DNAME_INLINE_LEN, sizeof(long))); 2363 BUILD_BUG_ON(!IS_ALIGNED(DNAME_INLINE_LEN, sizeof(long)));
2364 kmemcheck_mark_initialized(dentry->d_iname, DNAME_INLINE_LEN);
2365 kmemcheck_mark_initialized(target->d_iname, DNAME_INLINE_LEN);
2396 for (i = 0; i < DNAME_INLINE_LEN / sizeof(long); i++) { 2366 for (i = 0; i < DNAME_INLINE_LEN / sizeof(long); i++) {
2397 swap(((long *) &dentry->d_iname)[i], 2367 swap(((long *) &dentry->d_iname)[i],
2398 ((long *) &target->d_iname)[i]); 2368 ((long *) &target->d_iname)[i]);
@@ -2526,13 +2496,13 @@ static void __d_move(struct dentry *dentry, struct dentry *target,
2526 /* splicing a tree */ 2496 /* splicing a tree */
2527 dentry->d_parent = target->d_parent; 2497 dentry->d_parent = target->d_parent;
2528 target->d_parent = target; 2498 target->d_parent = target;
2529 list_del_init(&target->d_u.d_child); 2499 list_del_init(&target->d_child);
2530 list_move(&dentry->d_u.d_child, &dentry->d_parent->d_subdirs); 2500 list_move(&dentry->d_child, &dentry->d_parent->d_subdirs);
2531 } else { 2501 } else {
2532 /* swapping two dentries */ 2502 /* swapping two dentries */
2533 swap(dentry->d_parent, target->d_parent); 2503 swap(dentry->d_parent, target->d_parent);
2534 list_move(&target->d_u.d_child, &target->d_parent->d_subdirs); 2504 list_move(&target->d_child, &target->d_parent->d_subdirs);
2535 list_move(&dentry->d_u.d_child, &dentry->d_parent->d_subdirs); 2505 list_move(&dentry->d_child, &dentry->d_parent->d_subdirs);
2536 if (exchange) 2506 if (exchange)
2537 fsnotify_d_move(target); 2507 fsnotify_d_move(target);
2538 fsnotify_d_move(dentry); 2508 fsnotify_d_move(dentry);
@@ -2608,11 +2578,11 @@ struct dentry *d_ancestor(struct dentry *p1, struct dentry *p2)
2608 * Note: If ever the locking in lock_rename() changes, then please 2578 * Note: If ever the locking in lock_rename() changes, then please
2609 * remember to update this too... 2579 * remember to update this too...
2610 */ 2580 */
2611static struct dentry *__d_unalias(struct inode *inode, 2581static int __d_unalias(struct inode *inode,
2612 struct dentry *dentry, struct dentry *alias) 2582 struct dentry *dentry, struct dentry *alias)
2613{ 2583{
2614 struct mutex *m1 = NULL, *m2 = NULL; 2584 struct mutex *m1 = NULL, *m2 = NULL;
2615 struct dentry *ret = ERR_PTR(-EBUSY); 2585 int ret = -EBUSY;
2616 2586
2617 /* If alias and dentry share a parent, then no extra locks required */ 2587 /* If alias and dentry share a parent, then no extra locks required */
2618 if (alias->d_parent == dentry->d_parent) 2588 if (alias->d_parent == dentry->d_parent)
@@ -2627,7 +2597,7 @@ static struct dentry *__d_unalias(struct inode *inode,
2627 m2 = &alias->d_parent->d_inode->i_mutex; 2597 m2 = &alias->d_parent->d_inode->i_mutex;
2628out_unalias: 2598out_unalias:
2629 __d_move(alias, dentry, false); 2599 __d_move(alias, dentry, false);
2630 ret = alias; 2600 ret = 0;
2631out_err: 2601out_err:
2632 spin_unlock(&inode->i_lock); 2602 spin_unlock(&inode->i_lock);
2633 if (m2) 2603 if (m2)
@@ -2662,130 +2632,57 @@ out_err:
2662 */ 2632 */
2663struct dentry *d_splice_alias(struct inode *inode, struct dentry *dentry) 2633struct dentry *d_splice_alias(struct inode *inode, struct dentry *dentry)
2664{ 2634{
2665 struct dentry *new = NULL;
2666
2667 if (IS_ERR(inode)) 2635 if (IS_ERR(inode))
2668 return ERR_CAST(inode); 2636 return ERR_CAST(inode);
2669 2637
2670 if (inode && S_ISDIR(inode->i_mode)) {
2671 spin_lock(&inode->i_lock);
2672 new = __d_find_any_alias(inode);
2673 if (new) {
2674 if (!IS_ROOT(new)) {
2675 spin_unlock(&inode->i_lock);
2676 dput(new);
2677 iput(inode);
2678 return ERR_PTR(-EIO);
2679 }
2680 if (d_ancestor(new, dentry)) {
2681 spin_unlock(&inode->i_lock);
2682 dput(new);
2683 iput(inode);
2684 return ERR_PTR(-EIO);
2685 }
2686 write_seqlock(&rename_lock);
2687 __d_move(new, dentry, false);
2688 write_sequnlock(&rename_lock);
2689 spin_unlock(&inode->i_lock);
2690 security_d_instantiate(new, inode);
2691 iput(inode);
2692 } else {
2693 /* already taking inode->i_lock, so d_add() by hand */
2694 __d_instantiate(dentry, inode);
2695 spin_unlock(&inode->i_lock);
2696 security_d_instantiate(dentry, inode);
2697 d_rehash(dentry);
2698 }
2699 } else {
2700 d_instantiate(dentry, inode);
2701 if (d_unhashed(dentry))
2702 d_rehash(dentry);
2703 }
2704 return new;
2705}
2706EXPORT_SYMBOL(d_splice_alias);
2707
2708/**
2709 * d_materialise_unique - introduce an inode into the tree
2710 * @dentry: candidate dentry
2711 * @inode: inode to bind to the dentry, to which aliases may be attached
2712 *
2713 * Introduces an dentry into the tree, substituting an extant disconnected
2714 * root directory alias in its place if there is one. Caller must hold the
2715 * i_mutex of the parent directory.
2716 */
2717struct dentry *d_materialise_unique(struct dentry *dentry, struct inode *inode)
2718{
2719 struct dentry *actual;
2720
2721 BUG_ON(!d_unhashed(dentry)); 2638 BUG_ON(!d_unhashed(dentry));
2722 2639
2723 if (!inode) { 2640 if (!inode) {
2724 actual = dentry;
2725 __d_instantiate(dentry, NULL); 2641 __d_instantiate(dentry, NULL);
2726 d_rehash(actual); 2642 goto out;
2727 goto out_nolock;
2728 } 2643 }
2729
2730 spin_lock(&inode->i_lock); 2644 spin_lock(&inode->i_lock);
2731
2732 if (S_ISDIR(inode->i_mode)) { 2645 if (S_ISDIR(inode->i_mode)) {
2733 struct dentry *alias; 2646 struct dentry *new = __d_find_any_alias(inode);
2734 2647 if (unlikely(new)) {
2735 /* Does an aliased dentry already exist? */
2736 alias = __d_find_alias(inode);
2737 if (alias) {
2738 actual = alias;
2739 write_seqlock(&rename_lock); 2648 write_seqlock(&rename_lock);
2740 2649 if (unlikely(d_ancestor(new, dentry))) {
2741 if (d_ancestor(alias, dentry)) { 2650 write_sequnlock(&rename_lock);
2742 /* Check for loops */
2743 actual = ERR_PTR(-ELOOP);
2744 spin_unlock(&inode->i_lock); 2651 spin_unlock(&inode->i_lock);
2745 } else if (IS_ROOT(alias)) { 2652 dput(new);
2746 /* Is this an anonymous mountpoint that we 2653 new = ERR_PTR(-ELOOP);
2747 * could splice into our tree? */ 2654 pr_warn_ratelimited(
2748 __d_move(alias, dentry, false); 2655 "VFS: Lookup of '%s' in %s %s"
2656 " would have caused loop\n",
2657 dentry->d_name.name,
2658 inode->i_sb->s_type->name,
2659 inode->i_sb->s_id);
2660 } else if (!IS_ROOT(new)) {
2661 int err = __d_unalias(inode, dentry, new);
2749 write_sequnlock(&rename_lock); 2662 write_sequnlock(&rename_lock);
2750 goto found; 2663 if (err) {
2664 dput(new);
2665 new = ERR_PTR(err);
2666 }
2751 } else { 2667 } else {
2752 /* Nope, but we must(!) avoid directory 2668 __d_move(new, dentry, false);
2753 * aliasing. This drops inode->i_lock */ 2669 write_sequnlock(&rename_lock);
2754 actual = __d_unalias(inode, dentry, alias); 2670 spin_unlock(&inode->i_lock);
2755 } 2671 security_d_instantiate(new, inode);
2756 write_sequnlock(&rename_lock);
2757 if (IS_ERR(actual)) {
2758 if (PTR_ERR(actual) == -ELOOP)
2759 pr_warn_ratelimited(
2760 "VFS: Lookup of '%s' in %s %s"
2761 " would have caused loop\n",
2762 dentry->d_name.name,
2763 inode->i_sb->s_type->name,
2764 inode->i_sb->s_id);
2765 dput(alias);
2766 } 2672 }
2767 goto out_nolock; 2673 iput(inode);
2674 return new;
2768 } 2675 }
2769 } 2676 }
2770 2677 /* already taking inode->i_lock, so d_add() by hand */
2771 /* Add a unique reference */ 2678 __d_instantiate(dentry, inode);
2772 actual = __d_instantiate_unique(dentry, inode);
2773 if (!actual)
2774 actual = dentry;
2775
2776 d_rehash(actual);
2777found:
2778 spin_unlock(&inode->i_lock); 2679 spin_unlock(&inode->i_lock);
2779out_nolock: 2680out:
2780 if (actual == dentry) { 2681 security_d_instantiate(dentry, inode);
2781 security_d_instantiate(dentry, inode); 2682 d_rehash(dentry);
2782 return NULL; 2683 return NULL;
2783 }
2784
2785 iput(inode);
2786 return actual;
2787} 2684}
2788EXPORT_SYMBOL_GPL(d_materialise_unique); 2685EXPORT_SYMBOL(d_splice_alias);
2789 2686
2790static int prepend(char **buffer, int *buflen, const char *str, int namelen) 2687static int prepend(char **buffer, int *buflen, const char *str, int namelen)
2791{ 2688{
@@ -3321,7 +3218,7 @@ void d_tmpfile(struct dentry *dentry, struct inode *inode)
3321{ 3218{
3322 inode_dec_link_count(inode); 3219 inode_dec_link_count(inode);
3323 BUG_ON(dentry->d_name.name != dentry->d_iname || 3220 BUG_ON(dentry->d_name.name != dentry->d_iname ||
3324 !hlist_unhashed(&dentry->d_alias) || 3221 !hlist_unhashed(&dentry->d_u.d_alias) ||
3325 !d_unlinked(dentry)); 3222 !d_unlinked(dentry));
3326 spin_lock(&dentry->d_parent->d_lock); 3223 spin_lock(&dentry->d_parent->d_lock);
3327 spin_lock_nested(&dentry->d_lock, DENTRY_D_LOCK_NESTED); 3224 spin_lock_nested(&dentry->d_lock, DENTRY_D_LOCK_NESTED);
diff --git a/fs/debugfs/file.c b/fs/debugfs/file.c
index 76c08c2beb2f..8e0f2f410189 100644
--- a/fs/debugfs/file.c
+++ b/fs/debugfs/file.c
@@ -692,18 +692,19 @@ EXPORT_SYMBOL_GPL(debugfs_create_u32_array);
692 * because some peripherals have several blocks of identical registers, 692 * because some peripherals have several blocks of identical registers,
693 * for example configuration of dma channels 693 * for example configuration of dma channels
694 */ 694 */
695int debugfs_print_regs32(struct seq_file *s, const struct debugfs_reg32 *regs, 695void debugfs_print_regs32(struct seq_file *s, const struct debugfs_reg32 *regs,
696 int nregs, void __iomem *base, char *prefix) 696 int nregs, void __iomem *base, char *prefix)
697{ 697{
698 int i, ret = 0; 698 int i;
699 699
700 for (i = 0; i < nregs; i++, regs++) { 700 for (i = 0; i < nregs; i++, regs++) {
701 if (prefix) 701 if (prefix)
702 ret += seq_printf(s, "%s", prefix); 702 seq_printf(s, "%s", prefix);
703 ret += seq_printf(s, "%s = 0x%08x\n", regs->name, 703 seq_printf(s, "%s = 0x%08x\n", regs->name,
704 readl(base + regs->offset)); 704 readl(base + regs->offset));
705 if (seq_has_overflowed(s))
706 break;
705 } 707 }
706 return ret;
707} 708}
708EXPORT_SYMBOL_GPL(debugfs_print_regs32); 709EXPORT_SYMBOL_GPL(debugfs_print_regs32);
709 710
diff --git a/fs/debugfs/inode.c b/fs/debugfs/inode.c
index 1e3b99d3db0d..05f2960ed7c3 100644
--- a/fs/debugfs/inode.c
+++ b/fs/debugfs/inode.c
@@ -553,7 +553,7 @@ void debugfs_remove_recursive(struct dentry *dentry)
553 * use the d_u.d_child as the rcu head and corrupt this list. 553 * use the d_u.d_child as the rcu head and corrupt this list.
554 */ 554 */
555 spin_lock(&parent->d_lock); 555 spin_lock(&parent->d_lock);
556 list_for_each_entry(child, &parent->d_subdirs, d_u.d_child) { 556 list_for_each_entry(child, &parent->d_subdirs, d_child) {
557 if (!debugfs_positive(child)) 557 if (!debugfs_positive(child))
558 continue; 558 continue;
559 559
diff --git a/fs/dlm/debug_fs.c b/fs/dlm/debug_fs.c
index 1323c568e362..eea64912c9c0 100644
--- a/fs/dlm/debug_fs.c
+++ b/fs/dlm/debug_fs.c
@@ -48,8 +48,8 @@ static char *print_lockmode(int mode)
48 } 48 }
49} 49}
50 50
51static int print_format1_lock(struct seq_file *s, struct dlm_lkb *lkb, 51static void print_format1_lock(struct seq_file *s, struct dlm_lkb *lkb,
52 struct dlm_rsb *res) 52 struct dlm_rsb *res)
53{ 53{
54 seq_printf(s, "%08x %s", lkb->lkb_id, print_lockmode(lkb->lkb_grmode)); 54 seq_printf(s, "%08x %s", lkb->lkb_id, print_lockmode(lkb->lkb_grmode));
55 55
@@ -68,21 +68,17 @@ static int print_format1_lock(struct seq_file *s, struct dlm_lkb *lkb,
68 if (lkb->lkb_wait_type) 68 if (lkb->lkb_wait_type)
69 seq_printf(s, " wait_type: %d", lkb->lkb_wait_type); 69 seq_printf(s, " wait_type: %d", lkb->lkb_wait_type);
70 70
71 return seq_puts(s, "\n"); 71 seq_puts(s, "\n");
72} 72}
73 73
74static int print_format1(struct dlm_rsb *res, struct seq_file *s) 74static void print_format1(struct dlm_rsb *res, struct seq_file *s)
75{ 75{
76 struct dlm_lkb *lkb; 76 struct dlm_lkb *lkb;
77 int i, lvblen = res->res_ls->ls_lvblen, recover_list, root_list; 77 int i, lvblen = res->res_ls->ls_lvblen, recover_list, root_list;
78 int rv;
79 78
80 lock_rsb(res); 79 lock_rsb(res);
81 80
82 rv = seq_printf(s, "\nResource %p Name (len=%d) \"", 81 seq_printf(s, "\nResource %p Name (len=%d) \"", res, res->res_length);
83 res, res->res_length);
84 if (rv)
85 goto out;
86 82
87 for (i = 0; i < res->res_length; i++) { 83 for (i = 0; i < res->res_length; i++) {
88 if (isprint(res->res_name[i])) 84 if (isprint(res->res_name[i]))
@@ -92,17 +88,16 @@ static int print_format1(struct dlm_rsb *res, struct seq_file *s)
92 } 88 }
93 89
94 if (res->res_nodeid > 0) 90 if (res->res_nodeid > 0)
95 rv = seq_printf(s, "\"\nLocal Copy, Master is node %d\n", 91 seq_printf(s, "\"\nLocal Copy, Master is node %d\n",
96 res->res_nodeid); 92 res->res_nodeid);
97 else if (res->res_nodeid == 0) 93 else if (res->res_nodeid == 0)
98 rv = seq_puts(s, "\"\nMaster Copy\n"); 94 seq_puts(s, "\"\nMaster Copy\n");
99 else if (res->res_nodeid == -1) 95 else if (res->res_nodeid == -1)
100 rv = seq_printf(s, "\"\nLooking up master (lkid %x)\n", 96 seq_printf(s, "\"\nLooking up master (lkid %x)\n",
101 res->res_first_lkid); 97 res->res_first_lkid);
102 else 98 else
103 rv = seq_printf(s, "\"\nInvalid master %d\n", 99 seq_printf(s, "\"\nInvalid master %d\n", res->res_nodeid);
104 res->res_nodeid); 100 if (seq_has_overflowed(s))
105 if (rv)
106 goto out; 101 goto out;
107 102
108 /* Print the LVB: */ 103 /* Print the LVB: */
@@ -116,8 +111,8 @@ static int print_format1(struct dlm_rsb *res, struct seq_file *s)
116 } 111 }
117 if (rsb_flag(res, RSB_VALNOTVALID)) 112 if (rsb_flag(res, RSB_VALNOTVALID))
118 seq_puts(s, " (INVALID)"); 113 seq_puts(s, " (INVALID)");
119 rv = seq_puts(s, "\n"); 114 seq_puts(s, "\n");
120 if (rv) 115 if (seq_has_overflowed(s))
121 goto out; 116 goto out;
122 } 117 }
123 118
@@ -125,32 +120,30 @@ static int print_format1(struct dlm_rsb *res, struct seq_file *s)
125 recover_list = !list_empty(&res->res_recover_list); 120 recover_list = !list_empty(&res->res_recover_list);
126 121
127 if (root_list || recover_list) { 122 if (root_list || recover_list) {
128 rv = seq_printf(s, "Recovery: root %d recover %d flags %lx " 123 seq_printf(s, "Recovery: root %d recover %d flags %lx count %d\n",
129 "count %d\n", root_list, recover_list, 124 root_list, recover_list,
130 res->res_flags, res->res_recover_locks_count); 125 res->res_flags, res->res_recover_locks_count);
131 if (rv)
132 goto out;
133 } 126 }
134 127
135 /* Print the locks attached to this resource */ 128 /* Print the locks attached to this resource */
136 seq_puts(s, "Granted Queue\n"); 129 seq_puts(s, "Granted Queue\n");
137 list_for_each_entry(lkb, &res->res_grantqueue, lkb_statequeue) { 130 list_for_each_entry(lkb, &res->res_grantqueue, lkb_statequeue) {
138 rv = print_format1_lock(s, lkb, res); 131 print_format1_lock(s, lkb, res);
139 if (rv) 132 if (seq_has_overflowed(s))
140 goto out; 133 goto out;
141 } 134 }
142 135
143 seq_puts(s, "Conversion Queue\n"); 136 seq_puts(s, "Conversion Queue\n");
144 list_for_each_entry(lkb, &res->res_convertqueue, lkb_statequeue) { 137 list_for_each_entry(lkb, &res->res_convertqueue, lkb_statequeue) {
145 rv = print_format1_lock(s, lkb, res); 138 print_format1_lock(s, lkb, res);
146 if (rv) 139 if (seq_has_overflowed(s))
147 goto out; 140 goto out;
148 } 141 }
149 142
150 seq_puts(s, "Waiting Queue\n"); 143 seq_puts(s, "Waiting Queue\n");
151 list_for_each_entry(lkb, &res->res_waitqueue, lkb_statequeue) { 144 list_for_each_entry(lkb, &res->res_waitqueue, lkb_statequeue) {
152 rv = print_format1_lock(s, lkb, res); 145 print_format1_lock(s, lkb, res);
153 if (rv) 146 if (seq_has_overflowed(s))
154 goto out; 147 goto out;
155 } 148 }
156 149
@@ -159,23 +152,23 @@ static int print_format1(struct dlm_rsb *res, struct seq_file *s)
159 152
160 seq_puts(s, "Lookup Queue\n"); 153 seq_puts(s, "Lookup Queue\n");
161 list_for_each_entry(lkb, &res->res_lookup, lkb_rsb_lookup) { 154 list_for_each_entry(lkb, &res->res_lookup, lkb_rsb_lookup) {
162 rv = seq_printf(s, "%08x %s", lkb->lkb_id, 155 seq_printf(s, "%08x %s",
163 print_lockmode(lkb->lkb_rqmode)); 156 lkb->lkb_id, print_lockmode(lkb->lkb_rqmode));
164 if (lkb->lkb_wait_type) 157 if (lkb->lkb_wait_type)
165 seq_printf(s, " wait_type: %d", lkb->lkb_wait_type); 158 seq_printf(s, " wait_type: %d", lkb->lkb_wait_type);
166 rv = seq_puts(s, "\n"); 159 seq_puts(s, "\n");
160 if (seq_has_overflowed(s))
161 goto out;
167 } 162 }
168 out: 163 out:
169 unlock_rsb(res); 164 unlock_rsb(res);
170 return rv;
171} 165}
172 166
173static int print_format2_lock(struct seq_file *s, struct dlm_lkb *lkb, 167static void print_format2_lock(struct seq_file *s, struct dlm_lkb *lkb,
174 struct dlm_rsb *r) 168 struct dlm_rsb *r)
175{ 169{
176 u64 xid = 0; 170 u64 xid = 0;
177 u64 us; 171 u64 us;
178 int rv;
179 172
180 if (lkb->lkb_flags & DLM_IFL_USER) { 173 if (lkb->lkb_flags & DLM_IFL_USER) {
181 if (lkb->lkb_ua) 174 if (lkb->lkb_ua)
@@ -188,103 +181,97 @@ static int print_format2_lock(struct seq_file *s, struct dlm_lkb *lkb,
188 /* id nodeid remid pid xid exflags flags sts grmode rqmode time_us 181 /* id nodeid remid pid xid exflags flags sts grmode rqmode time_us
189 r_nodeid r_len r_name */ 182 r_nodeid r_len r_name */
190 183
191 rv = seq_printf(s, "%x %d %x %u %llu %x %x %d %d %d %llu %u %d \"%s\"\n", 184 seq_printf(s, "%x %d %x %u %llu %x %x %d %d %d %llu %u %d \"%s\"\n",
192 lkb->lkb_id, 185 lkb->lkb_id,
193 lkb->lkb_nodeid, 186 lkb->lkb_nodeid,
194 lkb->lkb_remid, 187 lkb->lkb_remid,
195 lkb->lkb_ownpid, 188 lkb->lkb_ownpid,
196 (unsigned long long)xid, 189 (unsigned long long)xid,
197 lkb->lkb_exflags, 190 lkb->lkb_exflags,
198 lkb->lkb_flags, 191 lkb->lkb_flags,
199 lkb->lkb_status, 192 lkb->lkb_status,
200 lkb->lkb_grmode, 193 lkb->lkb_grmode,
201 lkb->lkb_rqmode, 194 lkb->lkb_rqmode,
202 (unsigned long long)us, 195 (unsigned long long)us,
203 r->res_nodeid, 196 r->res_nodeid,
204 r->res_length, 197 r->res_length,
205 r->res_name); 198 r->res_name);
206 return rv;
207} 199}
208 200
209static int print_format2(struct dlm_rsb *r, struct seq_file *s) 201static void print_format2(struct dlm_rsb *r, struct seq_file *s)
210{ 202{
211 struct dlm_lkb *lkb; 203 struct dlm_lkb *lkb;
212 int rv = 0;
213 204
214 lock_rsb(r); 205 lock_rsb(r);
215 206
216 list_for_each_entry(lkb, &r->res_grantqueue, lkb_statequeue) { 207 list_for_each_entry(lkb, &r->res_grantqueue, lkb_statequeue) {
217 rv = print_format2_lock(s, lkb, r); 208 print_format2_lock(s, lkb, r);
218 if (rv) 209 if (seq_has_overflowed(s))
219 goto out; 210 goto out;
220 } 211 }
221 212
222 list_for_each_entry(lkb, &r->res_convertqueue, lkb_statequeue) { 213 list_for_each_entry(lkb, &r->res_convertqueue, lkb_statequeue) {
223 rv = print_format2_lock(s, lkb, r); 214 print_format2_lock(s, lkb, r);
224 if (rv) 215 if (seq_has_overflowed(s))
225 goto out; 216 goto out;
226 } 217 }
227 218
228 list_for_each_entry(lkb, &r->res_waitqueue, lkb_statequeue) { 219 list_for_each_entry(lkb, &r->res_waitqueue, lkb_statequeue) {
229 rv = print_format2_lock(s, lkb, r); 220 print_format2_lock(s, lkb, r);
230 if (rv) 221 if (seq_has_overflowed(s))
231 goto out; 222 goto out;
232 } 223 }
233 out: 224 out:
234 unlock_rsb(r); 225 unlock_rsb(r);
235 return rv;
236} 226}
237 227
238static int print_format3_lock(struct seq_file *s, struct dlm_lkb *lkb, 228static void print_format3_lock(struct seq_file *s, struct dlm_lkb *lkb,
239 int rsb_lookup) 229 int rsb_lookup)
240{ 230{
241 u64 xid = 0; 231 u64 xid = 0;
242 int rv;
243 232
244 if (lkb->lkb_flags & DLM_IFL_USER) { 233 if (lkb->lkb_flags & DLM_IFL_USER) {
245 if (lkb->lkb_ua) 234 if (lkb->lkb_ua)
246 xid = lkb->lkb_ua->xid; 235 xid = lkb->lkb_ua->xid;
247 } 236 }
248 237
249 rv = seq_printf(s, "lkb %x %d %x %u %llu %x %x %d %d %d %d %d %d %u %llu %llu\n", 238 seq_printf(s, "lkb %x %d %x %u %llu %x %x %d %d %d %d %d %d %u %llu %llu\n",
250 lkb->lkb_id, 239 lkb->lkb_id,
251 lkb->lkb_nodeid, 240 lkb->lkb_nodeid,
252 lkb->lkb_remid, 241 lkb->lkb_remid,
253 lkb->lkb_ownpid, 242 lkb->lkb_ownpid,
254 (unsigned long long)xid, 243 (unsigned long long)xid,
255 lkb->lkb_exflags, 244 lkb->lkb_exflags,
256 lkb->lkb_flags, 245 lkb->lkb_flags,
257 lkb->lkb_status, 246 lkb->lkb_status,
258 lkb->lkb_grmode, 247 lkb->lkb_grmode,
259 lkb->lkb_rqmode, 248 lkb->lkb_rqmode,
260 lkb->lkb_last_bast.mode, 249 lkb->lkb_last_bast.mode,
261 rsb_lookup, 250 rsb_lookup,
262 lkb->lkb_wait_type, 251 lkb->lkb_wait_type,
263 lkb->lkb_lvbseq, 252 lkb->lkb_lvbseq,
264 (unsigned long long)ktime_to_ns(lkb->lkb_timestamp), 253 (unsigned long long)ktime_to_ns(lkb->lkb_timestamp),
265 (unsigned long long)ktime_to_ns(lkb->lkb_last_bast_time)); 254 (unsigned long long)ktime_to_ns(lkb->lkb_last_bast_time));
266 return rv;
267} 255}
268 256
269static int print_format3(struct dlm_rsb *r, struct seq_file *s) 257static void print_format3(struct dlm_rsb *r, struct seq_file *s)
270{ 258{
271 struct dlm_lkb *lkb; 259 struct dlm_lkb *lkb;
272 int i, lvblen = r->res_ls->ls_lvblen; 260 int i, lvblen = r->res_ls->ls_lvblen;
273 int print_name = 1; 261 int print_name = 1;
274 int rv;
275 262
276 lock_rsb(r); 263 lock_rsb(r);
277 264
278 rv = seq_printf(s, "rsb %p %d %x %lx %d %d %u %d ", 265 seq_printf(s, "rsb %p %d %x %lx %d %d %u %d ",
279 r, 266 r,
280 r->res_nodeid, 267 r->res_nodeid,
281 r->res_first_lkid, 268 r->res_first_lkid,
282 r->res_flags, 269 r->res_flags,
283 !list_empty(&r->res_root_list), 270 !list_empty(&r->res_root_list),
284 !list_empty(&r->res_recover_list), 271 !list_empty(&r->res_recover_list),
285 r->res_recover_locks_count, 272 r->res_recover_locks_count,
286 r->res_length); 273 r->res_length);
287 if (rv) 274 if (seq_has_overflowed(s))
288 goto out; 275 goto out;
289 276
290 for (i = 0; i < r->res_length; i++) { 277 for (i = 0; i < r->res_length; i++) {
@@ -292,7 +279,7 @@ static int print_format3(struct dlm_rsb *r, struct seq_file *s)
292 print_name = 0; 279 print_name = 0;
293 } 280 }
294 281
295 seq_printf(s, "%s", print_name ? "str " : "hex"); 282 seq_puts(s, print_name ? "str " : "hex");
296 283
297 for (i = 0; i < r->res_length; i++) { 284 for (i = 0; i < r->res_length; i++) {
298 if (print_name) 285 if (print_name)
@@ -300,8 +287,8 @@ static int print_format3(struct dlm_rsb *r, struct seq_file *s)
300 else 287 else
301 seq_printf(s, " %02x", (unsigned char)r->res_name[i]); 288 seq_printf(s, " %02x", (unsigned char)r->res_name[i]);
302 } 289 }
303 rv = seq_puts(s, "\n"); 290 seq_puts(s, "\n");
304 if (rv) 291 if (seq_has_overflowed(s))
305 goto out; 292 goto out;
306 293
307 if (!r->res_lvbptr) 294 if (!r->res_lvbptr)
@@ -311,65 +298,62 @@ static int print_format3(struct dlm_rsb *r, struct seq_file *s)
311 298
312 for (i = 0; i < lvblen; i++) 299 for (i = 0; i < lvblen; i++)
313 seq_printf(s, " %02x", (unsigned char)r->res_lvbptr[i]); 300 seq_printf(s, " %02x", (unsigned char)r->res_lvbptr[i]);
314 rv = seq_puts(s, "\n"); 301 seq_puts(s, "\n");
315 if (rv) 302 if (seq_has_overflowed(s))
316 goto out; 303 goto out;
317 304
318 do_locks: 305 do_locks:
319 list_for_each_entry(lkb, &r->res_grantqueue, lkb_statequeue) { 306 list_for_each_entry(lkb, &r->res_grantqueue, lkb_statequeue) {
320 rv = print_format3_lock(s, lkb, 0); 307 print_format3_lock(s, lkb, 0);
321 if (rv) 308 if (seq_has_overflowed(s))
322 goto out; 309 goto out;
323 } 310 }
324 311
325 list_for_each_entry(lkb, &r->res_convertqueue, lkb_statequeue) { 312 list_for_each_entry(lkb, &r->res_convertqueue, lkb_statequeue) {
326 rv = print_format3_lock(s, lkb, 0); 313 print_format3_lock(s, lkb, 0);
327 if (rv) 314 if (seq_has_overflowed(s))
328 goto out; 315 goto out;
329 } 316 }
330 317
331 list_for_each_entry(lkb, &r->res_waitqueue, lkb_statequeue) { 318 list_for_each_entry(lkb, &r->res_waitqueue, lkb_statequeue) {
332 rv = print_format3_lock(s, lkb, 0); 319 print_format3_lock(s, lkb, 0);
333 if (rv) 320 if (seq_has_overflowed(s))
334 goto out; 321 goto out;
335 } 322 }
336 323
337 list_for_each_entry(lkb, &r->res_lookup, lkb_rsb_lookup) { 324 list_for_each_entry(lkb, &r->res_lookup, lkb_rsb_lookup) {
338 rv = print_format3_lock(s, lkb, 1); 325 print_format3_lock(s, lkb, 1);
339 if (rv) 326 if (seq_has_overflowed(s))
340 goto out; 327 goto out;
341 } 328 }
342 out: 329 out:
343 unlock_rsb(r); 330 unlock_rsb(r);
344 return rv;
345} 331}
346 332
347static int print_format4(struct dlm_rsb *r, struct seq_file *s) 333static void print_format4(struct dlm_rsb *r, struct seq_file *s)
348{ 334{
349 int our_nodeid = dlm_our_nodeid(); 335 int our_nodeid = dlm_our_nodeid();
350 int print_name = 1; 336 int print_name = 1;
351 int i, rv; 337 int i;
352 338
353 lock_rsb(r); 339 lock_rsb(r);
354 340
355 rv = seq_printf(s, "rsb %p %d %d %d %d %lu %lx %d ", 341 seq_printf(s, "rsb %p %d %d %d %d %lu %lx %d ",
356 r, 342 r,
357 r->res_nodeid, 343 r->res_nodeid,
358 r->res_master_nodeid, 344 r->res_master_nodeid,
359 r->res_dir_nodeid, 345 r->res_dir_nodeid,
360 our_nodeid, 346 our_nodeid,
361 r->res_toss_time, 347 r->res_toss_time,
362 r->res_flags, 348 r->res_flags,
363 r->res_length); 349 r->res_length);
364 if (rv)
365 goto out;
366 350
367 for (i = 0; i < r->res_length; i++) { 351 for (i = 0; i < r->res_length; i++) {
368 if (!isascii(r->res_name[i]) || !isprint(r->res_name[i])) 352 if (!isascii(r->res_name[i]) || !isprint(r->res_name[i]))
369 print_name = 0; 353 print_name = 0;
370 } 354 }
371 355
372 seq_printf(s, "%s", print_name ? "str " : "hex"); 356 seq_puts(s, print_name ? "str " : "hex");
373 357
374 for (i = 0; i < r->res_length; i++) { 358 for (i = 0; i < r->res_length; i++) {
375 if (print_name) 359 if (print_name)
@@ -377,10 +361,9 @@ static int print_format4(struct dlm_rsb *r, struct seq_file *s)
377 else 361 else
378 seq_printf(s, " %02x", (unsigned char)r->res_name[i]); 362 seq_printf(s, " %02x", (unsigned char)r->res_name[i]);
379 } 363 }
380 rv = seq_puts(s, "\n"); 364 seq_puts(s, "\n");
381 out: 365
382 unlock_rsb(r); 366 unlock_rsb(r);
383 return rv;
384} 367}
385 368
386struct rsbtbl_iter { 369struct rsbtbl_iter {
@@ -390,47 +373,45 @@ struct rsbtbl_iter {
390 int header; 373 int header;
391}; 374};
392 375
393/* seq_printf returns -1 if the buffer is full, and 0 otherwise. 376/*
394 If the buffer is full, seq_printf can be called again, but it 377 * If the buffer is full, seq_printf can be called again, but it
395 does nothing and just returns -1. So, the these printing routines 378 * does nothing. So, the these printing routines periodically check
396 periodically check the return value to avoid wasting too much time 379 * seq_has_overflowed to avoid wasting too much time trying to print to
397 trying to print to a full buffer. */ 380 * a full buffer.
381 */
398 382
399static int table_seq_show(struct seq_file *seq, void *iter_ptr) 383static int table_seq_show(struct seq_file *seq, void *iter_ptr)
400{ 384{
401 struct rsbtbl_iter *ri = iter_ptr; 385 struct rsbtbl_iter *ri = iter_ptr;
402 int rv = 0;
403 386
404 switch (ri->format) { 387 switch (ri->format) {
405 case 1: 388 case 1:
406 rv = print_format1(ri->rsb, seq); 389 print_format1(ri->rsb, seq);
407 break; 390 break;
408 case 2: 391 case 2:
409 if (ri->header) { 392 if (ri->header) {
410 seq_printf(seq, "id nodeid remid pid xid exflags " 393 seq_puts(seq, "id nodeid remid pid xid exflags flags sts grmode rqmode time_ms r_nodeid r_len r_name\n");
411 "flags sts grmode rqmode time_ms "
412 "r_nodeid r_len r_name\n");
413 ri->header = 0; 394 ri->header = 0;
414 } 395 }
415 rv = print_format2(ri->rsb, seq); 396 print_format2(ri->rsb, seq);
416 break; 397 break;
417 case 3: 398 case 3:
418 if (ri->header) { 399 if (ri->header) {
419 seq_printf(seq, "version rsb 1.1 lvb 1.1 lkb 1.1\n"); 400 seq_puts(seq, "version rsb 1.1 lvb 1.1 lkb 1.1\n");
420 ri->header = 0; 401 ri->header = 0;
421 } 402 }
422 rv = print_format3(ri->rsb, seq); 403 print_format3(ri->rsb, seq);
423 break; 404 break;
424 case 4: 405 case 4:
425 if (ri->header) { 406 if (ri->header) {
426 seq_printf(seq, "version 4 rsb 2\n"); 407 seq_puts(seq, "version 4 rsb 2\n");
427 ri->header = 0; 408 ri->header = 0;
428 } 409 }
429 rv = print_format4(ri->rsb, seq); 410 print_format4(ri->rsb, seq);
430 break; 411 break;
431 } 412 }
432 413
433 return rv; 414 return 0;
434} 415}
435 416
436static const struct seq_operations format1_seq_ops; 417static const struct seq_operations format1_seq_ops;
diff --git a/fs/ecryptfs/crypto.c b/fs/ecryptfs/crypto.c
index 2f6735dbf1a9..c2d6604667b0 100644
--- a/fs/ecryptfs/crypto.c
+++ b/fs/ecryptfs/crypto.c
@@ -1373,7 +1373,7 @@ out:
1373int ecryptfs_read_xattr_region(char *page_virt, struct inode *ecryptfs_inode) 1373int ecryptfs_read_xattr_region(char *page_virt, struct inode *ecryptfs_inode)
1374{ 1374{
1375 struct dentry *lower_dentry = 1375 struct dentry *lower_dentry =
1376 ecryptfs_inode_to_private(ecryptfs_inode)->lower_file->f_dentry; 1376 ecryptfs_inode_to_private(ecryptfs_inode)->lower_file->f_path.dentry;
1377 ssize_t size; 1377 ssize_t size;
1378 int rc = 0; 1378 int rc = 0;
1379 1379
diff --git a/fs/ecryptfs/file.c b/fs/ecryptfs/file.c
index f5bce9096555..80154ec4f8c2 100644
--- a/fs/ecryptfs/file.c
+++ b/fs/ecryptfs/file.c
@@ -75,11 +75,11 @@ struct ecryptfs_getdents_callback {
75 75
76/* Inspired by generic filldir in fs/readdir.c */ 76/* Inspired by generic filldir in fs/readdir.c */
77static int 77static int
78ecryptfs_filldir(void *dirent, const char *lower_name, int lower_namelen, 78ecryptfs_filldir(struct dir_context *ctx, const char *lower_name,
79 loff_t offset, u64 ino, unsigned int d_type) 79 int lower_namelen, loff_t offset, u64 ino, unsigned int d_type)
80{ 80{
81 struct ecryptfs_getdents_callback *buf = 81 struct ecryptfs_getdents_callback *buf =
82 (struct ecryptfs_getdents_callback *)dirent; 82 container_of(ctx, struct ecryptfs_getdents_callback, ctx);
83 size_t name_size; 83 size_t name_size;
84 char *name; 84 char *name;
85 int rc; 85 int rc;
diff --git a/fs/ecryptfs/mmap.c b/fs/ecryptfs/mmap.c
index 564a1fa34b99..4626976794e7 100644
--- a/fs/ecryptfs/mmap.c
+++ b/fs/ecryptfs/mmap.c
@@ -419,7 +419,7 @@ static int ecryptfs_write_inode_size_to_xattr(struct inode *ecryptfs_inode)
419 ssize_t size; 419 ssize_t size;
420 void *xattr_virt; 420 void *xattr_virt;
421 struct dentry *lower_dentry = 421 struct dentry *lower_dentry =
422 ecryptfs_inode_to_private(ecryptfs_inode)->lower_file->f_dentry; 422 ecryptfs_inode_to_private(ecryptfs_inode)->lower_file->f_path.dentry;
423 struct inode *lower_inode = lower_dentry->d_inode; 423 struct inode *lower_inode = lower_dentry->d_inode;
424 int rc; 424 int rc;
425 425
diff --git a/fs/efivarfs/file.c b/fs/efivarfs/file.c
index cdb2971192a5..90001da9abfd 100644
--- a/fs/efivarfs/file.c
+++ b/fs/efivarfs/file.c
@@ -47,8 +47,8 @@ static ssize_t efivarfs_file_write(struct file *file,
47 47
48 if (bytes == -ENOENT) { 48 if (bytes == -ENOENT) {
49 drop_nlink(inode); 49 drop_nlink(inode);
50 d_delete(file->f_dentry); 50 d_delete(file->f_path.dentry);
51 dput(file->f_dentry); 51 dput(file->f_path.dentry);
52 } else { 52 } else {
53 mutex_lock(&inode->i_mutex); 53 mutex_lock(&inode->i_mutex);
54 i_size_write(inode, datasize + sizeof(attributes)); 54 i_size_write(inode, datasize + sizeof(attributes));
diff --git a/fs/eventfd.c b/fs/eventfd.c
index d6a88e7812f3..4b0a226024fa 100644
--- a/fs/eventfd.c
+++ b/fs/eventfd.c
@@ -287,17 +287,14 @@ static ssize_t eventfd_write(struct file *file, const char __user *buf, size_t c
287} 287}
288 288
289#ifdef CONFIG_PROC_FS 289#ifdef CONFIG_PROC_FS
290static int eventfd_show_fdinfo(struct seq_file *m, struct file *f) 290static void eventfd_show_fdinfo(struct seq_file *m, struct file *f)
291{ 291{
292 struct eventfd_ctx *ctx = f->private_data; 292 struct eventfd_ctx *ctx = f->private_data;
293 int ret;
294 293
295 spin_lock_irq(&ctx->wqh.lock); 294 spin_lock_irq(&ctx->wqh.lock);
296 ret = seq_printf(m, "eventfd-count: %16llx\n", 295 seq_printf(m, "eventfd-count: %16llx\n",
297 (unsigned long long)ctx->count); 296 (unsigned long long)ctx->count);
298 spin_unlock_irq(&ctx->wqh.lock); 297 spin_unlock_irq(&ctx->wqh.lock);
299
300 return ret;
301} 298}
302#endif 299#endif
303 300
diff --git a/fs/eventpoll.c b/fs/eventpoll.c
index 7bcfff900f05..d77f94491352 100644
--- a/fs/eventpoll.c
+++ b/fs/eventpoll.c
@@ -870,25 +870,22 @@ static unsigned int ep_eventpoll_poll(struct file *file, poll_table *wait)
870} 870}
871 871
872#ifdef CONFIG_PROC_FS 872#ifdef CONFIG_PROC_FS
873static int ep_show_fdinfo(struct seq_file *m, struct file *f) 873static void ep_show_fdinfo(struct seq_file *m, struct file *f)
874{ 874{
875 struct eventpoll *ep = f->private_data; 875 struct eventpoll *ep = f->private_data;
876 struct rb_node *rbp; 876 struct rb_node *rbp;
877 int ret = 0;
878 877
879 mutex_lock(&ep->mtx); 878 mutex_lock(&ep->mtx);
880 for (rbp = rb_first(&ep->rbr); rbp; rbp = rb_next(rbp)) { 879 for (rbp = rb_first(&ep->rbr); rbp; rbp = rb_next(rbp)) {
881 struct epitem *epi = rb_entry(rbp, struct epitem, rbn); 880 struct epitem *epi = rb_entry(rbp, struct epitem, rbn);
882 881
883 ret = seq_printf(m, "tfd: %8d events: %8x data: %16llx\n", 882 seq_printf(m, "tfd: %8d events: %8x data: %16llx\n",
884 epi->ffd.fd, epi->event.events, 883 epi->ffd.fd, epi->event.events,
885 (long long)epi->event.data); 884 (long long)epi->event.data);
886 if (ret) 885 if (seq_has_overflowed(m))
887 break; 886 break;
888 } 887 }
889 mutex_unlock(&ep->mtx); 888 mutex_unlock(&ep->mtx);
890
891 return ret;
892} 889}
893#endif 890#endif
894 891
diff --git a/fs/exportfs/expfs.c b/fs/exportfs/expfs.c
index b01fbfb51f43..fdfd206c737a 100644
--- a/fs/exportfs/expfs.c
+++ b/fs/exportfs/expfs.c
@@ -50,7 +50,7 @@ find_acceptable_alias(struct dentry *result,
50 50
51 inode = result->d_inode; 51 inode = result->d_inode;
52 spin_lock(&inode->i_lock); 52 spin_lock(&inode->i_lock);
53 hlist_for_each_entry(dentry, &inode->i_dentry, d_alias) { 53 hlist_for_each_entry(dentry, &inode->i_dentry, d_u.d_alias) {
54 dget(dentry); 54 dget(dentry);
55 spin_unlock(&inode->i_lock); 55 spin_unlock(&inode->i_lock);
56 if (toput) 56 if (toput)
@@ -241,10 +241,11 @@ struct getdents_callback {
241 * A rather strange filldir function to capture 241 * A rather strange filldir function to capture
242 * the name matching the specified inode number. 242 * the name matching the specified inode number.
243 */ 243 */
244static int filldir_one(void * __buf, const char * name, int len, 244static int filldir_one(struct dir_context *ctx, const char *name, int len,
245 loff_t pos, u64 ino, unsigned int d_type) 245 loff_t pos, u64 ino, unsigned int d_type)
246{ 246{
247 struct getdents_callback *buf = __buf; 247 struct getdents_callback *buf =
248 container_of(ctx, struct getdents_callback, ctx);
248 int result = 0; 249 int result = 0;
249 250
250 buf->sequence++; 251 buf->sequence++;
diff --git a/fs/fat/dir.c b/fs/fat/dir.c
index 3963ede84eb0..c5d6bb939d19 100644
--- a/fs/fat/dir.c
+++ b/fs/fat/dir.c
@@ -702,10 +702,11 @@ static int fat_readdir(struct file *file, struct dir_context *ctx)
702} 702}
703 703
704#define FAT_IOCTL_FILLDIR_FUNC(func, dirent_type) \ 704#define FAT_IOCTL_FILLDIR_FUNC(func, dirent_type) \
705static int func(void *__buf, const char *name, int name_len, \ 705static int func(struct dir_context *ctx, const char *name, int name_len, \
706 loff_t offset, u64 ino, unsigned int d_type) \ 706 loff_t offset, u64 ino, unsigned int d_type) \
707{ \ 707{ \
708 struct fat_ioctl_filldir_callback *buf = __buf; \ 708 struct fat_ioctl_filldir_callback *buf = \
709 container_of(ctx, struct fat_ioctl_filldir_callback, ctx); \
709 struct dirent_type __user *d1 = buf->dirent; \ 710 struct dirent_type __user *d1 = buf->dirent; \
710 struct dirent_type __user *d2 = d1 + 1; \ 711 struct dirent_type __user *d2 = d1 + 1; \
711 \ 712 \
diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c
index dbab798f5caf..df562cc87763 100644
--- a/fs/fuse/dir.c
+++ b/fs/fuse/dir.c
@@ -372,7 +372,7 @@ static struct dentry *fuse_lookup(struct inode *dir, struct dentry *entry,
372 if (inode && get_node_id(inode) == FUSE_ROOT_ID) 372 if (inode && get_node_id(inode) == FUSE_ROOT_ID)
373 goto out_iput; 373 goto out_iput;
374 374
375 newent = d_materialise_unique(entry, inode); 375 newent = d_splice_alias(inode, entry);
376 err = PTR_ERR(newent); 376 err = PTR_ERR(newent);
377 if (IS_ERR(newent)) 377 if (IS_ERR(newent))
378 goto out_err; 378 goto out_err;
@@ -1320,7 +1320,7 @@ static int fuse_direntplus_link(struct file *file,
1320 if (!inode) 1320 if (!inode)
1321 goto out; 1321 goto out;
1322 1322
1323 alias = d_materialise_unique(dentry, inode); 1323 alias = d_splice_alias(inode, dentry);
1324 err = PTR_ERR(alias); 1324 err = PTR_ERR(alias);
1325 if (IS_ERR(alias)) 1325 if (IS_ERR(alias))
1326 goto out; 1326 goto out;
diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index caa8d95b24e8..bf50259012ab 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -1988,7 +1988,7 @@ static int fuse_write_begin(struct file *file, struct address_space *mapping,
1988 struct page **pagep, void **fsdata) 1988 struct page **pagep, void **fsdata)
1989{ 1989{
1990 pgoff_t index = pos >> PAGE_CACHE_SHIFT; 1990 pgoff_t index = pos >> PAGE_CACHE_SHIFT;
1991 struct fuse_conn *fc = get_fuse_conn(file->f_dentry->d_inode); 1991 struct fuse_conn *fc = get_fuse_conn(file_inode(file));
1992 struct page *page; 1992 struct page *page;
1993 loff_t fsize; 1993 loff_t fsize;
1994 int err = -ENOMEM; 1994 int err = -ENOMEM;
diff --git a/fs/gfs2/export.c b/fs/gfs2/export.c
index 8b9b3775e2e7..c41d255b6a7b 100644
--- a/fs/gfs2/export.c
+++ b/fs/gfs2/export.c
@@ -69,10 +69,12 @@ struct get_name_filldir {
69 char *name; 69 char *name;
70}; 70};
71 71
72static int get_name_filldir(void *opaque, const char *name, int length, 72static int get_name_filldir(struct dir_context *ctx, const char *name,
73 loff_t offset, u64 inum, unsigned int type) 73 int length, loff_t offset, u64 inum,
74 unsigned int type)
74{ 75{
75 struct get_name_filldir *gnfd = opaque; 76 struct get_name_filldir *gnfd =
77 container_of(ctx, struct get_name_filldir, ctx);
76 78
77 if (inum != gnfd->inum.no_addr) 79 if (inum != gnfd->inum.no_addr)
78 return 0; 80 return 0;
diff --git a/fs/hppfs/hppfs.c b/fs/hppfs/hppfs.c
index 4338ff32959d..5f2755117ce7 100644
--- a/fs/hppfs/hppfs.c
+++ b/fs/hppfs/hppfs.c
@@ -548,10 +548,11 @@ struct hppfs_dirent {
548 struct dentry *dentry; 548 struct dentry *dentry;
549}; 549};
550 550
551static int hppfs_filldir(void *d, const char *name, int size, 551static int hppfs_filldir(struct dir_context *ctx, const char *name, int size,
552 loff_t offset, u64 inode, unsigned int type) 552 loff_t offset, u64 inode, unsigned int type)
553{ 553{
554 struct hppfs_dirent *dirent = d; 554 struct hppfs_dirent *dirent =
555 container_of(ctx, struct hppfs_dirent, ctx);
555 556
556 if (file_removed(dirent->dentry, name)) 557 if (file_removed(dirent->dentry, name))
557 return 0; 558 return 0;
diff --git a/fs/jfs/namei.c b/fs/jfs/namei.c
index d59c7defb1ef..38fdc533f4ec 100644
--- a/fs/jfs/namei.c
+++ b/fs/jfs/namei.c
@@ -84,7 +84,7 @@ static int jfs_create(struct inode *dip, struct dentry *dentry, umode_t mode,
84 struct inode *iplist[2]; 84 struct inode *iplist[2];
85 struct tblock *tblk; 85 struct tblock *tblk;
86 86
87 jfs_info("jfs_create: dip:0x%p name:%s", dip, dentry->d_name.name); 87 jfs_info("jfs_create: dip:0x%p name:%pd", dip, dentry);
88 88
89 dquot_initialize(dip); 89 dquot_initialize(dip);
90 90
@@ -216,7 +216,7 @@ static int jfs_mkdir(struct inode *dip, struct dentry *dentry, umode_t mode)
216 struct inode *iplist[2]; 216 struct inode *iplist[2];
217 struct tblock *tblk; 217 struct tblock *tblk;
218 218
219 jfs_info("jfs_mkdir: dip:0x%p name:%s", dip, dentry->d_name.name); 219 jfs_info("jfs_mkdir: dip:0x%p name:%pd", dip, dentry);
220 220
221 dquot_initialize(dip); 221 dquot_initialize(dip);
222 222
@@ -352,7 +352,7 @@ static int jfs_rmdir(struct inode *dip, struct dentry *dentry)
352 struct inode *iplist[2]; 352 struct inode *iplist[2];
353 struct tblock *tblk; 353 struct tblock *tblk;
354 354
355 jfs_info("jfs_rmdir: dip:0x%p name:%s", dip, dentry->d_name.name); 355 jfs_info("jfs_rmdir: dip:0x%p name:%pd", dip, dentry);
356 356
357 /* Init inode for quota operations. */ 357 /* Init inode for quota operations. */
358 dquot_initialize(dip); 358 dquot_initialize(dip);
@@ -480,7 +480,7 @@ static int jfs_unlink(struct inode *dip, struct dentry *dentry)
480 s64 new_size = 0; 480 s64 new_size = 0;
481 int commit_flag; 481 int commit_flag;
482 482
483 jfs_info("jfs_unlink: dip:0x%p name:%s", dip, dentry->d_name.name); 483 jfs_info("jfs_unlink: dip:0x%p name:%pd", dip, dentry);
484 484
485 /* Init inode for quota operations. */ 485 /* Init inode for quota operations. */
486 dquot_initialize(dip); 486 dquot_initialize(dip);
@@ -797,8 +797,7 @@ static int jfs_link(struct dentry *old_dentry,
797 struct btstack btstack; 797 struct btstack btstack;
798 struct inode *iplist[2]; 798 struct inode *iplist[2];
799 799
800 jfs_info("jfs_link: %s %s", old_dentry->d_name.name, 800 jfs_info("jfs_link: %pd %pd", old_dentry, dentry);
801 dentry->d_name.name);
802 801
803 dquot_initialize(dir); 802 dquot_initialize(dir);
804 803
@@ -1082,8 +1081,7 @@ static int jfs_rename(struct inode *old_dir, struct dentry *old_dentry,
1082 int commit_flag; 1081 int commit_flag;
1083 1082
1084 1083
1085 jfs_info("jfs_rename: %s %s", old_dentry->d_name.name, 1084 jfs_info("jfs_rename: %pd %pd", old_dentry, new_dentry);
1086 new_dentry->d_name.name);
1087 1085
1088 dquot_initialize(old_dir); 1086 dquot_initialize(old_dir);
1089 dquot_initialize(new_dir); 1087 dquot_initialize(new_dir);
@@ -1355,7 +1353,7 @@ static int jfs_mknod(struct inode *dir, struct dentry *dentry,
1355 if (!new_valid_dev(rdev)) 1353 if (!new_valid_dev(rdev))
1356 return -EINVAL; 1354 return -EINVAL;
1357 1355
1358 jfs_info("jfs_mknod: %s", dentry->d_name.name); 1356 jfs_info("jfs_mknod: %pd", dentry);
1359 1357
1360 dquot_initialize(dir); 1358 dquot_initialize(dir);
1361 1359
@@ -1444,7 +1442,7 @@ static struct dentry *jfs_lookup(struct inode *dip, struct dentry *dentry, unsig
1444 struct component_name key; 1442 struct component_name key;
1445 int rc; 1443 int rc;
1446 1444
1447 jfs_info("jfs_lookup: name = %s", dentry->d_name.name); 1445 jfs_info("jfs_lookup: name = %pd", dentry);
1448 1446
1449 if ((rc = get_UCSname(&key, dentry))) 1447 if ((rc = get_UCSname(&key, dentry)))
1450 return ERR_PTR(rc); 1448 return ERR_PTR(rc);
diff --git a/fs/kernfs/dir.c b/fs/kernfs/dir.c
index 1c771931bb60..37989f02a226 100644
--- a/fs/kernfs/dir.c
+++ b/fs/kernfs/dir.c
@@ -807,7 +807,7 @@ static struct dentry *kernfs_iop_lookup(struct inode *dir,
807 } 807 }
808 808
809 /* instantiate and hash dentry */ 809 /* instantiate and hash dentry */
810 ret = d_materialise_unique(dentry, inode); 810 ret = d_splice_alias(inode, dentry);
811 out_unlock: 811 out_unlock:
812 mutex_unlock(&kernfs_mutex); 812 mutex_unlock(&kernfs_mutex);
813 return ret; 813 return ret;
diff --git a/fs/libfs.c b/fs/libfs.c
index 171d2846f2a3..005843ce5dbd 100644
--- a/fs/libfs.c
+++ b/fs/libfs.c
@@ -114,18 +114,18 @@ loff_t dcache_dir_lseek(struct file *file, loff_t offset, int whence)
114 114
115 spin_lock(&dentry->d_lock); 115 spin_lock(&dentry->d_lock);
116 /* d_lock not required for cursor */ 116 /* d_lock not required for cursor */
117 list_del(&cursor->d_u.d_child); 117 list_del(&cursor->d_child);
118 p = dentry->d_subdirs.next; 118 p = dentry->d_subdirs.next;
119 while (n && p != &dentry->d_subdirs) { 119 while (n && p != &dentry->d_subdirs) {
120 struct dentry *next; 120 struct dentry *next;
121 next = list_entry(p, struct dentry, d_u.d_child); 121 next = list_entry(p, struct dentry, d_child);
122 spin_lock_nested(&next->d_lock, DENTRY_D_LOCK_NESTED); 122 spin_lock_nested(&next->d_lock, DENTRY_D_LOCK_NESTED);
123 if (simple_positive(next)) 123 if (simple_positive(next))
124 n--; 124 n--;
125 spin_unlock(&next->d_lock); 125 spin_unlock(&next->d_lock);
126 p = p->next; 126 p = p->next;
127 } 127 }
128 list_add_tail(&cursor->d_u.d_child, p); 128 list_add_tail(&cursor->d_child, p);
129 spin_unlock(&dentry->d_lock); 129 spin_unlock(&dentry->d_lock);
130 } 130 }
131 } 131 }
@@ -150,7 +150,7 @@ int dcache_readdir(struct file *file, struct dir_context *ctx)
150{ 150{
151 struct dentry *dentry = file->f_path.dentry; 151 struct dentry *dentry = file->f_path.dentry;
152 struct dentry *cursor = file->private_data; 152 struct dentry *cursor = file->private_data;
153 struct list_head *p, *q = &cursor->d_u.d_child; 153 struct list_head *p, *q = &cursor->d_child;
154 154
155 if (!dir_emit_dots(file, ctx)) 155 if (!dir_emit_dots(file, ctx))
156 return 0; 156 return 0;
@@ -159,7 +159,7 @@ int dcache_readdir(struct file *file, struct dir_context *ctx)
159 list_move(q, &dentry->d_subdirs); 159 list_move(q, &dentry->d_subdirs);
160 160
161 for (p = q->next; p != &dentry->d_subdirs; p = p->next) { 161 for (p = q->next; p != &dentry->d_subdirs; p = p->next) {
162 struct dentry *next = list_entry(p, struct dentry, d_u.d_child); 162 struct dentry *next = list_entry(p, struct dentry, d_child);
163 spin_lock_nested(&next->d_lock, DENTRY_D_LOCK_NESTED); 163 spin_lock_nested(&next->d_lock, DENTRY_D_LOCK_NESTED);
164 if (!simple_positive(next)) { 164 if (!simple_positive(next)) {
165 spin_unlock(&next->d_lock); 165 spin_unlock(&next->d_lock);
@@ -287,7 +287,7 @@ int simple_empty(struct dentry *dentry)
287 int ret = 0; 287 int ret = 0;
288 288
289 spin_lock(&dentry->d_lock); 289 spin_lock(&dentry->d_lock);
290 list_for_each_entry(child, &dentry->d_subdirs, d_u.d_child) { 290 list_for_each_entry(child, &dentry->d_subdirs, d_child) {
291 spin_lock_nested(&child->d_lock, DENTRY_D_LOCK_NESTED); 291 spin_lock_nested(&child->d_lock, DENTRY_D_LOCK_NESTED);
292 if (simple_positive(child)) { 292 if (simple_positive(child)) {
293 spin_unlock(&child->d_lock); 293 spin_unlock(&child->d_lock);
diff --git a/fs/lockd/svcsubs.c b/fs/lockd/svcsubs.c
index b6f3b84b6e99..d12ff4e2dbe7 100644
--- a/fs/lockd/svcsubs.c
+++ b/fs/lockd/svcsubs.c
@@ -408,7 +408,7 @@ nlmsvc_match_sb(void *datap, struct nlm_file *file)
408{ 408{
409 struct super_block *sb = datap; 409 struct super_block *sb = datap;
410 410
411 return sb == file->f_file->f_path.dentry->d_sb; 411 return sb == file_inode(file->f_file)->i_sb;
412} 412}
413 413
414/** 414/**
diff --git a/fs/ncpfs/dir.c b/fs/ncpfs/dir.c
index 7cb751dfbeef..008960101520 100644
--- a/fs/ncpfs/dir.c
+++ b/fs/ncpfs/dir.c
@@ -198,8 +198,8 @@ ncp_single_volume(struct ncp_server *server)
198 198
199static inline int ncp_is_server_root(struct inode *inode) 199static inline int ncp_is_server_root(struct inode *inode)
200{ 200{
201 return (!ncp_single_volume(NCP_SERVER(inode)) && 201 return !ncp_single_volume(NCP_SERVER(inode)) &&
202 inode == inode->i_sb->s_root->d_inode); 202 is_root_inode(inode);
203} 203}
204 204
205 205
@@ -403,7 +403,7 @@ ncp_dget_fpos(struct dentry *dentry, struct dentry *parent, unsigned long fpos)
403 403
404 /* If a pointer is invalid, we search the dentry. */ 404 /* If a pointer is invalid, we search the dentry. */
405 spin_lock(&parent->d_lock); 405 spin_lock(&parent->d_lock);
406 list_for_each_entry(dent, &parent->d_subdirs, d_u.d_child) { 406 list_for_each_entry(dent, &parent->d_subdirs, d_child) {
407 if ((unsigned long)dent->d_fsdata == fpos) { 407 if ((unsigned long)dent->d_fsdata == fpos) {
408 if (dent->d_inode) 408 if (dent->d_inode)
409 dget(dent); 409 dget(dent);
@@ -685,8 +685,7 @@ static void
685ncp_read_volume_list(struct file *file, struct dir_context *ctx, 685ncp_read_volume_list(struct file *file, struct dir_context *ctx,
686 struct ncp_cache_control *ctl) 686 struct ncp_cache_control *ctl)
687{ 687{
688 struct dentry *dentry = file->f_path.dentry; 688 struct inode *inode = file_inode(file);
689 struct inode *inode = dentry->d_inode;
690 struct ncp_server *server = NCP_SERVER(inode); 689 struct ncp_server *server = NCP_SERVER(inode);
691 struct ncp_volume_info info; 690 struct ncp_volume_info info;
692 struct ncp_entry_info entry; 691 struct ncp_entry_info entry;
@@ -721,8 +720,7 @@ static void
721ncp_do_readdir(struct file *file, struct dir_context *ctx, 720ncp_do_readdir(struct file *file, struct dir_context *ctx,
722 struct ncp_cache_control *ctl) 721 struct ncp_cache_control *ctl)
723{ 722{
724 struct dentry *dentry = file->f_path.dentry; 723 struct inode *dir = file_inode(file);
725 struct inode *dir = dentry->d_inode;
726 struct ncp_server *server = NCP_SERVER(dir); 724 struct ncp_server *server = NCP_SERVER(dir);
727 struct nw_search_sequence seq; 725 struct nw_search_sequence seq;
728 struct ncp_entry_info entry; 726 struct ncp_entry_info entry;
diff --git a/fs/ncpfs/file.c b/fs/ncpfs/file.c
index 77640a8bfb87..1dd7007f974d 100644
--- a/fs/ncpfs/file.c
+++ b/fs/ncpfs/file.c
@@ -100,8 +100,7 @@ out:
100static ssize_t 100static ssize_t
101ncp_file_read(struct file *file, char __user *buf, size_t count, loff_t *ppos) 101ncp_file_read(struct file *file, char __user *buf, size_t count, loff_t *ppos)
102{ 102{
103 struct dentry *dentry = file->f_path.dentry; 103 struct inode *inode = file_inode(file);
104 struct inode *inode = dentry->d_inode;
105 size_t already_read = 0; 104 size_t already_read = 0;
106 off_t pos; 105 off_t pos;
107 size_t bufsize; 106 size_t bufsize;
@@ -109,7 +108,7 @@ ncp_file_read(struct file *file, char __user *buf, size_t count, loff_t *ppos)
109 void* freepage; 108 void* freepage;
110 size_t freelen; 109 size_t freelen;
111 110
112 ncp_dbg(1, "enter %pd2\n", dentry); 111 ncp_dbg(1, "enter %pD2\n", file);
113 112
114 pos = *ppos; 113 pos = *ppos;
115 114
@@ -167,7 +166,7 @@ ncp_file_read(struct file *file, char __user *buf, size_t count, loff_t *ppos)
167 166
168 file_accessed(file); 167 file_accessed(file);
169 168
170 ncp_dbg(1, "exit %pd2\n", dentry); 169 ncp_dbg(1, "exit %pD2\n", file);
171outrel: 170outrel:
172 ncp_inode_close(inode); 171 ncp_inode_close(inode);
173 return already_read ? already_read : error; 172 return already_read ? already_read : error;
@@ -176,15 +175,14 @@ outrel:
176static ssize_t 175static ssize_t
177ncp_file_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos) 176ncp_file_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos)
178{ 177{
179 struct dentry *dentry = file->f_path.dentry; 178 struct inode *inode = file_inode(file);
180 struct inode *inode = dentry->d_inode;
181 size_t already_written = 0; 179 size_t already_written = 0;
182 off_t pos; 180 off_t pos;
183 size_t bufsize; 181 size_t bufsize;
184 int errno; 182 int errno;
185 void* bouncebuffer; 183 void* bouncebuffer;
186 184
187 ncp_dbg(1, "enter %pd2\n", dentry); 185 ncp_dbg(1, "enter %pD2\n", file);
188 if ((ssize_t) count < 0) 186 if ((ssize_t) count < 0)
189 return -EINVAL; 187 return -EINVAL;
190 pos = *ppos; 188 pos = *ppos;
@@ -263,7 +261,7 @@ ncp_file_write(struct file *file, const char __user *buf, size_t count, loff_t *
263 i_size_write(inode, pos); 261 i_size_write(inode, pos);
264 mutex_unlock(&inode->i_mutex); 262 mutex_unlock(&inode->i_mutex);
265 } 263 }
266 ncp_dbg(1, "exit %pd2\n", dentry); 264 ncp_dbg(1, "exit %pD2\n", file);
267outrel: 265outrel:
268 ncp_inode_close(inode); 266 ncp_inode_close(inode);
269 return already_written ? already_written : errno; 267 return already_written ? already_written : errno;
diff --git a/fs/ncpfs/mmap.c b/fs/ncpfs/mmap.c
index b359d12eb359..33b873b259a8 100644
--- a/fs/ncpfs/mmap.c
+++ b/fs/ncpfs/mmap.c
@@ -30,9 +30,7 @@
30static int ncp_file_mmap_fault(struct vm_area_struct *area, 30static int ncp_file_mmap_fault(struct vm_area_struct *area,
31 struct vm_fault *vmf) 31 struct vm_fault *vmf)
32{ 32{
33 struct file *file = area->vm_file; 33 struct inode *inode = file_inode(area->vm_file);
34 struct dentry *dentry = file->f_path.dentry;
35 struct inode *inode = dentry->d_inode;
36 char *pg_addr; 34 char *pg_addr;
37 unsigned int already_read; 35 unsigned int already_read;
38 unsigned int count; 36 unsigned int count;
diff --git a/fs/ncpfs/ncplib_kernel.h b/fs/ncpfs/ncplib_kernel.h
index 52cb19d66ecb..b785f74bfe3c 100644
--- a/fs/ncpfs/ncplib_kernel.h
+++ b/fs/ncpfs/ncplib_kernel.h
@@ -191,7 +191,7 @@ ncp_renew_dentries(struct dentry *parent)
191 struct dentry *dentry; 191 struct dentry *dentry;
192 192
193 spin_lock(&parent->d_lock); 193 spin_lock(&parent->d_lock);
194 list_for_each_entry(dentry, &parent->d_subdirs, d_u.d_child) { 194 list_for_each_entry(dentry, &parent->d_subdirs, d_child) {
195 if (dentry->d_fsdata == NULL) 195 if (dentry->d_fsdata == NULL)
196 ncp_age_dentry(server, dentry); 196 ncp_age_dentry(server, dentry);
197 else 197 else
@@ -207,7 +207,7 @@ ncp_invalidate_dircache_entries(struct dentry *parent)
207 struct dentry *dentry; 207 struct dentry *dentry;
208 208
209 spin_lock(&parent->d_lock); 209 spin_lock(&parent->d_lock);
210 list_for_each_entry(dentry, &parent->d_subdirs, d_u.d_child) { 210 list_for_each_entry(dentry, &parent->d_subdirs, d_child) {
211 dentry->d_fsdata = NULL; 211 dentry->d_fsdata = NULL;
212 ncp_age_dentry(server, dentry); 212 ncp_age_dentry(server, dentry);
213 } 213 }
diff --git a/fs/nfs/blocklayout/rpc_pipefs.c b/fs/nfs/blocklayout/rpc_pipefs.c
index acbf9ca4018c..dbe5839cdeba 100644
--- a/fs/nfs/blocklayout/rpc_pipefs.c
+++ b/fs/nfs/blocklayout/rpc_pipefs.c
@@ -112,7 +112,7 @@ out_unlock:
112static ssize_t bl_pipe_downcall(struct file *filp, const char __user *src, 112static ssize_t bl_pipe_downcall(struct file *filp, const char __user *src,
113 size_t mlen) 113 size_t mlen)
114{ 114{
115 struct nfs_net *nn = net_generic(filp->f_dentry->d_sb->s_fs_info, 115 struct nfs_net *nn = net_generic(file_inode(filp)->i_sb->s_fs_info,
116 nfs_net_id); 116 nfs_net_id);
117 117
118 if (mlen != sizeof (struct bl_dev_msg)) 118 if (mlen != sizeof (struct bl_dev_msg))
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c
index 6e62155abf26..9b0c55cb2a2e 100644
--- a/fs/nfs/dir.c
+++ b/fs/nfs/dir.c
@@ -133,7 +133,7 @@ out:
133static int 133static int
134nfs_closedir(struct inode *inode, struct file *filp) 134nfs_closedir(struct inode *inode, struct file *filp)
135{ 135{
136 put_nfs_open_dir_context(filp->f_path.dentry->d_inode, filp->private_data); 136 put_nfs_open_dir_context(file_inode(filp), filp->private_data);
137 return 0; 137 return 0;
138} 138}
139 139
@@ -499,7 +499,7 @@ void nfs_prime_dcache(struct dentry *parent, struct nfs_entry *entry)
499 if (IS_ERR(inode)) 499 if (IS_ERR(inode))
500 goto out; 500 goto out;
501 501
502 alias = d_materialise_unique(dentry, inode); 502 alias = d_splice_alias(inode, dentry);
503 if (IS_ERR(alias)) 503 if (IS_ERR(alias))
504 goto out; 504 goto out;
505 else if (alias) { 505 else if (alias) {
@@ -1393,7 +1393,7 @@ struct dentry *nfs_lookup(struct inode *dir, struct dentry * dentry, unsigned in
1393 nfs_advise_use_readdirplus(dir); 1393 nfs_advise_use_readdirplus(dir);
1394 1394
1395no_entry: 1395no_entry:
1396 res = d_materialise_unique(dentry, inode); 1396 res = d_splice_alias(inode, dentry);
1397 if (res != NULL) { 1397 if (res != NULL) {
1398 if (IS_ERR(res)) 1398 if (IS_ERR(res))
1399 goto out_unblock_sillyrename; 1399 goto out_unblock_sillyrename;
diff --git a/fs/nfs/getroot.c b/fs/nfs/getroot.c
index 880618a8b048..9ac3846cb59e 100644
--- a/fs/nfs/getroot.c
+++ b/fs/nfs/getroot.c
@@ -51,14 +51,14 @@ static int nfs_superblock_set_dummy_root(struct super_block *sb, struct inode *i
51 /* 51 /*
52 * Ensure that this dentry is invisible to d_find_alias(). 52 * Ensure that this dentry is invisible to d_find_alias().
53 * Otherwise, it may be spliced into the tree by 53 * Otherwise, it may be spliced into the tree by
54 * d_materialise_unique if a parent directory from the same 54 * d_splice_alias if a parent directory from the same
55 * filesystem gets mounted at a later time. 55 * filesystem gets mounted at a later time.
56 * This again causes shrink_dcache_for_umount_subtree() to 56 * This again causes shrink_dcache_for_umount_subtree() to
57 * Oops, since the test for IS_ROOT() will fail. 57 * Oops, since the test for IS_ROOT() will fail.
58 */ 58 */
59 spin_lock(&sb->s_root->d_inode->i_lock); 59 spin_lock(&sb->s_root->d_inode->i_lock);
60 spin_lock(&sb->s_root->d_lock); 60 spin_lock(&sb->s_root->d_lock);
61 hlist_del_init(&sb->s_root->d_alias); 61 hlist_del_init(&sb->s_root->d_u.d_alias);
62 spin_unlock(&sb->s_root->d_lock); 62 spin_unlock(&sb->s_root->d_lock);
63 spin_unlock(&sb->s_root->d_inode->i_lock); 63 spin_unlock(&sb->s_root->d_inode->i_lock);
64 } 64 }
diff --git a/fs/nfsd/nfs4recover.c b/fs/nfsd/nfs4recover.c
index a25490ae6c62..cc6a76072009 100644
--- a/fs/nfsd/nfs4recover.c
+++ b/fs/nfsd/nfs4recover.c
@@ -245,10 +245,11 @@ struct nfs4_dir_ctx {
245}; 245};
246 246
247static int 247static int
248nfsd4_build_namelist(void *arg, const char *name, int namlen, 248nfsd4_build_namelist(struct dir_context *__ctx, const char *name, int namlen,
249 loff_t offset, u64 ino, unsigned int d_type) 249 loff_t offset, u64 ino, unsigned int d_type)
250{ 250{
251 struct nfs4_dir_ctx *ctx = arg; 251 struct nfs4_dir_ctx *ctx =
252 container_of(__ctx, struct nfs4_dir_ctx, ctx);
252 struct name_list *entry; 253 struct name_list *entry;
253 254
254 if (namlen != HEXDIR_LEN - 1) 255 if (namlen != HEXDIR_LEN - 1)
@@ -704,7 +705,7 @@ cld_pipe_downcall(struct file *filp, const char __user *src, size_t mlen)
704 struct cld_upcall *tmp, *cup; 705 struct cld_upcall *tmp, *cup;
705 struct cld_msg __user *cmsg = (struct cld_msg __user *)src; 706 struct cld_msg __user *cmsg = (struct cld_msg __user *)src;
706 uint32_t xid; 707 uint32_t xid;
707 struct nfsd_net *nn = net_generic(filp->f_dentry->d_sb->s_fs_info, 708 struct nfsd_net *nn = net_generic(file_inode(filp)->i_sb->s_fs_info,
708 nfsd_net_id); 709 nfsd_net_id);
709 struct cld_net *cn = nn->cld_net; 710 struct cld_net *cn = nn->cld_net;
710 711
diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c
index eeea7a90eb87..b1eed4dd2eab 100644
--- a/fs/nfsd/nfs4xdr.c
+++ b/fs/nfsd/nfs4xdr.c
@@ -1886,7 +1886,7 @@ static __be32 nfsd4_encode_path(struct xdr_stream *xdr,
1886 goto out_free; 1886 goto out_free;
1887 } 1887 }
1888 p = xdr_encode_opaque(p, dentry->d_name.name, len); 1888 p = xdr_encode_opaque(p, dentry->d_name.name, len);
1889 dprintk("/%s", dentry->d_name.name); 1889 dprintk("/%pd", dentry);
1890 spin_unlock(&dentry->d_lock); 1890 spin_unlock(&dentry->d_lock);
1891 dput(dentry); 1891 dput(dentry);
1892 ncomponents--; 1892 ncomponents--;
diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c
index ca73ca79a0ee..9506ea565610 100644
--- a/fs/nfsd/nfsctl.c
+++ b/fs/nfsd/nfsctl.c
@@ -231,6 +231,10 @@ static struct file_operations reply_cache_stats_operations = {
231 * payload - write methods 231 * payload - write methods
232 */ 232 */
233 233
234static inline struct net *netns(struct file *file)
235{
236 return file_inode(file)->i_sb->s_fs_info;
237}
234 238
235/** 239/**
236 * write_unlock_ip - Release all locks used by a client 240 * write_unlock_ip - Release all locks used by a client
@@ -252,7 +256,7 @@ static ssize_t write_unlock_ip(struct file *file, char *buf, size_t size)
252 struct sockaddr *sap = (struct sockaddr *)&address; 256 struct sockaddr *sap = (struct sockaddr *)&address;
253 size_t salen = sizeof(address); 257 size_t salen = sizeof(address);
254 char *fo_path; 258 char *fo_path;
255 struct net *net = file->f_dentry->d_sb->s_fs_info; 259 struct net *net = netns(file);
256 260
257 /* sanity check */ 261 /* sanity check */
258 if (size == 0) 262 if (size == 0)
@@ -350,7 +354,6 @@ static ssize_t write_filehandle(struct file *file, char *buf, size_t size)
350 int len; 354 int len;
351 struct auth_domain *dom; 355 struct auth_domain *dom;
352 struct knfsd_fh fh; 356 struct knfsd_fh fh;
353 struct net *net = file->f_dentry->d_sb->s_fs_info;
354 357
355 if (size == 0) 358 if (size == 0)
356 return -EINVAL; 359 return -EINVAL;
@@ -385,7 +388,7 @@ static ssize_t write_filehandle(struct file *file, char *buf, size_t size)
385 if (!dom) 388 if (!dom)
386 return -ENOMEM; 389 return -ENOMEM;
387 390
388 len = exp_rootfh(net, dom, path, &fh, maxsize); 391 len = exp_rootfh(netns(file), dom, path, &fh, maxsize);
389 auth_domain_put(dom); 392 auth_domain_put(dom);
390 if (len) 393 if (len)
391 return len; 394 return len;
@@ -429,7 +432,7 @@ static ssize_t write_threads(struct file *file, char *buf, size_t size)
429{ 432{
430 char *mesg = buf; 433 char *mesg = buf;
431 int rv; 434 int rv;
432 struct net *net = file->f_dentry->d_sb->s_fs_info; 435 struct net *net = netns(file);
433 436
434 if (size > 0) { 437 if (size > 0) {
435 int newthreads; 438 int newthreads;
@@ -480,7 +483,7 @@ static ssize_t write_pool_threads(struct file *file, char *buf, size_t size)
480 int len; 483 int len;
481 int npools; 484 int npools;
482 int *nthreads; 485 int *nthreads;
483 struct net *net = file->f_dentry->d_sb->s_fs_info; 486 struct net *net = netns(file);
484 487
485 mutex_lock(&nfsd_mutex); 488 mutex_lock(&nfsd_mutex);
486 npools = nfsd_nrpools(net); 489 npools = nfsd_nrpools(net);
@@ -543,8 +546,7 @@ static ssize_t __write_versions(struct file *file, char *buf, size_t size)
543 unsigned minor; 546 unsigned minor;
544 ssize_t tlen = 0; 547 ssize_t tlen = 0;
545 char *sep; 548 char *sep;
546 struct net *net = file->f_dentry->d_sb->s_fs_info; 549 struct nfsd_net *nn = net_generic(netns(file), nfsd_net_id);
547 struct nfsd_net *nn = net_generic(net, nfsd_net_id);
548 550
549 if (size>0) { 551 if (size>0) {
550 if (nn->nfsd_serv) 552 if (nn->nfsd_serv)
@@ -830,10 +832,9 @@ static ssize_t __write_ports(struct file *file, char *buf, size_t size,
830static ssize_t write_ports(struct file *file, char *buf, size_t size) 832static ssize_t write_ports(struct file *file, char *buf, size_t size)
831{ 833{
832 ssize_t rv; 834 ssize_t rv;
833 struct net *net = file->f_dentry->d_sb->s_fs_info;
834 835
835 mutex_lock(&nfsd_mutex); 836 mutex_lock(&nfsd_mutex);
836 rv = __write_ports(file, buf, size, net); 837 rv = __write_ports(file, buf, size, netns(file));
837 mutex_unlock(&nfsd_mutex); 838 mutex_unlock(&nfsd_mutex);
838 return rv; 839 return rv;
839} 840}
@@ -865,8 +866,7 @@ int nfsd_max_blksize;
865static ssize_t write_maxblksize(struct file *file, char *buf, size_t size) 866static ssize_t write_maxblksize(struct file *file, char *buf, size_t size)
866{ 867{
867 char *mesg = buf; 868 char *mesg = buf;
868 struct net *net = file->f_dentry->d_sb->s_fs_info; 869 struct nfsd_net *nn = net_generic(netns(file), nfsd_net_id);
869 struct nfsd_net *nn = net_generic(net, nfsd_net_id);
870 870
871 if (size > 0) { 871 if (size > 0) {
872 int bsize; 872 int bsize;
@@ -915,8 +915,7 @@ static ssize_t write_maxblksize(struct file *file, char *buf, size_t size)
915static ssize_t write_maxconn(struct file *file, char *buf, size_t size) 915static ssize_t write_maxconn(struct file *file, char *buf, size_t size)
916{ 916{
917 char *mesg = buf; 917 char *mesg = buf;
918 struct net *net = file->f_dentry->d_sb->s_fs_info; 918 struct nfsd_net *nn = net_generic(netns(file), nfsd_net_id);
919 struct nfsd_net *nn = net_generic(net, nfsd_net_id);
920 unsigned int maxconn = nn->max_connections; 919 unsigned int maxconn = nn->max_connections;
921 920
922 if (size > 0) { 921 if (size > 0) {
@@ -997,8 +996,7 @@ static ssize_t nfsd4_write_time(struct file *file, char *buf, size_t size,
997 */ 996 */
998static ssize_t write_leasetime(struct file *file, char *buf, size_t size) 997static ssize_t write_leasetime(struct file *file, char *buf, size_t size)
999{ 998{
1000 struct net *net = file->f_dentry->d_sb->s_fs_info; 999 struct nfsd_net *nn = net_generic(netns(file), nfsd_net_id);
1001 struct nfsd_net *nn = net_generic(net, nfsd_net_id);
1002 return nfsd4_write_time(file, buf, size, &nn->nfsd4_lease, nn); 1000 return nfsd4_write_time(file, buf, size, &nn->nfsd4_lease, nn);
1003} 1001}
1004 1002
@@ -1014,8 +1012,7 @@ static ssize_t write_leasetime(struct file *file, char *buf, size_t size)
1014 */ 1012 */
1015static ssize_t write_gracetime(struct file *file, char *buf, size_t size) 1013static ssize_t write_gracetime(struct file *file, char *buf, size_t size)
1016{ 1014{
1017 struct net *net = file->f_dentry->d_sb->s_fs_info; 1015 struct nfsd_net *nn = net_generic(netns(file), nfsd_net_id);
1018 struct nfsd_net *nn = net_generic(net, nfsd_net_id);
1019 return nfsd4_write_time(file, buf, size, &nn->nfsd4_grace, nn); 1016 return nfsd4_write_time(file, buf, size, &nn->nfsd4_grace, nn);
1020} 1017}
1021 1018
@@ -1071,8 +1068,7 @@ static ssize_t __write_recoverydir(struct file *file, char *buf, size_t size,
1071static ssize_t write_recoverydir(struct file *file, char *buf, size_t size) 1068static ssize_t write_recoverydir(struct file *file, char *buf, size_t size)
1072{ 1069{
1073 ssize_t rv; 1070 ssize_t rv;
1074 struct net *net = file->f_dentry->d_sb->s_fs_info; 1071 struct nfsd_net *nn = net_generic(netns(file), nfsd_net_id);
1075 struct nfsd_net *nn = net_generic(net, nfsd_net_id);
1076 1072
1077 mutex_lock(&nfsd_mutex); 1073 mutex_lock(&nfsd_mutex);
1078 rv = __write_recoverydir(file, buf, size, nn); 1074 rv = __write_recoverydir(file, buf, size, nn);
@@ -1102,8 +1098,7 @@ static ssize_t write_recoverydir(struct file *file, char *buf, size_t size)
1102 */ 1098 */
1103static ssize_t write_v4_end_grace(struct file *file, char *buf, size_t size) 1099static ssize_t write_v4_end_grace(struct file *file, char *buf, size_t size)
1104{ 1100{
1105 struct net *net = file->f_dentry->d_sb->s_fs_info; 1101 struct nfsd_net *nn = net_generic(netns(file), nfsd_net_id);
1106 struct nfsd_net *nn = net_generic(net, nfsd_net_id);
1107 1102
1108 if (size > 0) { 1103 if (size > 0) {
1109 switch(buf[0]) { 1104 switch(buf[0]) {
diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c
index 989129e2d6ea..0a82e3c033ee 100644
--- a/fs/nfsd/vfs.c
+++ b/fs/nfsd/vfs.c
@@ -930,7 +930,6 @@ nfsd_vfs_write(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file *file,
930 unsigned long *cnt, int *stablep) 930 unsigned long *cnt, int *stablep)
931{ 931{
932 struct svc_export *exp; 932 struct svc_export *exp;
933 struct dentry *dentry;
934 struct inode *inode; 933 struct inode *inode;
935 mm_segment_t oldfs; 934 mm_segment_t oldfs;
936 __be32 err = 0; 935 __be32 err = 0;
@@ -949,8 +948,7 @@ nfsd_vfs_write(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file *file,
949 */ 948 */
950 current->flags |= PF_LESS_THROTTLE; 949 current->flags |= PF_LESS_THROTTLE;
951 950
952 dentry = file->f_path.dentry; 951 inode = file_inode(file);
953 inode = dentry->d_inode;
954 exp = fhp->fh_export; 952 exp = fhp->fh_export;
955 953
956 use_wgather = (rqstp->rq_vers == 2) && EX_WGATHER(exp); 954 use_wgather = (rqstp->rq_vers == 2) && EX_WGATHER(exp);
@@ -1819,10 +1817,12 @@ struct readdir_data {
1819 int full; 1817 int full;
1820}; 1818};
1821 1819
1822static int nfsd_buffered_filldir(void *__buf, const char *name, int namlen, 1820static int nfsd_buffered_filldir(struct dir_context *ctx, const char *name,
1823 loff_t offset, u64 ino, unsigned int d_type) 1821 int namlen, loff_t offset, u64 ino,
1822 unsigned int d_type)
1824{ 1823{
1825 struct readdir_data *buf = __buf; 1824 struct readdir_data *buf =
1825 container_of(ctx, struct readdir_data, ctx);
1826 struct buffered_dirent *de = (void *)(buf->dirent + buf->used); 1826 struct buffered_dirent *de = (void *)(buf->dirent + buf->used);
1827 unsigned int reclen; 1827 unsigned int reclen;
1828 1828
@@ -1842,7 +1842,7 @@ static int nfsd_buffered_filldir(void *__buf, const char *name, int namlen,
1842 return 0; 1842 return 0;
1843} 1843}
1844 1844
1845static __be32 nfsd_buffered_readdir(struct file *file, filldir_t func, 1845static __be32 nfsd_buffered_readdir(struct file *file, nfsd_filldir_t func,
1846 struct readdir_cd *cdp, loff_t *offsetp) 1846 struct readdir_cd *cdp, loff_t *offsetp)
1847{ 1847{
1848 struct buffered_dirent *de; 1848 struct buffered_dirent *de;
@@ -1926,7 +1926,7 @@ static __be32 nfsd_buffered_readdir(struct file *file, filldir_t func,
1926 */ 1926 */
1927__be32 1927__be32
1928nfsd_readdir(struct svc_rqst *rqstp, struct svc_fh *fhp, loff_t *offsetp, 1928nfsd_readdir(struct svc_rqst *rqstp, struct svc_fh *fhp, loff_t *offsetp,
1929 struct readdir_cd *cdp, filldir_t func) 1929 struct readdir_cd *cdp, nfsd_filldir_t func)
1930{ 1930{
1931 __be32 err; 1931 __be32 err;
1932 struct file *file; 1932 struct file *file;
diff --git a/fs/nfsd/vfs.h b/fs/nfsd/vfs.h
index c2ff3f14e5f6..b1796d6ee538 100644
--- a/fs/nfsd/vfs.h
+++ b/fs/nfsd/vfs.h
@@ -36,7 +36,7 @@
36/* 36/*
37 * Callback function for readdir 37 * Callback function for readdir
38 */ 38 */
39typedef int (*nfsd_dirop_t)(struct inode *, struct dentry *, int, int); 39typedef int (*nfsd_filldir_t)(void *, const char *, int, loff_t, u64, unsigned);
40 40
41/* nfsd/vfs.c */ 41/* nfsd/vfs.c */
42int nfsd_racache_init(int); 42int nfsd_racache_init(int);
@@ -95,7 +95,7 @@ __be32 nfsd_rename(struct svc_rqst *,
95__be32 nfsd_unlink(struct svc_rqst *, struct svc_fh *, int type, 95__be32 nfsd_unlink(struct svc_rqst *, struct svc_fh *, int type,
96 char *name, int len); 96 char *name, int len);
97__be32 nfsd_readdir(struct svc_rqst *, struct svc_fh *, 97__be32 nfsd_readdir(struct svc_rqst *, struct svc_fh *,
98 loff_t *, struct readdir_cd *, filldir_t); 98 loff_t *, struct readdir_cd *, nfsd_filldir_t);
99__be32 nfsd_statfs(struct svc_rqst *, struct svc_fh *, 99__be32 nfsd_statfs(struct svc_rqst *, struct svc_fh *,
100 struct kstatfs *, int access); 100 struct kstatfs *, int access);
101 101
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
diff --git a/fs/ntfs/namei.c b/fs/ntfs/namei.c
index 436f36037e09..b3973c2fd190 100644
--- a/fs/ntfs/namei.c
+++ b/fs/ntfs/namei.c
@@ -111,8 +111,8 @@ static struct dentry *ntfs_lookup(struct inode *dir_ino, struct dentry *dent,
111 unsigned long dent_ino; 111 unsigned long dent_ino;
112 int uname_len; 112 int uname_len;
113 113
114 ntfs_debug("Looking up %s in directory inode 0x%lx.", 114 ntfs_debug("Looking up %pd in directory inode 0x%lx.",
115 dent->d_name.name, dir_ino->i_ino); 115 dent, dir_ino->i_ino);
116 /* Convert the name of the dentry to Unicode. */ 116 /* Convert the name of the dentry to Unicode. */
117 uname_len = ntfs_nlstoucs(vol, dent->d_name.name, dent->d_name.len, 117 uname_len = ntfs_nlstoucs(vol, dent->d_name.name, dent->d_name.len,
118 &uname); 118 &uname);
diff --git a/fs/ocfs2/dcache.c b/fs/ocfs2/dcache.c
index e2e05a106beb..4fda7a5f3088 100644
--- a/fs/ocfs2/dcache.c
+++ b/fs/ocfs2/dcache.c
@@ -172,7 +172,7 @@ struct dentry *ocfs2_find_local_alias(struct inode *inode,
172 struct dentry *dentry; 172 struct dentry *dentry;
173 173
174 spin_lock(&inode->i_lock); 174 spin_lock(&inode->i_lock);
175 hlist_for_each_entry(dentry, &inode->i_dentry, d_alias) { 175 hlist_for_each_entry(dentry, &inode->i_dentry, d_u.d_alias) {
176 spin_lock(&dentry->d_lock); 176 spin_lock(&dentry->d_lock);
177 if (ocfs2_match_dentry(dentry, parent_blkno, skip_unhashed)) { 177 if (ocfs2_match_dentry(dentry, parent_blkno, skip_unhashed)) {
178 trace_ocfs2_find_local_alias(dentry->d_name.len, 178 trace_ocfs2_find_local_alias(dentry->d_name.len,
@@ -251,8 +251,8 @@ int ocfs2_dentry_attach_lock(struct dentry *dentry,
251 251
252 if (dl) { 252 if (dl) {
253 mlog_bug_on_msg(dl->dl_parent_blkno != parent_blkno, 253 mlog_bug_on_msg(dl->dl_parent_blkno != parent_blkno,
254 " \"%.*s\": old parent: %llu, new: %llu\n", 254 " \"%pd\": old parent: %llu, new: %llu\n",
255 dentry->d_name.len, dentry->d_name.name, 255 dentry,
256 (unsigned long long)parent_blkno, 256 (unsigned long long)parent_blkno,
257 (unsigned long long)dl->dl_parent_blkno); 257 (unsigned long long)dl->dl_parent_blkno);
258 return 0; 258 return 0;
@@ -277,8 +277,8 @@ int ocfs2_dentry_attach_lock(struct dentry *dentry,
277 (unsigned long long)OCFS2_I(inode)->ip_blkno); 277 (unsigned long long)OCFS2_I(inode)->ip_blkno);
278 278
279 mlog_bug_on_msg(dl->dl_parent_blkno != parent_blkno, 279 mlog_bug_on_msg(dl->dl_parent_blkno != parent_blkno,
280 " \"%.*s\": old parent: %llu, new: %llu\n", 280 " \"%pd\": old parent: %llu, new: %llu\n",
281 dentry->d_name.len, dentry->d_name.name, 281 dentry,
282 (unsigned long long)parent_blkno, 282 (unsigned long long)parent_blkno,
283 (unsigned long long)dl->dl_parent_blkno); 283 (unsigned long long)dl->dl_parent_blkno);
284 284
@@ -406,17 +406,15 @@ static void ocfs2_dentry_iput(struct dentry *dentry, struct inode *inode)
406 if (inode) 406 if (inode)
407 ino = (unsigned long long)OCFS2_I(inode)->ip_blkno; 407 ino = (unsigned long long)OCFS2_I(inode)->ip_blkno;
408 mlog(ML_ERROR, "Dentry is missing cluster lock. " 408 mlog(ML_ERROR, "Dentry is missing cluster lock. "
409 "inode: %llu, d_flags: 0x%x, d_name: %.*s\n", 409 "inode: %llu, d_flags: 0x%x, d_name: %pd\n",
410 ino, dentry->d_flags, dentry->d_name.len, 410 ino, dentry->d_flags, dentry);
411 dentry->d_name.name);
412 } 411 }
413 412
414 goto out; 413 goto out;
415 } 414 }
416 415
417 mlog_bug_on_msg(dl->dl_count == 0, "dentry: %.*s, count: %u\n", 416 mlog_bug_on_msg(dl->dl_count == 0, "dentry: %pd, count: %u\n",
418 dentry->d_name.len, dentry->d_name.name, 417 dentry, dl->dl_count);
419 dl->dl_count);
420 418
421 ocfs2_dentry_lock_put(OCFS2_SB(dentry->d_sb), dl); 419 ocfs2_dentry_lock_put(OCFS2_SB(dentry->d_sb), dl);
422 420
diff --git a/fs/ocfs2/dir.c b/fs/ocfs2/dir.c
index 0717662b4aef..c43d9b4a1ec0 100644
--- a/fs/ocfs2/dir.c
+++ b/fs/ocfs2/dir.c
@@ -2073,10 +2073,12 @@ struct ocfs2_empty_dir_priv {
2073 unsigned seen_other; 2073 unsigned seen_other;
2074 unsigned dx_dir; 2074 unsigned dx_dir;
2075}; 2075};
2076static int ocfs2_empty_dir_filldir(void *priv, const char *name, int name_len, 2076static int ocfs2_empty_dir_filldir(struct dir_context *ctx, const char *name,
2077 loff_t pos, u64 ino, unsigned type) 2077 int name_len, loff_t pos, u64 ino,
2078 unsigned type)
2078{ 2079{
2079 struct ocfs2_empty_dir_priv *p = priv; 2080 struct ocfs2_empty_dir_priv *p =
2081 container_of(ctx, struct ocfs2_empty_dir_priv, ctx);
2080 2082
2081 /* 2083 /*
2082 * Check the positions of "." and ".." records to be sure 2084 * Check the positions of "." and ".." records to be sure
diff --git a/fs/ocfs2/dlmfs/dlmfs.c b/fs/ocfs2/dlmfs/dlmfs.c
index 09b7d9dac71d..57c40e34f56f 100644
--- a/fs/ocfs2/dlmfs/dlmfs.c
+++ b/fs/ocfs2/dlmfs/dlmfs.c
@@ -565,8 +565,8 @@ static int dlmfs_unlink(struct inode *dir,
565 * to acquire a lock, this basically destroys our lockres. */ 565 * to acquire a lock, this basically destroys our lockres. */
566 status = user_dlm_destroy_lock(&DLMFS_I(inode)->ip_lockres); 566 status = user_dlm_destroy_lock(&DLMFS_I(inode)->ip_lockres);
567 if (status < 0) { 567 if (status < 0) {
568 mlog(ML_ERROR, "unlink %.*s, error %d from destroy\n", 568 mlog(ML_ERROR, "unlink %pd, error %d from destroy\n",
569 dentry->d_name.len, dentry->d_name.name, status); 569 dentry, status);
570 goto bail; 570 goto bail;
571 } 571 }
572 status = simple_unlink(dir, dentry); 572 status = simple_unlink(dir, dentry);
diff --git a/fs/ocfs2/dlmglue.c b/fs/ocfs2/dlmglue.c
index 21262f2b1654..37297c14f9a3 100644
--- a/fs/ocfs2/dlmglue.c
+++ b/fs/ocfs2/dlmglue.c
@@ -3725,8 +3725,7 @@ static int ocfs2_dentry_convert_worker(struct ocfs2_lock_res *lockres,
3725 break; 3725 break;
3726 spin_unlock(&dentry_attach_lock); 3726 spin_unlock(&dentry_attach_lock);
3727 3727
3728 mlog(0, "d_delete(%.*s);\n", dentry->d_name.len, 3728 mlog(0, "d_delete(%pd);\n", dentry);
3729 dentry->d_name.name);
3730 3729
3731 /* 3730 /*
3732 * The following dcache calls may do an 3731 * The following dcache calls may do an
diff --git a/fs/ocfs2/journal.c b/fs/ocfs2/journal.c
index 4b0c68849b36..4f502382180f 100644
--- a/fs/ocfs2/journal.c
+++ b/fs/ocfs2/journal.c
@@ -1982,10 +1982,12 @@ struct ocfs2_orphan_filldir_priv {
1982 struct ocfs2_super *osb; 1982 struct ocfs2_super *osb;
1983}; 1983};
1984 1984
1985static int ocfs2_orphan_filldir(void *priv, const char *name, int name_len, 1985static int ocfs2_orphan_filldir(struct dir_context *ctx, const char *name,
1986 loff_t pos, u64 ino, unsigned type) 1986 int name_len, loff_t pos, u64 ino,
1987 unsigned type)
1987{ 1988{
1988 struct ocfs2_orphan_filldir_priv *p = priv; 1989 struct ocfs2_orphan_filldir_priv *p =
1990 container_of(ctx, struct ocfs2_orphan_filldir_priv, ctx);
1989 struct inode *iter; 1991 struct inode *iter;
1990 1992
1991 if (name_len == 1 && !strncmp(".", name, 1)) 1993 if (name_len == 1 && !strncmp(".", name, 1))
diff --git a/fs/open.c b/fs/open.c
index de92c13b58be..b1bf3d542d5d 100644
--- a/fs/open.c
+++ b/fs/open.c
@@ -516,7 +516,7 @@ SYSCALL_DEFINE2(fchmod, unsigned int, fd, umode_t, mode)
516 int err = -EBADF; 516 int err = -EBADF;
517 517
518 if (f.file) { 518 if (f.file) {
519 audit_inode(NULL, f.file->f_path.dentry, 0); 519 audit_file(f.file);
520 err = chmod_common(&f.file->f_path, mode); 520 err = chmod_common(&f.file->f_path, mode);
521 fdput(f); 521 fdput(f);
522 } 522 }
@@ -642,7 +642,7 @@ SYSCALL_DEFINE3(fchown, unsigned int, fd, uid_t, user, gid_t, group)
642 error = mnt_want_write_file(f.file); 642 error = mnt_want_write_file(f.file);
643 if (error) 643 if (error)
644 goto out_fput; 644 goto out_fput;
645 audit_inode(NULL, f.file->f_path.dentry, 0); 645 audit_file(f.file);
646 error = chown_common(&f.file->f_path, user, group); 646 error = chown_common(&f.file->f_path, user, group);
647 mnt_drop_write_file(f.file); 647 mnt_drop_write_file(f.file);
648out_fput: 648out_fput:
diff --git a/fs/overlayfs/readdir.c b/fs/overlayfs/readdir.c
index ab1e3dcbed95..c0205990a9f5 100644
--- a/fs/overlayfs/readdir.c
+++ b/fs/overlayfs/readdir.c
@@ -180,10 +180,12 @@ static void ovl_cache_put(struct ovl_dir_file *od, struct dentry *dentry)
180 } 180 }
181} 181}
182 182
183static int ovl_fill_merge(void *buf, const char *name, int namelen, 183static int ovl_fill_merge(struct dir_context *ctx, const char *name,
184 loff_t offset, u64 ino, unsigned int d_type) 184 int namelen, loff_t offset, u64 ino,
185 unsigned int d_type)
185{ 186{
186 struct ovl_readdir_data *rdd = buf; 187 struct ovl_readdir_data *rdd =
188 container_of(ctx, struct ovl_readdir_data, ctx);
187 189
188 rdd->count++; 190 rdd->count++;
189 if (!rdd->is_merge) 191 if (!rdd->is_merge)
diff --git a/fs/proc/base.c b/fs/proc/base.c
index 772efa45a452..64891f3e41bd 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -2789,7 +2789,7 @@ retry:
2789int proc_pid_readdir(struct file *file, struct dir_context *ctx) 2789int proc_pid_readdir(struct file *file, struct dir_context *ctx)
2790{ 2790{
2791 struct tgid_iter iter; 2791 struct tgid_iter iter;
2792 struct pid_namespace *ns = file->f_dentry->d_sb->s_fs_info; 2792 struct pid_namespace *ns = file_inode(file)->i_sb->s_fs_info;
2793 loff_t pos = ctx->pos; 2793 loff_t pos = ctx->pos;
2794 2794
2795 if (pos >= PID_MAX_LIMIT + TGID_OFFSET) 2795 if (pos >= PID_MAX_LIMIT + TGID_OFFSET)
@@ -3095,7 +3095,7 @@ static int proc_task_readdir(struct file *file, struct dir_context *ctx)
3095 /* f_version caches the tgid value that the last readdir call couldn't 3095 /* f_version caches the tgid value that the last readdir call couldn't
3096 * return. lseek aka telldir automagically resets f_version to 0. 3096 * return. lseek aka telldir automagically resets f_version to 0.
3097 */ 3097 */
3098 ns = file->f_dentry->d_sb->s_fs_info; 3098 ns = inode->i_sb->s_fs_info;
3099 tid = (int)file->f_version; 3099 tid = (int)file->f_version;
3100 file->f_version = 0; 3100 file->f_version = 0;
3101 for (task = first_tid(proc_pid(inode), tid, ctx->pos - 2, ns); 3101 for (task = first_tid(proc_pid(inode), tid, ctx->pos - 2, ns);
diff --git a/fs/proc/fd.c b/fs/proc/fd.c
index e11d7c590bb0..8e5ad83b629a 100644
--- a/fs/proc/fd.c
+++ b/fs/proc/fd.c
@@ -53,7 +53,8 @@ static int seq_show(struct seq_file *m, void *v)
53 (long long)file->f_pos, f_flags, 53 (long long)file->f_pos, f_flags,
54 real_mount(file->f_path.mnt)->mnt_id); 54 real_mount(file->f_path.mnt)->mnt_id);
55 if (file->f_op->show_fdinfo) 55 if (file->f_op->show_fdinfo)
56 ret = file->f_op->show_fdinfo(m, file); 56 file->f_op->show_fdinfo(m, file);
57 ret = seq_has_overflowed(m);
57 fput(file); 58 fput(file);
58 } 59 }
59 60
diff --git a/fs/readdir.c b/fs/readdir.c
index 33fd92208cb7..ced679179cac 100644
--- a/fs/readdir.c
+++ b/fs/readdir.c
@@ -74,10 +74,11 @@ struct readdir_callback {
74 int result; 74 int result;
75}; 75};
76 76
77static int fillonedir(void * __buf, const char * name, int namlen, loff_t offset, 77static int fillonedir(struct dir_context *ctx, const char *name, int namlen,
78 u64 ino, unsigned int d_type) 78 loff_t offset, u64 ino, unsigned int d_type)
79{ 79{
80 struct readdir_callback *buf = (struct readdir_callback *) __buf; 80 struct readdir_callback *buf =
81 container_of(ctx, struct readdir_callback, ctx);
81 struct old_linux_dirent __user * dirent; 82 struct old_linux_dirent __user * dirent;
82 unsigned long d_ino; 83 unsigned long d_ino;
83 84
@@ -148,11 +149,12 @@ struct getdents_callback {
148 int error; 149 int error;
149}; 150};
150 151
151static int filldir(void * __buf, const char * name, int namlen, loff_t offset, 152static int filldir(struct dir_context *ctx, const char *name, int namlen,
152 u64 ino, unsigned int d_type) 153 loff_t offset, u64 ino, unsigned int d_type)
153{ 154{
154 struct linux_dirent __user * dirent; 155 struct linux_dirent __user * dirent;
155 struct getdents_callback * buf = (struct getdents_callback *) __buf; 156 struct getdents_callback *buf =
157 container_of(ctx, struct getdents_callback, ctx);
156 unsigned long d_ino; 158 unsigned long d_ino;
157 int reclen = ALIGN(offsetof(struct linux_dirent, d_name) + namlen + 2, 159 int reclen = ALIGN(offsetof(struct linux_dirent, d_name) + namlen + 2,
158 sizeof(long)); 160 sizeof(long));
@@ -232,11 +234,12 @@ struct getdents_callback64 {
232 int error; 234 int error;
233}; 235};
234 236
235static int filldir64(void * __buf, const char * name, int namlen, loff_t offset, 237static int filldir64(struct dir_context *ctx, const char *name, int namlen,
236 u64 ino, unsigned int d_type) 238 loff_t offset, u64 ino, unsigned int d_type)
237{ 239{
238 struct linux_dirent64 __user *dirent; 240 struct linux_dirent64 __user *dirent;
239 struct getdents_callback64 * buf = (struct getdents_callback64 *) __buf; 241 struct getdents_callback64 *buf =
242 container_of(ctx, struct getdents_callback64, ctx);
240 int reclen = ALIGN(offsetof(struct linux_dirent64, d_name) + namlen + 1, 243 int reclen = ALIGN(offsetof(struct linux_dirent64, d_name) + namlen + 1,
241 sizeof(u64)); 244 sizeof(u64));
242 245
diff --git a/fs/reiserfs/xattr.c b/fs/reiserfs/xattr.c
index 7c36898af402..04b06146bae2 100644
--- a/fs/reiserfs/xattr.c
+++ b/fs/reiserfs/xattr.c
@@ -188,10 +188,11 @@ struct reiserfs_dentry_buf {
188}; 188};
189 189
190static int 190static int
191fill_with_dentries(void *buf, const char *name, int namelen, loff_t offset, 191fill_with_dentries(struct dir_context *ctx, const char *name, int namelen,
192 u64 ino, unsigned int d_type) 192 loff_t offset, u64 ino, unsigned int d_type)
193{ 193{
194 struct reiserfs_dentry_buf *dbuf = buf; 194 struct reiserfs_dentry_buf *dbuf =
195 container_of(ctx, struct reiserfs_dentry_buf, ctx);
195 struct dentry *dentry; 196 struct dentry *dentry;
196 197
197 WARN_ON_ONCE(!mutex_is_locked(&dbuf->xadir->d_inode->i_mutex)); 198 WARN_ON_ONCE(!mutex_is_locked(&dbuf->xadir->d_inode->i_mutex));
@@ -209,9 +210,9 @@ fill_with_dentries(void *buf, const char *name, int namelen, loff_t offset,
209 } else if (!dentry->d_inode) { 210 } else if (!dentry->d_inode) {
210 /* A directory entry exists, but no file? */ 211 /* A directory entry exists, but no file? */
211 reiserfs_error(dentry->d_sb, "xattr-20003", 212 reiserfs_error(dentry->d_sb, "xattr-20003",
212 "Corrupted directory: xattr %s listed but " 213 "Corrupted directory: xattr %pd listed but "
213 "not found for file %s.\n", 214 "not found for file %pd.\n",
214 dentry->d_name.name, dbuf->xadir->d_name.name); 215 dentry, dbuf->xadir);
215 dput(dentry); 216 dput(dentry);
216 return -EIO; 217 return -EIO;
217 } 218 }
@@ -824,10 +825,12 @@ struct listxattr_buf {
824 struct dentry *dentry; 825 struct dentry *dentry;
825}; 826};
826 827
827static int listxattr_filler(void *buf, const char *name, int namelen, 828static int listxattr_filler(struct dir_context *ctx, const char *name,
828 loff_t offset, u64 ino, unsigned int d_type) 829 int namelen, loff_t offset, u64 ino,
830 unsigned int d_type)
829{ 831{
830 struct listxattr_buf *b = (struct listxattr_buf *)buf; 832 struct listxattr_buf *b =
833 container_of(ctx, struct listxattr_buf, ctx);
831 size_t size; 834 size_t size;
832 835
833 if (name[0] != '.' || 836 if (name[0] != '.' ||
diff --git a/fs/seq_file.c b/fs/seq_file.c
index 3857b720cb1b..353948ba1c5b 100644
--- a/fs/seq_file.c
+++ b/fs/seq_file.c
@@ -16,17 +16,6 @@
16#include <asm/uaccess.h> 16#include <asm/uaccess.h>
17#include <asm/page.h> 17#include <asm/page.h>
18 18
19
20/*
21 * seq_files have a buffer which can may overflow. When this happens a larger
22 * buffer is reallocated and all the data will be printed again.
23 * The overflow state is true when m->count == m->size.
24 */
25static bool seq_overflow(struct seq_file *m)
26{
27 return m->count == m->size;
28}
29
30static void seq_set_overflow(struct seq_file *m) 19static void seq_set_overflow(struct seq_file *m)
31{ 20{
32 m->count = m->size; 21 m->count = m->size;
@@ -124,7 +113,7 @@ static int traverse(struct seq_file *m, loff_t offset)
124 error = 0; 113 error = 0;
125 m->count = 0; 114 m->count = 0;
126 } 115 }
127 if (seq_overflow(m)) 116 if (seq_has_overflowed(m))
128 goto Eoverflow; 117 goto Eoverflow;
129 if (pos + m->count > offset) { 118 if (pos + m->count > offset) {
130 m->from = offset - pos; 119 m->from = offset - pos;
@@ -267,7 +256,7 @@ Fill:
267 break; 256 break;
268 } 257 }
269 err = m->op->show(m, p); 258 err = m->op->show(m, p);
270 if (seq_overflow(m) || err) { 259 if (seq_has_overflowed(m) || err) {
271 m->count = offs; 260 m->count = offs;
272 if (likely(err <= 0)) 261 if (likely(err <= 0))
273 break; 262 break;
diff --git a/fs/signalfd.c b/fs/signalfd.c
index 424b7b65321f..7e412ad74836 100644
--- a/fs/signalfd.c
+++ b/fs/signalfd.c
@@ -230,7 +230,7 @@ static ssize_t signalfd_read(struct file *file, char __user *buf, size_t count,
230} 230}
231 231
232#ifdef CONFIG_PROC_FS 232#ifdef CONFIG_PROC_FS
233static int signalfd_show_fdinfo(struct seq_file *m, struct file *f) 233static void signalfd_show_fdinfo(struct seq_file *m, struct file *f)
234{ 234{
235 struct signalfd_ctx *ctx = f->private_data; 235 struct signalfd_ctx *ctx = f->private_data;
236 sigset_t sigmask; 236 sigset_t sigmask;
@@ -238,8 +238,6 @@ static int signalfd_show_fdinfo(struct seq_file *m, struct file *f)
238 sigmask = ctx->sigmask; 238 sigmask = ctx->sigmask;
239 signotset(&sigmask); 239 signotset(&sigmask);
240 render_sigset_t(m, "sigmask:\t", &sigmask); 240 render_sigset_t(m, "sigmask:\t", &sigmask);
241
242 return 0;
243} 241}
244#endif 242#endif
245 243
diff --git a/fs/sync.c b/fs/sync.c
index bdc729d80e5e..01d9f18a70b5 100644
--- a/fs/sync.c
+++ b/fs/sync.c
@@ -154,7 +154,7 @@ SYSCALL_DEFINE1(syncfs, int, fd)
154 154
155 if (!f.file) 155 if (!f.file)
156 return -EBADF; 156 return -EBADF;
157 sb = f.file->f_dentry->d_sb; 157 sb = f.file->f_path.dentry->d_sb;
158 158
159 down_read(&sb->s_umount); 159 down_read(&sb->s_umount);
160 ret = sync_filesystem(sb); 160 ret = sync_filesystem(sb);
diff --git a/fs/timerfd.c b/fs/timerfd.c
index b46ffa94372a..b94fa6c3c6eb 100644
--- a/fs/timerfd.c
+++ b/fs/timerfd.c
@@ -288,7 +288,7 @@ static ssize_t timerfd_read(struct file *file, char __user *buf, size_t count,
288} 288}
289 289
290#ifdef CONFIG_PROC_FS 290#ifdef CONFIG_PROC_FS
291static int timerfd_show(struct seq_file *m, struct file *file) 291static void timerfd_show(struct seq_file *m, struct file *file)
292{ 292{
293 struct timerfd_ctx *ctx = file->private_data; 293 struct timerfd_ctx *ctx = file->private_data;
294 struct itimerspec t; 294 struct itimerspec t;
@@ -298,18 +298,19 @@ static int timerfd_show(struct seq_file *m, struct file *file)
298 t.it_interval = ktime_to_timespec(ctx->tintv); 298 t.it_interval = ktime_to_timespec(ctx->tintv);
299 spin_unlock_irq(&ctx->wqh.lock); 299 spin_unlock_irq(&ctx->wqh.lock);
300 300
301 return seq_printf(m, 301 seq_printf(m,
302 "clockid: %d\n" 302 "clockid: %d\n"
303 "ticks: %llu\n" 303 "ticks: %llu\n"
304 "settime flags: 0%o\n" 304 "settime flags: 0%o\n"
305 "it_value: (%llu, %llu)\n" 305 "it_value: (%llu, %llu)\n"
306 "it_interval: (%llu, %llu)\n", 306 "it_interval: (%llu, %llu)\n",
307 ctx->clockid, (unsigned long long)ctx->ticks, 307 ctx->clockid,
308 ctx->settime_flags, 308 (unsigned long long)ctx->ticks,
309 (unsigned long long)t.it_value.tv_sec, 309 ctx->settime_flags,
310 (unsigned long long)t.it_value.tv_nsec, 310 (unsigned long long)t.it_value.tv_sec,
311 (unsigned long long)t.it_interval.tv_sec, 311 (unsigned long long)t.it_value.tv_nsec,
312 (unsigned long long)t.it_interval.tv_nsec); 312 (unsigned long long)t.it_interval.tv_sec,
313 (unsigned long long)t.it_interval.tv_nsec);
313} 314}
314#else 315#else
315#define timerfd_show NULL 316#define timerfd_show NULL
diff --git a/fs/xattr.c b/fs/xattr.c
index 64e83efb742d..4ef698549e31 100644
--- a/fs/xattr.c
+++ b/fs/xattr.c
@@ -405,16 +405,14 @@ SYSCALL_DEFINE5(fsetxattr, int, fd, const char __user *, name,
405 const void __user *,value, size_t, size, int, flags) 405 const void __user *,value, size_t, size, int, flags)
406{ 406{
407 struct fd f = fdget(fd); 407 struct fd f = fdget(fd);
408 struct dentry *dentry;
409 int error = -EBADF; 408 int error = -EBADF;
410 409
411 if (!f.file) 410 if (!f.file)
412 return error; 411 return error;
413 dentry = f.file->f_path.dentry; 412 audit_file(f.file);
414 audit_inode(NULL, dentry, 0);
415 error = mnt_want_write_file(f.file); 413 error = mnt_want_write_file(f.file);
416 if (!error) { 414 if (!error) {
417 error = setxattr(dentry, name, value, size, flags); 415 error = setxattr(f.file->f_path.dentry, name, value, size, flags);
418 mnt_drop_write_file(f.file); 416 mnt_drop_write_file(f.file);
419 } 417 }
420 fdput(f); 418 fdput(f);
@@ -509,7 +507,7 @@ SYSCALL_DEFINE4(fgetxattr, int, fd, const char __user *, name,
509 507
510 if (!f.file) 508 if (!f.file)
511 return error; 509 return error;
512 audit_inode(NULL, f.file->f_path.dentry, 0); 510 audit_file(f.file);
513 error = getxattr(f.file->f_path.dentry, name, value, size); 511 error = getxattr(f.file->f_path.dentry, name, value, size);
514 fdput(f); 512 fdput(f);
515 return error; 513 return error;
@@ -590,7 +588,7 @@ SYSCALL_DEFINE3(flistxattr, int, fd, char __user *, list, size_t, size)
590 588
591 if (!f.file) 589 if (!f.file)
592 return error; 590 return error;
593 audit_inode(NULL, f.file->f_path.dentry, 0); 591 audit_file(f.file);
594 error = listxattr(f.file->f_path.dentry, list, size); 592 error = listxattr(f.file->f_path.dentry, list, size);
595 fdput(f); 593 fdput(f);
596 return error; 594 return error;
@@ -651,16 +649,14 @@ SYSCALL_DEFINE2(lremovexattr, const char __user *, pathname,
651SYSCALL_DEFINE2(fremovexattr, int, fd, const char __user *, name) 649SYSCALL_DEFINE2(fremovexattr, int, fd, const char __user *, name)
652{ 650{
653 struct fd f = fdget(fd); 651 struct fd f = fdget(fd);
654 struct dentry *dentry;
655 int error = -EBADF; 652 int error = -EBADF;
656 653
657 if (!f.file) 654 if (!f.file)
658 return error; 655 return error;
659 dentry = f.file->f_path.dentry; 656 audit_file(f.file);
660 audit_inode(NULL, dentry, 0);
661 error = mnt_want_write_file(f.file); 657 error = mnt_want_write_file(f.file);
662 if (!error) { 658 if (!error) {
663 error = removexattr(dentry, name); 659 error = removexattr(f.file->f_path.dentry, name);
664 mnt_drop_write_file(f.file); 660 mnt_drop_write_file(f.file);
665 } 661 }
666 fdput(f); 662 fdput(f);