Commit 6de1472f1a4a3bd912f515f29d3cf52a65a4c718

Authored by Al Viro
1 parent 48bc06e74b

nfs: use %p[dD] instead of open-coded (and often racy) equivalents

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

Showing 11 changed files with 119 additions and 186 deletions Side-by-side Diff

... ... @@ -98,9 +98,7 @@
98 98 struct nfs_open_dir_context *ctx;
99 99 struct rpc_cred *cred;
100 100  
101   - dfprintk(FILE, "NFS: open dir(%s/%s)\n",
102   - filp->f_path.dentry->d_parent->d_name.name,
103   - filp->f_path.dentry->d_name.name);
  101 + dfprintk(FILE, "NFS: open dir(%pD2)\n", filp);
104 102  
105 103 nfs_inc_stats(inode, NFSIOS_VFSOPEN);
106 104  
107 105  
... ... @@ -297,11 +295,10 @@
297 295 if (ctx->duped > 0
298 296 && ctx->dup_cookie == *desc->dir_cookie) {
299 297 if (printk_ratelimit()) {
300   - pr_notice("NFS: directory %s/%s contains a readdir loop."
  298 + pr_notice("NFS: directory %pD2 contains a readdir loop."
301 299 "Please contact your server vendor. "
302 300 "The file: %s has duplicate cookie %llu\n",
303   - desc->file->f_dentry->d_parent->d_name.name,
304   - desc->file->f_dentry->d_name.name,
  301 + desc->file,
305 302 array->array[i].string.name,
306 303 *desc->dir_cookie);
307 304 }
... ... @@ -822,9 +819,8 @@
822 819 struct nfs_open_dir_context *dir_ctx = file->private_data;
823 820 int res = 0;
824 821  
825   - dfprintk(FILE, "NFS: readdir(%s/%s) starting at cookie %llu\n",
826   - dentry->d_parent->d_name.name, dentry->d_name.name,
827   - (long long)ctx->pos);
  822 + dfprintk(FILE, "NFS: readdir(%pD2) starting at cookie %llu\n",
  823 + file, (long long)ctx->pos);
828 824 nfs_inc_stats(inode, NFSIOS_VFSGETDENTS);
829 825  
830 826 /*
831 827  
832 828  
... ... @@ -880,22 +876,17 @@
880 876 nfs_unblock_sillyrename(dentry);
881 877 if (res > 0)
882 878 res = 0;
883   - dfprintk(FILE, "NFS: readdir(%s/%s) returns %d\n",
884   - dentry->d_parent->d_name.name, dentry->d_name.name,
885   - res);
  879 + dfprintk(FILE, "NFS: readdir(%pD2) returns %d\n", file, res);
886 880 return res;
887 881 }
888 882  
889 883 static loff_t nfs_llseek_dir(struct file *filp, loff_t offset, int whence)
890 884 {
891   - struct dentry *dentry = filp->f_path.dentry;
892   - struct inode *inode = dentry->d_inode;
  885 + struct inode *inode = file_inode(filp);
893 886 struct nfs_open_dir_context *dir_ctx = filp->private_data;
894 887  
895   - dfprintk(FILE, "NFS: llseek dir(%s/%s, %lld, %d)\n",
896   - dentry->d_parent->d_name.name,
897   - dentry->d_name.name,
898   - offset, whence);
  888 + dfprintk(FILE, "NFS: llseek dir(%pD2, %lld, %d)\n",
  889 + filp, offset, whence);
899 890  
900 891 mutex_lock(&inode->i_mutex);
901 892 switch (whence) {
902 893  
903 894  
... ... @@ -925,15 +916,12 @@
925 916 static int nfs_fsync_dir(struct file *filp, loff_t start, loff_t end,
926 917 int datasync)
927 918 {
928   - struct dentry *dentry = filp->f_path.dentry;
929   - struct inode *inode = dentry->d_inode;
  919 + struct inode *inode = file_inode(filp);
930 920  
931   - dfprintk(FILE, "NFS: fsync dir(%s/%s) datasync %d\n",
932   - dentry->d_parent->d_name.name, dentry->d_name.name,
933   - datasync);
  921 + dfprintk(FILE, "NFS: fsync dir(%pD2) datasync %d\n", filp, datasync);
934 922  
935 923 mutex_lock(&inode->i_mutex);
936   - nfs_inc_stats(dentry->d_inode, NFSIOS_VFSFSYNC);
  924 + nfs_inc_stats(inode, NFSIOS_VFSFSYNC);
937 925 mutex_unlock(&inode->i_mutex);
938 926 return 0;
939 927 }
... ... @@ -1073,9 +1061,8 @@
1073 1061 }
1074 1062  
1075 1063 if (is_bad_inode(inode)) {
1076   - dfprintk(LOOKUPCACHE, "%s: %s/%s has dud inode\n",
1077   - __func__, dentry->d_parent->d_name.name,
1078   - dentry->d_name.name);
  1064 + dfprintk(LOOKUPCACHE, "%s: %pd2 has dud inode\n",
  1065 + __func__, dentry);
1079 1066 goto out_bad;
1080 1067 }
1081 1068  
... ... @@ -1125,9 +1112,8 @@
1125 1112 nfs_advise_use_readdirplus(dir);
1126 1113 out_valid_noent:
1127 1114 dput(parent);
1128   - dfprintk(LOOKUPCACHE, "NFS: %s(%s/%s) is valid\n",
1129   - __func__, dentry->d_parent->d_name.name,
1130   - dentry->d_name.name);
  1115 + dfprintk(LOOKUPCACHE, "NFS: %s(%pd2) is valid\n",
  1116 + __func__, dentry);
1131 1117 return 1;
1132 1118 out_zap_parent:
1133 1119 nfs_zap_caches(dir);
1134 1120  
... ... @@ -1147,18 +1133,16 @@
1147 1133 goto out_valid;
1148 1134  
1149 1135 dput(parent);
1150   - dfprintk(LOOKUPCACHE, "NFS: %s(%s/%s) is invalid\n",
1151   - __func__, dentry->d_parent->d_name.name,
1152   - dentry->d_name.name);
  1136 + dfprintk(LOOKUPCACHE, "NFS: %s(%pd2) is invalid\n",
  1137 + __func__, dentry);
1153 1138 return 0;
1154 1139 out_error:
1155 1140 nfs_free_fattr(fattr);
1156 1141 nfs_free_fhandle(fhandle);
1157 1142 nfs4_label_free(label);
1158 1143 dput(parent);
1159   - dfprintk(LOOKUPCACHE, "NFS: %s(%s/%s) lookup returned error %d\n",
1160   - __func__, dentry->d_parent->d_name.name,
1161   - dentry->d_name.name, error);
  1144 + dfprintk(LOOKUPCACHE, "NFS: %s(%pd2) lookup returned error %d\n",
  1145 + __func__, dentry, error);
1162 1146 return error;
1163 1147 }
1164 1148  
1165 1149  
... ... @@ -1182,16 +1166,14 @@
1182 1166 * eventually need to do something more here.
1183 1167 */
1184 1168 if (!inode) {
1185   - dfprintk(LOOKUPCACHE, "%s: %s/%s has negative inode\n",
1186   - __func__, dentry->d_parent->d_name.name,
1187   - dentry->d_name.name);
  1169 + dfprintk(LOOKUPCACHE, "%s: %pd2 has negative inode\n",
  1170 + __func__, dentry);
1188 1171 return 1;
1189 1172 }
1190 1173  
1191 1174 if (is_bad_inode(inode)) {
1192   - dfprintk(LOOKUPCACHE, "%s: %s/%s has dud inode\n",
1193   - __func__, dentry->d_parent->d_name.name,
1194   - dentry->d_name.name);
  1175 + dfprintk(LOOKUPCACHE, "%s: %pd2 has dud inode\n",
  1176 + __func__, dentry);
1195 1177 return 0;
1196 1178 }
1197 1179  
... ... @@ -1206,9 +1188,8 @@
1206 1188 */
1207 1189 static int nfs_dentry_delete(const struct dentry *dentry)
1208 1190 {
1209   - dfprintk(VFS, "NFS: dentry_delete(%s/%s, %x)\n",
1210   - dentry->d_parent->d_name.name, dentry->d_name.name,
1211   - dentry->d_flags);
  1191 + dfprintk(VFS, "NFS: dentry_delete(%pd2, %x)\n",
  1192 + dentry, dentry->d_flags);
1212 1193  
1213 1194 /* Unhash any dentry with a stale inode */
1214 1195 if (dentry->d_inode != NULL && NFS_STALE(dentry->d_inode))
... ... @@ -1286,8 +1267,7 @@
1286 1267 struct nfs4_label *label = NULL;
1287 1268 int error;
1288 1269  
1289   - dfprintk(VFS, "NFS: lookup(%s/%s)\n",
1290   - dentry->d_parent->d_name.name, dentry->d_name.name);
  1270 + dfprintk(VFS, "NFS: lookup(%pd2)\n", dentry);
1291 1271 nfs_inc_stats(dir, NFSIOS_VFSLOOKUP);
1292 1272  
1293 1273 res = ERR_PTR(-ENAMETOOLONG);
... ... @@ -1418,8 +1398,8 @@
1418 1398 /* Expect a negative dentry */
1419 1399 BUG_ON(dentry->d_inode);
1420 1400  
1421   - dfprintk(VFS, "NFS: atomic_open(%s/%ld), %s\n",
1422   - dir->i_sb->s_id, dir->i_ino, dentry->d_name.name);
  1401 + dfprintk(VFS, "NFS: atomic_open(%s/%ld), %pd\n",
  1402 + dir->i_sb->s_id, dir->i_ino, dentry);
1423 1403  
1424 1404 err = nfs_check_flags(open_flags);
1425 1405 if (err)
... ... @@ -1608,8 +1588,8 @@
1608 1588 int open_flags = excl ? O_CREAT | O_EXCL : O_CREAT;
1609 1589 int error;
1610 1590  
1611   - dfprintk(VFS, "NFS: create(%s/%ld), %s\n",
1612   - dir->i_sb->s_id, dir->i_ino, dentry->d_name.name);
  1591 + dfprintk(VFS, "NFS: create(%s/%ld), %pd\n",
  1592 + dir->i_sb->s_id, dir->i_ino, dentry);
1613 1593  
1614 1594 attr.ia_mode = mode;
1615 1595 attr.ia_valid = ATTR_MODE;
... ... @@ -1635,8 +1615,8 @@
1635 1615 struct iattr attr;
1636 1616 int status;
1637 1617  
1638   - dfprintk(VFS, "NFS: mknod(%s/%ld), %s\n",
1639   - dir->i_sb->s_id, dir->i_ino, dentry->d_name.name);
  1618 + dfprintk(VFS, "NFS: mknod(%s/%ld), %pd\n",
  1619 + dir->i_sb->s_id, dir->i_ino, dentry);
1640 1620  
1641 1621 if (!new_valid_dev(rdev))
1642 1622 return -EINVAL;
... ... @@ -1664,8 +1644,8 @@
1664 1644 struct iattr attr;
1665 1645 int error;
1666 1646  
1667   - dfprintk(VFS, "NFS: mkdir(%s/%ld), %s\n",
1668   - dir->i_sb->s_id, dir->i_ino, dentry->d_name.name);
  1647 + dfprintk(VFS, "NFS: mkdir(%s/%ld), %pd\n",
  1648 + dir->i_sb->s_id, dir->i_ino, dentry);
1669 1649  
1670 1650 attr.ia_valid = ATTR_MODE;
1671 1651 attr.ia_mode = mode | S_IFDIR;
... ... @@ -1692,8 +1672,8 @@
1692 1672 {
1693 1673 int error;
1694 1674  
1695   - dfprintk(VFS, "NFS: rmdir(%s/%ld), %s\n",
1696   - dir->i_sb->s_id, dir->i_ino, dentry->d_name.name);
  1675 + dfprintk(VFS, "NFS: rmdir(%s/%ld), %pd\n",
  1676 + dir->i_sb->s_id, dir->i_ino, dentry);
1697 1677  
1698 1678 trace_nfs_rmdir_enter(dir, dentry);
1699 1679 if (dentry->d_inode) {
... ... @@ -1728,8 +1708,7 @@
1728 1708 struct inode *inode = dentry->d_inode;
1729 1709 int error = -EBUSY;
1730 1710  
1731   - dfprintk(VFS, "NFS: safe_remove(%s/%s)\n",
1732   - dentry->d_parent->d_name.name, dentry->d_name.name);
  1711 + dfprintk(VFS, "NFS: safe_remove(%pd2)\n", dentry);
1733 1712  
1734 1713 /* If the dentry was sillyrenamed, we simply call d_delete() */
1735 1714 if (dentry->d_flags & DCACHE_NFSFS_RENAMED) {
... ... @@ -1762,8 +1741,8 @@
1762 1741 int error;
1763 1742 int need_rehash = 0;
1764 1743  
1765   - dfprintk(VFS, "NFS: unlink(%s/%ld, %s)\n", dir->i_sb->s_id,
1766   - dir->i_ino, dentry->d_name.name);
  1744 + dfprintk(VFS, "NFS: unlink(%s/%ld, %pd)\n", dir->i_sb->s_id,
  1745 + dir->i_ino, dentry);
1767 1746  
1768 1747 trace_nfs_unlink_enter(dir, dentry);
1769 1748 spin_lock(&dentry->d_lock);
... ... @@ -1813,8 +1792,8 @@
1813 1792 unsigned int pathlen = strlen(symname);
1814 1793 int error;
1815 1794  
1816   - dfprintk(VFS, "NFS: symlink(%s/%ld, %s, %s)\n", dir->i_sb->s_id,
1817   - dir->i_ino, dentry->d_name.name, symname);
  1795 + dfprintk(VFS, "NFS: symlink(%s/%ld, %pd, %s)\n", dir->i_sb->s_id,
  1796 + dir->i_ino, dentry, symname);
1818 1797  
1819 1798 if (pathlen > PAGE_SIZE)
1820 1799 return -ENAMETOOLONG;
1821 1800  
... ... @@ -1836,9 +1815,9 @@
1836 1815 error = NFS_PROTO(dir)->symlink(dir, dentry, page, pathlen, &attr);
1837 1816 trace_nfs_symlink_exit(dir, dentry, error);
1838 1817 if (error != 0) {
1839   - dfprintk(VFS, "NFS: symlink(%s/%ld, %s, %s) error %d\n",
  1818 + dfprintk(VFS, "NFS: symlink(%s/%ld, %pd, %s) error %d\n",
1840 1819 dir->i_sb->s_id, dir->i_ino,
1841   - dentry->d_name.name, symname, error);
  1820 + dentry, symname, error);
1842 1821 d_drop(dentry);
1843 1822 __free_page(page);
1844 1823 return error;
... ... @@ -1865,9 +1844,8 @@
1865 1844 struct inode *inode = old_dentry->d_inode;
1866 1845 int error;
1867 1846  
1868   - dfprintk(VFS, "NFS: link(%s/%s -> %s/%s)\n",
1869   - old_dentry->d_parent->d_name.name, old_dentry->d_name.name,
1870   - dentry->d_parent->d_name.name, dentry->d_name.name);
  1847 + dfprintk(VFS, "NFS: link(%pd2 -> %pd2)\n",
  1848 + old_dentry, dentry);
1871 1849  
1872 1850 trace_nfs_link_enter(inode, dir, dentry);
1873 1851 NFS_PROTO(inode)->return_delegation(inode);
... ... @@ -1915,9 +1893,8 @@
1915 1893 struct dentry *dentry = NULL, *rehash = NULL;
1916 1894 int error = -EBUSY;
1917 1895  
1918   - dfprintk(VFS, "NFS: rename(%s/%s -> %s/%s, ct=%d)\n",
1919   - old_dentry->d_parent->d_name.name, old_dentry->d_name.name,
1920   - new_dentry->d_parent->d_name.name, new_dentry->d_name.name,
  1896 + dfprintk(VFS, "NFS: rename(%pd2 -> %pd2, ct=%d)\n",
  1897 + old_dentry, new_dentry,
1921 1898 d_count(new_dentry));
1922 1899  
1923 1900 trace_nfs_rename_enter(old_dir, old_dentry, new_dir, new_dentry);
... ... @@ -124,9 +124,8 @@
124 124 ssize_t nfs_direct_IO(int rw, struct kiocb *iocb, const struct iovec *iov, loff_t pos, unsigned long nr_segs)
125 125 {
126 126 #ifndef CONFIG_NFS_SWAP
127   - dprintk("NFS: nfs_direct_IO (%s) off/no(%Ld/%lu) EINVAL\n",
128   - iocb->ki_filp->f_path.dentry->d_name.name,
129   - (long long) pos, nr_segs);
  127 + dprintk("NFS: nfs_direct_IO (%pD) off/no(%Ld/%lu) EINVAL\n",
  128 + iocb->ki_filp, (long long) pos, nr_segs);
130 129  
131 130 return -EINVAL;
132 131 #else
... ... @@ -909,10 +908,8 @@
909 908 count = iov_length(iov, nr_segs);
910 909 nfs_add_stats(mapping->host, NFSIOS_DIRECTREADBYTES, count);
911 910  
912   - dfprintk(FILE, "NFS: direct read(%s/%s, %zd@%Ld)\n",
913   - file->f_path.dentry->d_parent->d_name.name,
914   - file->f_path.dentry->d_name.name,
915   - count, (long long) pos);
  911 + dfprintk(FILE, "NFS: direct read(%pD2, %zd@%Ld)\n",
  912 + file, count, (long long) pos);
916 913  
917 914 retval = 0;
918 915 if (!count)
... ... @@ -965,10 +962,8 @@
965 962 count = iov_length(iov, nr_segs);
966 963 nfs_add_stats(mapping->host, NFSIOS_DIRECTWRITTENBYTES, count);
967 964  
968   - dfprintk(FILE, "NFS: direct write(%s/%s, %zd@%Ld)\n",
969   - file->f_path.dentry->d_parent->d_name.name,
970   - file->f_path.dentry->d_name.name,
971   - count, (long long) pos);
  965 + dfprintk(FILE, "NFS: direct write(%pD2, %zd@%Ld)\n",
  966 + file, count, (long long) pos);
972 967  
973 968 retval = generic_write_checks(file, &pos, &count, 0);
974 969 if (retval)
... ... @@ -65,9 +65,7 @@
65 65 {
66 66 int res;
67 67  
68   - dprintk("NFS: open file(%s/%s)\n",
69   - filp->f_path.dentry->d_parent->d_name.name,
70   - filp->f_path.dentry->d_name.name);
  68 + dprintk("NFS: open file(%pD2)\n", filp);
71 69  
72 70 nfs_inc_stats(inode, NFSIOS_VFSOPEN);
73 71 res = nfs_check_flags(filp->f_flags);
... ... @@ -81,9 +79,7 @@
81 79 int
82 80 nfs_file_release(struct inode *inode, struct file *filp)
83 81 {
84   - dprintk("NFS: release(%s/%s)\n",
85   - filp->f_path.dentry->d_parent->d_name.name,
86   - filp->f_path.dentry->d_name.name);
  82 + dprintk("NFS: release(%pD2)\n", filp);
87 83  
88 84 nfs_inc_stats(inode, NFSIOS_VFSRELEASE);
89 85 return nfs_release(inode, filp);
... ... @@ -123,10 +119,8 @@
123 119  
124 120 loff_t nfs_file_llseek(struct file *filp, loff_t offset, int whence)
125 121 {
126   - dprintk("NFS: llseek file(%s/%s, %lld, %d)\n",
127   - filp->f_path.dentry->d_parent->d_name.name,
128   - filp->f_path.dentry->d_name.name,
129   - offset, whence);
  122 + dprintk("NFS: llseek file(%pD2, %lld, %d)\n",
  123 + filp, offset, whence);
130 124  
131 125 /*
132 126 * whence == SEEK_END || SEEK_DATA || SEEK_HOLE => we must revalidate
133 127  
... ... @@ -150,12 +144,9 @@
150 144 int
151 145 nfs_file_flush(struct file *file, fl_owner_t id)
152 146 {
153   - struct dentry *dentry = file->f_path.dentry;
154   - struct inode *inode = dentry->d_inode;
  147 + struct inode *inode = file_inode(file);
155 148  
156   - dprintk("NFS: flush(%s/%s)\n",
157   - dentry->d_parent->d_name.name,
158   - dentry->d_name.name);
  149 + dprintk("NFS: flush(%pD2)\n", file);
159 150  
160 151 nfs_inc_stats(inode, NFSIOS_VFSFLUSH);
161 152 if ((file->f_mode & FMODE_WRITE) == 0)
162 153  
... ... @@ -177,15 +168,14 @@
177 168 nfs_file_read(struct kiocb *iocb, const struct iovec *iov,
178 169 unsigned long nr_segs, loff_t pos)
179 170 {
180   - struct dentry * dentry = iocb->ki_filp->f_path.dentry;
181   - struct inode * inode = dentry->d_inode;
  171 + struct inode *inode = file_inode(iocb->ki_filp);
182 172 ssize_t result;
183 173  
184 174 if (iocb->ki_filp->f_flags & O_DIRECT)
185 175 return nfs_file_direct_read(iocb, iov, nr_segs, pos, true);
186 176  
187   - dprintk("NFS: read(%s/%s, %lu@%lu)\n",
188   - dentry->d_parent->d_name.name, dentry->d_name.name,
  177 + dprintk("NFS: read(%pD2, %lu@%lu)\n",
  178 + iocb->ki_filp,
189 179 (unsigned long) iov_length(iov, nr_segs), (unsigned long) pos);
190 180  
191 181 result = nfs_revalidate_mapping(inode, iocb->ki_filp->f_mapping);
192 182  
... ... @@ -203,13 +193,11 @@
203 193 struct pipe_inode_info *pipe, size_t count,
204 194 unsigned int flags)
205 195 {
206   - struct dentry *dentry = filp->f_path.dentry;
207   - struct inode *inode = dentry->d_inode;
  196 + struct inode *inode = file_inode(filp);
208 197 ssize_t res;
209 198  
210   - dprintk("NFS: splice_read(%s/%s, %lu@%Lu)\n",
211   - dentry->d_parent->d_name.name, dentry->d_name.name,
212   - (unsigned long) count, (unsigned long long) *ppos);
  199 + dprintk("NFS: splice_read(%pD2, %lu@%Lu)\n",
  200 + filp, (unsigned long) count, (unsigned long long) *ppos);
213 201  
214 202 res = nfs_revalidate_mapping(inode, filp->f_mapping);
215 203 if (!res) {
216 204  
... ... @@ -224,12 +212,10 @@
224 212 int
225 213 nfs_file_mmap(struct file * file, struct vm_area_struct * vma)
226 214 {
227   - struct dentry *dentry = file->f_path.dentry;
228   - struct inode *inode = dentry->d_inode;
  215 + struct inode *inode = file_inode(file);
229 216 int status;
230 217  
231   - dprintk("NFS: mmap(%s/%s)\n",
232   - dentry->d_parent->d_name.name, dentry->d_name.name);
  218 + dprintk("NFS: mmap(%pD2)\n", file);
233 219  
234 220 /* Note: generic_file_mmap() returns ENOSYS on nommu systems
235 221 * so we call that before revalidating the mapping
236 222  
237 223  
... ... @@ -258,15 +244,12 @@
258 244 int
259 245 nfs_file_fsync_commit(struct file *file, loff_t start, loff_t end, int datasync)
260 246 {
261   - struct dentry *dentry = file->f_path.dentry;
262 247 struct nfs_open_context *ctx = nfs_file_open_context(file);
263   - struct inode *inode = dentry->d_inode;
  248 + struct inode *inode = file_inode(file);
264 249 int have_error, do_resend, status;
265 250 int ret = 0;
266 251  
267   - dprintk("NFS: fsync file(%s/%s) datasync %d\n",
268   - dentry->d_parent->d_name.name, dentry->d_name.name,
269   - datasync);
  252 + dprintk("NFS: fsync file(%pD2) datasync %d\n", file, datasync);
270 253  
271 254 nfs_inc_stats(inode, NFSIOS_VFSFSYNC);
272 255 do_resend = test_and_clear_bit(NFS_CONTEXT_RESEND_WRITES, &ctx->flags);
... ... @@ -371,10 +354,8 @@
371 354 struct page *page;
372 355 int once_thru = 0;
373 356  
374   - dfprintk(PAGECACHE, "NFS: write_begin(%s/%s(%ld), %u@%lld)\n",
375   - file->f_path.dentry->d_parent->d_name.name,
376   - file->f_path.dentry->d_name.name,
377   - mapping->host->i_ino, len, (long long) pos);
  357 + dfprintk(PAGECACHE, "NFS: write_begin(%pD2(%ld), %u@%lld)\n",
  358 + file, mapping->host->i_ino, len, (long long) pos);
378 359  
379 360 start:
380 361 /*
... ... @@ -414,10 +395,8 @@
414 395 struct nfs_open_context *ctx = nfs_file_open_context(file);
415 396 int status;
416 397  
417   - dfprintk(PAGECACHE, "NFS: write_end(%s/%s(%ld), %u@%lld)\n",
418   - file->f_path.dentry->d_parent->d_name.name,
419   - file->f_path.dentry->d_name.name,
420   - mapping->host->i_ino, len, (long long) pos);
  398 + dfprintk(PAGECACHE, "NFS: write_end(%pD2(%ld), %u@%lld)\n",
  399 + file, mapping->host->i_ino, len, (long long) pos);
421 400  
422 401 /*
423 402 * Zero any uninitialised parts of the page, and then mark the page
424 403  
425 404  
426 405  
... ... @@ -601,22 +580,21 @@
601 580 {
602 581 struct page *page = vmf->page;
603 582 struct file *filp = vma->vm_file;
604   - struct dentry *dentry = filp->f_path.dentry;
  583 + struct inode *inode = file_inode(filp);
605 584 unsigned pagelen;
606 585 int ret = VM_FAULT_NOPAGE;
607 586 struct address_space *mapping;
608 587  
609   - dfprintk(PAGECACHE, "NFS: vm_page_mkwrite(%s/%s(%ld), offset %lld)\n",
610   - dentry->d_parent->d_name.name, dentry->d_name.name,
611   - filp->f_mapping->host->i_ino,
  588 + dfprintk(PAGECACHE, "NFS: vm_page_mkwrite(%pD2(%ld), offset %lld)\n",
  589 + filp, filp->f_mapping->host->i_ino,
612 590 (long long)page_offset(page));
613 591  
614 592 /* make sure the cache has finished storing the page */
615   - nfs_fscache_wait_on_page_write(NFS_I(dentry->d_inode), page);
  593 + nfs_fscache_wait_on_page_write(NFS_I(inode), page);
616 594  
617 595 lock_page(page);
618 596 mapping = page_file_mapping(page);
619   - if (mapping != dentry->d_inode->i_mapping)
  597 + if (mapping != inode->i_mapping)
620 598 goto out_unlock;
621 599  
622 600 wait_on_page_writeback(page);
623 601  
624 602  
625 603  
... ... @@ -659,22 +637,21 @@
659 637 ssize_t nfs_file_write(struct kiocb *iocb, const struct iovec *iov,
660 638 unsigned long nr_segs, loff_t pos)
661 639 {
662   - struct dentry * dentry = iocb->ki_filp->f_path.dentry;
663   - struct inode * inode = dentry->d_inode;
  640 + struct file *file = iocb->ki_filp;
  641 + struct inode *inode = file_inode(file);
664 642 unsigned long written = 0;
665 643 ssize_t result;
666 644 size_t count = iov_length(iov, nr_segs);
667 645  
668   - result = nfs_key_timeout_notify(iocb->ki_filp, inode);
  646 + result = nfs_key_timeout_notify(file, inode);
669 647 if (result)
670 648 return result;
671 649  
672   - if (iocb->ki_filp->f_flags & O_DIRECT)
  650 + if (file->f_flags & O_DIRECT)
673 651 return nfs_file_direct_write(iocb, iov, nr_segs, pos, true);
674 652  
675   - dprintk("NFS: write(%s/%s, %lu@%Ld)\n",
676   - dentry->d_parent->d_name.name, dentry->d_name.name,
677   - (unsigned long) count, (long long) pos);
  653 + dprintk("NFS: write(%pD2, %lu@%Ld)\n",
  654 + file, (unsigned long) count, (long long) pos);
678 655  
679 656 result = -EBUSY;
680 657 if (IS_SWAPFILE(inode))
... ... @@ -682,8 +659,8 @@
682 659 /*
683 660 * O_APPEND implies that we must revalidate the file length.
684 661 */
685   - if (iocb->ki_filp->f_flags & O_APPEND) {
686   - result = nfs_revalidate_file_size(inode, iocb->ki_filp);
  662 + if (file->f_flags & O_APPEND) {
  663 + result = nfs_revalidate_file_size(inode, file);
687 664 if (result)
688 665 goto out;
689 666 }
... ... @@ -697,8 +674,8 @@
697 674 written = result;
698 675  
699 676 /* Return error values for O_DSYNC and IS_SYNC() */
700   - if (result >= 0 && nfs_need_sync_write(iocb->ki_filp, inode)) {
701   - int err = vfs_fsync(iocb->ki_filp, 0);
  677 + if (result >= 0 && nfs_need_sync_write(file, inode)) {
  678 + int err = vfs_fsync(file, 0);
702 679 if (err < 0)
703 680 result = err;
704 681 }
705 682  
... ... @@ -717,14 +694,12 @@
717 694 struct file *filp, loff_t *ppos,
718 695 size_t count, unsigned int flags)
719 696 {
720   - struct dentry *dentry = filp->f_path.dentry;
721   - struct inode *inode = dentry->d_inode;
  697 + struct inode *inode = file_inode(filp);
722 698 unsigned long written = 0;
723 699 ssize_t ret;
724 700  
725   - dprintk("NFS splice_write(%s/%s, %lu@%llu)\n",
726   - dentry->d_parent->d_name.name, dentry->d_name.name,
727   - (unsigned long) count, (unsigned long long) *ppos);
  701 + dprintk("NFS splice_write(%pD2, %lu@%llu)\n",
  702 + filp, (unsigned long) count, (unsigned long long) *ppos);
728 703  
729 704 /*
730 705 * The combination of splice and an O_APPEND destination is disallowed.
... ... @@ -883,10 +858,8 @@
883 858 int ret = -ENOLCK;
884 859 int is_local = 0;
885 860  
886   - dprintk("NFS: lock(%s/%s, t=%x, fl=%x, r=%lld:%lld)\n",
887   - filp->f_path.dentry->d_parent->d_name.name,
888   - filp->f_path.dentry->d_name.name,
889   - fl->fl_type, fl->fl_flags,
  861 + dprintk("NFS: lock(%pD2, t=%x, fl=%x, r=%lld:%lld)\n",
  862 + filp, fl->fl_type, fl->fl_flags,
890 863 (long long)fl->fl_start, (long long)fl->fl_end);
891 864  
892 865 nfs_inc_stats(inode, NFSIOS_VFSLOCK);
... ... @@ -923,10 +896,8 @@
923 896 struct inode *inode = filp->f_mapping->host;
924 897 int is_local = 0;
925 898  
926   - dprintk("NFS: flock(%s/%s, t=%x, fl=%x)\n",
927   - filp->f_path.dentry->d_parent->d_name.name,
928   - filp->f_path.dentry->d_name.name,
929   - fl->fl_type, fl->fl_flags);
  899 + dprintk("NFS: flock(%pD2, t=%x, fl=%x)\n",
  900 + filp, fl->fl_type, fl->fl_flags);
930 901  
931 902 if (!(fl->fl_flags & FL_FLOCK))
932 903 return -ENOLCK;
... ... @@ -960,9 +931,7 @@
960 931 */
961 932 int nfs_setlease(struct file *file, long arg, struct file_lock **fl)
962 933 {
963   - dprintk("NFS: setlease(%s/%s, arg=%ld)\n",
964   - file->f_path.dentry->d_parent->d_name.name,
965   - file->f_path.dentry->d_name.name, arg);
  934 + dprintk("NFS: setlease(%pD2, arg=%ld)\n", file, arg);
966 935 return -EINVAL;
967 936 }
968 937 EXPORT_SYMBOL_GPL(nfs_setlease);
... ... @@ -253,9 +253,8 @@
253 253  
254 254 dprintk("--> nfs_do_submount()\n");
255 255  
256   - dprintk("%s: submounting on %s/%s\n", __func__,
257   - dentry->d_parent->d_name.name,
258   - dentry->d_name.name);
  256 + dprintk("%s: submounting on %pd2\n", __func__,
  257 + dentry);
259 258 if (page == NULL)
260 259 goto out;
261 260 devname = nfs_devname(dentry, page, PAGE_SIZE);
... ... @@ -321,7 +321,7 @@
321 321 umode_t mode = sattr->ia_mode;
322 322 int status = -ENOMEM;
323 323  
324   - dprintk("NFS call create %s\n", dentry->d_name.name);
  324 + dprintk("NFS call create %pd\n", dentry);
325 325  
326 326 data = nfs3_alloc_createdata();
327 327 if (data == NULL)
... ... @@ -548,7 +548,7 @@
548 548 if (len > NFS3_MAXPATHLEN)
549 549 return -ENAMETOOLONG;
550 550  
551   - dprintk("NFS call symlink %s\n", dentry->d_name.name);
  551 + dprintk("NFS call symlink %pd\n", dentry);
552 552  
553 553 data = nfs3_alloc_createdata();
554 554 if (data == NULL)
... ... @@ -576,7 +576,7 @@
576 576 umode_t mode = sattr->ia_mode;
577 577 int status = -ENOMEM;
578 578  
579   - dprintk("NFS call mkdir %s\n", dentry->d_name.name);
  579 + dprintk("NFS call mkdir %pd\n", dentry);
580 580  
581 581 sattr->ia_mode &= ~current_umask();
582 582  
... ... @@ -695,7 +695,7 @@
695 695 umode_t mode = sattr->ia_mode;
696 696 int status = -ENOMEM;
697 697  
698   - dprintk("NFS call mknod %s %u:%u\n", dentry->d_name.name,
  698 + dprintk("NFS call mknod %pd %u:%u\n", dentry,
699 699 MAJOR(rdev), MINOR(rdev));
700 700  
701 701 sattr->ia_mode &= ~current_umask();
... ... @@ -31,9 +31,7 @@
31 31 * -EOPENSTALE. The VFS will retry the lookup/create/open.
32 32 */
33 33  
34   - dprintk("NFS: open file(%s/%s)\n",
35   - dentry->d_parent->d_name.name,
36   - dentry->d_name.name);
  34 + dprintk("NFS: open file(%pd2)\n", dentry);
37 35  
38 36 if ((openflags & O_ACCMODE) == 3)
39 37 openflags--;
fs/nfs/nfs4namespace.c
... ... @@ -283,8 +283,7 @@
283 283 if (locations == NULL || locations->nlocations <= 0)
284 284 goto out;
285 285  
286   - dprintk("%s: referral at %s/%s\n", __func__,
287   - dentry->d_parent->d_name.name, dentry->d_name.name);
  286 + dprintk("%s: referral at %pd2\n", __func__, dentry);
288 287  
289 288 page = (char *) __get_free_page(GFP_USER);
290 289 if (!page)
... ... @@ -348,8 +347,8 @@
348 347 mnt = ERR_PTR(-ENOENT);
349 348  
350 349 parent = dget_parent(dentry);
351   - dprintk("%s: getting locations for %s/%s\n",
352   - __func__, parent->d_name.name, dentry->d_name.name);
  350 + dprintk("%s: getting locations for %pd2\n",
  351 + __func__, dentry);
353 352  
354 353 err = nfs4_proc_fs_locations(client, parent->d_inode, &dentry->d_name, fs_locations, page);
355 354 dput(parent);
... ... @@ -3738,9 +3738,8 @@
3738 3738 };
3739 3739 int status;
3740 3740  
3741   - dprintk("%s: dentry = %s/%s, cookie = %Lu\n", __func__,
3742   - dentry->d_parent->d_name.name,
3743   - dentry->d_name.name,
  3741 + dprintk("%s: dentry = %pd2, cookie = %Lu\n", __func__,
  3742 + dentry,
3744 3743 (unsigned long long)cookie);
3745 3744 nfs4_setup_readdir(cookie, NFS_I(dir)->cookieverf, dentry, &args);
3746 3745 res.pgbase = args.pgbase;
... ... @@ -235,7 +235,7 @@
235 235 };
236 236 int status = -ENOMEM;
237 237  
238   - dprintk("NFS call create %s\n", dentry->d_name.name);
  238 + dprintk("NFS call create %pd\n", dentry);
239 239 data = nfs_alloc_createdata(dir, dentry, sattr);
240 240 if (data == NULL)
241 241 goto out;
... ... @@ -265,7 +265,7 @@
265 265 umode_t mode;
266 266 int status = -ENOMEM;
267 267  
268   - dprintk("NFS call mknod %s\n", dentry->d_name.name);
  268 + dprintk("NFS call mknod %pd\n", dentry);
269 269  
270 270 mode = sattr->ia_mode;
271 271 if (S_ISFIFO(mode)) {
... ... @@ -423,7 +423,7 @@
423 423 };
424 424 int status = -ENAMETOOLONG;
425 425  
426   - dprintk("NFS call symlink %s\n", dentry->d_name.name);
  426 + dprintk("NFS call symlink %pd\n", dentry);
427 427  
428 428 if (len > NFS2_MAXPATHLEN)
429 429 goto out;
... ... @@ -462,7 +462,7 @@
462 462 };
463 463 int status = -ENOMEM;
464 464  
465   - dprintk("NFS call mkdir %s\n", dentry->d_name.name);
  465 + dprintk("NFS call mkdir %pd\n", dentry);
466 466 data = nfs_alloc_createdata(dir, dentry, sattr);
467 467 if (data == NULL)
468 468 goto out;
... ... @@ -495,9 +495,8 @@
495 495 struct rpc_task *task;
496 496 int error = -EIO;
497 497  
498   - dfprintk(VFS, "NFS: silly-rename(%s/%s, ct=%d)\n",
499   - dentry->d_parent->d_name.name, dentry->d_name.name,
500   - d_count(dentry));
  498 + dfprintk(VFS, "NFS: silly-rename(%pd2, ct=%d)\n",
  499 + dentry, d_count(dentry));
501 500 nfs_inc_stats(dir, NFSIOS_SILLYRENAME);
502 501  
503 502 /*
... ... @@ -522,8 +521,8 @@
522 521 SILLYNAME_FILEID_LEN, fileid,
523 522 SILLYNAME_COUNTER_LEN, sillycounter);
524 523  
525   - dfprintk(VFS, "NFS: trying to rename %s to %s\n",
526   - dentry->d_name.name, silly);
  524 + dfprintk(VFS, "NFS: trying to rename %pd to %s\n",
  525 + dentry, silly);
527 526  
528 527 sdentry = lookup_one_len(silly, dentry->d_parent, slen);
529 528 /*
... ... @@ -954,10 +954,8 @@
954 954  
955 955 nfs_inc_stats(inode, NFSIOS_VFSUPDATEPAGE);
956 956  
957   - dprintk("NFS: nfs_updatepage(%s/%s %d@%lld)\n",
958   - file->f_path.dentry->d_parent->d_name.name,
959   - file->f_path.dentry->d_name.name, count,
960   - (long long)(page_file_offset(page) + offset));
  957 + dprintk("NFS: nfs_updatepage(%pD2 %d@%lld)\n",
  958 + file, count, (long long)(page_file_offset(page) + offset));
961 959  
962 960 if (nfs_can_extend_write(file, page, inode)) {
963 961 count = max(count + offset, nfs_page_length(page));