diff options
157 files changed, 1666 insertions, 2166 deletions
diff --git a/Documentation/filesystems/debugfs.txt b/Documentation/filesystems/debugfs.txt index 3a863f692728..88ab81c79109 100644 --- a/Documentation/filesystems/debugfs.txt +++ b/Documentation/filesystems/debugfs.txt | |||
@@ -140,7 +140,7 @@ file. | |||
140 | struct dentry *parent, | 140 | struct dentry *parent, |
141 | struct debugfs_regset32 *regset); | 141 | struct debugfs_regset32 *regset); |
142 | 142 | ||
143 | int debugfs_print_regs32(struct seq_file *s, struct debugfs_reg32 *regs, | 143 | void debugfs_print_regs32(struct seq_file *s, struct debugfs_reg32 *regs, |
144 | int nregs, void __iomem *base, char *prefix); | 144 | int nregs, void __iomem *base, char *prefix); |
145 | 145 | ||
146 | The "base" argument may be 0, but you may want to build the reg32 array | 146 | The "base" argument may be 0, but you may want to build the reg32 array |
diff --git a/Documentation/filesystems/nfs/Exporting b/Documentation/filesystems/nfs/Exporting index c8f036a9b13f..520a4becb75c 100644 --- a/Documentation/filesystems/nfs/Exporting +++ b/Documentation/filesystems/nfs/Exporting | |||
@@ -72,24 +72,11 @@ c/ Helper routines to allocate anonymous dentries, and to help attach | |||
72 | DCACHE_DISCONNECTED) dentry is allocated and attached. | 72 | DCACHE_DISCONNECTED) dentry is allocated and attached. |
73 | In the case of a directory, care is taken that only one dentry | 73 | In the case of a directory, care is taken that only one dentry |
74 | can ever be attached. | 74 | can ever be attached. |
75 | d_splice_alias(inode, dentry) or d_materialise_unique(dentry, inode) | 75 | d_splice_alias(inode, dentry) will introduce a new dentry into the tree; |
76 | will introduce a new dentry into the tree; either the passed-in | 76 | either the passed-in dentry or a preexisting alias for the given inode |
77 | dentry or a preexisting alias for the given inode (such as an | 77 | (such as an anonymous one created by d_obtain_alias), if appropriate. |
78 | anonymous one created by d_obtain_alias), if appropriate. The two | 78 | It returns NULL when the passed-in dentry is used, following the calling |
79 | functions differ in their handling of directories with preexisting | 79 | convention of ->lookup. |
80 | aliases: | ||
81 | d_splice_alias will use any existing IS_ROOT dentry, but it will | ||
82 | return -EIO rather than try to move a dentry with a different | ||
83 | parent. This is appropriate for local filesystems, which | ||
84 | should never see such an alias unless the filesystem is | ||
85 | corrupted somehow (for example, if two on-disk directory | ||
86 | entries refer to the same directory.) | ||
87 | d_materialise_unique will attempt to move any dentry. This is | ||
88 | appropriate for distributed filesystems, where finding a | ||
89 | directory other than where we last cached it may be a normal | ||
90 | consequence of concurrent operations on other hosts. | ||
91 | Both functions return NULL when the passed-in dentry is used, | ||
92 | following the calling convention of ->lookup. | ||
93 | 80 | ||
94 | 81 | ||
95 | Filesystem Issues | 82 | Filesystem Issues |
diff --git a/Documentation/filesystems/porting b/Documentation/filesystems/porting index 0f3a1390bf00..fa2db081505e 100644 --- a/Documentation/filesystems/porting +++ b/Documentation/filesystems/porting | |||
@@ -463,3 +463,11 @@ in your dentry operations instead. | |||
463 | of the in-tree instances did). inode_hash_lock is still held, | 463 | of the in-tree instances did). inode_hash_lock is still held, |
464 | of course, so they are still serialized wrt removal from inode hash, | 464 | of course, so they are still serialized wrt removal from inode hash, |
465 | as well as wrt set() callback of iget5_locked(). | 465 | as well as wrt set() callback of iget5_locked(). |
466 | -- | ||
467 | [mandatory] | ||
468 | d_materialise_unique() is gone; d_splice_alias() does everything you | ||
469 | need now. Remember that they have opposite orders of arguments ;-/ | ||
470 | -- | ||
471 | [mandatory] | ||
472 | f_dentry is gone; use f_path.dentry, or, better yet, see if you can avoid | ||
473 | it entirely. | ||
diff --git a/Documentation/filesystems/seq_file.txt b/Documentation/filesystems/seq_file.txt index 8ea3e90ace07..b797ed38de46 100644 --- a/Documentation/filesystems/seq_file.txt +++ b/Documentation/filesystems/seq_file.txt | |||
@@ -180,23 +180,19 @@ output must be passed to the seq_file code. Some utility functions have | |||
180 | been defined which make this task easy. | 180 | been defined which make this task easy. |
181 | 181 | ||
182 | Most code will simply use seq_printf(), which works pretty much like | 182 | Most code will simply use seq_printf(), which works pretty much like |
183 | printk(), but which requires the seq_file pointer as an argument. It is | 183 | printk(), but which requires the seq_file pointer as an argument. |
184 | common to ignore the return value from seq_printf(), but a function | ||
185 | producing complicated output may want to check that value and quit if | ||
186 | something non-zero is returned; an error return means that the seq_file | ||
187 | buffer has been filled and further output will be discarded. | ||
188 | 184 | ||
189 | For straight character output, the following functions may be used: | 185 | For straight character output, the following functions may be used: |
190 | 186 | ||
191 | int seq_putc(struct seq_file *m, char c); | 187 | seq_putc(struct seq_file *m, char c); |
192 | int seq_puts(struct seq_file *m, const char *s); | 188 | seq_puts(struct seq_file *m, const char *s); |
193 | int seq_escape(struct seq_file *m, const char *s, const char *esc); | 189 | seq_escape(struct seq_file *m, const char *s, const char *esc); |
194 | 190 | ||
195 | The first two output a single character and a string, just like one would | 191 | The first two output a single character and a string, just like one would |
196 | expect. seq_escape() is like seq_puts(), except that any character in s | 192 | expect. seq_escape() is like seq_puts(), except that any character in s |
197 | which is in the string esc will be represented in octal form in the output. | 193 | which is in the string esc will be represented in octal form in the output. |
198 | 194 | ||
199 | There is also a pair of functions for printing filenames: | 195 | There are also a pair of functions for printing filenames: |
200 | 196 | ||
201 | int seq_path(struct seq_file *m, struct path *path, char *esc); | 197 | int seq_path(struct seq_file *m, struct path *path, char *esc); |
202 | int seq_path_root(struct seq_file *m, struct path *path, | 198 | int seq_path_root(struct seq_file *m, struct path *path, |
@@ -209,6 +205,14 @@ root is desired, it can be used with seq_path_root(). Note that, if it | |||
209 | turns out that path cannot be reached from root, the value of root will be | 205 | turns out that path cannot be reached from root, the value of root will be |
210 | changed in seq_file_root() to a root which *does* work. | 206 | changed in seq_file_root() to a root which *does* work. |
211 | 207 | ||
208 | A function producing complicated output may want to check | ||
209 | bool seq_has_overflowed(struct seq_file *m); | ||
210 | and avoid further seq_<output> calls if true is returned. | ||
211 | |||
212 | A true return from seq_has_overflowed means that the seq_file buffer will | ||
213 | be discarded and the seq_show function will attempt to allocate a larger | ||
214 | buffer and retry printing. | ||
215 | |||
212 | 216 | ||
213 | Making it all work | 217 | Making it all work |
214 | 218 | ||
diff --git a/Documentation/filesystems/vfs.txt b/Documentation/filesystems/vfs.txt index 20bf204426ca..43ce0507ee25 100644 --- a/Documentation/filesystems/vfs.txt +++ b/Documentation/filesystems/vfs.txt | |||
@@ -835,7 +835,7 @@ struct file_operations { | |||
835 | ssize_t (*splice_read)(struct file *, struct pipe_inode_info *, size_t, unsigned int); | 835 | ssize_t (*splice_read)(struct file *, struct pipe_inode_info *, size_t, unsigned int); |
836 | int (*setlease)(struct file *, long arg, struct file_lock **, void **); | 836 | int (*setlease)(struct file *, long arg, struct file_lock **, void **); |
837 | long (*fallocate)(struct file *, int mode, loff_t offset, loff_t len); | 837 | long (*fallocate)(struct file *, int mode, loff_t offset, loff_t len); |
838 | int (*show_fdinfo)(struct seq_file *m, struct file *f); | 838 | void (*show_fdinfo)(struct seq_file *m, struct file *f); |
839 | }; | 839 | }; |
840 | 840 | ||
841 | Again, all methods are called without any locks being held, unless | 841 | Again, all methods are called without any locks being held, unless |
diff --git a/arch/alpha/kernel/osf_sys.c b/arch/alpha/kernel/osf_sys.c index f9c732e18284..e51f578636a5 100644 --- a/arch/alpha/kernel/osf_sys.c +++ b/arch/alpha/kernel/osf_sys.c | |||
@@ -104,11 +104,12 @@ struct osf_dirent_callback { | |||
104 | }; | 104 | }; |
105 | 105 | ||
106 | static int | 106 | static int |
107 | osf_filldir(void *__buf, const char *name, int namlen, loff_t offset, | 107 | osf_filldir(struct dir_context *ctx, const char *name, int namlen, |
108 | u64 ino, unsigned int d_type) | 108 | loff_t offset, u64 ino, unsigned int d_type) |
109 | { | 109 | { |
110 | struct osf_dirent __user *dirent; | 110 | struct osf_dirent __user *dirent; |
111 | struct osf_dirent_callback *buf = (struct osf_dirent_callback *) __buf; | 111 | struct osf_dirent_callback *buf = |
112 | container_of(ctx, struct osf_dirent_callback, ctx); | ||
112 | unsigned int reclen = ALIGN(NAME_OFFSET + namlen + 1, sizeof(u32)); | 113 | unsigned int reclen = ALIGN(NAME_OFFSET + namlen + 1, sizeof(u32)); |
113 | unsigned int d_ino; | 114 | unsigned int d_ino; |
114 | 115 | ||
diff --git a/arch/parisc/hpux/fs.c b/arch/parisc/hpux/fs.c index 2bedafea3d94..97a7bf8df348 100644 --- a/arch/parisc/hpux/fs.c +++ b/arch/parisc/hpux/fs.c | |||
@@ -56,11 +56,12 @@ struct getdents_callback { | |||
56 | 56 | ||
57 | #define NAME_OFFSET(de) ((int) ((de)->d_name - (char __user *) (de))) | 57 | #define NAME_OFFSET(de) ((int) ((de)->d_name - (char __user *) (de))) |
58 | 58 | ||
59 | static int filldir(void * __buf, const char * name, int namlen, loff_t offset, | 59 | static int filldir(struct dir_context *ctx, const char *name, int namlen, |
60 | u64 ino, unsigned d_type) | 60 | loff_t offset, u64 ino, unsigned d_type) |
61 | { | 61 | { |
62 | struct hpux_dirent __user * dirent; | 62 | struct hpux_dirent __user * dirent; |
63 | struct getdents_callback * buf = (struct getdents_callback *) __buf; | 63 | struct getdents_callback *buf = |
64 | container_of(ctx, struct getdents_callback, ctx); | ||
64 | ino_t d_ino; | 65 | ino_t d_ino; |
65 | int reclen = ALIGN(NAME_OFFSET(dirent) + namlen + 1, sizeof(long)); | 66 | int reclen = ALIGN(NAME_OFFSET(dirent) + namlen + 1, sizeof(long)); |
66 | 67 | ||
diff --git a/arch/powerpc/oprofile/cell/spu_task_sync.c b/arch/powerpc/oprofile/cell/spu_task_sync.c index 28f1af2db1f5..1c27831df1ac 100644 --- a/arch/powerpc/oprofile/cell/spu_task_sync.c +++ b/arch/powerpc/oprofile/cell/spu_task_sync.c | |||
@@ -331,8 +331,7 @@ get_exec_dcookie_and_offset(struct spu *spu, unsigned int *offsetp, | |||
331 | 331 | ||
332 | if (mm->exe_file) { | 332 | if (mm->exe_file) { |
333 | app_cookie = fast_get_dcookie(&mm->exe_file->f_path); | 333 | app_cookie = fast_get_dcookie(&mm->exe_file->f_path); |
334 | pr_debug("got dcookie for %s\n", | 334 | pr_debug("got dcookie for %pD\n", mm->exe_file); |
335 | mm->exe_file->f_dentry->d_name.name); | ||
336 | } | 335 | } |
337 | 336 | ||
338 | for (vma = mm->mmap; vma; vma = vma->vm_next) { | 337 | for (vma = mm->mmap; vma; vma = vma->vm_next) { |
@@ -342,15 +341,14 @@ get_exec_dcookie_and_offset(struct spu *spu, unsigned int *offsetp, | |||
342 | if (!vma->vm_file) | 341 | if (!vma->vm_file) |
343 | goto fail_no_image_cookie; | 342 | goto fail_no_image_cookie; |
344 | 343 | ||
345 | pr_debug("Found spu ELF at %X(object-id:%lx) for file %s\n", | 344 | pr_debug("Found spu ELF at %X(object-id:%lx) for file %pD\n", |
346 | my_offset, spu_ref, | 345 | my_offset, spu_ref, vma->vm_file); |
347 | vma->vm_file->f_dentry->d_name.name); | ||
348 | *offsetp = my_offset; | 346 | *offsetp = my_offset; |
349 | break; | 347 | break; |
350 | } | 348 | } |
351 | 349 | ||
352 | *spu_bin_dcookie = fast_get_dcookie(&vma->vm_file->f_path); | 350 | *spu_bin_dcookie = fast_get_dcookie(&vma->vm_file->f_path); |
353 | pr_debug("got dcookie for %s\n", vma->vm_file->f_dentry->d_name.name); | 351 | pr_debug("got dcookie for %pD\n", vma->vm_file); |
354 | 352 | ||
355 | up_read(&mm->mmap_sem); | 353 | up_read(&mm->mmap_sem); |
356 | 354 | ||
diff --git a/arch/powerpc/platforms/cell/spufs/inode.c b/arch/powerpc/platforms/cell/spufs/inode.c index 87ba7cf99cd7..65d633f20d37 100644 --- a/arch/powerpc/platforms/cell/spufs/inode.c +++ b/arch/powerpc/platforms/cell/spufs/inode.c | |||
@@ -164,7 +164,7 @@ static void spufs_prune_dir(struct dentry *dir) | |||
164 | struct dentry *dentry, *tmp; | 164 | struct dentry *dentry, *tmp; |
165 | 165 | ||
166 | mutex_lock(&dir->d_inode->i_mutex); | 166 | mutex_lock(&dir->d_inode->i_mutex); |
167 | list_for_each_entry_safe(dentry, tmp, &dir->d_subdirs, d_u.d_child) { | 167 | list_for_each_entry_safe(dentry, tmp, &dir->d_subdirs, d_child) { |
168 | spin_lock(&dentry->d_lock); | 168 | spin_lock(&dentry->d_lock); |
169 | if (!(d_unhashed(dentry)) && dentry->d_inode) { | 169 | if (!(d_unhashed(dentry)) && dentry->d_inode) { |
170 | dget_dlock(dentry); | 170 | dget_dlock(dentry); |
diff --git a/arch/s390/hypfs/hypfs_dbfs.c b/arch/s390/hypfs/hypfs_dbfs.c index 2badf2bf9cd7..47fe1055c714 100644 --- a/arch/s390/hypfs/hypfs_dbfs.c +++ b/arch/s390/hypfs/hypfs_dbfs.c | |||
@@ -83,10 +83,9 @@ static ssize_t dbfs_read(struct file *file, char __user *buf, | |||
83 | 83 | ||
84 | static long dbfs_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | 84 | static long dbfs_ioctl(struct file *file, unsigned int cmd, unsigned long arg) |
85 | { | 85 | { |
86 | struct hypfs_dbfs_file *df; | 86 | struct hypfs_dbfs_file *df = file_inode(file)->i_private; |
87 | long rc; | 87 | long rc; |
88 | 88 | ||
89 | df = file->f_path.dentry->d_inode->i_private; | ||
90 | mutex_lock(&df->lock); | 89 | mutex_lock(&df->lock); |
91 | if (df->unlocked_ioctl) | 90 | if (df->unlocked_ioctl) |
92 | rc = df->unlocked_ioctl(file, cmd, arg); | 91 | rc = df->unlocked_ioctl(file, cmd, arg); |
diff --git a/arch/x86/ia32/ia32_aout.c b/arch/x86/ia32/ia32_aout.c index df91466f973d..ae6aad1d24f7 100644 --- a/arch/x86/ia32/ia32_aout.c +++ b/arch/x86/ia32/ia32_aout.c | |||
@@ -342,8 +342,8 @@ static int load_aout_binary(struct linux_binprm *bprm) | |||
342 | time_after(jiffies, error_time + 5*HZ)) { | 342 | time_after(jiffies, error_time + 5*HZ)) { |
343 | printk(KERN_WARNING | 343 | printk(KERN_WARNING |
344 | "fd_offset is not page aligned. Please convert " | 344 | "fd_offset is not page aligned. Please convert " |
345 | "program: %s\n", | 345 | "program: %pD\n", |
346 | bprm->file->f_path.dentry->d_name.name); | 346 | bprm->file); |
347 | error_time = jiffies; | 347 | error_time = jiffies; |
348 | } | 348 | } |
349 | #endif | 349 | #endif |
@@ -429,8 +429,8 @@ static int load_aout_library(struct file *file) | |||
429 | if (time_after(jiffies, error_time + 5*HZ)) { | 429 | if (time_after(jiffies, error_time + 5*HZ)) { |
430 | printk(KERN_WARNING | 430 | printk(KERN_WARNING |
431 | "N_TXTOFF is not page aligned. Please convert " | 431 | "N_TXTOFF is not page aligned. Please convert " |
432 | "library: %s\n", | 432 | "library: %pD\n", |
433 | file->f_path.dentry->d_name.name); | 433 | file); |
434 | error_time = jiffies; | 434 | error_time = jiffies; |
435 | } | 435 | } |
436 | #endif | 436 | #endif |
diff --git a/drivers/block/drbd/drbd_debugfs.c b/drivers/block/drbd/drbd_debugfs.c index 900d4d3272d1..9a950022ff88 100644 --- a/drivers/block/drbd/drbd_debugfs.c +++ b/drivers/block/drbd/drbd_debugfs.c | |||
@@ -419,7 +419,7 @@ static int in_flight_summary_show(struct seq_file *m, void *pos) | |||
419 | return 0; | 419 | return 0; |
420 | } | 420 | } |
421 | 421 | ||
422 | /* simple_positive(file->f_dentry) respectively debugfs_positive(), | 422 | /* simple_positive(file->f_path.dentry) respectively debugfs_positive(), |
423 | * but neither is "reachable" from here. | 423 | * but neither is "reachable" from here. |
424 | * So we have our own inline version of it above. :-( */ | 424 | * So we have our own inline version of it above. :-( */ |
425 | static inline int debugfs_positive(struct dentry *dentry) | 425 | static inline int debugfs_positive(struct dentry *dentry) |
@@ -437,14 +437,14 @@ static int drbd_single_open(struct file *file, int (*show)(struct seq_file *, vo | |||
437 | 437 | ||
438 | /* Are we still linked, | 438 | /* Are we still linked, |
439 | * or has debugfs_remove() already been called? */ | 439 | * or has debugfs_remove() already been called? */ |
440 | parent = file->f_dentry->d_parent; | 440 | parent = file->f_path.dentry->d_parent; |
441 | /* not sure if this can happen: */ | 441 | /* not sure if this can happen: */ |
442 | if (!parent || !parent->d_inode) | 442 | if (!parent || !parent->d_inode) |
443 | goto out; | 443 | goto out; |
444 | /* serialize with d_delete() */ | 444 | /* serialize with d_delete() */ |
445 | mutex_lock(&parent->d_inode->i_mutex); | 445 | mutex_lock(&parent->d_inode->i_mutex); |
446 | /* Make sure the object is still alive */ | 446 | /* Make sure the object is still alive */ |
447 | if (debugfs_positive(file->f_dentry) | 447 | if (debugfs_positive(file->f_path.dentry) |
448 | && kref_get_unless_zero(kref)) | 448 | && kref_get_unless_zero(kref)) |
449 | ret = 0; | 449 | ret = 0; |
450 | mutex_unlock(&parent->d_inode->i_mutex); | 450 | mutex_unlock(&parent->d_inode->i_mutex); |
diff --git a/drivers/gpu/drm/armada/armada_gem.c b/drivers/gpu/drm/armada/armada_gem.c index 7496f55611a5..ef5feeecec84 100644 --- a/drivers/gpu/drm/armada/armada_gem.c +++ b/drivers/gpu/drm/armada/armada_gem.c | |||
@@ -226,7 +226,7 @@ struct armada_gem_object *armada_gem_alloc_object(struct drm_device *dev, | |||
226 | 226 | ||
227 | obj->dev_addr = DMA_ERROR_CODE; | 227 | obj->dev_addr = DMA_ERROR_CODE; |
228 | 228 | ||
229 | mapping = obj->obj.filp->f_path.dentry->d_inode->i_mapping; | 229 | mapping = file_inode(obj->obj.filp)->i_mapping; |
230 | mapping_set_gfp_mask(mapping, GFP_HIGHUSER | __GFP_RECLAIMABLE); | 230 | mapping_set_gfp_mask(mapping, GFP_HIGHUSER | __GFP_RECLAIMABLE); |
231 | 231 | ||
232 | DRM_DEBUG_DRIVER("alloc obj %p size %zu\n", obj, size); | 232 | DRM_DEBUG_DRIVER("alloc obj %p size %zu\n", obj, size); |
diff --git a/drivers/media/pci/zoran/zoran_procfs.c b/drivers/media/pci/zoran/zoran_procfs.c index f7ceee0cdefd..437652761093 100644 --- a/drivers/media/pci/zoran/zoran_procfs.c +++ b/drivers/media/pci/zoran/zoran_procfs.c | |||
@@ -157,8 +157,8 @@ static ssize_t zoran_write(struct file *file, const char __user *buffer, | |||
157 | return -EFAULT; | 157 | return -EFAULT; |
158 | } | 158 | } |
159 | string[count] = 0; | 159 | string[count] = 0; |
160 | dprintk(4, KERN_INFO "%s: write_proc: name=%s count=%zu zr=%p\n", | 160 | dprintk(4, KERN_INFO "%s: write_proc: name=%pD count=%zu zr=%p\n", |
161 | ZR_DEVNAME(zr), file->f_path.dentry->d_name.name, count, zr); | 161 | ZR_DEVNAME(zr), file, count, zr); |
162 | ldelim = " \t\n"; | 162 | ldelim = " \t\n"; |
163 | tdelim = "="; | 163 | tdelim = "="; |
164 | line = strpbrk(sp, ldelim); | 164 | line = strpbrk(sp, ldelim); |
diff --git a/drivers/misc/genwqe/card_dev.c b/drivers/misc/genwqe/card_dev.c index 5918586f2f76..c49d244265ec 100644 --- a/drivers/misc/genwqe/card_dev.c +++ b/drivers/misc/genwqe/card_dev.c | |||
@@ -395,7 +395,7 @@ static void genwqe_vma_open(struct vm_area_struct *vma) | |||
395 | static void genwqe_vma_close(struct vm_area_struct *vma) | 395 | static void genwqe_vma_close(struct vm_area_struct *vma) |
396 | { | 396 | { |
397 | unsigned long vsize = vma->vm_end - vma->vm_start; | 397 | unsigned long vsize = vma->vm_end - vma->vm_start; |
398 | struct inode *inode = vma->vm_file->f_dentry->d_inode; | 398 | struct inode *inode = file_inode(vma->vm_file); |
399 | struct dma_mapping *dma_map; | 399 | struct dma_mapping *dma_map; |
400 | struct genwqe_dev *cd = container_of(inode->i_cdev, struct genwqe_dev, | 400 | struct genwqe_dev *cd = container_of(inode->i_cdev, struct genwqe_dev, |
401 | cdev_genwqe); | 401 | cdev_genwqe); |
diff --git a/drivers/net/tun.c b/drivers/net/tun.c index 9dd3746994a4..4d332dc93b70 100644 --- a/drivers/net/tun.c +++ b/drivers/net/tun.c | |||
@@ -2222,7 +2222,7 @@ static int tun_chr_close(struct inode *inode, struct file *file) | |||
2222 | } | 2222 | } |
2223 | 2223 | ||
2224 | #ifdef CONFIG_PROC_FS | 2224 | #ifdef CONFIG_PROC_FS |
2225 | static int tun_chr_show_fdinfo(struct seq_file *m, struct file *f) | 2225 | static void tun_chr_show_fdinfo(struct seq_file *m, struct file *f) |
2226 | { | 2226 | { |
2227 | struct tun_struct *tun; | 2227 | struct tun_struct *tun; |
2228 | struct ifreq ifr; | 2228 | struct ifreq ifr; |
@@ -2238,7 +2238,7 @@ static int tun_chr_show_fdinfo(struct seq_file *m, struct file *f) | |||
2238 | if (tun) | 2238 | if (tun) |
2239 | tun_put(tun); | 2239 | tun_put(tun); |
2240 | 2240 | ||
2241 | return seq_printf(m, "iff:\t%s\n", ifr.ifr_name); | 2241 | seq_printf(m, "iff:\t%s\n", ifr.ifr_name); |
2242 | } | 2242 | } |
2243 | #endif | 2243 | #endif |
2244 | 2244 | ||
diff --git a/drivers/s390/char/hmcdrv_dev.c b/drivers/s390/char/hmcdrv_dev.c index 0c5176179c17..43cee7fcd01c 100644 --- a/drivers/s390/char/hmcdrv_dev.c +++ b/drivers/s390/char/hmcdrv_dev.c | |||
@@ -136,8 +136,7 @@ static int hmcdrv_dev_open(struct inode *inode, struct file *fp) | |||
136 | if (rc) | 136 | if (rc) |
137 | module_put(THIS_MODULE); | 137 | module_put(THIS_MODULE); |
138 | 138 | ||
139 | pr_debug("open file '/dev/%s' with return code %d\n", | 139 | pr_debug("open file '/dev/%pD' with return code %d\n", fp, rc); |
140 | fp->f_dentry->d_name.name, rc); | ||
141 | return rc; | 140 | return rc; |
142 | } | 141 | } |
143 | 142 | ||
@@ -146,7 +145,7 @@ static int hmcdrv_dev_open(struct inode *inode, struct file *fp) | |||
146 | */ | 145 | */ |
147 | static int hmcdrv_dev_release(struct inode *inode, struct file *fp) | 146 | static int hmcdrv_dev_release(struct inode *inode, struct file *fp) |
148 | { | 147 | { |
149 | pr_debug("closing file '/dev/%s'\n", fp->f_dentry->d_name.name); | 148 | pr_debug("closing file '/dev/%pD'\n", fp); |
150 | kfree(fp->private_data); | 149 | kfree(fp->private_data); |
151 | fp->private_data = NULL; | 150 | fp->private_data = NULL; |
152 | hmcdrv_ftp_shutdown(); | 151 | hmcdrv_ftp_shutdown(); |
@@ -231,8 +230,8 @@ static ssize_t hmcdrv_dev_read(struct file *fp, char __user *ubuf, | |||
231 | retlen = hmcdrv_dev_transfer((char *) fp->private_data, | 230 | retlen = hmcdrv_dev_transfer((char *) fp->private_data, |
232 | *pos, ubuf, len); | 231 | *pos, ubuf, len); |
233 | 232 | ||
234 | pr_debug("read from file '/dev/%s' at %lld returns %zd/%zu\n", | 233 | pr_debug("read from file '/dev/%pD' at %lld returns %zd/%zu\n", |
235 | fp->f_dentry->d_name.name, (long long) *pos, retlen, len); | 234 | fp, (long long) *pos, retlen, len); |
236 | 235 | ||
237 | if (retlen > 0) | 236 | if (retlen > 0) |
238 | *pos += retlen; | 237 | *pos += retlen; |
@@ -248,8 +247,8 @@ static ssize_t hmcdrv_dev_write(struct file *fp, const char __user *ubuf, | |||
248 | { | 247 | { |
249 | ssize_t retlen; | 248 | ssize_t retlen; |
250 | 249 | ||
251 | pr_debug("writing file '/dev/%s' at pos. %lld with length %zd\n", | 250 | pr_debug("writing file '/dev/%pD' at pos. %lld with length %zd\n", |
252 | fp->f_dentry->d_name.name, (long long) *pos, len); | 251 | fp, (long long) *pos, len); |
253 | 252 | ||
254 | if (!fp->private_data) { /* first expect a cmd write */ | 253 | if (!fp->private_data) { /* first expect a cmd write */ |
255 | fp->private_data = kmalloc(len + 1, GFP_KERNEL); | 254 | fp->private_data = kmalloc(len + 1, GFP_KERNEL); |
@@ -272,8 +271,7 @@ static ssize_t hmcdrv_dev_write(struct file *fp, const char __user *ubuf, | |||
272 | if (retlen > 0) | 271 | if (retlen > 0) |
273 | *pos += retlen; | 272 | *pos += retlen; |
274 | 273 | ||
275 | pr_debug("write to file '/dev/%s' returned %zd\n", | 274 | pr_debug("write to file '/dev/%pD' returned %zd\n", fp, retlen); |
276 | fp->f_dentry->d_name.name, retlen); | ||
277 | 275 | ||
278 | return retlen; | 276 | return retlen; |
279 | } | 277 | } |
diff --git a/drivers/scsi/lpfc/lpfc_debugfs.c b/drivers/scsi/lpfc/lpfc_debugfs.c index 786a2aff7b59..5633e7dadc08 100644 --- a/drivers/scsi/lpfc/lpfc_debugfs.c +++ b/drivers/scsi/lpfc/lpfc_debugfs.c | |||
@@ -968,8 +968,8 @@ lpfc_debugfs_dumpDif_open(struct inode *inode, struct file *file) | |||
968 | goto out; | 968 | goto out; |
969 | 969 | ||
970 | /* Round to page boundary */ | 970 | /* Round to page boundary */ |
971 | printk(KERN_ERR "9060 BLKGRD: %s: _dump_buf_dif=0x%p file=%s\n", | 971 | printk(KERN_ERR "9060 BLKGRD: %s: _dump_buf_dif=0x%p file=%pD\n", |
972 | __func__, _dump_buf_dif, file->f_dentry->d_name.name); | 972 | __func__, _dump_buf_dif, file); |
973 | debug->buffer = _dump_buf_dif; | 973 | debug->buffer = _dump_buf_dif; |
974 | if (!debug->buffer) { | 974 | if (!debug->buffer) { |
975 | kfree(debug); | 975 | kfree(debug); |
@@ -1011,7 +1011,7 @@ static ssize_t | |||
1011 | lpfc_debugfs_dif_err_read(struct file *file, char __user *buf, | 1011 | lpfc_debugfs_dif_err_read(struct file *file, char __user *buf, |
1012 | size_t nbytes, loff_t *ppos) | 1012 | size_t nbytes, loff_t *ppos) |
1013 | { | 1013 | { |
1014 | struct dentry *dent = file->f_dentry; | 1014 | struct dentry *dent = file->f_path.dentry; |
1015 | struct lpfc_hba *phba = file->private_data; | 1015 | struct lpfc_hba *phba = file->private_data; |
1016 | char cbuf[32]; | 1016 | char cbuf[32]; |
1017 | uint64_t tmp = 0; | 1017 | uint64_t tmp = 0; |
@@ -1052,7 +1052,7 @@ static ssize_t | |||
1052 | lpfc_debugfs_dif_err_write(struct file *file, const char __user *buf, | 1052 | lpfc_debugfs_dif_err_write(struct file *file, const char __user *buf, |
1053 | size_t nbytes, loff_t *ppos) | 1053 | size_t nbytes, loff_t *ppos) |
1054 | { | 1054 | { |
1055 | struct dentry *dent = file->f_dentry; | 1055 | struct dentry *dent = file->f_path.dentry; |
1056 | struct lpfc_hba *phba = file->private_data; | 1056 | struct lpfc_hba *phba = file->private_data; |
1057 | char dstbuf[32]; | 1057 | char dstbuf[32]; |
1058 | uint64_t tmp = 0; | 1058 | uint64_t tmp = 0; |
diff --git a/drivers/staging/lustre/lustre/libcfs/tracefile.c b/drivers/staging/lustre/lustre/libcfs/tracefile.c index 7e3f6a45da00..7561030c96e6 100644 --- a/drivers/staging/lustre/lustre/libcfs/tracefile.c +++ b/drivers/staging/lustre/lustre/libcfs/tracefile.c | |||
@@ -1025,8 +1025,8 @@ static int tracefiled(void *arg) | |||
1025 | 1025 | ||
1026 | if (f_pos >= (off_t)cfs_tracefile_size) | 1026 | if (f_pos >= (off_t)cfs_tracefile_size) |
1027 | f_pos = 0; | 1027 | f_pos = 0; |
1028 | else if (f_pos > i_size_read(filp->f_dentry->d_inode)) | 1028 | else if (f_pos > i_size_read(file_inode(filp))) |
1029 | f_pos = i_size_read(filp->f_dentry->d_inode); | 1029 | f_pos = i_size_read(file_inode(filp)); |
1030 | 1030 | ||
1031 | buf = kmap(tage->page); | 1031 | buf = kmap(tage->page); |
1032 | rc = vfs_write(filp, (__force const char __user *)buf, | 1032 | rc = vfs_write(filp, (__force const char __user *)buf, |
diff --git a/drivers/staging/lustre/lustre/llite/dcache.c b/drivers/staging/lustre/lustre/llite/dcache.c index 439e4875b05c..f692261e9b5c 100644 --- a/drivers/staging/lustre/lustre/llite/dcache.c +++ b/drivers/staging/lustre/lustre/llite/dcache.c | |||
@@ -151,10 +151,10 @@ static int ll_ddelete(const struct dentry *de) | |||
151 | { | 151 | { |
152 | LASSERT(de); | 152 | LASSERT(de); |
153 | 153 | ||
154 | CDEBUG(D_DENTRY, "%s dentry %.*s (%p, parent %p, inode %p) %s%s\n", | 154 | CDEBUG(D_DENTRY, "%s dentry %pd (%p, parent %p, inode %p) %s%s\n", |
155 | d_lustre_invalid((struct dentry *)de) ? "deleting" : "keeping", | 155 | d_lustre_invalid((struct dentry *)de) ? "deleting" : "keeping", |
156 | de->d_name.len, de->d_name.name, de, de->d_parent, de->d_inode, | 156 | de, de, de->d_parent, de->d_inode, |
157 | d_unhashed((struct dentry *)de) ? "" : "hashed,", | 157 | d_unhashed(de) ? "" : "hashed,", |
158 | list_empty(&de->d_subdirs) ? "" : "subdirs"); | 158 | list_empty(&de->d_subdirs) ? "" : "subdirs"); |
159 | 159 | ||
160 | /* kernel >= 2.6.38 last refcount is decreased after this function. */ | 160 | /* kernel >= 2.6.38 last refcount is decreased after this function. */ |
@@ -180,8 +180,8 @@ int ll_d_init(struct dentry *de) | |||
180 | { | 180 | { |
181 | LASSERT(de != NULL); | 181 | LASSERT(de != NULL); |
182 | 182 | ||
183 | CDEBUG(D_DENTRY, "ldd on dentry %.*s (%p) parent %p inode %p refc %d\n", | 183 | CDEBUG(D_DENTRY, "ldd on dentry %pd (%p) parent %p inode %p refc %d\n", |
184 | de->d_name.len, de->d_name.name, de, de->d_parent, de->d_inode, | 184 | de, de, de->d_parent, de->d_inode, |
185 | d_count(de)); | 185 | d_count(de)); |
186 | 186 | ||
187 | if (de->d_fsdata == NULL) { | 187 | if (de->d_fsdata == NULL) { |
@@ -258,10 +258,9 @@ void ll_invalidate_aliases(struct inode *inode) | |||
258 | inode->i_ino, inode->i_generation, inode); | 258 | inode->i_ino, inode->i_generation, inode); |
259 | 259 | ||
260 | ll_lock_dcache(inode); | 260 | ll_lock_dcache(inode); |
261 | ll_d_hlist_for_each_entry(dentry, p, &inode->i_dentry, d_alias) { | 261 | ll_d_hlist_for_each_entry(dentry, p, &inode->i_dentry, d_u.d_alias) { |
262 | CDEBUG(D_DENTRY, "dentry in drop %.*s (%p) parent %p " | 262 | CDEBUG(D_DENTRY, "dentry in drop %pd (%p) parent %p " |
263 | "inode %p flags %d\n", dentry->d_name.len, | 263 | "inode %p flags %d\n", dentry, dentry, dentry->d_parent, |
264 | dentry->d_name.name, dentry, dentry->d_parent, | ||
265 | dentry->d_inode, dentry->d_flags); | 264 | dentry->d_inode, dentry->d_flags); |
266 | 265 | ||
267 | if (unlikely(dentry == dentry->d_sb->s_root)) { | 266 | if (unlikely(dentry == dentry->d_sb->s_root)) { |
@@ -352,8 +351,8 @@ static int ll_revalidate_nd(struct dentry *dentry, unsigned int flags) | |||
352 | { | 351 | { |
353 | int rc; | 352 | int rc; |
354 | 353 | ||
355 | CDEBUG(D_VFSTRACE, "VFS Op:name=%s, flags=%u\n", | 354 | CDEBUG(D_VFSTRACE, "VFS Op:name=%pd, flags=%u\n", |
356 | dentry->d_name.name, flags); | 355 | dentry, flags); |
357 | 356 | ||
358 | rc = ll_revalidate_dentry(dentry, flags); | 357 | rc = ll_revalidate_dentry(dentry, flags); |
359 | return rc; | 358 | return rc; |
diff --git a/drivers/staging/lustre/lustre/llite/dir.c b/drivers/staging/lustre/lustre/llite/dir.c index b0bb7095dde5..a79fd65ec4c6 100644 --- a/drivers/staging/lustre/lustre/llite/dir.c +++ b/drivers/staging/lustre/lustre/llite/dir.c | |||
@@ -593,7 +593,7 @@ int ll_dir_read(struct inode *inode, struct dir_context *ctx) | |||
593 | 593 | ||
594 | static int ll_readdir(struct file *filp, struct dir_context *ctx) | 594 | static int ll_readdir(struct file *filp, struct dir_context *ctx) |
595 | { | 595 | { |
596 | struct inode *inode = filp->f_dentry->d_inode; | 596 | struct inode *inode = file_inode(filp); |
597 | struct ll_file_data *lfd = LUSTRE_FPRIVATE(filp); | 597 | struct ll_file_data *lfd = LUSTRE_FPRIVATE(filp); |
598 | struct ll_sb_info *sbi = ll_i2sbi(inode); | 598 | struct ll_sb_info *sbi = ll_i2sbi(inode); |
599 | int hash64 = sbi->ll_flags & LL_SBI_64BIT_HASH; | 599 | int hash64 = sbi->ll_flags & LL_SBI_64BIT_HASH; |
@@ -1242,7 +1242,7 @@ ll_getname(const char __user *filename) | |||
1242 | 1242 | ||
1243 | static long ll_dir_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | 1243 | static long ll_dir_ioctl(struct file *file, unsigned int cmd, unsigned long arg) |
1244 | { | 1244 | { |
1245 | struct inode *inode = file->f_dentry->d_inode; | 1245 | struct inode *inode = file_inode(file); |
1246 | struct ll_sb_info *sbi = ll_i2sbi(inode); | 1246 | struct ll_sb_info *sbi = ll_i2sbi(inode); |
1247 | struct obd_ioctl_data *data; | 1247 | struct obd_ioctl_data *data; |
1248 | int rc = 0; | 1248 | int rc = 0; |
@@ -1389,7 +1389,7 @@ lmv_out_free: | |||
1389 | return -EFAULT; | 1389 | return -EFAULT; |
1390 | } | 1390 | } |
1391 | 1391 | ||
1392 | if (inode->i_sb->s_root == file->f_dentry) | 1392 | if (is_root_inode(inode)) |
1393 | set_default = 1; | 1393 | set_default = 1; |
1394 | 1394 | ||
1395 | /* in v1 and v3 cases lumv1 points to data */ | 1395 | /* in v1 and v3 cases lumv1 points to data */ |
@@ -1780,8 +1780,7 @@ out_quotactl: | |||
1780 | return ll_flush_ctx(inode); | 1780 | return ll_flush_ctx(inode); |
1781 | #ifdef CONFIG_FS_POSIX_ACL | 1781 | #ifdef CONFIG_FS_POSIX_ACL |
1782 | case LL_IOC_RMTACL: { | 1782 | case LL_IOC_RMTACL: { |
1783 | if (sbi->ll_flags & LL_SBI_RMT_CLIENT && | 1783 | if (sbi->ll_flags & LL_SBI_RMT_CLIENT && is_root_inode(inode)) { |
1784 | inode == inode->i_sb->s_root->d_inode) { | ||
1785 | struct ll_file_data *fd = LUSTRE_FPRIVATE(file); | 1784 | struct ll_file_data *fd = LUSTRE_FPRIVATE(file); |
1786 | 1785 | ||
1787 | LASSERT(fd != NULL); | 1786 | LASSERT(fd != NULL); |
diff --git a/drivers/staging/lustre/lustre/llite/file.c b/drivers/staging/lustre/lustre/llite/file.c index c99b74117152..a2ae9a68a9a0 100644 --- a/drivers/staging/lustre/lustre/llite/file.c +++ b/drivers/staging/lustre/lustre/llite/file.c | |||
@@ -266,6 +266,10 @@ static int ll_md_close(struct obd_export *md_exp, struct inode *inode, | |||
266 | { | 266 | { |
267 | struct ll_file_data *fd = LUSTRE_FPRIVATE(file); | 267 | struct ll_file_data *fd = LUSTRE_FPRIVATE(file); |
268 | struct ll_inode_info *lli = ll_i2info(inode); | 268 | struct ll_inode_info *lli = ll_i2info(inode); |
269 | int lockmode; | ||
270 | __u64 flags = LDLM_FL_BLOCK_GRANTED | LDLM_FL_TEST_LOCK; | ||
271 | struct lustre_handle lockh; | ||
272 | ldlm_policy_data_t policy = {.l_inodebits={MDS_INODELOCK_OPEN}}; | ||
269 | int rc = 0; | 273 | int rc = 0; |
270 | 274 | ||
271 | /* clear group lock, if present */ | 275 | /* clear group lock, if present */ |
@@ -292,39 +296,26 @@ static int ll_md_close(struct obd_export *md_exp, struct inode *inode, | |||
292 | 296 | ||
293 | /* Let's see if we have good enough OPEN lock on the file and if | 297 | /* Let's see if we have good enough OPEN lock on the file and if |
294 | we can skip talking to MDS */ | 298 | we can skip talking to MDS */ |
295 | if (file->f_dentry->d_inode) { /* Can this ever be false? */ | ||
296 | int lockmode; | ||
297 | __u64 flags = LDLM_FL_BLOCK_GRANTED | LDLM_FL_TEST_LOCK; | ||
298 | struct lustre_handle lockh; | ||
299 | struct inode *inode = file->f_dentry->d_inode; | ||
300 | ldlm_policy_data_t policy = {.l_inodebits={MDS_INODELOCK_OPEN}}; | ||
301 | |||
302 | mutex_lock(&lli->lli_och_mutex); | ||
303 | if (fd->fd_omode & FMODE_WRITE) { | ||
304 | lockmode = LCK_CW; | ||
305 | LASSERT(lli->lli_open_fd_write_count); | ||
306 | lli->lli_open_fd_write_count--; | ||
307 | } else if (fd->fd_omode & FMODE_EXEC) { | ||
308 | lockmode = LCK_PR; | ||
309 | LASSERT(lli->lli_open_fd_exec_count); | ||
310 | lli->lli_open_fd_exec_count--; | ||
311 | } else { | ||
312 | lockmode = LCK_CR; | ||
313 | LASSERT(lli->lli_open_fd_read_count); | ||
314 | lli->lli_open_fd_read_count--; | ||
315 | } | ||
316 | mutex_unlock(&lli->lli_och_mutex); | ||
317 | 299 | ||
318 | if (!md_lock_match(md_exp, flags, ll_inode2fid(inode), | 300 | mutex_lock(&lli->lli_och_mutex); |
319 | LDLM_IBITS, &policy, lockmode, | 301 | if (fd->fd_omode & FMODE_WRITE) { |
320 | &lockh)) { | 302 | lockmode = LCK_CW; |
321 | rc = ll_md_real_close(file->f_dentry->d_inode, | 303 | LASSERT(lli->lli_open_fd_write_count); |
322 | fd->fd_omode); | 304 | lli->lli_open_fd_write_count--; |
323 | } | 305 | } else if (fd->fd_omode & FMODE_EXEC) { |
306 | lockmode = LCK_PR; | ||
307 | LASSERT(lli->lli_open_fd_exec_count); | ||
308 | lli->lli_open_fd_exec_count--; | ||
324 | } else { | 309 | } else { |
325 | CERROR("Releasing a file %p with negative dentry %p. Name %s", | 310 | lockmode = LCK_CR; |
326 | file, file->f_dentry, file->f_dentry->d_name.name); | 311 | LASSERT(lli->lli_open_fd_read_count); |
312 | lli->lli_open_fd_read_count--; | ||
327 | } | 313 | } |
314 | mutex_unlock(&lli->lli_och_mutex); | ||
315 | |||
316 | if (!md_lock_match(md_exp, flags, ll_inode2fid(inode), | ||
317 | LDLM_IBITS, &policy, lockmode, &lockh)) | ||
318 | rc = ll_md_real_close(inode, fd->fd_omode); | ||
328 | 319 | ||
329 | out: | 320 | out: |
330 | LUSTRE_FPRIVATE(file) = NULL; | 321 | LUSTRE_FPRIVATE(file) = NULL; |
@@ -350,8 +341,7 @@ int ll_file_release(struct inode *inode, struct file *file) | |||
350 | inode->i_generation, inode); | 341 | inode->i_generation, inode); |
351 | 342 | ||
352 | #ifdef CONFIG_FS_POSIX_ACL | 343 | #ifdef CONFIG_FS_POSIX_ACL |
353 | if (sbi->ll_flags & LL_SBI_RMT_CLIENT && | 344 | if (sbi->ll_flags & LL_SBI_RMT_CLIENT && is_root_inode(inode)) { |
354 | inode == inode->i_sb->s_root->d_inode) { | ||
355 | struct ll_file_data *fd = LUSTRE_FPRIVATE(file); | 345 | struct ll_file_data *fd = LUSTRE_FPRIVATE(file); |
356 | 346 | ||
357 | LASSERT(fd != NULL); | 347 | LASSERT(fd != NULL); |
@@ -363,7 +353,7 @@ int ll_file_release(struct inode *inode, struct file *file) | |||
363 | } | 353 | } |
364 | #endif | 354 | #endif |
365 | 355 | ||
366 | if (inode->i_sb->s_root != file->f_dentry) | 356 | if (!is_root_inode(inode)) |
367 | ll_stats_ops_tally(sbi, LPROC_LL_RELEASE, 1); | 357 | ll_stats_ops_tally(sbi, LPROC_LL_RELEASE, 1); |
368 | fd = LUSTRE_FPRIVATE(file); | 358 | fd = LUSTRE_FPRIVATE(file); |
369 | LASSERT(fd != NULL); | 359 | LASSERT(fd != NULL); |
@@ -375,7 +365,7 @@ int ll_file_release(struct inode *inode, struct file *file) | |||
375 | lli->lli_opendir_pid != 0) | 365 | lli->lli_opendir_pid != 0) |
376 | ll_stop_statahead(inode, lli->lli_opendir_key); | 366 | ll_stop_statahead(inode, lli->lli_opendir_key); |
377 | 367 | ||
378 | if (inode->i_sb->s_root == file->f_dentry) { | 368 | if (is_root_inode(inode)) { |
379 | LUSTRE_FPRIVATE(file) = NULL; | 369 | LUSTRE_FPRIVATE(file) = NULL; |
380 | ll_file_data_put(fd); | 370 | ll_file_data_put(fd); |
381 | return 0; | 371 | return 0; |
@@ -394,21 +384,19 @@ int ll_file_release(struct inode *inode, struct file *file) | |||
394 | return rc; | 384 | return rc; |
395 | } | 385 | } |
396 | 386 | ||
397 | static int ll_intent_file_open(struct file *file, void *lmm, | 387 | static int ll_intent_file_open(struct dentry *dentry, void *lmm, |
398 | int lmmsize, struct lookup_intent *itp) | 388 | int lmmsize, struct lookup_intent *itp) |
399 | { | 389 | { |
400 | struct ll_sb_info *sbi = ll_i2sbi(file->f_dentry->d_inode); | 390 | struct inode *inode = dentry->d_inode; |
401 | struct dentry *parent = file->f_dentry->d_parent; | 391 | struct ll_sb_info *sbi = ll_i2sbi(inode); |
402 | const char *name = file->f_dentry->d_name.name; | 392 | struct dentry *parent = dentry->d_parent; |
403 | const int len = file->f_dentry->d_name.len; | 393 | const char *name = dentry->d_name.name; |
394 | const int len = dentry->d_name.len; | ||
404 | struct md_op_data *op_data; | 395 | struct md_op_data *op_data; |
405 | struct ptlrpc_request *req; | 396 | struct ptlrpc_request *req; |
406 | __u32 opc = LUSTRE_OPC_ANY; | 397 | __u32 opc = LUSTRE_OPC_ANY; |
407 | int rc; | 398 | int rc; |
408 | 399 | ||
409 | if (!parent) | ||
410 | return -ENOENT; | ||
411 | |||
412 | /* Usually we come here only for NFSD, and we want open lock. | 400 | /* Usually we come here only for NFSD, and we want open lock. |
413 | But we can also get here with pre 2.6.15 patchless kernels, and in | 401 | But we can also get here with pre 2.6.15 patchless kernels, and in |
414 | that case that lock is also ok */ | 402 | that case that lock is also ok */ |
@@ -425,7 +413,7 @@ static int ll_intent_file_open(struct file *file, void *lmm, | |||
425 | } | 413 | } |
426 | 414 | ||
427 | op_data = ll_prep_md_op_data(NULL, parent->d_inode, | 415 | op_data = ll_prep_md_op_data(NULL, parent->d_inode, |
428 | file->f_dentry->d_inode, name, len, | 416 | inode, name, len, |
429 | O_RDWR, opc, NULL); | 417 | O_RDWR, opc, NULL); |
430 | if (IS_ERR(op_data)) | 418 | if (IS_ERR(op_data)) |
431 | return PTR_ERR(op_data); | 419 | return PTR_ERR(op_data); |
@@ -441,7 +429,7 @@ static int ll_intent_file_open(struct file *file, void *lmm, | |||
441 | if (!it_disposition(itp, DISP_OPEN_OPEN) || | 429 | if (!it_disposition(itp, DISP_OPEN_OPEN) || |
442 | it_open_error(DISP_OPEN_OPEN, itp)) | 430 | it_open_error(DISP_OPEN_OPEN, itp)) |
443 | goto out; | 431 | goto out; |
444 | ll_release_openhandle(file->f_dentry, itp); | 432 | ll_release_openhandle(inode, itp); |
445 | goto out; | 433 | goto out; |
446 | } | 434 | } |
447 | 435 | ||
@@ -456,10 +444,9 @@ static int ll_intent_file_open(struct file *file, void *lmm, | |||
456 | goto out; | 444 | goto out; |
457 | } | 445 | } |
458 | 446 | ||
459 | rc = ll_prep_inode(&file->f_dentry->d_inode, req, NULL, itp); | 447 | rc = ll_prep_inode(&inode, req, NULL, itp); |
460 | if (!rc && itp->d.lustre.it_lock_mode) | 448 | if (!rc && itp->d.lustre.it_lock_mode) |
461 | ll_set_lock_data(sbi->ll_md_exp, file->f_dentry->d_inode, | 449 | ll_set_lock_data(sbi->ll_md_exp, inode, itp, NULL); |
462 | itp, NULL); | ||
463 | 450 | ||
464 | out: | 451 | out: |
465 | ptlrpc_req_finished(req); | 452 | ptlrpc_req_finished(req); |
@@ -501,7 +488,7 @@ static int ll_och_fill(struct obd_export *md_exp, struct lookup_intent *it, | |||
501 | static int ll_local_open(struct file *file, struct lookup_intent *it, | 488 | static int ll_local_open(struct file *file, struct lookup_intent *it, |
502 | struct ll_file_data *fd, struct obd_client_handle *och) | 489 | struct ll_file_data *fd, struct obd_client_handle *och) |
503 | { | 490 | { |
504 | struct inode *inode = file->f_dentry->d_inode; | 491 | struct inode *inode = file_inode(file); |
505 | struct ll_inode_info *lli = ll_i2info(inode); | 492 | struct ll_inode_info *lli = ll_i2info(inode); |
506 | 493 | ||
507 | LASSERT(!LUSTRE_FPRIVATE(file)); | 494 | LASSERT(!LUSTRE_FPRIVATE(file)); |
@@ -574,7 +561,7 @@ int ll_file_open(struct inode *inode, struct file *file) | |||
574 | spin_unlock(&lli->lli_sa_lock); | 561 | spin_unlock(&lli->lli_sa_lock); |
575 | } | 562 | } |
576 | 563 | ||
577 | if (inode->i_sb->s_root == file->f_dentry) { | 564 | if (is_root_inode(inode)) { |
578 | LUSTRE_FPRIVATE(file) = fd; | 565 | LUSTRE_FPRIVATE(file) = fd; |
579 | return 0; | 566 | return 0; |
580 | } | 567 | } |
@@ -632,7 +619,7 @@ restart: | |||
632 | goto out_openerr; | 619 | goto out_openerr; |
633 | } | 620 | } |
634 | 621 | ||
635 | ll_release_openhandle(file->f_dentry, it); | 622 | ll_release_openhandle(inode, it); |
636 | } | 623 | } |
637 | (*och_usecount)++; | 624 | (*och_usecount)++; |
638 | 625 | ||
@@ -652,7 +639,7 @@ restart: | |||
652 | result in a deadlock */ | 639 | result in a deadlock */ |
653 | mutex_unlock(&lli->lli_och_mutex); | 640 | mutex_unlock(&lli->lli_och_mutex); |
654 | it->it_create_mode |= M_CHECK_STALE; | 641 | it->it_create_mode |= M_CHECK_STALE; |
655 | rc = ll_intent_file_open(file, NULL, 0, it); | 642 | rc = ll_intent_file_open(file->f_path.dentry, NULL, 0, it); |
656 | it->it_create_mode &= ~M_CHECK_STALE; | 643 | it->it_create_mode &= ~M_CHECK_STALE; |
657 | if (rc) | 644 | if (rc) |
658 | goto out_openerr; | 645 | goto out_openerr; |
@@ -1065,7 +1052,7 @@ int ll_glimpse_ioctl(struct ll_sb_info *sbi, struct lov_stripe_md *lsm, | |||
1065 | static bool file_is_noatime(const struct file *file) | 1052 | static bool file_is_noatime(const struct file *file) |
1066 | { | 1053 | { |
1067 | const struct vfsmount *mnt = file->f_path.mnt; | 1054 | const struct vfsmount *mnt = file->f_path.mnt; |
1068 | const struct inode *inode = file->f_path.dentry->d_inode; | 1055 | const struct inode *inode = file_inode(file); |
1069 | 1056 | ||
1070 | /* Adapted from file_accessed() and touch_atime().*/ | 1057 | /* Adapted from file_accessed() and touch_atime().*/ |
1071 | if (file->f_flags & O_NOATIME) | 1058 | if (file->f_flags & O_NOATIME) |
@@ -1091,7 +1078,7 @@ static bool file_is_noatime(const struct file *file) | |||
1091 | 1078 | ||
1092 | void ll_io_init(struct cl_io *io, const struct file *file, int write) | 1079 | void ll_io_init(struct cl_io *io, const struct file *file, int write) |
1093 | { | 1080 | { |
1094 | struct inode *inode = file->f_dentry->d_inode; | 1081 | struct inode *inode = file_inode(file); |
1095 | 1082 | ||
1096 | io->u.ci_rw.crw_nonblock = file->f_flags & O_NONBLOCK; | 1083 | io->u.ci_rw.crw_nonblock = file->f_flags & O_NONBLOCK; |
1097 | if (write) { | 1084 | if (write) { |
@@ -1117,7 +1104,7 @@ ll_file_io_generic(const struct lu_env *env, struct vvp_io_args *args, | |||
1117 | struct file *file, enum cl_io_type iot, | 1104 | struct file *file, enum cl_io_type iot, |
1118 | loff_t *ppos, size_t count) | 1105 | loff_t *ppos, size_t count) |
1119 | { | 1106 | { |
1120 | struct ll_inode_info *lli = ll_i2info(file->f_dentry->d_inode); | 1107 | struct ll_inode_info *lli = ll_i2info(file_inode(file)); |
1121 | struct ll_file_data *fd = LUSTRE_FPRIVATE(file); | 1108 | struct ll_file_data *fd = LUSTRE_FPRIVATE(file); |
1122 | struct cl_io *io; | 1109 | struct cl_io *io; |
1123 | ssize_t result; | 1110 | ssize_t result; |
@@ -1178,20 +1165,20 @@ out: | |||
1178 | /* If any bit been read/written (result != 0), we just return | 1165 | /* If any bit been read/written (result != 0), we just return |
1179 | * short read/write instead of restart io. */ | 1166 | * short read/write instead of restart io. */ |
1180 | if ((result == 0 || result == -ENODATA) && io->ci_need_restart) { | 1167 | if ((result == 0 || result == -ENODATA) && io->ci_need_restart) { |
1181 | CDEBUG(D_VFSTRACE, "Restart %s on %s from %lld, count:%zd\n", | 1168 | CDEBUG(D_VFSTRACE, "Restart %s on %pD from %lld, count:%zd\n", |
1182 | iot == CIT_READ ? "read" : "write", | 1169 | iot == CIT_READ ? "read" : "write", |
1183 | file->f_dentry->d_name.name, *ppos, count); | 1170 | file, *ppos, count); |
1184 | LASSERTF(io->ci_nob == 0, "%zd", io->ci_nob); | 1171 | LASSERTF(io->ci_nob == 0, "%zd", io->ci_nob); |
1185 | goto restart; | 1172 | goto restart; |
1186 | } | 1173 | } |
1187 | 1174 | ||
1188 | if (iot == CIT_READ) { | 1175 | if (iot == CIT_READ) { |
1189 | if (result >= 0) | 1176 | if (result >= 0) |
1190 | ll_stats_ops_tally(ll_i2sbi(file->f_dentry->d_inode), | 1177 | ll_stats_ops_tally(ll_i2sbi(file_inode(file)), |
1191 | LPROC_LL_READ_BYTES, result); | 1178 | LPROC_LL_READ_BYTES, result); |
1192 | } else if (iot == CIT_WRITE) { | 1179 | } else if (iot == CIT_WRITE) { |
1193 | if (result >= 0) { | 1180 | if (result >= 0) { |
1194 | ll_stats_ops_tally(ll_i2sbi(file->f_dentry->d_inode), | 1181 | ll_stats_ops_tally(ll_i2sbi(file_inode(file)), |
1195 | LPROC_LL_WRITE_BYTES, result); | 1182 | LPROC_LL_WRITE_BYTES, result); |
1196 | fd->fd_write_failed = false; | 1183 | fd->fd_write_failed = false; |
1197 | } else if (result != -ERESTARTSYS) { | 1184 | } else if (result != -ERESTARTSYS) { |
@@ -1354,7 +1341,7 @@ static int ll_lov_recreate_fid(struct inode *inode, unsigned long arg) | |||
1354 | return ll_lov_recreate(inode, &oi, ost_idx); | 1341 | return ll_lov_recreate(inode, &oi, ost_idx); |
1355 | } | 1342 | } |
1356 | 1343 | ||
1357 | int ll_lov_setstripe_ea_info(struct inode *inode, struct file *file, | 1344 | int ll_lov_setstripe_ea_info(struct inode *inode, struct dentry *dentry, |
1358 | int flags, struct lov_user_md *lum, int lum_size) | 1345 | int flags, struct lov_user_md *lum, int lum_size) |
1359 | { | 1346 | { |
1360 | struct lov_stripe_md *lsm = NULL; | 1347 | struct lov_stripe_md *lsm = NULL; |
@@ -1371,21 +1358,20 @@ int ll_lov_setstripe_ea_info(struct inode *inode, struct file *file, | |||
1371 | } | 1358 | } |
1372 | 1359 | ||
1373 | ll_inode_size_lock(inode); | 1360 | ll_inode_size_lock(inode); |
1374 | rc = ll_intent_file_open(file, lum, lum_size, &oit); | 1361 | rc = ll_intent_file_open(dentry, lum, lum_size, &oit); |
1375 | if (rc) | 1362 | if (rc) |
1376 | goto out_unlock; | 1363 | goto out_unlock; |
1377 | rc = oit.d.lustre.it_status; | 1364 | rc = oit.d.lustre.it_status; |
1378 | if (rc < 0) | 1365 | if (rc < 0) |
1379 | goto out_req_free; | 1366 | goto out_req_free; |
1380 | 1367 | ||
1381 | ll_release_openhandle(file->f_dentry, &oit); | 1368 | ll_release_openhandle(inode, &oit); |
1382 | 1369 | ||
1383 | out_unlock: | 1370 | out_unlock: |
1384 | ll_inode_size_unlock(inode); | 1371 | ll_inode_size_unlock(inode); |
1385 | ll_intent_release(&oit); | 1372 | ll_intent_release(&oit); |
1386 | ccc_inode_lsm_put(inode, lsm); | 1373 | ccc_inode_lsm_put(inode, lsm); |
1387 | out: | 1374 | out: |
1388 | cl_lov_delay_create_clear(&file->f_flags); | ||
1389 | return rc; | 1375 | return rc; |
1390 | out_req_free: | 1376 | out_req_free: |
1391 | ptlrpc_req_finished((struct ptlrpc_request *) oit.d.lustre.it_data); | 1377 | ptlrpc_req_finished((struct ptlrpc_request *) oit.d.lustre.it_data); |
@@ -1499,7 +1485,9 @@ static int ll_lov_setea(struct inode *inode, struct file *file, | |||
1499 | return -EFAULT; | 1485 | return -EFAULT; |
1500 | } | 1486 | } |
1501 | 1487 | ||
1502 | rc = ll_lov_setstripe_ea_info(inode, file, flags, lump, lum_size); | 1488 | rc = ll_lov_setstripe_ea_info(inode, file->f_path.dentry, flags, lump, |
1489 | lum_size); | ||
1490 | cl_lov_delay_create_clear(&file->f_flags); | ||
1503 | 1491 | ||
1504 | OBD_FREE_LARGE(lump, lum_size); | 1492 | OBD_FREE_LARGE(lump, lum_size); |
1505 | return rc; | 1493 | return rc; |
@@ -1526,7 +1514,9 @@ static int ll_lov_setstripe(struct inode *inode, struct file *file, | |||
1526 | return -EFAULT; | 1514 | return -EFAULT; |
1527 | } | 1515 | } |
1528 | 1516 | ||
1529 | rc = ll_lov_setstripe_ea_info(inode, file, flags, lumv1, lum_size); | 1517 | rc = ll_lov_setstripe_ea_info(inode, file->f_path.dentry, flags, lumv1, |
1518 | lum_size); | ||
1519 | cl_lov_delay_create_clear(&file->f_flags); | ||
1530 | if (rc == 0) { | 1520 | if (rc == 0) { |
1531 | struct lov_stripe_md *lsm; | 1521 | struct lov_stripe_md *lsm; |
1532 | __u32 gen; | 1522 | __u32 gen; |
@@ -1631,22 +1621,21 @@ int ll_put_grouplock(struct inode *inode, struct file *file, unsigned long arg) | |||
1631 | /** | 1621 | /** |
1632 | * Close inode open handle | 1622 | * Close inode open handle |
1633 | * | 1623 | * |
1634 | * \param dentry [in] dentry which contains the inode | 1624 | * \param inode [in] inode in question |
1635 | * \param it [in,out] intent which contains open info and result | 1625 | * \param it [in,out] intent which contains open info and result |
1636 | * | 1626 | * |
1637 | * \retval 0 success | 1627 | * \retval 0 success |
1638 | * \retval <0 failure | 1628 | * \retval <0 failure |
1639 | */ | 1629 | */ |
1640 | int ll_release_openhandle(struct dentry *dentry, struct lookup_intent *it) | 1630 | int ll_release_openhandle(struct inode *inode, struct lookup_intent *it) |
1641 | { | 1631 | { |
1642 | struct inode *inode = dentry->d_inode; | ||
1643 | struct obd_client_handle *och; | 1632 | struct obd_client_handle *och; |
1644 | int rc; | 1633 | int rc; |
1645 | 1634 | ||
1646 | LASSERT(inode); | 1635 | LASSERT(inode); |
1647 | 1636 | ||
1648 | /* Root ? Do nothing. */ | 1637 | /* Root ? Do nothing. */ |
1649 | if (dentry->d_inode->i_sb->s_root == dentry) | 1638 | if (is_root_inode(inode)) |
1650 | return 0; | 1639 | return 0; |
1651 | 1640 | ||
1652 | /* No open handle to close? Move away */ | 1641 | /* No open handle to close? Move away */ |
@@ -1959,8 +1948,8 @@ static int ll_swap_layouts(struct file *file1, struct file *file2, | |||
1959 | if (!llss) | 1948 | if (!llss) |
1960 | return -ENOMEM; | 1949 | return -ENOMEM; |
1961 | 1950 | ||
1962 | llss->inode1 = file1->f_dentry->d_inode; | 1951 | llss->inode1 = file_inode(file1); |
1963 | llss->inode2 = file2->f_dentry->d_inode; | 1952 | llss->inode2 = file_inode(file2); |
1964 | 1953 | ||
1965 | if (!S_ISREG(llss->inode2->i_mode)) { | 1954 | if (!S_ISREG(llss->inode2->i_mode)) { |
1966 | rc = -EINVAL; | 1955 | rc = -EINVAL; |
@@ -2092,7 +2081,7 @@ putgl: | |||
2092 | rc = 0; | 2081 | rc = 0; |
2093 | if (llss->ia2.ia_valid != 0) { | 2082 | if (llss->ia2.ia_valid != 0) { |
2094 | mutex_lock(&llss->inode1->i_mutex); | 2083 | mutex_lock(&llss->inode1->i_mutex); |
2095 | rc = ll_setattr(file1->f_dentry, &llss->ia2); | 2084 | rc = ll_setattr(file1->f_path.dentry, &llss->ia2); |
2096 | mutex_unlock(&llss->inode1->i_mutex); | 2085 | mutex_unlock(&llss->inode1->i_mutex); |
2097 | } | 2086 | } |
2098 | 2087 | ||
@@ -2100,7 +2089,7 @@ putgl: | |||
2100 | int rc1; | 2089 | int rc1; |
2101 | 2090 | ||
2102 | mutex_lock(&llss->inode2->i_mutex); | 2091 | mutex_lock(&llss->inode2->i_mutex); |
2103 | rc1 = ll_setattr(file2->f_dentry, &llss->ia1); | 2092 | rc1 = ll_setattr(file2->f_path.dentry, &llss->ia1); |
2104 | mutex_unlock(&llss->inode2->i_mutex); | 2093 | mutex_unlock(&llss->inode2->i_mutex); |
2105 | if (rc == 0) | 2094 | if (rc == 0) |
2106 | rc = rc1; | 2095 | rc = rc1; |
@@ -2185,7 +2174,7 @@ static int ll_hsm_import(struct inode *inode, struct file *file, | |||
2185 | 2174 | ||
2186 | mutex_lock(&inode->i_mutex); | 2175 | mutex_lock(&inode->i_mutex); |
2187 | 2176 | ||
2188 | rc = ll_setattr_raw(file->f_dentry, attr, true); | 2177 | rc = ll_setattr_raw(file->f_path.dentry, attr, true); |
2189 | if (rc == -ENODATA) | 2178 | if (rc == -ENODATA) |
2190 | rc = 0; | 2179 | rc = 0; |
2191 | 2180 | ||
@@ -2204,7 +2193,7 @@ out: | |||
2204 | static long | 2193 | static long |
2205 | ll_file_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | 2194 | ll_file_ioctl(struct file *file, unsigned int cmd, unsigned long arg) |
2206 | { | 2195 | { |
2207 | struct inode *inode = file->f_dentry->d_inode; | 2196 | struct inode *inode = file_inode(file); |
2208 | struct ll_file_data *fd = LUSTRE_FPRIVATE(file); | 2197 | struct ll_file_data *fd = LUSTRE_FPRIVATE(file); |
2209 | int flags, rc; | 2198 | int flags, rc; |
2210 | 2199 | ||
@@ -2523,7 +2512,7 @@ ll_file_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | |||
2523 | 2512 | ||
2524 | static loff_t ll_file_seek(struct file *file, loff_t offset, int origin) | 2513 | static loff_t ll_file_seek(struct file *file, loff_t offset, int origin) |
2525 | { | 2514 | { |
2526 | struct inode *inode = file->f_dentry->d_inode; | 2515 | struct inode *inode = file_inode(file); |
2527 | loff_t retval, eof = 0; | 2516 | loff_t retval, eof = 0; |
2528 | 2517 | ||
2529 | retval = offset + ((origin == SEEK_END) ? i_size_read(inode) : | 2518 | retval = offset + ((origin == SEEK_END) ? i_size_read(inode) : |
@@ -2547,7 +2536,7 @@ static loff_t ll_file_seek(struct file *file, loff_t offset, int origin) | |||
2547 | 2536 | ||
2548 | static int ll_flush(struct file *file, fl_owner_t id) | 2537 | static int ll_flush(struct file *file, fl_owner_t id) |
2549 | { | 2538 | { |
2550 | struct inode *inode = file->f_dentry->d_inode; | 2539 | struct inode *inode = file_inode(file); |
2551 | struct ll_inode_info *lli = ll_i2info(inode); | 2540 | struct ll_inode_info *lli = ll_i2info(inode); |
2552 | struct ll_file_data *fd = LUSTRE_FPRIVATE(file); | 2541 | struct ll_file_data *fd = LUSTRE_FPRIVATE(file); |
2553 | int rc, err; | 2542 | int rc, err; |
@@ -2622,16 +2611,9 @@ int cl_sync_file_range(struct inode *inode, loff_t start, loff_t end, | |||
2622 | return result; | 2611 | return result; |
2623 | } | 2612 | } |
2624 | 2613 | ||
2625 | /* | ||
2626 | * When dentry is provided (the 'else' case), *file->f_dentry may be | ||
2627 | * null and dentry must be used directly rather than pulled from | ||
2628 | * *file->f_dentry as is done otherwise. | ||
2629 | */ | ||
2630 | |||
2631 | int ll_fsync(struct file *file, loff_t start, loff_t end, int datasync) | 2614 | int ll_fsync(struct file *file, loff_t start, loff_t end, int datasync) |
2632 | { | 2615 | { |
2633 | struct dentry *dentry = file->f_dentry; | 2616 | struct inode *inode = file_inode(file); |
2634 | struct inode *inode = dentry->d_inode; | ||
2635 | struct ll_inode_info *lli = ll_i2info(inode); | 2617 | struct ll_inode_info *lli = ll_i2info(inode); |
2636 | struct ptlrpc_request *req; | 2618 | struct ptlrpc_request *req; |
2637 | struct obd_capa *oc; | 2619 | struct obd_capa *oc; |
@@ -2684,7 +2666,7 @@ int ll_fsync(struct file *file, loff_t start, loff_t end, int datasync) | |||
2684 | static int | 2666 | static int |
2685 | ll_file_flock(struct file *file, int cmd, struct file_lock *file_lock) | 2667 | ll_file_flock(struct file *file, int cmd, struct file_lock *file_lock) |
2686 | { | 2668 | { |
2687 | struct inode *inode = file->f_dentry->d_inode; | 2669 | struct inode *inode = file_inode(file); |
2688 | struct ll_sb_info *sbi = ll_i2sbi(inode); | 2670 | struct ll_sb_info *sbi = ll_i2sbi(inode); |
2689 | struct ldlm_enqueue_info einfo = { | 2671 | struct ldlm_enqueue_info einfo = { |
2690 | .ei_type = LDLM_FLOCK, | 2672 | .ei_type = LDLM_FLOCK, |
@@ -2908,8 +2890,8 @@ static int __ll_inode_revalidate(struct dentry *dentry, __u64 ibits) | |||
2908 | 2890 | ||
2909 | LASSERT(inode != NULL); | 2891 | LASSERT(inode != NULL); |
2910 | 2892 | ||
2911 | CDEBUG(D_VFSTRACE, "VFS Op:inode=%lu/%u(%p),name=%s\n", | 2893 | CDEBUG(D_VFSTRACE, "VFS Op:inode=%lu/%u(%p),name=%pd\n", |
2912 | inode->i_ino, inode->i_generation, inode, dentry->d_name.name); | 2894 | inode->i_ino, inode->i_generation, inode, dentry); |
2913 | 2895 | ||
2914 | exp = ll_i2mdexp(inode); | 2896 | exp = ll_i2mdexp(inode); |
2915 | 2897 | ||
@@ -3119,7 +3101,7 @@ int ll_inode_permission(struct inode *inode, int mask) | |||
3119 | /* as root inode are NOT getting validated in lookup operation, | 3101 | /* as root inode are NOT getting validated in lookup operation, |
3120 | * need to do it before permission check. */ | 3102 | * need to do it before permission check. */ |
3121 | 3103 | ||
3122 | if (inode == inode->i_sb->s_root->d_inode) { | 3104 | if (is_root_inode(inode)) { |
3123 | rc = __ll_inode_revalidate(inode->i_sb->s_root, | 3105 | rc = __ll_inode_revalidate(inode->i_sb->s_root, |
3124 | MDS_INODELOCK_LOOKUP); | 3106 | MDS_INODELOCK_LOOKUP); |
3125 | if (rc) | 3107 | if (rc) |
diff --git a/drivers/staging/lustre/lustre/llite/llite_internal.h b/drivers/staging/lustre/lustre/llite/llite_internal.h index 36aa0fd147f2..77d1c12704b4 100644 --- a/drivers/staging/lustre/lustre/llite/llite_internal.h +++ b/drivers/staging/lustre/lustre/llite/llite_internal.h | |||
@@ -748,7 +748,7 @@ int ll_file_release(struct inode *inode, struct file *file); | |||
748 | int ll_glimpse_ioctl(struct ll_sb_info *sbi, | 748 | int ll_glimpse_ioctl(struct ll_sb_info *sbi, |
749 | struct lov_stripe_md *lsm, lstat_t *st); | 749 | struct lov_stripe_md *lsm, lstat_t *st); |
750 | void ll_ioepoch_open(struct ll_inode_info *lli, __u64 ioepoch); | 750 | void ll_ioepoch_open(struct ll_inode_info *lli, __u64 ioepoch); |
751 | int ll_release_openhandle(struct dentry *, struct lookup_intent *); | 751 | int ll_release_openhandle(struct inode *, struct lookup_intent *); |
752 | int ll_md_real_close(struct inode *inode, fmode_t fmode); | 752 | int ll_md_real_close(struct inode *inode, fmode_t fmode); |
753 | void ll_ioepoch_close(struct inode *inode, struct md_op_data *op_data, | 753 | void ll_ioepoch_close(struct inode *inode, struct md_op_data *op_data, |
754 | struct obd_client_handle **och, unsigned long flags); | 754 | struct obd_client_handle **och, unsigned long flags); |
@@ -763,7 +763,7 @@ struct posix_acl *ll_get_acl(struct inode *inode, int type); | |||
763 | 763 | ||
764 | int ll_inode_permission(struct inode *inode, int mask); | 764 | int ll_inode_permission(struct inode *inode, int mask); |
765 | 765 | ||
766 | int ll_lov_setstripe_ea_info(struct inode *inode, struct file *file, | 766 | int ll_lov_setstripe_ea_info(struct inode *inode, struct dentry *dentry, |
767 | int flags, struct lov_user_md *lum, | 767 | int flags, struct lov_user_md *lum, |
768 | int lum_size); | 768 | int lum_size); |
769 | int ll_lov_getstripe_ea_info(struct inode *inode, const char *filename, | 769 | int ll_lov_getstripe_ea_info(struct inode *inode, const char *filename, |
@@ -1413,7 +1413,7 @@ extern ssize_t ll_direct_rw_pages(const struct lu_env *env, struct cl_io *io, | |||
1413 | static inline int ll_file_nolock(const struct file *file) | 1413 | static inline int ll_file_nolock(const struct file *file) |
1414 | { | 1414 | { |
1415 | struct ll_file_data *fd = LUSTRE_FPRIVATE(file); | 1415 | struct ll_file_data *fd = LUSTRE_FPRIVATE(file); |
1416 | struct inode *inode = file->f_dentry->d_inode; | 1416 | struct inode *inode = file_inode(file); |
1417 | 1417 | ||
1418 | LASSERT(fd != NULL); | 1418 | LASSERT(fd != NULL); |
1419 | return ((fd->fd_flags & LL_FILE_IGNORE_LOCK) || | 1419 | return ((fd->fd_flags & LL_FILE_IGNORE_LOCK) || |
@@ -1489,8 +1489,8 @@ static inline void __d_lustre_invalidate(struct dentry *dentry) | |||
1489 | */ | 1489 | */ |
1490 | static inline void d_lustre_invalidate(struct dentry *dentry, int nested) | 1490 | static inline void d_lustre_invalidate(struct dentry *dentry, int nested) |
1491 | { | 1491 | { |
1492 | CDEBUG(D_DENTRY, "invalidate dentry %.*s (%p) parent %p inode %p " | 1492 | CDEBUG(D_DENTRY, "invalidate dentry %pd (%p) parent %p inode %p " |
1493 | "refc %d\n", dentry->d_name.len, dentry->d_name.name, dentry, | 1493 | "refc %d\n", dentry, dentry, |
1494 | dentry->d_parent, dentry->d_inode, d_count(dentry)); | 1494 | dentry->d_parent, dentry->d_inode, d_count(dentry)); |
1495 | 1495 | ||
1496 | spin_lock_nested(&dentry->d_lock, | 1496 | spin_lock_nested(&dentry->d_lock, |
diff --git a/drivers/staging/lustre/lustre/llite/llite_lib.c b/drivers/staging/lustre/lustre/llite/llite_lib.c index a8bcc51057f1..7b6b9e2e0102 100644 --- a/drivers/staging/lustre/lustre/llite/llite_lib.c +++ b/drivers/staging/lustre/lustre/llite/llite_lib.c | |||
@@ -698,10 +698,8 @@ void lustre_dump_dentry(struct dentry *dentry, int recur) | |||
698 | list_for_each(tmp, &dentry->d_subdirs) | 698 | list_for_each(tmp, &dentry->d_subdirs) |
699 | subdirs++; | 699 | subdirs++; |
700 | 700 | ||
701 | CERROR("dentry %p dump: name=%.*s parent=%.*s (%p), inode=%p, count=%u," | 701 | CERROR("dentry %p dump: name=%pd parent=%p, inode=%p, count=%u," |
702 | " flags=0x%x, fsdata=%p, %d subdirs\n", dentry, | 702 | " flags=0x%x, fsdata=%p, %d subdirs\n", dentry, dentry, |
703 | dentry->d_name.len, dentry->d_name.name, | ||
704 | dentry->d_parent->d_name.len, dentry->d_parent->d_name.name, | ||
705 | dentry->d_parent, dentry->d_inode, d_count(dentry), | 703 | dentry->d_parent, dentry->d_inode, d_count(dentry), |
706 | dentry->d_flags, dentry->d_fsdata, subdirs); | 704 | dentry->d_flags, dentry->d_fsdata, subdirs); |
707 | if (dentry->d_inode != NULL) | 705 | if (dentry->d_inode != NULL) |
@@ -711,7 +709,7 @@ void lustre_dump_dentry(struct dentry *dentry, int recur) | |||
711 | return; | 709 | return; |
712 | 710 | ||
713 | list_for_each(tmp, &dentry->d_subdirs) { | 711 | list_for_each(tmp, &dentry->d_subdirs) { |
714 | struct dentry *d = list_entry(tmp, struct dentry, d_u.d_child); | 712 | struct dentry *d = list_entry(tmp, struct dentry, d_child); |
715 | lustre_dump_dentry(d, recur - 1); | 713 | lustre_dump_dentry(d, recur - 1); |
716 | } | 714 | } |
717 | } | 715 | } |
diff --git a/drivers/staging/lustre/lustre/llite/llite_mmap.c b/drivers/staging/lustre/lustre/llite/llite_mmap.c index ae605a6d9dc2..ba1c047ae927 100644 --- a/drivers/staging/lustre/lustre/llite/llite_mmap.c +++ b/drivers/staging/lustre/lustre/llite/llite_mmap.c | |||
@@ -100,7 +100,7 @@ ll_fault_io_init(struct vm_area_struct *vma, struct lu_env **env_ret, | |||
100 | unsigned long *ra_flags) | 100 | unsigned long *ra_flags) |
101 | { | 101 | { |
102 | struct file *file = vma->vm_file; | 102 | struct file *file = vma->vm_file; |
103 | struct inode *inode = file->f_dentry->d_inode; | 103 | struct inode *inode = file_inode(file); |
104 | struct cl_io *io; | 104 | struct cl_io *io; |
105 | struct cl_fault_io *fio; | 105 | struct cl_fault_io *fio; |
106 | struct lu_env *env; | 106 | struct lu_env *env; |
@@ -213,7 +213,7 @@ static int ll_page_mkwrite0(struct vm_area_struct *vma, struct page *vmpage, | |||
213 | cfs_restore_sigs(set); | 213 | cfs_restore_sigs(set); |
214 | 214 | ||
215 | if (result == 0) { | 215 | if (result == 0) { |
216 | struct inode *inode = vma->vm_file->f_dentry->d_inode; | 216 | struct inode *inode = file_inode(vma->vm_file); |
217 | struct ll_inode_info *lli = ll_i2info(inode); | 217 | struct ll_inode_info *lli = ll_i2info(inode); |
218 | 218 | ||
219 | lock_page(vmpage); | 219 | lock_page(vmpage); |
@@ -396,7 +396,7 @@ static int ll_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf) | |||
396 | CWARN("app(%s): the page %lu of file %lu is under heavy" | 396 | CWARN("app(%s): the page %lu of file %lu is under heavy" |
397 | " contention.\n", | 397 | " contention.\n", |
398 | current->comm, vmf->pgoff, | 398 | current->comm, vmf->pgoff, |
399 | vma->vm_file->f_dentry->d_inode->i_ino); | 399 | file_inode(vma->vm_file)->i_ino); |
400 | printed = true; | 400 | printed = true; |
401 | } | 401 | } |
402 | } while (retry); | 402 | } while (retry); |
@@ -430,7 +430,7 @@ static int ll_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf) | |||
430 | */ | 430 | */ |
431 | static void ll_vm_open(struct vm_area_struct *vma) | 431 | static void ll_vm_open(struct vm_area_struct *vma) |
432 | { | 432 | { |
433 | struct inode *inode = vma->vm_file->f_dentry->d_inode; | 433 | struct inode *inode = file_inode(vma->vm_file); |
434 | struct ccc_object *vob = cl_inode2ccc(inode); | 434 | struct ccc_object *vob = cl_inode2ccc(inode); |
435 | 435 | ||
436 | LASSERT(vma->vm_file); | 436 | LASSERT(vma->vm_file); |
@@ -443,7 +443,7 @@ static void ll_vm_open(struct vm_area_struct *vma) | |||
443 | */ | 443 | */ |
444 | static void ll_vm_close(struct vm_area_struct *vma) | 444 | static void ll_vm_close(struct vm_area_struct *vma) |
445 | { | 445 | { |
446 | struct inode *inode = vma->vm_file->f_dentry->d_inode; | 446 | struct inode *inode = file_inode(vma->vm_file); |
447 | struct ccc_object *vob = cl_inode2ccc(inode); | 447 | struct ccc_object *vob = cl_inode2ccc(inode); |
448 | 448 | ||
449 | LASSERT(vma->vm_file); | 449 | LASSERT(vma->vm_file); |
@@ -476,7 +476,7 @@ static const struct vm_operations_struct ll_file_vm_ops = { | |||
476 | 476 | ||
477 | int ll_file_mmap(struct file *file, struct vm_area_struct *vma) | 477 | int ll_file_mmap(struct file *file, struct vm_area_struct *vma) |
478 | { | 478 | { |
479 | struct inode *inode = file->f_dentry->d_inode; | 479 | struct inode *inode = file_inode(file); |
480 | int rc; | 480 | int rc; |
481 | 481 | ||
482 | if (ll_file_nolock(file)) | 482 | if (ll_file_nolock(file)) |
diff --git a/drivers/staging/lustre/lustre/llite/llite_nfs.c b/drivers/staging/lustre/lustre/llite/llite_nfs.c index ae3a12ab7fa1..243a7840457f 100644 --- a/drivers/staging/lustre/lustre/llite/llite_nfs.c +++ b/drivers/staging/lustre/lustre/llite/llite_nfs.c | |||
@@ -207,13 +207,15 @@ static int ll_encode_fh(struct inode *inode, __u32 *fh, int *plen, | |||
207 | return LUSTRE_NFS_FID; | 207 | return LUSTRE_NFS_FID; |
208 | } | 208 | } |
209 | 209 | ||
210 | static int ll_nfs_get_name_filldir(void *cookie, const char *name, int namelen, | 210 | static int ll_nfs_get_name_filldir(struct dir_context *ctx, const char *name, |
211 | loff_t hash, u64 ino, unsigned type) | 211 | int namelen, loff_t hash, u64 ino, |
212 | unsigned type) | ||
212 | { | 213 | { |
213 | /* It is hack to access lde_fid for comparison with lgd_fid. | 214 | /* It is hack to access lde_fid for comparison with lgd_fid. |
214 | * So the input 'name' must be part of the 'lu_dirent'. */ | 215 | * So the input 'name' must be part of the 'lu_dirent'. */ |
215 | struct lu_dirent *lde = container_of0(name, struct lu_dirent, lde_name); | 216 | struct lu_dirent *lde = container_of0(name, struct lu_dirent, lde_name); |
216 | struct ll_getname_data *lgd = cookie; | 217 | struct ll_getname_data *lgd = |
218 | container_of(ctx, struct ll_getname_data, ctx); | ||
217 | struct lu_fid fid; | 219 | struct lu_fid fid; |
218 | 220 | ||
219 | fid_le_to_cpu(&fid, &lde->lde_fid); | 221 | fid_le_to_cpu(&fid, &lde->lde_fid); |
diff --git a/drivers/staging/lustre/lustre/llite/lloop.c b/drivers/staging/lustre/lustre/llite/lloop.c index 264e5ec3fed6..9e31b789b790 100644 --- a/drivers/staging/lustre/lustre/llite/lloop.c +++ b/drivers/staging/lustre/lustre/llite/lloop.c | |||
@@ -187,7 +187,7 @@ static int do_bio_lustrebacked(struct lloop_device *lo, struct bio *head) | |||
187 | { | 187 | { |
188 | const struct lu_env *env = lo->lo_env; | 188 | const struct lu_env *env = lo->lo_env; |
189 | struct cl_io *io = &lo->lo_io; | 189 | struct cl_io *io = &lo->lo_io; |
190 | struct inode *inode = lo->lo_backing_file->f_dentry->d_inode; | 190 | struct inode *inode = file_inode(lo->lo_backing_file); |
191 | struct cl_object *obj = ll_i2info(inode)->lli_clob; | 191 | struct cl_object *obj = ll_i2info(inode)->lli_clob; |
192 | pgoff_t offset; | 192 | pgoff_t offset; |
193 | int ret; | 193 | int ret; |
@@ -626,7 +626,7 @@ static int lo_ioctl(struct block_device *bdev, fmode_t mode, | |||
626 | break; | 626 | break; |
627 | } | 627 | } |
628 | if (inode == NULL) | 628 | if (inode == NULL) |
629 | inode = lo->lo_backing_file->f_dentry->d_inode; | 629 | inode = file_inode(lo->lo_backing_file); |
630 | if (lo->lo_state == LLOOP_BOUND) | 630 | if (lo->lo_state == LLOOP_BOUND) |
631 | fid = ll_i2info(inode)->lli_fid; | 631 | fid = ll_i2info(inode)->lli_fid; |
632 | else | 632 | else |
@@ -692,8 +692,7 @@ static enum llioc_iter lloop_ioctl(struct inode *unused, struct file *file, | |||
692 | lo_free = lo; | 692 | lo_free = lo; |
693 | continue; | 693 | continue; |
694 | } | 694 | } |
695 | if (lo->lo_backing_file->f_dentry->d_inode == | 695 | if (file_inode(lo->lo_backing_file) == file_inode(file)) |
696 | file->f_dentry->d_inode) | ||
697 | break; | 696 | break; |
698 | } | 697 | } |
699 | if (lo || !lo_free) { | 698 | if (lo || !lo_free) { |
diff --git a/drivers/staging/lustre/lustre/llite/namei.c b/drivers/staging/lustre/lustre/llite/namei.c index 7a68c1e027e0..8e926b385a60 100644 --- a/drivers/staging/lustre/lustre/llite/namei.c +++ b/drivers/staging/lustre/lustre/llite/namei.c | |||
@@ -54,27 +54,6 @@ | |||
54 | static int ll_create_it(struct inode *, struct dentry *, | 54 | static int ll_create_it(struct inode *, struct dentry *, |
55 | int, struct lookup_intent *); | 55 | int, struct lookup_intent *); |
56 | 56 | ||
57 | /* | ||
58 | * Check if we have something mounted at the named dchild. | ||
59 | * In such a case there would always be dentry present. | ||
60 | */ | ||
61 | static int ll_d_mountpoint(struct dentry *dparent, struct dentry *dchild, | ||
62 | struct qstr *name) | ||
63 | { | ||
64 | int mounted = 0; | ||
65 | |||
66 | if (unlikely(dchild)) { | ||
67 | mounted = d_mountpoint(dchild); | ||
68 | } else if (dparent) { | ||
69 | dchild = d_lookup(dparent, name); | ||
70 | if (dchild) { | ||
71 | mounted = d_mountpoint(dchild); | ||
72 | dput(dchild); | ||
73 | } | ||
74 | } | ||
75 | return mounted; | ||
76 | } | ||
77 | |||
78 | /* called from iget5_locked->find_inode() under inode_hash_lock spinlock */ | 57 | /* called from iget5_locked->find_inode() under inode_hash_lock spinlock */ |
79 | static int ll_test_inode(struct inode *inode, void *opaque) | 58 | static int ll_test_inode(struct inode *inode, void *opaque) |
80 | { | 59 | { |
@@ -167,14 +146,14 @@ static void ll_invalidate_negative_children(struct inode *dir) | |||
167 | struct ll_d_hlist_node *p; | 146 | struct ll_d_hlist_node *p; |
168 | 147 | ||
169 | ll_lock_dcache(dir); | 148 | ll_lock_dcache(dir); |
170 | ll_d_hlist_for_each_entry(dentry, p, &dir->i_dentry, d_alias) { | 149 | ll_d_hlist_for_each_entry(dentry, p, &dir->i_dentry, d_u.d_alias) { |
171 | spin_lock(&dentry->d_lock); | 150 | spin_lock(&dentry->d_lock); |
172 | if (!list_empty(&dentry->d_subdirs)) { | 151 | if (!list_empty(&dentry->d_subdirs)) { |
173 | struct dentry *child; | 152 | struct dentry *child; |
174 | 153 | ||
175 | list_for_each_entry_safe(child, tmp_subdir, | 154 | list_for_each_entry_safe(child, tmp_subdir, |
176 | &dentry->d_subdirs, | 155 | &dentry->d_subdirs, |
177 | d_u.d_child) { | 156 | d_child) { |
178 | if (child->d_inode == NULL) | 157 | if (child->d_inode == NULL) |
179 | d_lustre_invalidate(child, 1); | 158 | d_lustre_invalidate(child, 1); |
180 | } | 159 | } |
@@ -285,7 +264,7 @@ int ll_md_blocking_ast(struct ldlm_lock *lock, struct ldlm_lock_desc *desc, | |||
285 | 264 | ||
286 | if ((bits & (MDS_INODELOCK_LOOKUP | MDS_INODELOCK_PERM)) && | 265 | if ((bits & (MDS_INODELOCK_LOOKUP | MDS_INODELOCK_PERM)) && |
287 | inode->i_sb->s_root != NULL && | 266 | inode->i_sb->s_root != NULL && |
288 | inode != inode->i_sb->s_root->d_inode) | 267 | is_root_inode(inode)) |
289 | ll_invalidate_aliases(inode); | 268 | ll_invalidate_aliases(inode); |
290 | 269 | ||
291 | iput(inode); | 270 | iput(inode); |
@@ -362,7 +341,7 @@ static struct dentry *ll_find_alias(struct inode *inode, struct dentry *dentry) | |||
362 | discon_alias = invalid_alias = NULL; | 341 | discon_alias = invalid_alias = NULL; |
363 | 342 | ||
364 | ll_lock_dcache(inode); | 343 | ll_lock_dcache(inode); |
365 | ll_d_hlist_for_each_entry(alias, p, &inode->i_dentry, d_alias) { | 344 | ll_d_hlist_for_each_entry(alias, p, &inode->i_dentry, d_u.d_alias) { |
366 | LASSERT(alias != dentry); | 345 | LASSERT(alias != dentry); |
367 | 346 | ||
368 | spin_lock(&alias->d_lock); | 347 | spin_lock(&alias->d_lock); |
@@ -509,8 +488,8 @@ static struct dentry *ll_lookup_it(struct inode *parent, struct dentry *dentry, | |||
509 | if (dentry->d_name.len > ll_i2sbi(parent)->ll_namelen) | 488 | if (dentry->d_name.len > ll_i2sbi(parent)->ll_namelen) |
510 | return ERR_PTR(-ENAMETOOLONG); | 489 | return ERR_PTR(-ENAMETOOLONG); |
511 | 490 | ||
512 | CDEBUG(D_VFSTRACE, "VFS Op:name=%.*s,dir=%lu/%u(%p),intent=%s\n", | 491 | CDEBUG(D_VFSTRACE, "VFS Op:name=%pd,dir=%lu/%u(%p),intent=%s\n", |
513 | dentry->d_name.len, dentry->d_name.name, parent->i_ino, | 492 | dentry, parent->i_ino, |
514 | parent->i_generation, parent, LL_IT2STR(it)); | 493 | parent->i_generation, parent, LL_IT2STR(it)); |
515 | 494 | ||
516 | if (d_mountpoint(dentry)) | 495 | if (d_mountpoint(dentry)) |
@@ -563,7 +542,7 @@ static struct dentry *ll_lookup_it(struct inode *parent, struct dentry *dentry, | |||
563 | if ((it->it_op & IT_OPEN) && dentry->d_inode && | 542 | if ((it->it_op & IT_OPEN) && dentry->d_inode && |
564 | !S_ISREG(dentry->d_inode->i_mode) && | 543 | !S_ISREG(dentry->d_inode->i_mode) && |
565 | !S_ISDIR(dentry->d_inode->i_mode)) { | 544 | !S_ISDIR(dentry->d_inode->i_mode)) { |
566 | ll_release_openhandle(dentry, it); | 545 | ll_release_openhandle(dentry->d_inode, it); |
567 | } | 546 | } |
568 | ll_lookup_finish_locks(it, dentry); | 547 | ll_lookup_finish_locks(it, dentry); |
569 | 548 | ||
@@ -586,8 +565,8 @@ static struct dentry *ll_lookup_nd(struct inode *parent, struct dentry *dentry, | |||
586 | struct lookup_intent *itp, it = { .it_op = IT_GETATTR }; | 565 | struct lookup_intent *itp, it = { .it_op = IT_GETATTR }; |
587 | struct dentry *de; | 566 | struct dentry *de; |
588 | 567 | ||
589 | CDEBUG(D_VFSTRACE, "VFS Op:name=%.*s,dir=%lu/%u(%p),flags=%u\n", | 568 | CDEBUG(D_VFSTRACE, "VFS Op:name=%pd,dir=%lu/%u(%p),flags=%u\n", |
590 | dentry->d_name.len, dentry->d_name.name, parent->i_ino, | 569 | dentry, parent->i_ino, |
591 | parent->i_generation, parent, flags); | 570 | parent->i_generation, parent, flags); |
592 | 571 | ||
593 | /* Optimize away (CREATE && !OPEN). Let .create handle the race. */ | 572 | /* Optimize away (CREATE && !OPEN). Let .create handle the race. */ |
@@ -619,9 +598,9 @@ static int ll_atomic_open(struct inode *dir, struct dentry *dentry, | |||
619 | long long lookup_flags = LOOKUP_OPEN; | 598 | long long lookup_flags = LOOKUP_OPEN; |
620 | int rc = 0; | 599 | int rc = 0; |
621 | 600 | ||
622 | CDEBUG(D_VFSTRACE, "VFS Op:name=%.*s,dir=%lu/%u(%p),file %p," | 601 | CDEBUG(D_VFSTRACE, "VFS Op:name=%pd,dir=%lu/%u(%p),file %p," |
623 | "open_flags %x,mode %x opened %d\n", | 602 | "open_flags %x,mode %x opened %d\n", |
624 | dentry->d_name.len, dentry->d_name.name, dir->i_ino, | 603 | dentry, dir->i_ino, |
625 | dir->i_generation, dir, file, open_flags, mode, *opened); | 604 | dir->i_generation, dir, file, open_flags, mode, *opened); |
626 | 605 | ||
627 | it = kzalloc(sizeof(*it), GFP_NOFS); | 606 | it = kzalloc(sizeof(*it), GFP_NOFS); |
@@ -741,8 +720,8 @@ static int ll_create_it(struct inode *dir, struct dentry *dentry, int mode, | |||
741 | struct inode *inode; | 720 | struct inode *inode; |
742 | int rc = 0; | 721 | int rc = 0; |
743 | 722 | ||
744 | CDEBUG(D_VFSTRACE, "VFS Op:name=%.*s,dir=%lu/%u(%p),intent=%s\n", | 723 | CDEBUG(D_VFSTRACE, "VFS Op:name=%pd,dir=%lu/%u(%p),intent=%s\n", |
745 | dentry->d_name.len, dentry->d_name.name, dir->i_ino, | 724 | dentry, dir->i_ino, |
746 | dir->i_generation, dir, LL_IT2STR(it)); | 725 | dir->i_generation, dir, LL_IT2STR(it)); |
747 | 726 | ||
748 | rc = it_open_error(DISP_OPEN_CREATE, it); | 727 | rc = it_open_error(DISP_OPEN_CREATE, it); |
@@ -775,9 +754,9 @@ static void ll_update_times(struct ptlrpc_request *request, | |||
775 | LTIME_S(inode->i_ctime) = body->ctime; | 754 | LTIME_S(inode->i_ctime) = body->ctime; |
776 | } | 755 | } |
777 | 756 | ||
778 | static int ll_new_node(struct inode *dir, struct qstr *name, | 757 | static int ll_new_node(struct inode *dir, struct dentry *dentry, |
779 | const char *tgt, int mode, int rdev, | 758 | const char *tgt, int mode, int rdev, |
780 | struct dentry *dchild, __u32 opc) | 759 | __u32 opc) |
781 | { | 760 | { |
782 | struct ptlrpc_request *request = NULL; | 761 | struct ptlrpc_request *request = NULL; |
783 | struct md_op_data *op_data; | 762 | struct md_op_data *op_data; |
@@ -789,8 +768,10 @@ static int ll_new_node(struct inode *dir, struct qstr *name, | |||
789 | if (unlikely(tgt != NULL)) | 768 | if (unlikely(tgt != NULL)) |
790 | tgt_len = strlen(tgt) + 1; | 769 | tgt_len = strlen(tgt) + 1; |
791 | 770 | ||
792 | op_data = ll_prep_md_op_data(NULL, dir, NULL, name->name, | 771 | op_data = ll_prep_md_op_data(NULL, dir, NULL, |
793 | name->len, 0, opc, NULL); | 772 | dentry->d_name.name, |
773 | dentry->d_name.len, | ||
774 | 0, opc, NULL); | ||
794 | if (IS_ERR(op_data)) { | 775 | if (IS_ERR(op_data)) { |
795 | err = PTR_ERR(op_data); | 776 | err = PTR_ERR(op_data); |
796 | goto err_exit; | 777 | goto err_exit; |
@@ -806,27 +787,25 @@ static int ll_new_node(struct inode *dir, struct qstr *name, | |||
806 | 787 | ||
807 | ll_update_times(request, dir); | 788 | ll_update_times(request, dir); |
808 | 789 | ||
809 | if (dchild) { | 790 | err = ll_prep_inode(&inode, request, dir->i_sb, NULL); |
810 | err = ll_prep_inode(&inode, request, dchild->d_sb, NULL); | 791 | if (err) |
811 | if (err) | 792 | goto err_exit; |
812 | goto err_exit; | ||
813 | 793 | ||
814 | d_instantiate(dchild, inode); | 794 | d_instantiate(dentry, inode); |
815 | } | ||
816 | err_exit: | 795 | err_exit: |
817 | ptlrpc_req_finished(request); | 796 | ptlrpc_req_finished(request); |
818 | 797 | ||
819 | return err; | 798 | return err; |
820 | } | 799 | } |
821 | 800 | ||
822 | static int ll_mknod_generic(struct inode *dir, struct qstr *name, int mode, | 801 | static int ll_mknod(struct inode *dir, struct dentry *dchild, |
823 | unsigned rdev, struct dentry *dchild) | 802 | umode_t mode, dev_t rdev) |
824 | { | 803 | { |
825 | int err; | 804 | int err; |
826 | 805 | ||
827 | CDEBUG(D_VFSTRACE, "VFS Op:name=%.*s,dir=%lu/%u(%p) mode %o dev %x\n", | 806 | CDEBUG(D_VFSTRACE, "VFS Op:name=%pd,dir=%lu/%u(%p) mode %o dev %x\n", |
828 | name->len, name->name, dir->i_ino, dir->i_generation, dir, | 807 | dchild, dir->i_ino, dir->i_generation, dir, |
829 | mode, rdev); | 808 | mode, old_encode_dev(rdev)); |
830 | 809 | ||
831 | if (!IS_POSIXACL(dir) || !exp_connect_umask(ll_i2mdexp(dir))) | 810 | if (!IS_POSIXACL(dir) || !exp_connect_umask(ll_i2mdexp(dir))) |
832 | mode &= ~current_umask(); | 811 | mode &= ~current_umask(); |
@@ -839,7 +818,8 @@ static int ll_mknod_generic(struct inode *dir, struct qstr *name, int mode, | |||
839 | case S_IFBLK: | 818 | case S_IFBLK: |
840 | case S_IFIFO: | 819 | case S_IFIFO: |
841 | case S_IFSOCK: | 820 | case S_IFSOCK: |
842 | err = ll_new_node(dir, name, NULL, mode, rdev, dchild, | 821 | err = ll_new_node(dir, dchild, NULL, mode, |
822 | old_encode_dev(rdev), | ||
843 | LUSTRE_OPC_MKNOD); | 823 | LUSTRE_OPC_MKNOD); |
844 | break; | 824 | break; |
845 | case S_IFDIR: | 825 | case S_IFDIR: |
@@ -863,134 +843,25 @@ static int ll_create_nd(struct inode *dir, struct dentry *dentry, | |||
863 | { | 843 | { |
864 | int rc; | 844 | int rc; |
865 | 845 | ||
866 | CDEBUG(D_VFSTRACE, "VFS Op:name=%.*s,dir=%lu/%u(%p)," | 846 | CDEBUG(D_VFSTRACE, "VFS Op:name=%pd,dir=%lu/%u(%p)," |
867 | "flags=%u, excl=%d\n", | 847 | "flags=%u, excl=%d\n", |
868 | dentry->d_name.len, dentry->d_name.name, dir->i_ino, | 848 | dentry, dir->i_ino, |
869 | dir->i_generation, dir, mode, want_excl); | 849 | dir->i_generation, dir, mode, want_excl); |
870 | 850 | ||
871 | rc = ll_mknod_generic(dir, &dentry->d_name, mode, 0, dentry); | 851 | rc = ll_mknod(dir, dentry, mode, 0); |
872 | 852 | ||
873 | ll_stats_ops_tally(ll_i2sbi(dir), LPROC_LL_CREATE, 1); | 853 | ll_stats_ops_tally(ll_i2sbi(dir), LPROC_LL_CREATE, 1); |
874 | 854 | ||
875 | CDEBUG(D_VFSTRACE, "VFS Op:name=%.*s, unhashed %d\n", | 855 | CDEBUG(D_VFSTRACE, "VFS Op:name=%pd, unhashed %d\n", |
876 | dentry->d_name.len, dentry->d_name.name, d_unhashed(dentry)); | 856 | dentry, d_unhashed(dentry)); |
877 | 857 | ||
878 | return rc; | 858 | return rc; |
879 | } | 859 | } |
880 | 860 | ||
881 | static int ll_symlink_generic(struct inode *dir, struct qstr *name, | 861 | static inline void ll_get_child_fid(struct dentry *child, struct lu_fid *fid) |
882 | const char *tgt, struct dentry *dchild) | ||
883 | { | 862 | { |
884 | int err; | 863 | if (child->d_inode) |
885 | 864 | *fid = *ll_inode2fid(child->d_inode); | |
886 | CDEBUG(D_VFSTRACE, "VFS Op:name=%.*s,dir=%lu/%u(%p),target=%.*s\n", | ||
887 | name->len, name->name, dir->i_ino, dir->i_generation, | ||
888 | dir, 3000, tgt); | ||
889 | |||
890 | err = ll_new_node(dir, name, (char *)tgt, S_IFLNK | S_IRWXUGO, | ||
891 | 0, dchild, LUSTRE_OPC_SYMLINK); | ||
892 | |||
893 | if (!err) | ||
894 | ll_stats_ops_tally(ll_i2sbi(dir), LPROC_LL_SYMLINK, 1); | ||
895 | |||
896 | return err; | ||
897 | } | ||
898 | |||
899 | static int ll_link_generic(struct inode *src, struct inode *dir, | ||
900 | struct qstr *name, struct dentry *dchild) | ||
901 | { | ||
902 | struct ll_sb_info *sbi = ll_i2sbi(dir); | ||
903 | struct ptlrpc_request *request = NULL; | ||
904 | struct md_op_data *op_data; | ||
905 | int err; | ||
906 | |||
907 | CDEBUG(D_VFSTRACE, | ||
908 | "VFS Op: inode=%lu/%u(%p), dir=%lu/%u(%p), target=%.*s\n", | ||
909 | src->i_ino, src->i_generation, src, dir->i_ino, | ||
910 | dir->i_generation, dir, name->len, name->name); | ||
911 | |||
912 | op_data = ll_prep_md_op_data(NULL, src, dir, name->name, name->len, | ||
913 | 0, LUSTRE_OPC_ANY, NULL); | ||
914 | if (IS_ERR(op_data)) | ||
915 | return PTR_ERR(op_data); | ||
916 | |||
917 | err = md_link(sbi->ll_md_exp, op_data, &request); | ||
918 | ll_finish_md_op_data(op_data); | ||
919 | if (err) | ||
920 | goto out; | ||
921 | |||
922 | ll_update_times(request, dir); | ||
923 | ll_stats_ops_tally(sbi, LPROC_LL_LINK, 1); | ||
924 | out: | ||
925 | ptlrpc_req_finished(request); | ||
926 | return err; | ||
927 | } | ||
928 | |||
929 | static int ll_mkdir_generic(struct inode *dir, struct qstr *name, | ||
930 | int mode, struct dentry *dchild) | ||
931 | |||
932 | { | ||
933 | int err; | ||
934 | |||
935 | CDEBUG(D_VFSTRACE, "VFS Op:name=%.*s,dir=%lu/%u(%p)\n", | ||
936 | name->len, name->name, dir->i_ino, dir->i_generation, dir); | ||
937 | |||
938 | if (!IS_POSIXACL(dir) || !exp_connect_umask(ll_i2mdexp(dir))) | ||
939 | mode &= ~current_umask(); | ||
940 | mode = (mode & (S_IRWXUGO|S_ISVTX)) | S_IFDIR; | ||
941 | err = ll_new_node(dir, name, NULL, mode, 0, dchild, LUSTRE_OPC_MKDIR); | ||
942 | |||
943 | if (!err) | ||
944 | ll_stats_ops_tally(ll_i2sbi(dir), LPROC_LL_MKDIR, 1); | ||
945 | |||
946 | return err; | ||
947 | } | ||
948 | |||
949 | /* Try to find the child dentry by its name. | ||
950 | If found, put the result fid into @fid. */ | ||
951 | static void ll_get_child_fid(struct inode * dir, struct qstr *name, | ||
952 | struct lu_fid *fid) | ||
953 | { | ||
954 | struct dentry *parent, *child; | ||
955 | |||
956 | parent = ll_d_hlist_entry(dir->i_dentry, struct dentry, d_alias); | ||
957 | child = d_lookup(parent, name); | ||
958 | if (child) { | ||
959 | if (child->d_inode) | ||
960 | *fid = *ll_inode2fid(child->d_inode); | ||
961 | dput(child); | ||
962 | } | ||
963 | } | ||
964 | |||
965 | static int ll_rmdir_generic(struct inode *dir, struct dentry *dparent, | ||
966 | struct dentry *dchild, struct qstr *name) | ||
967 | { | ||
968 | struct ptlrpc_request *request = NULL; | ||
969 | struct md_op_data *op_data; | ||
970 | int rc; | ||
971 | |||
972 | CDEBUG(D_VFSTRACE, "VFS Op:name=%.*s,dir=%lu/%u(%p)\n", | ||
973 | name->len, name->name, dir->i_ino, dir->i_generation, dir); | ||
974 | |||
975 | if (unlikely(ll_d_mountpoint(dparent, dchild, name))) | ||
976 | return -EBUSY; | ||
977 | |||
978 | op_data = ll_prep_md_op_data(NULL, dir, NULL, name->name, name->len, | ||
979 | S_IFDIR, LUSTRE_OPC_ANY, NULL); | ||
980 | if (IS_ERR(op_data)) | ||
981 | return PTR_ERR(op_data); | ||
982 | |||
983 | ll_get_child_fid(dir, name, &op_data->op_fid3); | ||
984 | op_data->op_fid2 = op_data->op_fid3; | ||
985 | rc = md_unlink(ll_i2sbi(dir)->ll_md_exp, op_data, &request); | ||
986 | ll_finish_md_op_data(op_data); | ||
987 | if (rc == 0) { | ||
988 | ll_update_times(request, dir); | ||
989 | ll_stats_ops_tally(ll_i2sbi(dir), LPROC_LL_RMDIR, 1); | ||
990 | } | ||
991 | |||
992 | ptlrpc_req_finished(request); | ||
993 | return rc; | ||
994 | } | 865 | } |
995 | 866 | ||
996 | /** | 867 | /** |
@@ -1099,32 +970,26 @@ out: | |||
1099 | return rc; | 970 | return rc; |
1100 | } | 971 | } |
1101 | 972 | ||
1102 | /* ll_unlink_generic() doesn't update the inode with the new link count. | 973 | /* ll_unlink() doesn't update the inode with the new link count. |
1103 | * Instead, ll_ddelete() and ll_d_iput() will update it based upon if there | 974 | * Instead, ll_ddelete() and ll_d_iput() will update it based upon if there |
1104 | * is any lock existing. They will recycle dentries and inodes based upon locks | 975 | * is any lock existing. They will recycle dentries and inodes based upon locks |
1105 | * too. b=20433 */ | 976 | * too. b=20433 */ |
1106 | static int ll_unlink_generic(struct inode *dir, struct dentry *dparent, | 977 | static int ll_unlink(struct inode * dir, struct dentry *dentry) |
1107 | struct dentry *dchild, struct qstr *name) | ||
1108 | { | 978 | { |
1109 | struct ptlrpc_request *request = NULL; | 979 | struct ptlrpc_request *request = NULL; |
1110 | struct md_op_data *op_data; | 980 | struct md_op_data *op_data; |
1111 | int rc; | 981 | int rc; |
1112 | CDEBUG(D_VFSTRACE, "VFS Op:name=%.*s,dir=%lu/%u(%p)\n", | 982 | CDEBUG(D_VFSTRACE, "VFS Op:name=%pd,dir=%lu/%u(%p)\n", |
1113 | name->len, name->name, dir->i_ino, dir->i_generation, dir); | 983 | dentry, dir->i_ino, dir->i_generation, dir); |
1114 | |||
1115 | /* | ||
1116 | * XXX: unlink bind mountpoint maybe call to here, | ||
1117 | * just check it as vfs_unlink does. | ||
1118 | */ | ||
1119 | if (unlikely(ll_d_mountpoint(dparent, dchild, name))) | ||
1120 | return -EBUSY; | ||
1121 | 984 | ||
1122 | op_data = ll_prep_md_op_data(NULL, dir, NULL, name->name, | 985 | op_data = ll_prep_md_op_data(NULL, dir, NULL, |
1123 | name->len, 0, LUSTRE_OPC_ANY, NULL); | 986 | dentry->d_name.name, |
987 | dentry->d_name.len, | ||
988 | 0, LUSTRE_OPC_ANY, NULL); | ||
1124 | if (IS_ERR(op_data)) | 989 | if (IS_ERR(op_data)) |
1125 | return PTR_ERR(op_data); | 990 | return PTR_ERR(op_data); |
1126 | 991 | ||
1127 | ll_get_child_fid(dir, name, &op_data->op_fid3); | 992 | ll_get_child_fid(dentry, &op_data->op_fid3); |
1128 | op_data->op_fid2 = op_data->op_fid3; | 993 | op_data->op_fid2 = op_data->op_fid3; |
1129 | rc = md_unlink(ll_i2sbi(dir)->ll_md_exp, op_data, &request); | 994 | rc = md_unlink(ll_i2sbi(dir)->ll_md_exp, op_data, &request); |
1130 | ll_finish_md_op_data(op_data); | 995 | ll_finish_md_op_data(op_data); |
@@ -1140,95 +1005,140 @@ static int ll_unlink_generic(struct inode *dir, struct dentry *dparent, | |||
1140 | return rc; | 1005 | return rc; |
1141 | } | 1006 | } |
1142 | 1007 | ||
1143 | static int ll_rename_generic(struct inode *src, struct dentry *src_dparent, | 1008 | static int ll_mkdir(struct inode *dir, struct dentry *dentry, ll_umode_t mode) |
1144 | struct dentry *src_dchild, struct qstr *src_name, | ||
1145 | struct inode *tgt, struct dentry *tgt_dparent, | ||
1146 | struct dentry *tgt_dchild, struct qstr *tgt_name) | ||
1147 | { | 1009 | { |
1148 | struct ptlrpc_request *request = NULL; | ||
1149 | struct ll_sb_info *sbi = ll_i2sbi(src); | ||
1150 | struct md_op_data *op_data; | ||
1151 | int err; | 1010 | int err; |
1152 | 1011 | ||
1153 | CDEBUG(D_VFSTRACE, | 1012 | CDEBUG(D_VFSTRACE, "VFS Op:name=%pd,dir=%lu/%u(%p)\n", |
1154 | "VFS Op:oldname=%.*s,src_dir=%lu/%u(%p),newname=%.*s," | 1013 | dentry, dir->i_ino, dir->i_generation, dir); |
1155 | "tgt_dir=%lu/%u(%p)\n", src_name->len, src_name->name, | ||
1156 | src->i_ino, src->i_generation, src, tgt_name->len, | ||
1157 | tgt_name->name, tgt->i_ino, tgt->i_generation, tgt); | ||
1158 | 1014 | ||
1159 | if (unlikely(ll_d_mountpoint(src_dparent, src_dchild, src_name) || | 1015 | if (!IS_POSIXACL(dir) || !exp_connect_umask(ll_i2mdexp(dir))) |
1160 | ll_d_mountpoint(tgt_dparent, tgt_dchild, tgt_name))) | 1016 | mode &= ~current_umask(); |
1161 | return -EBUSY; | 1017 | mode = (mode & (S_IRWXUGO|S_ISVTX)) | S_IFDIR; |
1018 | err = ll_new_node(dir, dentry, NULL, mode, 0, LUSTRE_OPC_MKDIR); | ||
1162 | 1019 | ||
1163 | op_data = ll_prep_md_op_data(NULL, src, tgt, NULL, 0, 0, | 1020 | if (!err) |
1164 | LUSTRE_OPC_ANY, NULL); | 1021 | ll_stats_ops_tally(ll_i2sbi(dir), LPROC_LL_MKDIR, 1); |
1022 | |||
1023 | return err; | ||
1024 | } | ||
1025 | |||
1026 | static int ll_rmdir(struct inode *dir, struct dentry *dentry) | ||
1027 | { | ||
1028 | struct ptlrpc_request *request = NULL; | ||
1029 | struct md_op_data *op_data; | ||
1030 | int rc; | ||
1031 | |||
1032 | CDEBUG(D_VFSTRACE, "VFS Op:name=%pd,dir=%lu/%u(%p)\n", | ||
1033 | dentry, dir->i_ino, dir->i_generation, dir); | ||
1034 | |||
1035 | op_data = ll_prep_md_op_data(NULL, dir, NULL, | ||
1036 | dentry->d_name.name, | ||
1037 | dentry->d_name.len, | ||
1038 | S_IFDIR, LUSTRE_OPC_ANY, NULL); | ||
1165 | if (IS_ERR(op_data)) | 1039 | if (IS_ERR(op_data)) |
1166 | return PTR_ERR(op_data); | 1040 | return PTR_ERR(op_data); |
1167 | 1041 | ||
1168 | ll_get_child_fid(src, src_name, &op_data->op_fid3); | 1042 | ll_get_child_fid(dentry, &op_data->op_fid3); |
1169 | ll_get_child_fid(tgt, tgt_name, &op_data->op_fid4); | 1043 | op_data->op_fid2 = op_data->op_fid3; |
1170 | err = md_rename(sbi->ll_md_exp, op_data, | 1044 | rc = md_unlink(ll_i2sbi(dir)->ll_md_exp, op_data, &request); |
1171 | src_name->name, src_name->len, | ||
1172 | tgt_name->name, tgt_name->len, &request); | ||
1173 | ll_finish_md_op_data(op_data); | 1045 | ll_finish_md_op_data(op_data); |
1174 | if (!err) { | 1046 | if (rc == 0) { |
1175 | ll_update_times(request, src); | 1047 | ll_update_times(request, dir); |
1176 | ll_update_times(request, tgt); | 1048 | ll_stats_ops_tally(ll_i2sbi(dir), LPROC_LL_RMDIR, 1); |
1177 | ll_stats_ops_tally(sbi, LPROC_LL_RENAME, 1); | ||
1178 | err = ll_objects_destroy(request, src); | ||
1179 | } | 1049 | } |
1180 | 1050 | ||
1181 | ptlrpc_req_finished(request); | 1051 | ptlrpc_req_finished(request); |
1182 | 1052 | return rc; | |
1183 | return err; | ||
1184 | } | 1053 | } |
1185 | 1054 | ||
1186 | static int ll_mknod(struct inode *dir, struct dentry *dchild, ll_umode_t mode, | 1055 | static int ll_symlink(struct inode *dir, struct dentry *dentry, |
1187 | dev_t rdev) | 1056 | const char *oldname) |
1188 | { | 1057 | { |
1189 | return ll_mknod_generic(dir, &dchild->d_name, mode, | 1058 | int err; |
1190 | old_encode_dev(rdev), dchild); | ||
1191 | } | ||
1192 | 1059 | ||
1193 | static int ll_unlink(struct inode * dir, struct dentry *dentry) | 1060 | CDEBUG(D_VFSTRACE, "VFS Op:name=%pd,dir=%lu/%u(%p),target=%.*s\n", |
1194 | { | 1061 | dentry, dir->i_ino, dir->i_generation, |
1195 | return ll_unlink_generic(dir, NULL, dentry, &dentry->d_name); | 1062 | dir, 3000, oldname); |
1196 | } | ||
1197 | 1063 | ||
1198 | static int ll_mkdir(struct inode *dir, struct dentry *dentry, ll_umode_t mode) | 1064 | err = ll_new_node(dir, dentry, oldname, S_IFLNK | S_IRWXUGO, |
1199 | { | 1065 | 0, LUSTRE_OPC_SYMLINK); |
1200 | return ll_mkdir_generic(dir, &dentry->d_name, mode, dentry); | ||
1201 | } | ||
1202 | 1066 | ||
1203 | static int ll_rmdir(struct inode *dir, struct dentry *dentry) | 1067 | if (!err) |
1204 | { | 1068 | ll_stats_ops_tally(ll_i2sbi(dir), LPROC_LL_SYMLINK, 1); |
1205 | return ll_rmdir_generic(dir, NULL, dentry, &dentry->d_name); | ||
1206 | } | ||
1207 | 1069 | ||
1208 | static int ll_symlink(struct inode *dir, struct dentry *dentry, | 1070 | return err; |
1209 | const char *oldname) | ||
1210 | { | ||
1211 | return ll_symlink_generic(dir, &dentry->d_name, oldname, dentry); | ||
1212 | } | 1071 | } |
1213 | 1072 | ||
1214 | static int ll_link(struct dentry *old_dentry, struct inode *dir, | 1073 | static int ll_link(struct dentry *old_dentry, struct inode *dir, |
1215 | struct dentry *new_dentry) | 1074 | struct dentry *new_dentry) |
1216 | { | 1075 | { |
1217 | return ll_link_generic(old_dentry->d_inode, dir, &new_dentry->d_name, | 1076 | struct inode *src = old_dentry->d_inode; |
1218 | new_dentry); | 1077 | struct ll_sb_info *sbi = ll_i2sbi(dir); |
1078 | struct ptlrpc_request *request = NULL; | ||
1079 | struct md_op_data *op_data; | ||
1080 | int err; | ||
1081 | |||
1082 | CDEBUG(D_VFSTRACE, | ||
1083 | "VFS Op: inode=%lu/%u(%p), dir=%lu/%u(%p), target=%pd\n", | ||
1084 | src->i_ino, src->i_generation, src, dir->i_ino, | ||
1085 | dir->i_generation, dir, new_dentry); | ||
1086 | |||
1087 | op_data = ll_prep_md_op_data(NULL, src, dir, new_dentry->d_name.name, | ||
1088 | new_dentry->d_name.len, | ||
1089 | 0, LUSTRE_OPC_ANY, NULL); | ||
1090 | if (IS_ERR(op_data)) | ||
1091 | return PTR_ERR(op_data); | ||
1092 | |||
1093 | err = md_link(sbi->ll_md_exp, op_data, &request); | ||
1094 | ll_finish_md_op_data(op_data); | ||
1095 | if (err) | ||
1096 | goto out; | ||
1097 | |||
1098 | ll_update_times(request, dir); | ||
1099 | ll_stats_ops_tally(sbi, LPROC_LL_LINK, 1); | ||
1100 | out: | ||
1101 | ptlrpc_req_finished(request); | ||
1102 | return err; | ||
1219 | } | 1103 | } |
1220 | 1104 | ||
1221 | static int ll_rename(struct inode *old_dir, struct dentry *old_dentry, | 1105 | static int ll_rename(struct inode *old_dir, struct dentry *old_dentry, |
1222 | struct inode *new_dir, struct dentry *new_dentry) | 1106 | struct inode *new_dir, struct dentry *new_dentry) |
1223 | { | 1107 | { |
1108 | struct ptlrpc_request *request = NULL; | ||
1109 | struct ll_sb_info *sbi = ll_i2sbi(old_dir); | ||
1110 | struct md_op_data *op_data; | ||
1224 | int err; | 1111 | int err; |
1225 | err = ll_rename_generic(old_dir, NULL, | 1112 | |
1226 | old_dentry, &old_dentry->d_name, | 1113 | CDEBUG(D_VFSTRACE, |
1227 | new_dir, NULL, new_dentry, | 1114 | "VFS Op:oldname=%pd,src_dir=%lu/%u(%p),newname=%pd," |
1228 | &new_dentry->d_name); | 1115 | "tgt_dir=%lu/%u(%p)\n", old_dentry, |
1116 | old_dir->i_ino, old_dir->i_generation, old_dir, new_dentry, | ||
1117 | new_dir->i_ino, new_dir->i_generation, new_dir); | ||
1118 | |||
1119 | op_data = ll_prep_md_op_data(NULL, old_dir, new_dir, NULL, 0, 0, | ||
1120 | LUSTRE_OPC_ANY, NULL); | ||
1121 | if (IS_ERR(op_data)) | ||
1122 | return PTR_ERR(op_data); | ||
1123 | |||
1124 | ll_get_child_fid(old_dentry, &op_data->op_fid3); | ||
1125 | ll_get_child_fid(new_dentry, &op_data->op_fid4); | ||
1126 | err = md_rename(sbi->ll_md_exp, op_data, | ||
1127 | old_dentry->d_name.name, | ||
1128 | old_dentry->d_name.len, | ||
1129 | new_dentry->d_name.name, | ||
1130 | new_dentry->d_name.len, &request); | ||
1131 | ll_finish_md_op_data(op_data); | ||
1229 | if (!err) { | 1132 | if (!err) { |
1230 | d_move(old_dentry, new_dentry); | 1133 | ll_update_times(request, old_dir); |
1134 | ll_update_times(request, new_dir); | ||
1135 | ll_stats_ops_tally(sbi, LPROC_LL_RENAME, 1); | ||
1136 | err = ll_objects_destroy(request, old_dir); | ||
1231 | } | 1137 | } |
1138 | |||
1139 | ptlrpc_req_finished(request); | ||
1140 | if (!err) | ||
1141 | d_move(old_dentry, new_dentry); | ||
1232 | return err; | 1142 | return err; |
1233 | } | 1143 | } |
1234 | 1144 | ||
diff --git a/drivers/staging/lustre/lustre/llite/statahead.c b/drivers/staging/lustre/lustre/llite/statahead.c index 06b71bcf97a7..09d965e76842 100644 --- a/drivers/staging/lustre/lustre/llite/statahead.c +++ b/drivers/staging/lustre/lustre/llite/statahead.c | |||
@@ -969,8 +969,8 @@ static int ll_agl_thread(void *arg) | |||
969 | struct l_wait_info lwi = { 0 }; | 969 | struct l_wait_info lwi = { 0 }; |
970 | 970 | ||
971 | thread->t_pid = current_pid(); | 971 | thread->t_pid = current_pid(); |
972 | CDEBUG(D_READA, "agl thread started: sai %p, parent %.*s\n", | 972 | CDEBUG(D_READA, "agl thread started: sai %p, parent %pd\n", |
973 | sai, parent->d_name.len, parent->d_name.name); | 973 | sai, parent); |
974 | 974 | ||
975 | atomic_inc(&sbi->ll_agl_total); | 975 | atomic_inc(&sbi->ll_agl_total); |
976 | spin_lock(&plli->lli_agl_lock); | 976 | spin_lock(&plli->lli_agl_lock); |
@@ -1019,8 +1019,8 @@ static int ll_agl_thread(void *arg) | |||
1019 | spin_unlock(&plli->lli_agl_lock); | 1019 | spin_unlock(&plli->lli_agl_lock); |
1020 | wake_up(&thread->t_ctl_waitq); | 1020 | wake_up(&thread->t_ctl_waitq); |
1021 | ll_sai_put(sai); | 1021 | ll_sai_put(sai); |
1022 | CDEBUG(D_READA, "agl thread stopped: sai %p, parent %.*s\n", | 1022 | CDEBUG(D_READA, "agl thread stopped: sai %p, parent %pd\n", |
1023 | sai, parent->d_name.len, parent->d_name.name); | 1023 | sai, parent); |
1024 | return 0; | 1024 | return 0; |
1025 | } | 1025 | } |
1026 | 1026 | ||
@@ -1031,8 +1031,8 @@ static void ll_start_agl(struct dentry *parent, struct ll_statahead_info *sai) | |||
1031 | struct ll_inode_info *plli; | 1031 | struct ll_inode_info *plli; |
1032 | struct task_struct *task; | 1032 | struct task_struct *task; |
1033 | 1033 | ||
1034 | CDEBUG(D_READA, "start agl thread: sai %p, parent %.*s\n", | 1034 | CDEBUG(D_READA, "start agl thread: sai %p, parent %pd\n", |
1035 | sai, parent->d_name.len, parent->d_name.name); | 1035 | sai, parent); |
1036 | 1036 | ||
1037 | plli = ll_i2info(parent->d_inode); | 1037 | plli = ll_i2info(parent->d_inode); |
1038 | task = kthread_run(ll_agl_thread, parent, | 1038 | task = kthread_run(ll_agl_thread, parent, |
@@ -1066,8 +1066,8 @@ static int ll_statahead_thread(void *arg) | |||
1066 | struct l_wait_info lwi = { 0 }; | 1066 | struct l_wait_info lwi = { 0 }; |
1067 | 1067 | ||
1068 | thread->t_pid = current_pid(); | 1068 | thread->t_pid = current_pid(); |
1069 | CDEBUG(D_READA, "statahead thread starting: sai %p, parent %.*s\n", | 1069 | CDEBUG(D_READA, "statahead thread starting: sai %p, parent %pd\n", |
1070 | sai, parent->d_name.len, parent->d_name.name); | 1070 | sai, parent); |
1071 | 1071 | ||
1072 | if (sbi->ll_flags & LL_SBI_AGL_ENABLED) | 1072 | if (sbi->ll_flags & LL_SBI_AGL_ENABLED) |
1073 | ll_start_agl(parent, sai); | 1073 | ll_start_agl(parent, sai); |
@@ -1288,8 +1288,8 @@ out: | |||
1288 | wake_up(&thread->t_ctl_waitq); | 1288 | wake_up(&thread->t_ctl_waitq); |
1289 | ll_sai_put(sai); | 1289 | ll_sai_put(sai); |
1290 | dput(parent); | 1290 | dput(parent); |
1291 | CDEBUG(D_READA, "statahead thread stopped: sai %p, parent %.*s\n", | 1291 | CDEBUG(D_READA, "statahead thread stopped: sai %p, parent %pd\n", |
1292 | sai, parent->d_name.len, parent->d_name.name); | 1292 | sai, parent); |
1293 | return rc; | 1293 | return rc; |
1294 | } | 1294 | } |
1295 | 1295 | ||
@@ -1612,10 +1612,9 @@ int do_statahead_enter(struct inode *dir, struct dentry **dentryp, | |||
1612 | } else if ((*dentryp)->d_inode != inode) { | 1612 | } else if ((*dentryp)->d_inode != inode) { |
1613 | /* revalidate, but inode is recreated */ | 1613 | /* revalidate, but inode is recreated */ |
1614 | CDEBUG(D_READA, | 1614 | CDEBUG(D_READA, |
1615 | "stale dentry %.*s inode %lu/%u, " | 1615 | "stale dentry %pd inode %lu/%u, " |
1616 | "statahead inode %lu/%u\n", | 1616 | "statahead inode %lu/%u\n", |
1617 | (*dentryp)->d_name.len, | 1617 | *dentryp, |
1618 | (*dentryp)->d_name.name, | ||
1619 | (*dentryp)->d_inode->i_ino, | 1618 | (*dentryp)->d_inode->i_ino, |
1620 | (*dentryp)->d_inode->i_generation, | 1619 | (*dentryp)->d_inode->i_generation, |
1621 | inode->i_ino, | 1620 | inode->i_ino, |
@@ -1666,9 +1665,9 @@ int do_statahead_enter(struct inode *dir, struct dentry **dentryp, | |||
1666 | if (unlikely(sai->sai_inode != parent->d_inode)) { | 1665 | if (unlikely(sai->sai_inode != parent->d_inode)) { |
1667 | struct ll_inode_info *nlli = ll_i2info(parent->d_inode); | 1666 | struct ll_inode_info *nlli = ll_i2info(parent->d_inode); |
1668 | 1667 | ||
1669 | CWARN("Race condition, someone changed %.*s just now: " | 1668 | CWARN("Race condition, someone changed %pd just now: " |
1670 | "old parent "DFID", new parent "DFID"\n", | 1669 | "old parent "DFID", new parent "DFID"\n", |
1671 | (*dentryp)->d_name.len, (*dentryp)->d_name.name, | 1670 | *dentryp, |
1672 | PFID(&lli->lli_fid), PFID(&nlli->lli_fid)); | 1671 | PFID(&lli->lli_fid), PFID(&nlli->lli_fid)); |
1673 | dput(parent); | 1672 | dput(parent); |
1674 | iput(sai->sai_inode); | 1673 | iput(sai->sai_inode); |
@@ -1676,8 +1675,8 @@ int do_statahead_enter(struct inode *dir, struct dentry **dentryp, | |||
1676 | goto out; | 1675 | goto out; |
1677 | } | 1676 | } |
1678 | 1677 | ||
1679 | CDEBUG(D_READA, "start statahead thread: sai %p, parent %.*s\n", | 1678 | CDEBUG(D_READA, "start statahead thread: sai %p, parent %pd\n", |
1680 | sai, parent->d_name.len, parent->d_name.name); | 1679 | sai, parent); |
1681 | 1680 | ||
1682 | /* The sai buffer already has one reference taken at allocation time, | 1681 | /* The sai buffer already has one reference taken at allocation time, |
1683 | * but as soon as we expose the sai by attaching it to the lli that | 1682 | * but as soon as we expose the sai by attaching it to the lli that |
diff --git a/drivers/staging/lustre/lustre/llite/vvp_io.c b/drivers/staging/lustre/lustre/llite/vvp_io.c index d3f967a78138..e540a6d286f8 100644 --- a/drivers/staging/lustre/lustre/llite/vvp_io.c +++ b/drivers/staging/lustre/lustre/llite/vvp_io.c | |||
@@ -108,7 +108,7 @@ static int vvp_io_fault_iter_init(const struct lu_env *env, | |||
108 | struct inode *inode = ccc_object_inode(ios->cis_obj); | 108 | struct inode *inode = ccc_object_inode(ios->cis_obj); |
109 | 109 | ||
110 | LASSERT(inode == | 110 | LASSERT(inode == |
111 | cl2ccc_io(env, ios)->cui_fd->fd_file->f_dentry->d_inode); | 111 | file_inode(cl2ccc_io(env, ios)->cui_fd->fd_file)); |
112 | vio->u.fault.ft_mtime = LTIME_S(inode->i_mtime); | 112 | vio->u.fault.ft_mtime = LTIME_S(inode->i_mtime); |
113 | return 0; | 113 | return 0; |
114 | } | 114 | } |
@@ -239,7 +239,7 @@ static int vvp_mmap_locks(const struct lu_env *env, | |||
239 | 239 | ||
240 | down_read(&mm->mmap_sem); | 240 | down_read(&mm->mmap_sem); |
241 | while ((vma = our_vma(mm, addr, count)) != NULL) { | 241 | while ((vma = our_vma(mm, addr, count)) != NULL) { |
242 | struct inode *inode = vma->vm_file->f_dentry->d_inode; | 242 | struct inode *inode = file_inode(vma->vm_file); |
243 | int flags = CEF_MUST; | 243 | int flags = CEF_MUST; |
244 | 244 | ||
245 | if (ll_file_nolock(vma->vm_file)) { | 245 | if (ll_file_nolock(vma->vm_file)) { |
diff --git a/drivers/staging/lustre/lustre/llite/xattr.c b/drivers/staging/lustre/lustre/llite/xattr.c index 252a6194ed9b..3151baf5585c 100644 --- a/drivers/staging/lustre/lustre/llite/xattr.c +++ b/drivers/staging/lustre/lustre/llite/xattr.c | |||
@@ -241,14 +241,11 @@ int ll_setxattr(struct dentry *dentry, const char *name, | |||
241 | lump->lmm_stripe_offset = -1; | 241 | lump->lmm_stripe_offset = -1; |
242 | 242 | ||
243 | if (lump != NULL && S_ISREG(inode->i_mode)) { | 243 | if (lump != NULL && S_ISREG(inode->i_mode)) { |
244 | struct file f; | ||
245 | int flags = FMODE_WRITE; | 244 | int flags = FMODE_WRITE; |
246 | int lum_size = (lump->lmm_magic == LOV_USER_MAGIC_V1) ? | 245 | int lum_size = (lump->lmm_magic == LOV_USER_MAGIC_V1) ? |
247 | sizeof(*lump) : sizeof(struct lov_user_md_v3); | 246 | sizeof(*lump) : sizeof(struct lov_user_md_v3); |
248 | 247 | ||
249 | memset(&f, 0, sizeof(f)); /* f.f_flags is used below */ | 248 | rc = ll_lov_setstripe_ea_info(inode, dentry, flags, lump, |
250 | f.f_dentry = dentry; | ||
251 | rc = ll_lov_setstripe_ea_info(inode, &f, flags, lump, | ||
252 | lum_size); | 249 | lum_size); |
253 | /* b10667: rc always be 0 here for now */ | 250 | /* b10667: rc always be 0 here for now */ |
254 | rc = 0; | 251 | rc = 0; |
@@ -519,8 +516,8 @@ ssize_t ll_getxattr(struct dentry *dentry, const char *name, | |||
519 | } | 516 | } |
520 | 517 | ||
521 | if (size < lmmsize) { | 518 | if (size < lmmsize) { |
522 | CERROR("server bug: replied size %d > %d for %s (%s)\n", | 519 | CERROR("server bug: replied size %d > %d for %pd (%s)\n", |
523 | lmmsize, (int)size, dentry->d_name.name, name); | 520 | lmmsize, (int)size, dentry, name); |
524 | rc = -ERANGE; | 521 | rc = -ERANGE; |
525 | goto out; | 522 | goto out; |
526 | } | 523 | } |
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) | |||
250 | int | 248 | int |
251 | affs_unlink(struct inode *dir, struct dentry *dentry) | 249 | affs_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) | |||
321 | int | 317 | int |
322 | affs_rmdir(struct inode *dir, struct dentry *dentry) | 318 | affs_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); | |||
26 | static int afs_d_revalidate(struct dentry *dentry, unsigned int flags); | 26 | static int afs_d_revalidate(struct dentry *dentry, unsigned int flags); |
27 | static int afs_d_delete(const struct dentry *dentry); | 27 | static int afs_d_delete(const struct dentry *dentry); |
28 | static void afs_d_release(struct dentry *dentry); | 28 | static void afs_d_release(struct dentry *dentry); |
29 | static int afs_lookup_filldir(void *_cookie, const char *name, int nlen, | 29 | static 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); |
31 | static int afs_create(struct inode *dir, struct dentry *dentry, umode_t mode, | 31 | static 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 | */ |
394 | static int afs_lookup_filldir(void *_cookie, const char *name, int nlen, | 394 | static 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 | ||
683 | out_bad: | 684 | out_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 | */ |
699 | static int afs_d_delete(const struct dentry *dentry) | 699 | static 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 | */ |
722 | static void afs_d_release(struct dentry *dentry) | 722 | static 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 | */ |
123 | static int afs_mntpt_open(struct inode *inode, struct file *file) | 116 | static 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 | */ |
683 | int afs_fsync(struct file *file, loff_t start, loff_t end, int datasync) | 683 | int 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 | ||
481 | found: | 473 | found: |
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 | ||
230 | more: | 228 | more: |
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 | ||
5309 | unsigned char btrfs_filetype_table[] = { | 5309 | unsigned 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 | ||
93 | bad_type: | 91 | bad_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 | ||
153 | more: | 153 | more: |
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 | ||
210 | static long cifs_fallocate(struct file *file, int mode, loff_t off, loff_t len) | 210 | static 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 | ||
1171 | static inline struct cifs_sb_info * | ||
1172 | CIFS_FILE_SB(struct file *file) | ||
1173 | { | ||
1174 | return CIFS_SB(file_inode(file)->i_sb); | ||
1175 | } | ||
1176 | |||
1171 | static inline char CIFS_DIR_SEP(const struct cifs_sb_info *cifs_sb) | 1177 | static 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); |
129 | out: | 129 | out: |
@@ -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 */ | ||
44 | int coda_isroot(struct inode *i) | ||
45 | { | ||
46 | return ( i->i_sb->s_root->d_inode == i ); | ||
47 | } | ||
48 | |||
49 | unsigned short coda_flags_to_cflags(unsigned short flags) | 43 | unsigned 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 */ |
54 | char *coda_f2s(struct CodaFid *f); | 54 | char *coda_f2s(struct CodaFid *f); |
55 | int coda_isroot(struct inode *i); | ||
56 | int coda_iscontrol(const char *name, size_t length); | 55 | int coda_iscontrol(const char *name, size_t length); |
57 | 56 | ||
58 | void coda_vattr_to_iattr(struct inode *, struct coda_vattr *); | 57 | void 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 | ||
850 | static int compat_fillonedir(void *__buf, const char *name, int namlen, | 850 | static 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 | ||
918 | static int compat_filldir(void *__buf, const char *name, int namlen, | 920 | static 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 | ||
1004 | static int compat_filldir64(void * __buf, const char * name, int namlen, loff_t offset, | 1007 | static 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 | ||
259 | static void __d_free_external(struct rcu_head *head) | 258 | static 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 | ||
272 | static void dentry_free(struct dentry *dentry) | 270 | static 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 | ||
723 | again: | 722 | again: |
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; |
773 | restart: | 772 | restart: |
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: | |||
1051 | resume: | 1050 | resume: |
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(); | ||
1086 | ascend: | ||
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 | ||
1121 | rename_retry: | 1118 | rename_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 | ||
1604 | void d_instantiate(struct dentry *entry, struct inode * inode) | 1604 | void 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 | */ |
1700 | int d_instantiate_no_diralias(struct dentry *entry, struct inode *inode) | 1700 | int 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 | |||
1936 | err_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 | */ |
2611 | static struct dentry *__d_unalias(struct inode *inode, | 2581 | static 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; |
2628 | out_unalias: | 2598 | out_unalias: |
2629 | __d_move(alias, dentry, false); | 2599 | __d_move(alias, dentry, false); |
2630 | ret = alias; | 2600 | ret = 0; |
2631 | out_err: | 2601 | out_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 | */ |
2663 | struct dentry *d_splice_alias(struct inode *inode, struct dentry *dentry) | 2633 | struct 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 | } | ||
2706 | EXPORT_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 | */ | ||
2717 | struct 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); | ||
2777 | found: | ||
2778 | spin_unlock(&inode->i_lock); | 2679 | spin_unlock(&inode->i_lock); |
2779 | out_nolock: | 2680 | out: |
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 | } |
2788 | EXPORT_SYMBOL_GPL(d_materialise_unique); | 2685 | EXPORT_SYMBOL(d_splice_alias); |
2789 | 2686 | ||
2790 | static int prepend(char **buffer, int *buflen, const char *str, int namelen) | 2687 | static 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 | */ |
695 | int debugfs_print_regs32(struct seq_file *s, const struct debugfs_reg32 *regs, | 695 | void 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 | } |
708 | EXPORT_SYMBOL_GPL(debugfs_print_regs32); | 709 | EXPORT_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 | ||
51 | static int print_format1_lock(struct seq_file *s, struct dlm_lkb *lkb, | 51 | static 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 | ||
74 | static int print_format1(struct dlm_rsb *res, struct seq_file *s) | 74 | static 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 | ||
173 | static int print_format2_lock(struct seq_file *s, struct dlm_lkb *lkb, | 167 | static 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 | ||
209 | static int print_format2(struct dlm_rsb *r, struct seq_file *s) | 201 | static 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 | ||
238 | static int print_format3_lock(struct seq_file *s, struct dlm_lkb *lkb, | 228 | static 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 | ||
269 | static int print_format3(struct dlm_rsb *r, struct seq_file *s) | 257 | static 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 | ||
347 | static int print_format4(struct dlm_rsb *r, struct seq_file *s) | 333 | static 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 | ||
386 | struct rsbtbl_iter { | 369 | struct 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 | ||
399 | static int table_seq_show(struct seq_file *seq, void *iter_ptr) | 383 | static 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 | ||
436 | static const struct seq_operations format1_seq_ops; | 417 | static 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: | |||
1373 | int ecryptfs_read_xattr_region(char *page_virt, struct inode *ecryptfs_inode) | 1373 | int 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 */ |
77 | static int | 77 | static int |
78 | ecryptfs_filldir(void *dirent, const char *lower_name, int lower_namelen, | 78 | ecryptfs_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 |
290 | static int eventfd_show_fdinfo(struct seq_file *m, struct file *f) | 290 | static 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 |
873 | static int ep_show_fdinfo(struct seq_file *m, struct file *f) | 873 | static 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 | */ |
244 | static int filldir_one(void * __buf, const char * name, int len, | 244 | static 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) \ |
705 | static int func(void *__buf, const char *name, int name_len, \ | 705 | static 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 | ||
72 | static int get_name_filldir(void *opaque, const char *name, int length, | 72 | static 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 | ||
551 | static int hppfs_filldir(void *d, const char *name, int size, | 551 | static 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 | ||
199 | static inline int ncp_is_server_root(struct inode *inode) | 199 | static 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 | |||
685 | ncp_read_volume_list(struct file *file, struct dir_context *ctx, | 685 | ncp_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 | |||
721 | ncp_do_readdir(struct file *file, struct dir_context *ctx, | 720 | ncp_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: | |||
100 | static ssize_t | 100 | static ssize_t |
101 | ncp_file_read(struct file *file, char __user *buf, size_t count, loff_t *ppos) | 101 | ncp_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); |
171 | outrel: | 170 | outrel: |
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: | |||
176 | static ssize_t | 175 | static ssize_t |
177 | ncp_file_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos) | 176 | ncp_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); |
267 | outrel: | 265 | outrel: |
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 @@ | |||
30 | static int ncp_file_mmap_fault(struct vm_area_struct *area, | 30 | static 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: | |||
112 | static ssize_t bl_pipe_downcall(struct file *filp, const char __user *src, | 112 | static 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: | |||
133 | static int | 133 | static int |
134 | nfs_closedir(struct inode *inode, struct file *filp) | 134 | nfs_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 | ||
1395 | no_entry: | 1395 | no_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 | ||
247 | static int | 247 | static int |
248 | nfsd4_build_namelist(void *arg, const char *name, int namlen, | 248 | nfsd4_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 | ||
234 | static 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, | |||
830 | static ssize_t write_ports(struct file *file, char *buf, size_t size) | 832 | static 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; | |||
865 | static ssize_t write_maxblksize(struct file *file, char *buf, size_t size) | 866 | static 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) | |||
915 | static ssize_t write_maxconn(struct file *file, char *buf, size_t size) | 915 | static 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 | */ |
998 | static ssize_t write_leasetime(struct file *file, char *buf, size_t size) | 997 | static 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 | */ |
1015 | static ssize_t write_gracetime(struct file *file, char *buf, size_t size) | 1013 | static 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, | |||
1071 | static ssize_t write_recoverydir(struct file *file, char *buf, size_t size) | 1068 | static 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 | */ |
1103 | static ssize_t write_v4_end_grace(struct file *file, char *buf, size_t size) | 1099 | static 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 | ||
1822 | static int nfsd_buffered_filldir(void *__buf, const char *name, int namlen, | 1820 | static 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 | ||
1845 | static __be32 nfsd_buffered_readdir(struct file *file, filldir_t func, | 1845 | static __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 |
1928 | nfsd_readdir(struct svc_rqst *rqstp, struct svc_fh *fhp, loff_t *offsetp, | 1928 | nfsd_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 | */ |
39 | typedef int (*nfsd_dirop_t)(struct inode *, struct dentry *, int, int); | 39 | typedef int (*nfsd_filldir_t)(void *, const char *, int, loff_t, u64, unsigned); |
40 | 40 | ||
41 | /* nfsd/vfs.c */ | 41 | /* nfsd/vfs.c */ |
42 | int nfsd_racache_init(int); | 42 | int 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 | ||
23 | static int show_fdinfo(struct seq_file *m, struct file *f, | 23 | static 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) |
41 | static int show_mark_fhandle(struct seq_file *m, struct inode *inode) | 40 | static 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 |
70 | static int show_mark_fhandle(struct seq_file *m, struct inode *inode) | 67 | static 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 | ||
78 | static int inotify_fdinfo(struct seq_file *m, struct fsnotify_mark *mark) | 74 | static 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 | ||
103 | int inotify_show_fdinfo(struct seq_file *m, struct file *f) | 94 | void 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 | ||
112 | static int fanotify_fdinfo(struct seq_file *m, struct fsnotify_mark *mark) | 103 | static 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 | } |
142 | out: | ||
143 | return ret; | ||
144 | } | 130 | } |
145 | 131 | ||
146 | int fanotify_show_fdinfo(struct seq_file *m, struct file *f) | 132 | void 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 |
13 | extern int inotify_show_fdinfo(struct seq_file *m, struct file *f); | 13 | void inotify_show_fdinfo(struct seq_file *m, struct file *f); |
14 | #endif | 14 | #endif |
15 | 15 | ||
16 | #ifdef CONFIG_FANOTIFY | 16 | #ifdef CONFIG_FANOTIFY |
17 | extern int fanotify_show_fdinfo(struct seq_file *m, struct file *f); | 17 | void 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 | }; |
2076 | static int ocfs2_empty_dir_filldir(void *priv, const char *name, int name_len, | 2076 | static 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 | ||
1985 | static int ocfs2_orphan_filldir(void *priv, const char *name, int name_len, | 1985 | static 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)) |
@@ -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); |
648 | out_fput: | 648 | out_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 | ||
183 | static int ovl_fill_merge(void *buf, const char *name, int namelen, | 183 | static 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: | |||
2789 | int proc_pid_readdir(struct file *file, struct dir_context *ctx) | 2789 | int 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 | ||
77 | static int fillonedir(void * __buf, const char * name, int namlen, loff_t offset, | 77 | static 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 | ||
151 | static int filldir(void * __buf, const char * name, int namlen, loff_t offset, | 152 | static 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 | ||
235 | static int filldir64(void * __buf, const char * name, int namlen, loff_t offset, | 237 | static 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 | ||
190 | static int | 190 | static int |
191 | fill_with_dentries(void *buf, const char *name, int namelen, loff_t offset, | 191 | fill_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 | ||
827 | static int listxattr_filler(void *buf, const char *name, int namelen, | 828 | static 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 | */ | ||
25 | static bool seq_overflow(struct seq_file *m) | ||
26 | { | ||
27 | return m->count == m->size; | ||
28 | } | ||
29 | |||
30 | static void seq_set_overflow(struct seq_file *m) | 19 | static 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 |
233 | static int signalfd_show_fdinfo(struct seq_file *m, struct file *f) | 233 | static 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 | ||
@@ -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 |
291 | static int timerfd_show(struct seq_file *m, struct file *file) | 291 | static 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, | |||
651 | SYSCALL_DEFINE2(fremovexattr, int, fd, const char __user *, name) | 649 | SYSCALL_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); |
diff --git a/include/linux/audit.h b/include/linux/audit.h index e58fe7df8b9c..0c04917c2f12 100644 --- a/include/linux/audit.h +++ b/include/linux/audit.h | |||
@@ -130,6 +130,7 @@ extern void audit_putname(struct filename *name); | |||
130 | #define AUDIT_INODE_HIDDEN 2 /* audit record should be hidden */ | 130 | #define AUDIT_INODE_HIDDEN 2 /* audit record should be hidden */ |
131 | extern void __audit_inode(struct filename *name, const struct dentry *dentry, | 131 | extern void __audit_inode(struct filename *name, const struct dentry *dentry, |
132 | unsigned int flags); | 132 | unsigned int flags); |
133 | extern void __audit_file(const struct file *); | ||
133 | extern void __audit_inode_child(const struct inode *parent, | 134 | extern void __audit_inode_child(const struct inode *parent, |
134 | const struct dentry *dentry, | 135 | const struct dentry *dentry, |
135 | const unsigned char type); | 136 | const unsigned char type); |
@@ -183,6 +184,11 @@ static inline void audit_inode(struct filename *name, | |||
183 | __audit_inode(name, dentry, flags); | 184 | __audit_inode(name, dentry, flags); |
184 | } | 185 | } |
185 | } | 186 | } |
187 | static inline void audit_file(struct file *file) | ||
188 | { | ||
189 | if (unlikely(!audit_dummy_context())) | ||
190 | __audit_file(file); | ||
191 | } | ||
186 | static inline void audit_inode_parent_hidden(struct filename *name, | 192 | static inline void audit_inode_parent_hidden(struct filename *name, |
187 | const struct dentry *dentry) | 193 | const struct dentry *dentry) |
188 | { | 194 | { |
@@ -357,6 +363,9 @@ static inline void audit_inode(struct filename *name, | |||
357 | const struct dentry *dentry, | 363 | const struct dentry *dentry, |
358 | unsigned int parent) | 364 | unsigned int parent) |
359 | { } | 365 | { } |
366 | static inline void audit_file(struct file *file) | ||
367 | { | ||
368 | } | ||
360 | static inline void audit_inode_parent_hidden(struct filename *name, | 369 | static inline void audit_inode_parent_hidden(struct filename *name, |
361 | const struct dentry *dentry) | 370 | const struct dentry *dentry) |
362 | { } | 371 | { } |
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h index 1d5196889048..27b0c9105da5 100644 --- a/include/linux/cgroup.h +++ b/include/linux/cgroup.h | |||
@@ -367,8 +367,8 @@ struct css_set { | |||
367 | * struct cftype: handler definitions for cgroup control files | 367 | * struct cftype: handler definitions for cgroup control files |
368 | * | 368 | * |
369 | * When reading/writing to a file: | 369 | * When reading/writing to a file: |
370 | * - the cgroup to use is file->f_dentry->d_parent->d_fsdata | 370 | * - the cgroup to use is file->f_path.dentry->d_parent->d_fsdata |
371 | * - the 'cftype' of the file is file->f_dentry->d_fsdata | 371 | * - the 'cftype' of the file is file->f_path.dentry->d_fsdata |
372 | */ | 372 | */ |
373 | 373 | ||
374 | /* cftype->flags */ | 374 | /* cftype->flags */ |
diff --git a/include/linux/dcache.h b/include/linux/dcache.h index b2a2a08523bf..5a813988e6d4 100644 --- a/include/linux/dcache.h +++ b/include/linux/dcache.h | |||
@@ -124,15 +124,15 @@ struct dentry { | |||
124 | void *d_fsdata; /* fs-specific data */ | 124 | void *d_fsdata; /* fs-specific data */ |
125 | 125 | ||
126 | struct list_head d_lru; /* LRU list */ | 126 | struct list_head d_lru; /* LRU list */ |
127 | struct list_head d_child; /* child of parent list */ | ||
128 | struct list_head d_subdirs; /* our children */ | ||
127 | /* | 129 | /* |
128 | * d_child and d_rcu can share memory | 130 | * d_alias and d_rcu can share memory |
129 | */ | 131 | */ |
130 | union { | 132 | union { |
131 | struct list_head d_child; /* child of parent list */ | 133 | struct hlist_node d_alias; /* inode alias list */ |
132 | struct rcu_head d_rcu; | 134 | struct rcu_head d_rcu; |
133 | } d_u; | 135 | } d_u; |
134 | struct list_head d_subdirs; /* our children */ | ||
135 | struct hlist_node d_alias; /* inode alias list */ | ||
136 | }; | 136 | }; |
137 | 137 | ||
138 | /* | 138 | /* |
@@ -230,7 +230,6 @@ extern seqlock_t rename_lock; | |||
230 | */ | 230 | */ |
231 | extern void d_instantiate(struct dentry *, struct inode *); | 231 | extern void d_instantiate(struct dentry *, struct inode *); |
232 | extern struct dentry * d_instantiate_unique(struct dentry *, struct inode *); | 232 | extern struct dentry * d_instantiate_unique(struct dentry *, struct inode *); |
233 | extern struct dentry * d_materialise_unique(struct dentry *, struct inode *); | ||
234 | extern int d_instantiate_no_diralias(struct dentry *, struct inode *); | 233 | extern int d_instantiate_no_diralias(struct dentry *, struct inode *); |
235 | extern void __d_drop(struct dentry *dentry); | 234 | extern void __d_drop(struct dentry *dentry); |
236 | extern void d_drop(struct dentry *dentry); | 235 | extern void d_drop(struct dentry *dentry); |
diff --git a/include/linux/debugfs.h b/include/linux/debugfs.h index 4d0b4d1aa132..d84f8c254a87 100644 --- a/include/linux/debugfs.h +++ b/include/linux/debugfs.h | |||
@@ -92,8 +92,8 @@ struct dentry *debugfs_create_regset32(const char *name, umode_t mode, | |||
92 | struct dentry *parent, | 92 | struct dentry *parent, |
93 | struct debugfs_regset32 *regset); | 93 | struct debugfs_regset32 *regset); |
94 | 94 | ||
95 | int debugfs_print_regs32(struct seq_file *s, const struct debugfs_reg32 *regs, | 95 | void debugfs_print_regs32(struct seq_file *s, const struct debugfs_reg32 *regs, |
96 | int nregs, void __iomem *base, char *prefix); | 96 | int nregs, void __iomem *base, char *prefix); |
97 | 97 | ||
98 | struct dentry *debugfs_create_u32_array(const char *name, umode_t mode, | 98 | struct dentry *debugfs_create_u32_array(const char *name, umode_t mode, |
99 | struct dentry *parent, | 99 | struct dentry *parent, |
@@ -233,10 +233,9 @@ static inline struct dentry *debugfs_create_regset32(const char *name, | |||
233 | return ERR_PTR(-ENODEV); | 233 | return ERR_PTR(-ENODEV); |
234 | } | 234 | } |
235 | 235 | ||
236 | static inline int debugfs_print_regs32(struct seq_file *s, const struct debugfs_reg32 *regs, | 236 | static inline void debugfs_print_regs32(struct seq_file *s, const struct debugfs_reg32 *regs, |
237 | int nregs, void __iomem *base, char *prefix) | 237 | int nregs, void __iomem *base, char *prefix) |
238 | { | 238 | { |
239 | return 0; | ||
240 | } | 239 | } |
241 | 240 | ||
242 | static inline bool debugfs_initialized(void) | 241 | static inline bool debugfs_initialized(void) |
diff --git a/include/linux/fs.h b/include/linux/fs.h index f21b15804917..bb29b02d9bb6 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
@@ -786,7 +786,6 @@ struct file { | |||
786 | struct rcu_head fu_rcuhead; | 786 | struct rcu_head fu_rcuhead; |
787 | } f_u; | 787 | } f_u; |
788 | struct path f_path; | 788 | struct path f_path; |
789 | #define f_dentry f_path.dentry | ||
790 | struct inode *f_inode; /* cached value */ | 789 | struct inode *f_inode; /* cached value */ |
791 | const struct file_operations *f_op; | 790 | const struct file_operations *f_op; |
792 | 791 | ||
@@ -1465,7 +1464,10 @@ int fiemap_check_flags(struct fiemap_extent_info *fieinfo, u32 fs_flags); | |||
1465 | * This allows the kernel to read directories into kernel space or | 1464 | * This allows the kernel to read directories into kernel space or |
1466 | * to have different dirent layouts depending on the binary type. | 1465 | * to have different dirent layouts depending on the binary type. |
1467 | */ | 1466 | */ |
1468 | typedef int (*filldir_t)(void *, const char *, int, loff_t, u64, unsigned); | 1467 | struct dir_context; |
1468 | typedef int (*filldir_t)(struct dir_context *, const char *, int, loff_t, u64, | ||
1469 | unsigned); | ||
1470 | |||
1469 | struct dir_context { | 1471 | struct dir_context { |
1470 | const filldir_t actor; | 1472 | const filldir_t actor; |
1471 | loff_t pos; | 1473 | loff_t pos; |
@@ -1511,7 +1513,7 @@ struct file_operations { | |||
1511 | int (*setlease)(struct file *, long, struct file_lock **, void **); | 1513 | int (*setlease)(struct file *, long, struct file_lock **, void **); |
1512 | long (*fallocate)(struct file *file, int mode, loff_t offset, | 1514 | long (*fallocate)(struct file *file, int mode, loff_t offset, |
1513 | loff_t len); | 1515 | loff_t len); |
1514 | int (*show_fdinfo)(struct seq_file *m, struct file *f); | 1516 | void (*show_fdinfo)(struct seq_file *m, struct file *f); |
1515 | }; | 1517 | }; |
1516 | 1518 | ||
1517 | struct inode_operations { | 1519 | struct inode_operations { |
@@ -2787,6 +2789,11 @@ static inline void inode_has_no_xattr(struct inode *inode) | |||
2787 | inode->i_flags |= S_NOSEC; | 2789 | inode->i_flags |= S_NOSEC; |
2788 | } | 2790 | } |
2789 | 2791 | ||
2792 | static inline bool is_root_inode(struct inode *inode) | ||
2793 | { | ||
2794 | return inode == inode->i_sb->s_root->d_inode; | ||
2795 | } | ||
2796 | |||
2790 | static inline bool dir_emit(struct dir_context *ctx, | 2797 | static inline bool dir_emit(struct dir_context *ctx, |
2791 | const char *name, int namelen, | 2798 | const char *name, int namelen, |
2792 | u64 ino, unsigned type) | 2799 | u64 ino, unsigned type) |
diff --git a/include/linux/seq_file.h b/include/linux/seq_file.h index 52e0097f61f0..cf6a9daaaf6d 100644 --- a/include/linux/seq_file.h +++ b/include/linux/seq_file.h | |||
@@ -43,6 +43,21 @@ struct seq_operations { | |||
43 | #define SEQ_SKIP 1 | 43 | #define SEQ_SKIP 1 |
44 | 44 | ||
45 | /** | 45 | /** |
46 | * seq_has_overflowed - check if the buffer has overflowed | ||
47 | * @m: the seq_file handle | ||
48 | * | ||
49 | * seq_files have a buffer which may overflow. When this happens a larger | ||
50 | * buffer is reallocated and all the data will be printed again. | ||
51 | * The overflow state is true when m->count == m->size. | ||
52 | * | ||
53 | * Returns true if the buffer received more than it can hold. | ||
54 | */ | ||
55 | static inline bool seq_has_overflowed(struct seq_file *m) | ||
56 | { | ||
57 | return m->count == m->size; | ||
58 | } | ||
59 | |||
60 | /** | ||
46 | * seq_get_buf - get buffer to write arbitrary data to | 61 | * seq_get_buf - get buffer to write arbitrary data to |
47 | * @m: the seq_file handle | 62 | * @m: the seq_file handle |
48 | * @bufp: the beginning of the buffer is stored here | 63 | * @bufp: the beginning of the buffer is stored here |
diff --git a/include/linux/uio.h b/include/linux/uio.h index 9b1581414cd4..bd8569a14c4a 100644 --- a/include/linux/uio.h +++ b/include/linux/uio.h | |||
@@ -31,6 +31,7 @@ struct iov_iter { | |||
31 | size_t count; | 31 | size_t count; |
32 | union { | 32 | union { |
33 | const struct iovec *iov; | 33 | const struct iovec *iov; |
34 | const struct kvec *kvec; | ||
34 | const struct bio_vec *bvec; | 35 | const struct bio_vec *bvec; |
35 | }; | 36 | }; |
36 | unsigned long nr_segs; | 37 | unsigned long nr_segs; |
@@ -82,10 +83,13 @@ size_t copy_page_from_iter(struct page *page, size_t offset, size_t bytes, | |||
82 | struct iov_iter *i); | 83 | struct iov_iter *i); |
83 | size_t copy_to_iter(void *addr, size_t bytes, struct iov_iter *i); | 84 | size_t copy_to_iter(void *addr, size_t bytes, struct iov_iter *i); |
84 | size_t copy_from_iter(void *addr, size_t bytes, struct iov_iter *i); | 85 | size_t copy_from_iter(void *addr, size_t bytes, struct iov_iter *i); |
86 | size_t copy_from_iter_nocache(void *addr, size_t bytes, struct iov_iter *i); | ||
85 | size_t iov_iter_zero(size_t bytes, struct iov_iter *); | 87 | size_t iov_iter_zero(size_t bytes, struct iov_iter *); |
86 | unsigned long iov_iter_alignment(const struct iov_iter *i); | 88 | unsigned long iov_iter_alignment(const struct iov_iter *i); |
87 | void iov_iter_init(struct iov_iter *i, int direction, const struct iovec *iov, | 89 | void iov_iter_init(struct iov_iter *i, int direction, const struct iovec *iov, |
88 | unsigned long nr_segs, size_t count); | 90 | unsigned long nr_segs, size_t count); |
91 | void iov_iter_kvec(struct iov_iter *i, int direction, const struct kvec *iov, | ||
92 | unsigned long nr_segs, size_t count); | ||
89 | ssize_t iov_iter_get_pages(struct iov_iter *i, struct page **pages, | 93 | ssize_t iov_iter_get_pages(struct iov_iter *i, struct page **pages, |
90 | size_t maxsize, unsigned maxpages, size_t *start); | 94 | size_t maxsize, unsigned maxpages, size_t *start); |
91 | ssize_t iov_iter_get_pages_alloc(struct iov_iter *i, struct page ***pages, | 95 | ssize_t iov_iter_get_pages_alloc(struct iov_iter *i, struct page ***pages, |
@@ -123,6 +127,8 @@ static inline void iov_iter_reexpand(struct iov_iter *i, size_t count) | |||
123 | { | 127 | { |
124 | i->count = count; | 128 | i->count = count; |
125 | } | 129 | } |
130 | size_t csum_and_copy_to_iter(void *addr, size_t bytes, __wsum *csum, struct iov_iter *i); | ||
131 | size_t csum_and_copy_from_iter(void *addr, size_t bytes, __wsum *csum, struct iov_iter *i); | ||
126 | 132 | ||
127 | int memcpy_fromiovec(unsigned char *kdata, struct iovec *iov, int len); | 133 | int memcpy_fromiovec(unsigned char *kdata, struct iovec *iov, int len); |
128 | int memcpy_toiovec(struct iovec *iov, unsigned char *kdata, int len); | 134 | int memcpy_toiovec(struct iovec *iov, unsigned char *kdata, int len); |
diff --git a/include/net/netfilter/nf_conntrack_core.h b/include/net/netfilter/nf_conntrack_core.h index cc0c18827602..f2f0fa3bb150 100644 --- a/include/net/netfilter/nf_conntrack_core.h +++ b/include/net/netfilter/nf_conntrack_core.h | |||
@@ -72,7 +72,7 @@ static inline int nf_conntrack_confirm(struct sk_buff *skb) | |||
72 | return ret; | 72 | return ret; |
73 | } | 73 | } |
74 | 74 | ||
75 | int | 75 | void |
76 | print_tuple(struct seq_file *s, const struct nf_conntrack_tuple *tuple, | 76 | print_tuple(struct seq_file *s, const struct nf_conntrack_tuple *tuple, |
77 | const struct nf_conntrack_l3proto *l3proto, | 77 | const struct nf_conntrack_l3proto *l3proto, |
78 | const struct nf_conntrack_l4proto *proto); | 78 | const struct nf_conntrack_l4proto *proto); |
diff --git a/include/net/netfilter/nf_conntrack_l3proto.h b/include/net/netfilter/nf_conntrack_l3proto.h index adc1fa3dd7ab..cdc920b4c4c2 100644 --- a/include/net/netfilter/nf_conntrack_l3proto.h +++ b/include/net/netfilter/nf_conntrack_l3proto.h | |||
@@ -38,8 +38,8 @@ struct nf_conntrack_l3proto { | |||
38 | const struct nf_conntrack_tuple *orig); | 38 | const struct nf_conntrack_tuple *orig); |
39 | 39 | ||
40 | /* Print out the per-protocol part of the tuple. */ | 40 | /* Print out the per-protocol part of the tuple. */ |
41 | int (*print_tuple)(struct seq_file *s, | 41 | void (*print_tuple)(struct seq_file *s, |
42 | const struct nf_conntrack_tuple *); | 42 | const struct nf_conntrack_tuple *); |
43 | 43 | ||
44 | /* | 44 | /* |
45 | * Called before tracking. | 45 | * Called before tracking. |
diff --git a/include/net/netfilter/nf_conntrack_l4proto.h b/include/net/netfilter/nf_conntrack_l4proto.h index 4c8d573830b7..1f7061313d54 100644 --- a/include/net/netfilter/nf_conntrack_l4proto.h +++ b/include/net/netfilter/nf_conntrack_l4proto.h | |||
@@ -56,11 +56,11 @@ struct nf_conntrack_l4proto { | |||
56 | u_int8_t pf, unsigned int hooknum); | 56 | u_int8_t pf, unsigned int hooknum); |
57 | 57 | ||
58 | /* Print out the per-protocol part of the tuple. Return like seq_* */ | 58 | /* Print out the per-protocol part of the tuple. Return like seq_* */ |
59 | int (*print_tuple)(struct seq_file *s, | 59 | void (*print_tuple)(struct seq_file *s, |
60 | const struct nf_conntrack_tuple *); | 60 | const struct nf_conntrack_tuple *); |
61 | 61 | ||
62 | /* Print out the private part of the conntrack. */ | 62 | /* Print out the private part of the conntrack. */ |
63 | int (*print_conntrack)(struct seq_file *s, struct nf_conn *); | 63 | void (*print_conntrack)(struct seq_file *s, struct nf_conn *); |
64 | 64 | ||
65 | /* Return the array of timeouts for this protocol. */ | 65 | /* Return the array of timeouts for this protocol. */ |
66 | unsigned int *(*get_timeouts)(struct net *net); | 66 | unsigned int *(*get_timeouts)(struct net *net); |
diff --git a/ipc/mqueue.c b/ipc/mqueue.c index 4fcf39af1776..7635a1cf99f3 100644 --- a/ipc/mqueue.c +++ b/ipc/mqueue.c | |||
@@ -990,7 +990,7 @@ SYSCALL_DEFINE5(mq_timedsend, mqd_t, mqdes, const char __user *, u_msg_ptr, | |||
990 | goto out_fput; | 990 | goto out_fput; |
991 | } | 991 | } |
992 | info = MQUEUE_I(inode); | 992 | info = MQUEUE_I(inode); |
993 | audit_inode(NULL, f.file->f_path.dentry, 0); | 993 | audit_file(f.file); |
994 | 994 | ||
995 | if (unlikely(!(f.file->f_mode & FMODE_WRITE))) { | 995 | if (unlikely(!(f.file->f_mode & FMODE_WRITE))) { |
996 | ret = -EBADF; | 996 | ret = -EBADF; |
@@ -1106,7 +1106,7 @@ SYSCALL_DEFINE5(mq_timedreceive, mqd_t, mqdes, char __user *, u_msg_ptr, | |||
1106 | goto out_fput; | 1106 | goto out_fput; |
1107 | } | 1107 | } |
1108 | info = MQUEUE_I(inode); | 1108 | info = MQUEUE_I(inode); |
1109 | audit_inode(NULL, f.file->f_path.dentry, 0); | 1109 | audit_file(f.file); |
1110 | 1110 | ||
1111 | if (unlikely(!(f.file->f_mode & FMODE_READ))) { | 1111 | if (unlikely(!(f.file->f_mode & FMODE_READ))) { |
1112 | ret = -EBADF; | 1112 | ret = -EBADF; |
diff --git a/kernel/auditsc.c b/kernel/auditsc.c index e420a0c41b5f..c75522a83678 100644 --- a/kernel/auditsc.c +++ b/kernel/auditsc.c | |||
@@ -1897,6 +1897,11 @@ out: | |||
1897 | audit_copy_inode(n, dentry, inode); | 1897 | audit_copy_inode(n, dentry, inode); |
1898 | } | 1898 | } |
1899 | 1899 | ||
1900 | void __audit_file(const struct file *file) | ||
1901 | { | ||
1902 | __audit_inode(NULL, file->f_path.dentry, 0); | ||
1903 | } | ||
1904 | |||
1900 | /** | 1905 | /** |
1901 | * __audit_inode_child - collect inode info for created/removed objects | 1906 | * __audit_inode_child - collect inode info for created/removed objects |
1902 | * @parent: inode of dentry parent | 1907 | * @parent: inode of dentry parent |
@@ -2373,7 +2378,7 @@ int __audit_log_bprm_fcaps(struct linux_binprm *bprm, | |||
2373 | ax->d.next = context->aux; | 2378 | ax->d.next = context->aux; |
2374 | context->aux = (void *)ax; | 2379 | context->aux = (void *)ax; |
2375 | 2380 | ||
2376 | dentry = dget(bprm->file->f_dentry); | 2381 | dentry = dget(bprm->file->f_path.dentry); |
2377 | get_vfs_caps_from_disk(dentry, &vcaps); | 2382 | get_vfs_caps_from_disk(dentry, &vcaps); |
2378 | dput(dentry); | 2383 | dput(dentry); |
2379 | 2384 | ||
diff --git a/kernel/events/core.c b/kernel/events/core.c index 3e19d3ebc29c..113b837470cd 100644 --- a/kernel/events/core.c +++ b/kernel/events/core.c | |||
@@ -614,7 +614,7 @@ static inline int perf_cgroup_connect(int fd, struct perf_event *event, | |||
614 | if (!f.file) | 614 | if (!f.file) |
615 | return -EBADF; | 615 | return -EBADF; |
616 | 616 | ||
617 | css = css_tryget_online_from_dir(f.file->f_dentry, | 617 | css = css_tryget_online_from_dir(f.file->f_path.dentry, |
618 | &perf_event_cgrp_subsys); | 618 | &perf_event_cgrp_subsys); |
619 | if (IS_ERR(css)) { | 619 | if (IS_ERR(css)) { |
620 | ret = PTR_ERR(css); | 620 | ret = PTR_ERR(css); |
diff --git a/kernel/taskstats.c b/kernel/taskstats.c index b312fcc73024..670fff88a961 100644 --- a/kernel/taskstats.c +++ b/kernel/taskstats.c | |||
@@ -459,7 +459,7 @@ static int cgroupstats_user_cmd(struct sk_buff *skb, struct genl_info *info) | |||
459 | stats = nla_data(na); | 459 | stats = nla_data(na); |
460 | memset(stats, 0, sizeof(*stats)); | 460 | memset(stats, 0, sizeof(*stats)); |
461 | 461 | ||
462 | rc = cgroupstats_build(stats, f.file->f_dentry); | 462 | rc = cgroupstats_build(stats, f.file->f_path.dentry); |
463 | if (rc < 0) { | 463 | if (rc < 0) { |
464 | nlmsg_free(rep_skb); | 464 | nlmsg_free(rep_skb); |
465 | goto err; | 465 | goto err; |
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index 92f4a6cee172..426962b04183 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c | |||
@@ -6417,7 +6417,7 @@ static int instance_mkdir (struct inode *inode, struct dentry *dentry, umode_t m | |||
6417 | int ret; | 6417 | int ret; |
6418 | 6418 | ||
6419 | /* Paranoid: Make sure the parent is the "instances" directory */ | 6419 | /* Paranoid: Make sure the parent is the "instances" directory */ |
6420 | parent = hlist_entry(inode->i_dentry.first, struct dentry, d_alias); | 6420 | parent = hlist_entry(inode->i_dentry.first, struct dentry, d_u.d_alias); |
6421 | if (WARN_ON_ONCE(parent != trace_instance_dir)) | 6421 | if (WARN_ON_ONCE(parent != trace_instance_dir)) |
6422 | return -ENOENT; | 6422 | return -ENOENT; |
6423 | 6423 | ||
@@ -6444,7 +6444,7 @@ static int instance_rmdir(struct inode *inode, struct dentry *dentry) | |||
6444 | int ret; | 6444 | int ret; |
6445 | 6445 | ||
6446 | /* Paranoid: Make sure the parent is the "instances" directory */ | 6446 | /* Paranoid: Make sure the parent is the "instances" directory */ |
6447 | parent = hlist_entry(inode->i_dentry.first, struct dentry, d_alias); | 6447 | parent = hlist_entry(inode->i_dentry.first, struct dentry, d_u.d_alias); |
6448 | if (WARN_ON_ONCE(parent != trace_instance_dir)) | 6448 | if (WARN_ON_ONCE(parent != trace_instance_dir)) |
6449 | return -ENOENT; | 6449 | return -ENOENT; |
6450 | 6450 | ||
diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c index 0cc51edde3a8..1b0df1e504f0 100644 --- a/kernel/trace/trace_events.c +++ b/kernel/trace/trace_events.c | |||
@@ -461,7 +461,7 @@ static void remove_event_file_dir(struct ftrace_event_file *file) | |||
461 | 461 | ||
462 | if (dir) { | 462 | if (dir) { |
463 | spin_lock(&dir->d_lock); /* probably unneeded */ | 463 | spin_lock(&dir->d_lock); /* probably unneeded */ |
464 | list_for_each_entry(child, &dir->d_subdirs, d_u.d_child) { | 464 | list_for_each_entry(child, &dir->d_subdirs, d_child) { |
465 | if (child->d_inode) /* probably unneeded */ | 465 | if (child->d_inode) /* probably unneeded */ |
466 | child->d_inode->i_private = NULL; | 466 | child->d_inode->i_private = NULL; |
467 | } | 467 | } |
diff --git a/mm/iov_iter.c b/mm/iov_iter.c index e34a3cb6aad6..a1599ca4ab0e 100644 --- a/mm/iov_iter.c +++ b/mm/iov_iter.c | |||
@@ -3,95 +3,136 @@ | |||
3 | #include <linux/pagemap.h> | 3 | #include <linux/pagemap.h> |
4 | #include <linux/slab.h> | 4 | #include <linux/slab.h> |
5 | #include <linux/vmalloc.h> | 5 | #include <linux/vmalloc.h> |
6 | 6 | #include <net/checksum.h> | |
7 | static size_t copy_to_iter_iovec(void *from, size_t bytes, struct iov_iter *i) | 7 | |
8 | { | 8 | #define iterate_iovec(i, n, __v, __p, skip, STEP) { \ |
9 | size_t skip, copy, left, wanted; | 9 | size_t left; \ |
10 | const struct iovec *iov; | 10 | size_t wanted = n; \ |
11 | char __user *buf; | 11 | __p = i->iov; \ |
12 | 12 | __v.iov_len = min(n, __p->iov_len - skip); \ | |
13 | if (unlikely(bytes > i->count)) | 13 | if (likely(__v.iov_len)) { \ |
14 | bytes = i->count; | 14 | __v.iov_base = __p->iov_base + skip; \ |
15 | 15 | left = (STEP); \ | |
16 | if (unlikely(!bytes)) | 16 | __v.iov_len -= left; \ |
17 | return 0; | 17 | skip += __v.iov_len; \ |
18 | 18 | n -= __v.iov_len; \ | |
19 | wanted = bytes; | 19 | } else { \ |
20 | iov = i->iov; | 20 | left = 0; \ |
21 | skip = i->iov_offset; | 21 | } \ |
22 | buf = iov->iov_base + skip; | 22 | while (unlikely(!left && n)) { \ |
23 | copy = min(bytes, iov->iov_len - skip); | 23 | __p++; \ |
24 | 24 | __v.iov_len = min(n, __p->iov_len); \ | |
25 | left = __copy_to_user(buf, from, copy); | 25 | if (unlikely(!__v.iov_len)) \ |
26 | copy -= left; | 26 | continue; \ |
27 | skip += copy; | 27 | __v.iov_base = __p->iov_base; \ |
28 | from += copy; | 28 | left = (STEP); \ |
29 | bytes -= copy; | 29 | __v.iov_len -= left; \ |
30 | while (unlikely(!left && bytes)) { | 30 | skip = __v.iov_len; \ |
31 | iov++; | 31 | n -= __v.iov_len; \ |
32 | buf = iov->iov_base; | 32 | } \ |
33 | copy = min(bytes, iov->iov_len); | 33 | n = wanted - n; \ |
34 | left = __copy_to_user(buf, from, copy); | 34 | } |
35 | copy -= left; | 35 | |
36 | skip = copy; | 36 | #define iterate_kvec(i, n, __v, __p, skip, STEP) { \ |
37 | from += copy; | 37 | size_t wanted = n; \ |
38 | bytes -= copy; | 38 | __p = i->kvec; \ |
39 | } | 39 | __v.iov_len = min(n, __p->iov_len - skip); \ |
40 | 40 | if (likely(__v.iov_len)) { \ | |
41 | if (skip == iov->iov_len) { | 41 | __v.iov_base = __p->iov_base + skip; \ |
42 | iov++; | 42 | (void)(STEP); \ |
43 | skip = 0; | 43 | skip += __v.iov_len; \ |
44 | } | 44 | n -= __v.iov_len; \ |
45 | i->count -= wanted - bytes; | 45 | } \ |
46 | i->nr_segs -= iov - i->iov; | 46 | while (unlikely(n)) { \ |
47 | i->iov = iov; | 47 | __p++; \ |
48 | i->iov_offset = skip; | 48 | __v.iov_len = min(n, __p->iov_len); \ |
49 | return wanted - bytes; | 49 | if (unlikely(!__v.iov_len)) \ |
50 | } | 50 | continue; \ |
51 | 51 | __v.iov_base = __p->iov_base; \ | |
52 | static size_t copy_from_iter_iovec(void *to, size_t bytes, struct iov_iter *i) | 52 | (void)(STEP); \ |
53 | { | 53 | skip = __v.iov_len; \ |
54 | size_t skip, copy, left, wanted; | 54 | n -= __v.iov_len; \ |
55 | const struct iovec *iov; | 55 | } \ |
56 | char __user *buf; | 56 | n = wanted; \ |
57 | 57 | } | |
58 | if (unlikely(bytes > i->count)) | 58 | |
59 | bytes = i->count; | 59 | #define iterate_bvec(i, n, __v, __p, skip, STEP) { \ |
60 | 60 | size_t wanted = n; \ | |
61 | if (unlikely(!bytes)) | 61 | __p = i->bvec; \ |
62 | return 0; | 62 | __v.bv_len = min_t(size_t, n, __p->bv_len - skip); \ |
63 | 63 | if (likely(__v.bv_len)) { \ | |
64 | wanted = bytes; | 64 | __v.bv_page = __p->bv_page; \ |
65 | iov = i->iov; | 65 | __v.bv_offset = __p->bv_offset + skip; \ |
66 | skip = i->iov_offset; | 66 | (void)(STEP); \ |
67 | buf = iov->iov_base + skip; | 67 | skip += __v.bv_len; \ |
68 | copy = min(bytes, iov->iov_len - skip); | 68 | n -= __v.bv_len; \ |
69 | 69 | } \ | |
70 | left = __copy_from_user(to, buf, copy); | 70 | while (unlikely(n)) { \ |
71 | copy -= left; | 71 | __p++; \ |
72 | skip += copy; | 72 | __v.bv_len = min_t(size_t, n, __p->bv_len); \ |
73 | to += copy; | 73 | if (unlikely(!__v.bv_len)) \ |
74 | bytes -= copy; | 74 | continue; \ |
75 | while (unlikely(!left && bytes)) { | 75 | __v.bv_page = __p->bv_page; \ |
76 | iov++; | 76 | __v.bv_offset = __p->bv_offset; \ |
77 | buf = iov->iov_base; | 77 | (void)(STEP); \ |
78 | copy = min(bytes, iov->iov_len); | 78 | skip = __v.bv_len; \ |
79 | left = __copy_from_user(to, buf, copy); | 79 | n -= __v.bv_len; \ |
80 | copy -= left; | 80 | } \ |
81 | skip = copy; | 81 | n = wanted; \ |
82 | to += copy; | 82 | } |
83 | bytes -= copy; | 83 | |
84 | } | 84 | #define iterate_all_kinds(i, n, v, I, B, K) { \ |
85 | 85 | size_t skip = i->iov_offset; \ | |
86 | if (skip == iov->iov_len) { | 86 | if (unlikely(i->type & ITER_BVEC)) { \ |
87 | iov++; | 87 | const struct bio_vec *bvec; \ |
88 | skip = 0; | 88 | struct bio_vec v; \ |
89 | } | 89 | iterate_bvec(i, n, v, bvec, skip, (B)) \ |
90 | i->count -= wanted - bytes; | 90 | } else if (unlikely(i->type & ITER_KVEC)) { \ |
91 | i->nr_segs -= iov - i->iov; | 91 | const struct kvec *kvec; \ |
92 | i->iov = iov; | 92 | struct kvec v; \ |
93 | i->iov_offset = skip; | 93 | iterate_kvec(i, n, v, kvec, skip, (K)) \ |
94 | return wanted - bytes; | 94 | } else { \ |
95 | const struct iovec *iov; \ | ||
96 | struct iovec v; \ | ||
97 | iterate_iovec(i, n, v, iov, skip, (I)) \ | ||
98 | } \ | ||
99 | } | ||
100 | |||
101 | #define iterate_and_advance(i, n, v, I, B, K) { \ | ||
102 | size_t skip = i->iov_offset; \ | ||
103 | if (unlikely(i->type & ITER_BVEC)) { \ | ||
104 | const struct bio_vec *bvec; \ | ||
105 | struct bio_vec v; \ | ||
106 | iterate_bvec(i, n, v, bvec, skip, (B)) \ | ||
107 | if (skip == bvec->bv_len) { \ | ||
108 | bvec++; \ | ||
109 | skip = 0; \ | ||
110 | } \ | ||
111 | i->nr_segs -= bvec - i->bvec; \ | ||
112 | i->bvec = bvec; \ | ||
113 | } else if (unlikely(i->type & ITER_KVEC)) { \ | ||
114 | const struct kvec *kvec; \ | ||
115 | struct kvec v; \ | ||
116 | iterate_kvec(i, n, v, kvec, skip, (K)) \ | ||
117 | if (skip == kvec->iov_len) { \ | ||
118 | kvec++; \ | ||
119 | skip = 0; \ | ||
120 | } \ | ||
121 | i->nr_segs -= kvec - i->kvec; \ | ||
122 | i->kvec = kvec; \ | ||
123 | } else { \ | ||
124 | const struct iovec *iov; \ | ||
125 | struct iovec v; \ | ||
126 | iterate_iovec(i, n, v, iov, skip, (I)) \ | ||
127 | if (skip == iov->iov_len) { \ | ||
128 | iov++; \ | ||
129 | skip = 0; \ | ||
130 | } \ | ||
131 | i->nr_segs -= iov - i->iov; \ | ||
132 | i->iov = iov; \ | ||
133 | } \ | ||
134 | i->count -= n; \ | ||
135 | i->iov_offset = skip; \ | ||
95 | } | 136 | } |
96 | 137 | ||
97 | static size_t copy_page_to_iter_iovec(struct page *page, size_t offset, size_t bytes, | 138 | static size_t copy_page_to_iter_iovec(struct page *page, size_t offset, size_t bytes, |
@@ -256,134 +297,6 @@ done: | |||
256 | return wanted - bytes; | 297 | return wanted - bytes; |
257 | } | 298 | } |
258 | 299 | ||
259 | static size_t zero_iovec(size_t bytes, struct iov_iter *i) | ||
260 | { | ||
261 | size_t skip, copy, left, wanted; | ||
262 | const struct iovec *iov; | ||
263 | char __user *buf; | ||
264 | |||
265 | if (unlikely(bytes > i->count)) | ||
266 | bytes = i->count; | ||
267 | |||
268 | if (unlikely(!bytes)) | ||
269 | return 0; | ||
270 | |||
271 | wanted = bytes; | ||
272 | iov = i->iov; | ||
273 | skip = i->iov_offset; | ||
274 | buf = iov->iov_base + skip; | ||
275 | copy = min(bytes, iov->iov_len - skip); | ||
276 | |||
277 | left = __clear_user(buf, copy); | ||
278 | copy -= left; | ||
279 | skip += copy; | ||
280 | bytes -= copy; | ||
281 | |||
282 | while (unlikely(!left && bytes)) { | ||
283 | iov++; | ||
284 | buf = iov->iov_base; | ||
285 | copy = min(bytes, iov->iov_len); | ||
286 | left = __clear_user(buf, copy); | ||
287 | copy -= left; | ||
288 | skip = copy; | ||
289 | bytes -= copy; | ||
290 | } | ||
291 | |||
292 | if (skip == iov->iov_len) { | ||
293 | iov++; | ||
294 | skip = 0; | ||
295 | } | ||
296 | i->count -= wanted - bytes; | ||
297 | i->nr_segs -= iov - i->iov; | ||
298 | i->iov = iov; | ||
299 | i->iov_offset = skip; | ||
300 | return wanted - bytes; | ||
301 | } | ||
302 | |||
303 | static size_t __iovec_copy_from_user_inatomic(char *vaddr, | ||
304 | const struct iovec *iov, size_t base, size_t bytes) | ||
305 | { | ||
306 | size_t copied = 0, left = 0; | ||
307 | |||
308 | while (bytes) { | ||
309 | char __user *buf = iov->iov_base + base; | ||
310 | int copy = min(bytes, iov->iov_len - base); | ||
311 | |||
312 | base = 0; | ||
313 | left = __copy_from_user_inatomic(vaddr, buf, copy); | ||
314 | copied += copy; | ||
315 | bytes -= copy; | ||
316 | vaddr += copy; | ||
317 | iov++; | ||
318 | |||
319 | if (unlikely(left)) | ||
320 | break; | ||
321 | } | ||
322 | return copied - left; | ||
323 | } | ||
324 | |||
325 | /* | ||
326 | * Copy as much as we can into the page and return the number of bytes which | ||
327 | * were successfully copied. If a fault is encountered then return the number of | ||
328 | * bytes which were copied. | ||
329 | */ | ||
330 | static size_t copy_from_user_atomic_iovec(struct page *page, | ||
331 | struct iov_iter *i, unsigned long offset, size_t bytes) | ||
332 | { | ||
333 | char *kaddr; | ||
334 | size_t copied; | ||
335 | |||
336 | kaddr = kmap_atomic(page); | ||
337 | if (likely(i->nr_segs == 1)) { | ||
338 | int left; | ||
339 | char __user *buf = i->iov->iov_base + i->iov_offset; | ||
340 | left = __copy_from_user_inatomic(kaddr + offset, buf, bytes); | ||
341 | copied = bytes - left; | ||
342 | } else { | ||
343 | copied = __iovec_copy_from_user_inatomic(kaddr + offset, | ||
344 | i->iov, i->iov_offset, bytes); | ||
345 | } | ||
346 | kunmap_atomic(kaddr); | ||
347 | |||
348 | return copied; | ||
349 | } | ||
350 | |||
351 | static void advance_iovec(struct iov_iter *i, size_t bytes) | ||
352 | { | ||
353 | BUG_ON(i->count < bytes); | ||
354 | |||
355 | if (likely(i->nr_segs == 1)) { | ||
356 | i->iov_offset += bytes; | ||
357 | i->count -= bytes; | ||
358 | } else { | ||
359 | const struct iovec *iov = i->iov; | ||
360 | size_t base = i->iov_offset; | ||
361 | unsigned long nr_segs = i->nr_segs; | ||
362 | |||
363 | /* | ||
364 | * The !iov->iov_len check ensures we skip over unlikely | ||
365 | * zero-length segments (without overruning the iovec). | ||
366 | */ | ||
367 | while (bytes || unlikely(i->count && !iov->iov_len)) { | ||
368 | int copy; | ||
369 | |||
370 | copy = min(bytes, iov->iov_len - base); | ||
371 | BUG_ON(!i->count || i->count < copy); | ||
372 | i->count -= copy; | ||
373 | bytes -= copy; | ||
374 | base += copy; | ||
375 | if (iov->iov_len == base) { | ||
376 | iov++; | ||
377 | nr_segs--; | ||
378 | base = 0; | ||
379 | } | ||
380 | } | ||
381 | i->iov = iov; | ||
382 | i->iov_offset = base; | ||
383 | i->nr_segs = nr_segs; | ||
384 | } | ||
385 | } | ||
386 | |||
387 | /* | 300 | /* |
388 | * Fault in the first iovec of the given iov_iter, to a maximum length | 301 | * Fault in the first iovec of the given iov_iter, to a maximum length |
389 | * of bytes. Returns 0 on success, or non-zero if the memory could not be | 302 | * of bytes. Returns 0 on success, or non-zero if the memory could not be |
@@ -395,7 +308,7 @@ static void advance_iovec(struct iov_iter *i, size_t bytes) | |||
395 | */ | 308 | */ |
396 | int iov_iter_fault_in_readable(struct iov_iter *i, size_t bytes) | 309 | int iov_iter_fault_in_readable(struct iov_iter *i, size_t bytes) |
397 | { | 310 | { |
398 | if (!(i->type & ITER_BVEC)) { | 311 | if (!(i->type & (ITER_BVEC|ITER_KVEC))) { |
399 | char __user *buf = i->iov->iov_base + i->iov_offset; | 312 | char __user *buf = i->iov->iov_base + i->iov_offset; |
400 | bytes = min(bytes, i->iov->iov_len - i->iov_offset); | 313 | bytes = min(bytes, i->iov->iov_len - i->iov_offset); |
401 | return fault_in_pages_readable(buf, bytes); | 314 | return fault_in_pages_readable(buf, bytes); |
@@ -404,136 +317,25 @@ int iov_iter_fault_in_readable(struct iov_iter *i, size_t bytes) | |||
404 | } | 317 | } |
405 | EXPORT_SYMBOL(iov_iter_fault_in_readable); | 318 | EXPORT_SYMBOL(iov_iter_fault_in_readable); |
406 | 319 | ||
407 | static unsigned long alignment_iovec(const struct iov_iter *i) | ||
408 | { | ||
409 | const struct iovec *iov = i->iov; | ||
410 | unsigned long res; | ||
411 | size_t size = i->count; | ||
412 | size_t n; | ||
413 | |||
414 | if (!size) | ||
415 | return 0; | ||
416 | |||
417 | res = (unsigned long)iov->iov_base + i->iov_offset; | ||
418 | n = iov->iov_len - i->iov_offset; | ||
419 | if (n >= size) | ||
420 | return res | size; | ||
421 | size -= n; | ||
422 | res |= n; | ||
423 | while (size > (++iov)->iov_len) { | ||
424 | res |= (unsigned long)iov->iov_base | iov->iov_len; | ||
425 | size -= iov->iov_len; | ||
426 | } | ||
427 | res |= (unsigned long)iov->iov_base | size; | ||
428 | return res; | ||
429 | } | ||
430 | |||
431 | void iov_iter_init(struct iov_iter *i, int direction, | 320 | void iov_iter_init(struct iov_iter *i, int direction, |
432 | const struct iovec *iov, unsigned long nr_segs, | 321 | const struct iovec *iov, unsigned long nr_segs, |
433 | size_t count) | 322 | size_t count) |
434 | { | 323 | { |
435 | /* It will get better. Eventually... */ | 324 | /* It will get better. Eventually... */ |
436 | if (segment_eq(get_fs(), KERNEL_DS)) | 325 | if (segment_eq(get_fs(), KERNEL_DS)) { |
437 | direction |= ITER_KVEC; | 326 | direction |= ITER_KVEC; |
438 | i->type = direction; | 327 | i->type = direction; |
439 | i->iov = iov; | 328 | i->kvec = (struct kvec *)iov; |
329 | } else { | ||
330 | i->type = direction; | ||
331 | i->iov = iov; | ||
332 | } | ||
440 | i->nr_segs = nr_segs; | 333 | i->nr_segs = nr_segs; |
441 | i->iov_offset = 0; | 334 | i->iov_offset = 0; |
442 | i->count = count; | 335 | i->count = count; |
443 | } | 336 | } |
444 | EXPORT_SYMBOL(iov_iter_init); | 337 | EXPORT_SYMBOL(iov_iter_init); |
445 | 338 | ||
446 | static ssize_t get_pages_iovec(struct iov_iter *i, | ||
447 | struct page **pages, size_t maxsize, unsigned maxpages, | ||
448 | size_t *start) | ||
449 | { | ||
450 | size_t offset = i->iov_offset; | ||
451 | const struct iovec *iov = i->iov; | ||
452 | size_t len; | ||
453 | unsigned long addr; | ||
454 | int n; | ||
455 | int res; | ||
456 | |||
457 | len = iov->iov_len - offset; | ||
458 | if (len > i->count) | ||
459 | len = i->count; | ||
460 | if (len > maxsize) | ||
461 | len = maxsize; | ||
462 | addr = (unsigned long)iov->iov_base + offset; | ||
463 | len += *start = addr & (PAGE_SIZE - 1); | ||
464 | if (len > maxpages * PAGE_SIZE) | ||
465 | len = maxpages * PAGE_SIZE; | ||
466 | addr &= ~(PAGE_SIZE - 1); | ||
467 | n = (len + PAGE_SIZE - 1) / PAGE_SIZE; | ||
468 | res = get_user_pages_fast(addr, n, (i->type & WRITE) != WRITE, pages); | ||
469 | if (unlikely(res < 0)) | ||
470 | return res; | ||
471 | return (res == n ? len : res * PAGE_SIZE) - *start; | ||
472 | } | ||
473 | |||
474 | static ssize_t get_pages_alloc_iovec(struct iov_iter *i, | ||
475 | struct page ***pages, size_t maxsize, | ||
476 | size_t *start) | ||
477 | { | ||
478 | size_t offset = i->iov_offset; | ||
479 | const struct iovec *iov = i->iov; | ||
480 | size_t len; | ||
481 | unsigned long addr; | ||
482 | void *p; | ||
483 | int n; | ||
484 | int res; | ||
485 | |||
486 | len = iov->iov_len - offset; | ||
487 | if (len > i->count) | ||
488 | len = i->count; | ||
489 | if (len > maxsize) | ||
490 | len = maxsize; | ||
491 | addr = (unsigned long)iov->iov_base + offset; | ||
492 | len += *start = addr & (PAGE_SIZE - 1); | ||
493 | addr &= ~(PAGE_SIZE - 1); | ||
494 | n = (len + PAGE_SIZE - 1) / PAGE_SIZE; | ||
495 | |||
496 | p = kmalloc(n * sizeof(struct page *), GFP_KERNEL); | ||
497 | if (!p) | ||
498 | p = vmalloc(n * sizeof(struct page *)); | ||
499 | if (!p) | ||
500 | return -ENOMEM; | ||
501 | |||
502 | res = get_user_pages_fast(addr, n, (i->type & WRITE) != WRITE, p); | ||
503 | if (unlikely(res < 0)) { | ||
504 | kvfree(p); | ||
505 | return res; | ||
506 | } | ||
507 | *pages = p; | ||
508 | return (res == n ? len : res * PAGE_SIZE) - *start; | ||
509 | } | ||
510 | |||
511 | static int iov_iter_npages_iovec(const struct iov_iter *i, int maxpages) | ||
512 | { | ||
513 | size_t offset = i->iov_offset; | ||
514 | size_t size = i->count; | ||
515 | const struct iovec *iov = i->iov; | ||
516 | int npages = 0; | ||
517 | int n; | ||
518 | |||
519 | for (n = 0; size && n < i->nr_segs; n++, iov++) { | ||
520 | unsigned long addr = (unsigned long)iov->iov_base + offset; | ||
521 | size_t len = iov->iov_len - offset; | ||
522 | offset = 0; | ||
523 | if (unlikely(!len)) /* empty segment */ | ||
524 | continue; | ||
525 | if (len > size) | ||
526 | len = size; | ||
527 | npages += (addr + len + PAGE_SIZE - 1) / PAGE_SIZE | ||
528 | - addr / PAGE_SIZE; | ||
529 | if (npages >= maxpages) /* don't bother going further */ | ||
530 | return maxpages; | ||
531 | size -= len; | ||
532 | offset = 0; | ||
533 | } | ||
534 | return min(npages, maxpages); | ||
535 | } | ||
536 | |||
537 | static void memcpy_from_page(char *to, struct page *page, size_t offset, size_t len) | 339 | static void memcpy_from_page(char *to, struct page *page, size_t offset, size_t len) |
538 | { | 340 | { |
539 | char *from = kmap_atomic(page); | 341 | char *from = kmap_atomic(page); |
@@ -555,293 +357,78 @@ static void memzero_page(struct page *page, size_t offset, size_t len) | |||
555 | kunmap_atomic(addr); | 357 | kunmap_atomic(addr); |
556 | } | 358 | } |
557 | 359 | ||
558 | static size_t copy_to_iter_bvec(void *from, size_t bytes, struct iov_iter *i) | 360 | size_t copy_to_iter(void *addr, size_t bytes, struct iov_iter *i) |
559 | { | 361 | { |
560 | size_t skip, copy, wanted; | 362 | char *from = addr; |
561 | const struct bio_vec *bvec; | ||
562 | |||
563 | if (unlikely(bytes > i->count)) | 363 | if (unlikely(bytes > i->count)) |
564 | bytes = i->count; | 364 | bytes = i->count; |
565 | 365 | ||
566 | if (unlikely(!bytes)) | 366 | if (unlikely(!bytes)) |
567 | return 0; | 367 | return 0; |
568 | 368 | ||
569 | wanted = bytes; | 369 | iterate_and_advance(i, bytes, v, |
570 | bvec = i->bvec; | 370 | __copy_to_user(v.iov_base, (from += v.iov_len) - v.iov_len, |
571 | skip = i->iov_offset; | 371 | v.iov_len), |
572 | copy = min_t(size_t, bytes, bvec->bv_len - skip); | 372 | memcpy_to_page(v.bv_page, v.bv_offset, |
373 | (from += v.bv_len) - v.bv_len, v.bv_len), | ||
374 | memcpy(v.iov_base, (from += v.iov_len) - v.iov_len, v.iov_len) | ||
375 | ) | ||
573 | 376 | ||
574 | memcpy_to_page(bvec->bv_page, skip + bvec->bv_offset, from, copy); | 377 | return bytes; |
575 | skip += copy; | ||
576 | from += copy; | ||
577 | bytes -= copy; | ||
578 | while (bytes) { | ||
579 | bvec++; | ||
580 | copy = min(bytes, (size_t)bvec->bv_len); | ||
581 | memcpy_to_page(bvec->bv_page, bvec->bv_offset, from, copy); | ||
582 | skip = copy; | ||
583 | from += copy; | ||
584 | bytes -= copy; | ||
585 | } | ||
586 | if (skip == bvec->bv_len) { | ||
587 | bvec++; | ||
588 | skip = 0; | ||
589 | } | ||
590 | i->count -= wanted - bytes; | ||
591 | i->nr_segs -= bvec - i->bvec; | ||
592 | i->bvec = bvec; | ||
593 | i->iov_offset = skip; | ||
594 | return wanted - bytes; | ||
595 | } | 378 | } |
379 | EXPORT_SYMBOL(copy_to_iter); | ||
596 | 380 | ||
597 | static size_t copy_from_iter_bvec(void *to, size_t bytes, struct iov_iter *i) | 381 | size_t copy_from_iter(void *addr, size_t bytes, struct iov_iter *i) |
598 | { | 382 | { |
599 | size_t skip, copy, wanted; | 383 | char *to = addr; |
600 | const struct bio_vec *bvec; | ||
601 | |||
602 | if (unlikely(bytes > i->count)) | 384 | if (unlikely(bytes > i->count)) |
603 | bytes = i->count; | 385 | bytes = i->count; |
604 | 386 | ||
605 | if (unlikely(!bytes)) | 387 | if (unlikely(!bytes)) |
606 | return 0; | 388 | return 0; |
607 | 389 | ||
608 | wanted = bytes; | 390 | iterate_and_advance(i, bytes, v, |
609 | bvec = i->bvec; | 391 | __copy_from_user((to += v.iov_len) - v.iov_len, v.iov_base, |
610 | skip = i->iov_offset; | 392 | v.iov_len), |
611 | 393 | memcpy_from_page((to += v.bv_len) - v.bv_len, v.bv_page, | |
612 | copy = min(bytes, bvec->bv_len - skip); | 394 | v.bv_offset, v.bv_len), |
395 | memcpy((to += v.iov_len) - v.iov_len, v.iov_base, v.iov_len) | ||
396 | ) | ||
613 | 397 | ||
614 | memcpy_from_page(to, bvec->bv_page, bvec->bv_offset + skip, copy); | 398 | return bytes; |
615 | |||
616 | to += copy; | ||
617 | skip += copy; | ||
618 | bytes -= copy; | ||
619 | |||
620 | while (bytes) { | ||
621 | bvec++; | ||
622 | copy = min(bytes, (size_t)bvec->bv_len); | ||
623 | memcpy_from_page(to, bvec->bv_page, bvec->bv_offset, copy); | ||
624 | skip = copy; | ||
625 | to += copy; | ||
626 | bytes -= copy; | ||
627 | } | ||
628 | if (skip == bvec->bv_len) { | ||
629 | bvec++; | ||
630 | skip = 0; | ||
631 | } | ||
632 | i->count -= wanted; | ||
633 | i->nr_segs -= bvec - i->bvec; | ||
634 | i->bvec = bvec; | ||
635 | i->iov_offset = skip; | ||
636 | return wanted; | ||
637 | } | ||
638 | |||
639 | static size_t copy_page_to_iter_bvec(struct page *page, size_t offset, | ||
640 | size_t bytes, struct iov_iter *i) | ||
641 | { | ||
642 | void *kaddr = kmap_atomic(page); | ||
643 | size_t wanted = copy_to_iter_bvec(kaddr + offset, bytes, i); | ||
644 | kunmap_atomic(kaddr); | ||
645 | return wanted; | ||
646 | } | ||
647 | |||
648 | static size_t copy_page_from_iter_bvec(struct page *page, size_t offset, | ||
649 | size_t bytes, struct iov_iter *i) | ||
650 | { | ||
651 | void *kaddr = kmap_atomic(page); | ||
652 | size_t wanted = copy_from_iter_bvec(kaddr + offset, bytes, i); | ||
653 | kunmap_atomic(kaddr); | ||
654 | return wanted; | ||
655 | } | 399 | } |
400 | EXPORT_SYMBOL(copy_from_iter); | ||
656 | 401 | ||
657 | static size_t zero_bvec(size_t bytes, struct iov_iter *i) | 402 | size_t copy_from_iter_nocache(void *addr, size_t bytes, struct iov_iter *i) |
658 | { | 403 | { |
659 | size_t skip, copy, wanted; | 404 | char *to = addr; |
660 | const struct bio_vec *bvec; | ||
661 | |||
662 | if (unlikely(bytes > i->count)) | 405 | if (unlikely(bytes > i->count)) |
663 | bytes = i->count; | 406 | bytes = i->count; |
664 | 407 | ||
665 | if (unlikely(!bytes)) | 408 | if (unlikely(!bytes)) |
666 | return 0; | 409 | return 0; |
667 | 410 | ||
668 | wanted = bytes; | 411 | iterate_and_advance(i, bytes, v, |
669 | bvec = i->bvec; | 412 | __copy_from_user_nocache((to += v.iov_len) - v.iov_len, |
670 | skip = i->iov_offset; | 413 | v.iov_base, v.iov_len), |
671 | copy = min_t(size_t, bytes, bvec->bv_len - skip); | 414 | memcpy_from_page((to += v.bv_len) - v.bv_len, v.bv_page, |
672 | 415 | v.bv_offset, v.bv_len), | |
673 | memzero_page(bvec->bv_page, skip + bvec->bv_offset, copy); | 416 | memcpy((to += v.iov_len) - v.iov_len, v.iov_base, v.iov_len) |
674 | skip += copy; | 417 | ) |
675 | bytes -= copy; | ||
676 | while (bytes) { | ||
677 | bvec++; | ||
678 | copy = min(bytes, (size_t)bvec->bv_len); | ||
679 | memzero_page(bvec->bv_page, bvec->bv_offset, copy); | ||
680 | skip = copy; | ||
681 | bytes -= copy; | ||
682 | } | ||
683 | if (skip == bvec->bv_len) { | ||
684 | bvec++; | ||
685 | skip = 0; | ||
686 | } | ||
687 | i->count -= wanted - bytes; | ||
688 | i->nr_segs -= bvec - i->bvec; | ||
689 | i->bvec = bvec; | ||
690 | i->iov_offset = skip; | ||
691 | return wanted - bytes; | ||
692 | } | ||
693 | 418 | ||
694 | static size_t copy_from_user_bvec(struct page *page, | ||
695 | struct iov_iter *i, unsigned long offset, size_t bytes) | ||
696 | { | ||
697 | char *kaddr; | ||
698 | size_t left; | ||
699 | const struct bio_vec *bvec; | ||
700 | size_t base = i->iov_offset; | ||
701 | |||
702 | kaddr = kmap_atomic(page); | ||
703 | for (left = bytes, bvec = i->bvec; left; bvec++, base = 0) { | ||
704 | size_t copy = min(left, bvec->bv_len - base); | ||
705 | if (!bvec->bv_len) | ||
706 | continue; | ||
707 | memcpy_from_page(kaddr + offset, bvec->bv_page, | ||
708 | bvec->bv_offset + base, copy); | ||
709 | offset += copy; | ||
710 | left -= copy; | ||
711 | } | ||
712 | kunmap_atomic(kaddr); | ||
713 | return bytes; | 419 | return bytes; |
714 | } | 420 | } |
715 | 421 | EXPORT_SYMBOL(copy_from_iter_nocache); | |
716 | static void advance_bvec(struct iov_iter *i, size_t bytes) | ||
717 | { | ||
718 | BUG_ON(i->count < bytes); | ||
719 | |||
720 | if (likely(i->nr_segs == 1)) { | ||
721 | i->iov_offset += bytes; | ||
722 | i->count -= bytes; | ||
723 | } else { | ||
724 | const struct bio_vec *bvec = i->bvec; | ||
725 | size_t base = i->iov_offset; | ||
726 | unsigned long nr_segs = i->nr_segs; | ||
727 | |||
728 | /* | ||
729 | * The !iov->iov_len check ensures we skip over unlikely | ||
730 | * zero-length segments (without overruning the iovec). | ||
731 | */ | ||
732 | while (bytes || unlikely(i->count && !bvec->bv_len)) { | ||
733 | int copy; | ||
734 | |||
735 | copy = min(bytes, bvec->bv_len - base); | ||
736 | BUG_ON(!i->count || i->count < copy); | ||
737 | i->count -= copy; | ||
738 | bytes -= copy; | ||
739 | base += copy; | ||
740 | if (bvec->bv_len == base) { | ||
741 | bvec++; | ||
742 | nr_segs--; | ||
743 | base = 0; | ||
744 | } | ||
745 | } | ||
746 | i->bvec = bvec; | ||
747 | i->iov_offset = base; | ||
748 | i->nr_segs = nr_segs; | ||
749 | } | ||
750 | } | ||
751 | |||
752 | static unsigned long alignment_bvec(const struct iov_iter *i) | ||
753 | { | ||
754 | const struct bio_vec *bvec = i->bvec; | ||
755 | unsigned long res; | ||
756 | size_t size = i->count; | ||
757 | size_t n; | ||
758 | |||
759 | if (!size) | ||
760 | return 0; | ||
761 | |||
762 | res = bvec->bv_offset + i->iov_offset; | ||
763 | n = bvec->bv_len - i->iov_offset; | ||
764 | if (n >= size) | ||
765 | return res | size; | ||
766 | size -= n; | ||
767 | res |= n; | ||
768 | while (size > (++bvec)->bv_len) { | ||
769 | res |= bvec->bv_offset | bvec->bv_len; | ||
770 | size -= bvec->bv_len; | ||
771 | } | ||
772 | res |= bvec->bv_offset | size; | ||
773 | return res; | ||
774 | } | ||
775 | |||
776 | static ssize_t get_pages_bvec(struct iov_iter *i, | ||
777 | struct page **pages, size_t maxsize, unsigned maxpages, | ||
778 | size_t *start) | ||
779 | { | ||
780 | const struct bio_vec *bvec = i->bvec; | ||
781 | size_t len = bvec->bv_len - i->iov_offset; | ||
782 | if (len > i->count) | ||
783 | len = i->count; | ||
784 | if (len > maxsize) | ||
785 | len = maxsize; | ||
786 | /* can't be more than PAGE_SIZE */ | ||
787 | *start = bvec->bv_offset + i->iov_offset; | ||
788 | |||
789 | get_page(*pages = bvec->bv_page); | ||
790 | |||
791 | return len; | ||
792 | } | ||
793 | |||
794 | static ssize_t get_pages_alloc_bvec(struct iov_iter *i, | ||
795 | struct page ***pages, size_t maxsize, | ||
796 | size_t *start) | ||
797 | { | ||
798 | const struct bio_vec *bvec = i->bvec; | ||
799 | size_t len = bvec->bv_len - i->iov_offset; | ||
800 | if (len > i->count) | ||
801 | len = i->count; | ||
802 | if (len > maxsize) | ||
803 | len = maxsize; | ||
804 | *start = bvec->bv_offset + i->iov_offset; | ||
805 | |||
806 | *pages = kmalloc(sizeof(struct page *), GFP_KERNEL); | ||
807 | if (!*pages) | ||
808 | return -ENOMEM; | ||
809 | |||
810 | get_page(**pages = bvec->bv_page); | ||
811 | |||
812 | return len; | ||
813 | } | ||
814 | |||
815 | static int iov_iter_npages_bvec(const struct iov_iter *i, int maxpages) | ||
816 | { | ||
817 | size_t offset = i->iov_offset; | ||
818 | size_t size = i->count; | ||
819 | const struct bio_vec *bvec = i->bvec; | ||
820 | int npages = 0; | ||
821 | int n; | ||
822 | |||
823 | for (n = 0; size && n < i->nr_segs; n++, bvec++) { | ||
824 | size_t len = bvec->bv_len - offset; | ||
825 | offset = 0; | ||
826 | if (unlikely(!len)) /* empty segment */ | ||
827 | continue; | ||
828 | if (len > size) | ||
829 | len = size; | ||
830 | npages++; | ||
831 | if (npages >= maxpages) /* don't bother going further */ | ||
832 | return maxpages; | ||
833 | size -= len; | ||
834 | offset = 0; | ||
835 | } | ||
836 | return min(npages, maxpages); | ||
837 | } | ||
838 | 422 | ||
839 | size_t copy_page_to_iter(struct page *page, size_t offset, size_t bytes, | 423 | size_t copy_page_to_iter(struct page *page, size_t offset, size_t bytes, |
840 | struct iov_iter *i) | 424 | struct iov_iter *i) |
841 | { | 425 | { |
842 | if (i->type & ITER_BVEC) | 426 | if (i->type & (ITER_BVEC|ITER_KVEC)) { |
843 | return copy_page_to_iter_bvec(page, offset, bytes, i); | 427 | void *kaddr = kmap_atomic(page); |
844 | else | 428 | size_t wanted = copy_to_iter(kaddr + offset, bytes, i); |
429 | kunmap_atomic(kaddr); | ||
430 | return wanted; | ||
431 | } else | ||
845 | return copy_page_to_iter_iovec(page, offset, bytes, i); | 432 | return copy_page_to_iter_iovec(page, offset, bytes, i); |
846 | } | 433 | } |
847 | EXPORT_SYMBOL(copy_page_to_iter); | 434 | EXPORT_SYMBOL(copy_page_to_iter); |
@@ -849,57 +436,53 @@ EXPORT_SYMBOL(copy_page_to_iter); | |||
849 | size_t copy_page_from_iter(struct page *page, size_t offset, size_t bytes, | 436 | size_t copy_page_from_iter(struct page *page, size_t offset, size_t bytes, |
850 | struct iov_iter *i) | 437 | struct iov_iter *i) |
851 | { | 438 | { |
852 | if (i->type & ITER_BVEC) | 439 | if (i->type & (ITER_BVEC|ITER_KVEC)) { |
853 | return copy_page_from_iter_bvec(page, offset, bytes, i); | 440 | void *kaddr = kmap_atomic(page); |
854 | else | 441 | size_t wanted = copy_from_iter(kaddr + offset, bytes, i); |
442 | kunmap_atomic(kaddr); | ||
443 | return wanted; | ||
444 | } else | ||
855 | return copy_page_from_iter_iovec(page, offset, bytes, i); | 445 | return copy_page_from_iter_iovec(page, offset, bytes, i); |
856 | } | 446 | } |
857 | EXPORT_SYMBOL(copy_page_from_iter); | 447 | EXPORT_SYMBOL(copy_page_from_iter); |
858 | 448 | ||
859 | size_t copy_to_iter(void *addr, size_t bytes, struct iov_iter *i) | 449 | size_t iov_iter_zero(size_t bytes, struct iov_iter *i) |
860 | { | 450 | { |
861 | if (i->type & ITER_BVEC) | 451 | if (unlikely(bytes > i->count)) |
862 | return copy_to_iter_bvec(addr, bytes, i); | 452 | bytes = i->count; |
863 | else | ||
864 | return copy_to_iter_iovec(addr, bytes, i); | ||
865 | } | ||
866 | EXPORT_SYMBOL(copy_to_iter); | ||
867 | 453 | ||
868 | size_t copy_from_iter(void *addr, size_t bytes, struct iov_iter *i) | 454 | if (unlikely(!bytes)) |
869 | { | 455 | return 0; |
870 | if (i->type & ITER_BVEC) | ||
871 | return copy_from_iter_bvec(addr, bytes, i); | ||
872 | else | ||
873 | return copy_from_iter_iovec(addr, bytes, i); | ||
874 | } | ||
875 | EXPORT_SYMBOL(copy_from_iter); | ||
876 | 456 | ||
877 | size_t iov_iter_zero(size_t bytes, struct iov_iter *i) | 457 | iterate_and_advance(i, bytes, v, |
878 | { | 458 | __clear_user(v.iov_base, v.iov_len), |
879 | if (i->type & ITER_BVEC) { | 459 | memzero_page(v.bv_page, v.bv_offset, v.bv_len), |
880 | return zero_bvec(bytes, i); | 460 | memset(v.iov_base, 0, v.iov_len) |
881 | } else { | 461 | ) |
882 | return zero_iovec(bytes, i); | 462 | |
883 | } | 463 | return bytes; |
884 | } | 464 | } |
885 | EXPORT_SYMBOL(iov_iter_zero); | 465 | EXPORT_SYMBOL(iov_iter_zero); |
886 | 466 | ||
887 | size_t iov_iter_copy_from_user_atomic(struct page *page, | 467 | size_t iov_iter_copy_from_user_atomic(struct page *page, |
888 | struct iov_iter *i, unsigned long offset, size_t bytes) | 468 | struct iov_iter *i, unsigned long offset, size_t bytes) |
889 | { | 469 | { |
890 | if (i->type & ITER_BVEC) | 470 | char *kaddr = kmap_atomic(page), *p = kaddr + offset; |
891 | return copy_from_user_bvec(page, i, offset, bytes); | 471 | iterate_all_kinds(i, bytes, v, |
892 | else | 472 | __copy_from_user_inatomic((p += v.iov_len) - v.iov_len, |
893 | return copy_from_user_atomic_iovec(page, i, offset, bytes); | 473 | v.iov_base, v.iov_len), |
474 | memcpy_from_page((p += v.bv_len) - v.bv_len, v.bv_page, | ||
475 | v.bv_offset, v.bv_len), | ||
476 | memcpy((p += v.iov_len) - v.iov_len, v.iov_base, v.iov_len) | ||
477 | ) | ||
478 | kunmap_atomic(kaddr); | ||
479 | return bytes; | ||
894 | } | 480 | } |
895 | EXPORT_SYMBOL(iov_iter_copy_from_user_atomic); | 481 | EXPORT_SYMBOL(iov_iter_copy_from_user_atomic); |
896 | 482 | ||
897 | void iov_iter_advance(struct iov_iter *i, size_t size) | 483 | void iov_iter_advance(struct iov_iter *i, size_t size) |
898 | { | 484 | { |
899 | if (i->type & ITER_BVEC) | 485 | iterate_and_advance(i, size, v, 0, 0, 0) |
900 | advance_bvec(i, size); | ||
901 | else | ||
902 | advance_iovec(i, size); | ||
903 | } | 486 | } |
904 | EXPORT_SYMBOL(iov_iter_advance); | 487 | EXPORT_SYMBOL(iov_iter_advance); |
905 | 488 | ||
@@ -917,12 +500,33 @@ size_t iov_iter_single_seg_count(const struct iov_iter *i) | |||
917 | } | 500 | } |
918 | EXPORT_SYMBOL(iov_iter_single_seg_count); | 501 | EXPORT_SYMBOL(iov_iter_single_seg_count); |
919 | 502 | ||
503 | void iov_iter_kvec(struct iov_iter *i, int direction, | ||
504 | const struct kvec *iov, unsigned long nr_segs, | ||
505 | size_t count) | ||
506 | { | ||
507 | BUG_ON(!(direction & ITER_KVEC)); | ||
508 | i->type = direction; | ||
509 | i->kvec = (struct kvec *)iov; | ||
510 | i->nr_segs = nr_segs; | ||
511 | i->iov_offset = 0; | ||
512 | i->count = count; | ||
513 | } | ||
514 | EXPORT_SYMBOL(iov_iter_kvec); | ||
515 | |||
920 | unsigned long iov_iter_alignment(const struct iov_iter *i) | 516 | unsigned long iov_iter_alignment(const struct iov_iter *i) |
921 | { | 517 | { |
922 | if (i->type & ITER_BVEC) | 518 | unsigned long res = 0; |
923 | return alignment_bvec(i); | 519 | size_t size = i->count; |
924 | else | 520 | |
925 | return alignment_iovec(i); | 521 | if (!size) |
522 | return 0; | ||
523 | |||
524 | iterate_all_kinds(i, size, v, | ||
525 | (res |= (unsigned long)v.iov_base | v.iov_len, 0), | ||
526 | res |= v.bv_offset | v.bv_len, | ||
527 | res |= (unsigned long)v.iov_base | v.iov_len | ||
528 | ) | ||
529 | return res; | ||
926 | } | 530 | } |
927 | EXPORT_SYMBOL(iov_iter_alignment); | 531 | EXPORT_SYMBOL(iov_iter_alignment); |
928 | 532 | ||
@@ -930,29 +534,207 @@ ssize_t iov_iter_get_pages(struct iov_iter *i, | |||
930 | struct page **pages, size_t maxsize, unsigned maxpages, | 534 | struct page **pages, size_t maxsize, unsigned maxpages, |
931 | size_t *start) | 535 | size_t *start) |
932 | { | 536 | { |
933 | if (i->type & ITER_BVEC) | 537 | if (maxsize > i->count) |
934 | return get_pages_bvec(i, pages, maxsize, maxpages, start); | 538 | maxsize = i->count; |
935 | else | 539 | |
936 | return get_pages_iovec(i, pages, maxsize, maxpages, start); | 540 | if (!maxsize) |
541 | return 0; | ||
542 | |||
543 | iterate_all_kinds(i, maxsize, v, ({ | ||
544 | unsigned long addr = (unsigned long)v.iov_base; | ||
545 | size_t len = v.iov_len + (*start = addr & (PAGE_SIZE - 1)); | ||
546 | int n; | ||
547 | int res; | ||
548 | |||
549 | if (len > maxpages * PAGE_SIZE) | ||
550 | len = maxpages * PAGE_SIZE; | ||
551 | addr &= ~(PAGE_SIZE - 1); | ||
552 | n = DIV_ROUND_UP(len, PAGE_SIZE); | ||
553 | res = get_user_pages_fast(addr, n, (i->type & WRITE) != WRITE, pages); | ||
554 | if (unlikely(res < 0)) | ||
555 | return res; | ||
556 | return (res == n ? len : res * PAGE_SIZE) - *start; | ||
557 | 0;}),({ | ||
558 | /* can't be more than PAGE_SIZE */ | ||
559 | *start = v.bv_offset; | ||
560 | get_page(*pages = v.bv_page); | ||
561 | return v.bv_len; | ||
562 | }),({ | ||
563 | return -EFAULT; | ||
564 | }) | ||
565 | ) | ||
566 | return 0; | ||
937 | } | 567 | } |
938 | EXPORT_SYMBOL(iov_iter_get_pages); | 568 | EXPORT_SYMBOL(iov_iter_get_pages); |
939 | 569 | ||
570 | static struct page **get_pages_array(size_t n) | ||
571 | { | ||
572 | struct page **p = kmalloc(n * sizeof(struct page *), GFP_KERNEL); | ||
573 | if (!p) | ||
574 | p = vmalloc(n * sizeof(struct page *)); | ||
575 | return p; | ||
576 | } | ||
577 | |||
940 | ssize_t iov_iter_get_pages_alloc(struct iov_iter *i, | 578 | ssize_t iov_iter_get_pages_alloc(struct iov_iter *i, |
941 | struct page ***pages, size_t maxsize, | 579 | struct page ***pages, size_t maxsize, |
942 | size_t *start) | 580 | size_t *start) |
943 | { | 581 | { |
944 | if (i->type & ITER_BVEC) | 582 | struct page **p; |
945 | return get_pages_alloc_bvec(i, pages, maxsize, start); | 583 | |
946 | else | 584 | if (maxsize > i->count) |
947 | return get_pages_alloc_iovec(i, pages, maxsize, start); | 585 | maxsize = i->count; |
586 | |||
587 | if (!maxsize) | ||
588 | return 0; | ||
589 | |||
590 | iterate_all_kinds(i, maxsize, v, ({ | ||
591 | unsigned long addr = (unsigned long)v.iov_base; | ||
592 | size_t len = v.iov_len + (*start = addr & (PAGE_SIZE - 1)); | ||
593 | int n; | ||
594 | int res; | ||
595 | |||
596 | addr &= ~(PAGE_SIZE - 1); | ||
597 | n = DIV_ROUND_UP(len, PAGE_SIZE); | ||
598 | p = get_pages_array(n); | ||
599 | if (!p) | ||
600 | return -ENOMEM; | ||
601 | res = get_user_pages_fast(addr, n, (i->type & WRITE) != WRITE, p); | ||
602 | if (unlikely(res < 0)) { | ||
603 | kvfree(p); | ||
604 | return res; | ||
605 | } | ||
606 | *pages = p; | ||
607 | return (res == n ? len : res * PAGE_SIZE) - *start; | ||
608 | 0;}),({ | ||
609 | /* can't be more than PAGE_SIZE */ | ||
610 | *start = v.bv_offset; | ||
611 | *pages = p = get_pages_array(1); | ||
612 | if (!p) | ||
613 | return -ENOMEM; | ||
614 | get_page(*p = v.bv_page); | ||
615 | return v.bv_len; | ||
616 | }),({ | ||
617 | return -EFAULT; | ||
618 | }) | ||
619 | ) | ||
620 | return 0; | ||
948 | } | 621 | } |
949 | EXPORT_SYMBOL(iov_iter_get_pages_alloc); | 622 | EXPORT_SYMBOL(iov_iter_get_pages_alloc); |
950 | 623 | ||
624 | size_t csum_and_copy_from_iter(void *addr, size_t bytes, __wsum *csum, | ||
625 | struct iov_iter *i) | ||
626 | { | ||
627 | char *to = addr; | ||
628 | __wsum sum, next; | ||
629 | size_t off = 0; | ||
630 | if (unlikely(bytes > i->count)) | ||
631 | bytes = i->count; | ||
632 | |||
633 | if (unlikely(!bytes)) | ||
634 | return 0; | ||
635 | |||
636 | sum = *csum; | ||
637 | iterate_and_advance(i, bytes, v, ({ | ||
638 | int err = 0; | ||
639 | next = csum_and_copy_from_user(v.iov_base, | ||
640 | (to += v.iov_len) - v.iov_len, | ||
641 | v.iov_len, 0, &err); | ||
642 | if (!err) { | ||
643 | sum = csum_block_add(sum, next, off); | ||
644 | off += v.iov_len; | ||
645 | } | ||
646 | err ? v.iov_len : 0; | ||
647 | }), ({ | ||
648 | char *p = kmap_atomic(v.bv_page); | ||
649 | next = csum_partial_copy_nocheck(p + v.bv_offset, | ||
650 | (to += v.bv_len) - v.bv_len, | ||
651 | v.bv_len, 0); | ||
652 | kunmap_atomic(p); | ||
653 | sum = csum_block_add(sum, next, off); | ||
654 | off += v.bv_len; | ||
655 | }),({ | ||
656 | next = csum_partial_copy_nocheck(v.iov_base, | ||
657 | (to += v.iov_len) - v.iov_len, | ||
658 | v.iov_len, 0); | ||
659 | sum = csum_block_add(sum, next, off); | ||
660 | off += v.iov_len; | ||
661 | }) | ||
662 | ) | ||
663 | *csum = sum; | ||
664 | return bytes; | ||
665 | } | ||
666 | EXPORT_SYMBOL(csum_and_copy_from_iter); | ||
667 | |||
668 | size_t csum_and_copy_to_iter(void *addr, size_t bytes, __wsum *csum, | ||
669 | struct iov_iter *i) | ||
670 | { | ||
671 | char *from = addr; | ||
672 | __wsum sum, next; | ||
673 | size_t off = 0; | ||
674 | if (unlikely(bytes > i->count)) | ||
675 | bytes = i->count; | ||
676 | |||
677 | if (unlikely(!bytes)) | ||
678 | return 0; | ||
679 | |||
680 | sum = *csum; | ||
681 | iterate_and_advance(i, bytes, v, ({ | ||
682 | int err = 0; | ||
683 | next = csum_and_copy_to_user((from += v.iov_len) - v.iov_len, | ||
684 | v.iov_base, | ||
685 | v.iov_len, 0, &err); | ||
686 | if (!err) { | ||
687 | sum = csum_block_add(sum, next, off); | ||
688 | off += v.iov_len; | ||
689 | } | ||
690 | err ? v.iov_len : 0; | ||
691 | }), ({ | ||
692 | char *p = kmap_atomic(v.bv_page); | ||
693 | next = csum_partial_copy_nocheck((from += v.bv_len) - v.bv_len, | ||
694 | p + v.bv_offset, | ||
695 | v.bv_len, 0); | ||
696 | kunmap_atomic(p); | ||
697 | sum = csum_block_add(sum, next, off); | ||
698 | off += v.bv_len; | ||
699 | }),({ | ||
700 | next = csum_partial_copy_nocheck((from += v.iov_len) - v.iov_len, | ||
701 | v.iov_base, | ||
702 | v.iov_len, 0); | ||
703 | sum = csum_block_add(sum, next, off); | ||
704 | off += v.iov_len; | ||
705 | }) | ||
706 | ) | ||
707 | *csum = sum; | ||
708 | return bytes; | ||
709 | } | ||
710 | EXPORT_SYMBOL(csum_and_copy_to_iter); | ||
711 | |||
951 | int iov_iter_npages(const struct iov_iter *i, int maxpages) | 712 | int iov_iter_npages(const struct iov_iter *i, int maxpages) |
952 | { | 713 | { |
953 | if (i->type & ITER_BVEC) | 714 | size_t size = i->count; |
954 | return iov_iter_npages_bvec(i, maxpages); | 715 | int npages = 0; |
955 | else | 716 | |
956 | return iov_iter_npages_iovec(i, maxpages); | 717 | if (!size) |
718 | return 0; | ||
719 | |||
720 | iterate_all_kinds(i, size, v, ({ | ||
721 | unsigned long p = (unsigned long)v.iov_base; | ||
722 | npages += DIV_ROUND_UP(p + v.iov_len, PAGE_SIZE) | ||
723 | - p / PAGE_SIZE; | ||
724 | if (npages >= maxpages) | ||
725 | return maxpages; | ||
726 | 0;}),({ | ||
727 | npages++; | ||
728 | if (npages >= maxpages) | ||
729 | return maxpages; | ||
730 | }),({ | ||
731 | unsigned long p = (unsigned long)v.iov_base; | ||
732 | npages += DIV_ROUND_UP(p + v.iov_len, PAGE_SIZE) | ||
733 | - p / PAGE_SIZE; | ||
734 | if (npages >= maxpages) | ||
735 | return maxpages; | ||
736 | }) | ||
737 | ) | ||
738 | return npages; | ||
957 | } | 739 | } |
958 | EXPORT_SYMBOL(iov_iter_npages); | 740 | EXPORT_SYMBOL(iov_iter_npages); |
diff --git a/mm/memcontrol.c b/mm/memcontrol.c index d6ac0e33e150..ee48428cf8e3 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c | |||
@@ -5064,7 +5064,7 @@ static ssize_t memcg_write_event_control(struct kernfs_open_file *of, | |||
5064 | * | 5064 | * |
5065 | * DO NOT ADD NEW FILES. | 5065 | * DO NOT ADD NEW FILES. |
5066 | */ | 5066 | */ |
5067 | name = cfile.file->f_dentry->d_name.name; | 5067 | name = cfile.file->f_path.dentry->d_name.name; |
5068 | 5068 | ||
5069 | if (!strcmp(name, "memory.usage_in_bytes")) { | 5069 | if (!strcmp(name, "memory.usage_in_bytes")) { |
5070 | event->register_event = mem_cgroup_usage_register_event; | 5070 | event->register_event = mem_cgroup_usage_register_event; |
@@ -5088,7 +5088,7 @@ static ssize_t memcg_write_event_control(struct kernfs_open_file *of, | |||
5088 | * automatically removed on cgroup destruction but the removal is | 5088 | * automatically removed on cgroup destruction but the removal is |
5089 | * asynchronous, so take an extra ref on @css. | 5089 | * asynchronous, so take an extra ref on @css. |
5090 | */ | 5090 | */ |
5091 | cfile_css = css_tryget_online_from_dir(cfile.file->f_dentry->d_parent, | 5091 | cfile_css = css_tryget_online_from_dir(cfile.file->f_path.dentry->d_parent, |
5092 | &memory_cgrp_subsys); | 5092 | &memory_cgrp_subsys); |
5093 | ret = -EINVAL; | 5093 | ret = -EINVAL; |
5094 | if (IS_ERR(cfile_css)) | 5094 | if (IS_ERR(cfile_css)) |
diff --git a/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c b/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c index a054fe083431..5c61328b7704 100644 --- a/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c +++ b/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c | |||
@@ -56,11 +56,11 @@ static bool ipv4_invert_tuple(struct nf_conntrack_tuple *tuple, | |||
56 | return true; | 56 | return true; |
57 | } | 57 | } |
58 | 58 | ||
59 | static int ipv4_print_tuple(struct seq_file *s, | 59 | static void ipv4_print_tuple(struct seq_file *s, |
60 | const struct nf_conntrack_tuple *tuple) | 60 | const struct nf_conntrack_tuple *tuple) |
61 | { | 61 | { |
62 | return seq_printf(s, "src=%pI4 dst=%pI4 ", | 62 | seq_printf(s, "src=%pI4 dst=%pI4 ", |
63 | &tuple->src.u3.ip, &tuple->dst.u3.ip); | 63 | &tuple->src.u3.ip, &tuple->dst.u3.ip); |
64 | } | 64 | } |
65 | 65 | ||
66 | static int ipv4_get_l4proto(const struct sk_buff *skb, unsigned int nhoff, | 66 | static int ipv4_get_l4proto(const struct sk_buff *skb, unsigned int nhoff, |
diff --git a/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4_compat.c b/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4_compat.c index 4c48e434bb1f..a460a87e14f8 100644 --- a/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4_compat.c +++ b/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4_compat.c | |||
@@ -94,7 +94,7 @@ static void ct_seq_stop(struct seq_file *s, void *v) | |||
94 | } | 94 | } |
95 | 95 | ||
96 | #ifdef CONFIG_NF_CONNTRACK_SECMARK | 96 | #ifdef CONFIG_NF_CONNTRACK_SECMARK |
97 | static int ct_show_secctx(struct seq_file *s, const struct nf_conn *ct) | 97 | static void ct_show_secctx(struct seq_file *s, const struct nf_conn *ct) |
98 | { | 98 | { |
99 | int ret; | 99 | int ret; |
100 | u32 len; | 100 | u32 len; |
@@ -102,17 +102,15 @@ static int ct_show_secctx(struct seq_file *s, const struct nf_conn *ct) | |||
102 | 102 | ||
103 | ret = security_secid_to_secctx(ct->secmark, &secctx, &len); | 103 | ret = security_secid_to_secctx(ct->secmark, &secctx, &len); |
104 | if (ret) | 104 | if (ret) |
105 | return 0; | 105 | return; |
106 | 106 | ||
107 | ret = seq_printf(s, "secctx=%s ", secctx); | 107 | seq_printf(s, "secctx=%s ", secctx); |
108 | 108 | ||
109 | security_release_secctx(secctx, len); | 109 | security_release_secctx(secctx, len); |
110 | return ret; | ||
111 | } | 110 | } |
112 | #else | 111 | #else |
113 | static inline int ct_show_secctx(struct seq_file *s, const struct nf_conn *ct) | 112 | static inline void ct_show_secctx(struct seq_file *s, const struct nf_conn *ct) |
114 | { | 113 | { |
115 | return 0; | ||
116 | } | 114 | } |
117 | #endif | 115 | #endif |
118 | 116 | ||
@@ -141,47 +139,52 @@ static int ct_seq_show(struct seq_file *s, void *v) | |||
141 | NF_CT_ASSERT(l4proto); | 139 | NF_CT_ASSERT(l4proto); |
142 | 140 | ||
143 | ret = -ENOSPC; | 141 | ret = -ENOSPC; |
144 | if (seq_printf(s, "%-8s %u %ld ", | 142 | seq_printf(s, "%-8s %u %ld ", |
145 | l4proto->name, nf_ct_protonum(ct), | 143 | l4proto->name, nf_ct_protonum(ct), |
146 | timer_pending(&ct->timeout) | 144 | timer_pending(&ct->timeout) |
147 | ? (long)(ct->timeout.expires - jiffies)/HZ : 0) != 0) | 145 | ? (long)(ct->timeout.expires - jiffies)/HZ : 0); |
148 | goto release; | 146 | |
147 | if (l4proto->print_conntrack) | ||
148 | l4proto->print_conntrack(s, ct); | ||
149 | 149 | ||
150 | if (l4proto->print_conntrack && l4proto->print_conntrack(s, ct)) | 150 | if (seq_has_overflowed(s)) |
151 | goto release; | 151 | goto release; |
152 | 152 | ||
153 | if (print_tuple(s, &ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple, | 153 | print_tuple(s, &ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple, |
154 | l3proto, l4proto)) | 154 | l3proto, l4proto); |
155 | |||
156 | if (seq_has_overflowed(s)) | ||
155 | goto release; | 157 | goto release; |
156 | 158 | ||
157 | if (seq_print_acct(s, ct, IP_CT_DIR_ORIGINAL)) | 159 | if (seq_print_acct(s, ct, IP_CT_DIR_ORIGINAL)) |
158 | goto release; | 160 | goto release; |
159 | 161 | ||
160 | if (!(test_bit(IPS_SEEN_REPLY_BIT, &ct->status))) | 162 | if (!(test_bit(IPS_SEEN_REPLY_BIT, &ct->status))) |
161 | if (seq_printf(s, "[UNREPLIED] ")) | 163 | seq_printf(s, "[UNREPLIED] "); |
162 | goto release; | ||
163 | 164 | ||
164 | if (print_tuple(s, &ct->tuplehash[IP_CT_DIR_REPLY].tuple, | 165 | print_tuple(s, &ct->tuplehash[IP_CT_DIR_REPLY].tuple, |
165 | l3proto, l4proto)) | 166 | l3proto, l4proto); |
167 | |||
168 | if (seq_has_overflowed(s)) | ||
166 | goto release; | 169 | goto release; |
167 | 170 | ||
168 | if (seq_print_acct(s, ct, IP_CT_DIR_REPLY)) | 171 | if (seq_print_acct(s, ct, IP_CT_DIR_REPLY)) |
169 | goto release; | 172 | goto release; |
170 | 173 | ||
171 | if (test_bit(IPS_ASSURED_BIT, &ct->status)) | 174 | if (test_bit(IPS_ASSURED_BIT, &ct->status)) |
172 | if (seq_printf(s, "[ASSURED] ")) | 175 | seq_printf(s, "[ASSURED] "); |
173 | goto release; | ||
174 | 176 | ||
175 | #ifdef CONFIG_NF_CONNTRACK_MARK | 177 | #ifdef CONFIG_NF_CONNTRACK_MARK |
176 | if (seq_printf(s, "mark=%u ", ct->mark)) | 178 | seq_printf(s, "mark=%u ", ct->mark); |
177 | goto release; | ||
178 | #endif | 179 | #endif |
179 | 180 | ||
180 | if (ct_show_secctx(s, ct)) | 181 | ct_show_secctx(s, ct); |
181 | goto release; | ||
182 | 182 | ||
183 | if (seq_printf(s, "use=%u\n", atomic_read(&ct->ct_general.use))) | 183 | seq_printf(s, "use=%u\n", atomic_read(&ct->ct_general.use)); |
184 | |||
185 | if (seq_has_overflowed(s)) | ||
184 | goto release; | 186 | goto release; |
187 | |||
185 | ret = 0; | 188 | ret = 0; |
186 | release: | 189 | release: |
187 | nf_ct_put(ct); | 190 | nf_ct_put(ct); |
diff --git a/net/ipv4/netfilter/nf_conntrack_proto_icmp.c b/net/ipv4/netfilter/nf_conntrack_proto_icmp.c index b91b2641adda..80d5554b9a88 100644 --- a/net/ipv4/netfilter/nf_conntrack_proto_icmp.c +++ b/net/ipv4/netfilter/nf_conntrack_proto_icmp.c | |||
@@ -72,13 +72,13 @@ static bool icmp_invert_tuple(struct nf_conntrack_tuple *tuple, | |||
72 | } | 72 | } |
73 | 73 | ||
74 | /* Print out the per-protocol part of the tuple. */ | 74 | /* Print out the per-protocol part of the tuple. */ |
75 | static int icmp_print_tuple(struct seq_file *s, | 75 | static void icmp_print_tuple(struct seq_file *s, |
76 | const struct nf_conntrack_tuple *tuple) | 76 | const struct nf_conntrack_tuple *tuple) |
77 | { | 77 | { |
78 | return seq_printf(s, "type=%u code=%u id=%u ", | 78 | seq_printf(s, "type=%u code=%u id=%u ", |
79 | tuple->dst.u.icmp.type, | 79 | tuple->dst.u.icmp.type, |
80 | tuple->dst.u.icmp.code, | 80 | tuple->dst.u.icmp.code, |
81 | ntohs(tuple->src.u.icmp.id)); | 81 | ntohs(tuple->src.u.icmp.id)); |
82 | } | 82 | } |
83 | 83 | ||
84 | static unsigned int *icmp_get_timeouts(struct net *net) | 84 | static unsigned int *icmp_get_timeouts(struct net *net) |
diff --git a/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c b/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c index 4cbc6b290dd5..b68d0e59c1f8 100644 --- a/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c +++ b/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c | |||
@@ -60,11 +60,11 @@ static bool ipv6_invert_tuple(struct nf_conntrack_tuple *tuple, | |||
60 | return true; | 60 | return true; |
61 | } | 61 | } |
62 | 62 | ||
63 | static int ipv6_print_tuple(struct seq_file *s, | 63 | static void ipv6_print_tuple(struct seq_file *s, |
64 | const struct nf_conntrack_tuple *tuple) | 64 | const struct nf_conntrack_tuple *tuple) |
65 | { | 65 | { |
66 | return seq_printf(s, "src=%pI6 dst=%pI6 ", | 66 | seq_printf(s, "src=%pI6 dst=%pI6 ", |
67 | tuple->src.u3.ip6, tuple->dst.u3.ip6); | 67 | tuple->src.u3.ip6, tuple->dst.u3.ip6); |
68 | } | 68 | } |
69 | 69 | ||
70 | static int ipv6_get_l4proto(const struct sk_buff *skb, unsigned int nhoff, | 70 | static int ipv6_get_l4proto(const struct sk_buff *skb, unsigned int nhoff, |
diff --git a/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c b/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c index b3807c5cb888..90388d606483 100644 --- a/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c +++ b/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c | |||
@@ -84,13 +84,13 @@ static bool icmpv6_invert_tuple(struct nf_conntrack_tuple *tuple, | |||
84 | } | 84 | } |
85 | 85 | ||
86 | /* Print out the per-protocol part of the tuple. */ | 86 | /* Print out the per-protocol part of the tuple. */ |
87 | static int icmpv6_print_tuple(struct seq_file *s, | 87 | static void icmpv6_print_tuple(struct seq_file *s, |
88 | const struct nf_conntrack_tuple *tuple) | 88 | const struct nf_conntrack_tuple *tuple) |
89 | { | 89 | { |
90 | return seq_printf(s, "type=%u code=%u id=%u ", | 90 | seq_printf(s, "type=%u code=%u id=%u ", |
91 | tuple->dst.u.icmp.type, | 91 | tuple->dst.u.icmp.type, |
92 | tuple->dst.u.icmp.code, | 92 | tuple->dst.u.icmp.code, |
93 | ntohs(tuple->src.u.icmp.id)); | 93 | ntohs(tuple->src.u.icmp.id)); |
94 | } | 94 | } |
95 | 95 | ||
96 | static unsigned int *icmpv6_get_timeouts(struct net *net) | 96 | static unsigned int *icmpv6_get_timeouts(struct net *net) |
diff --git a/net/netfilter/nf_conntrack_l3proto_generic.c b/net/netfilter/nf_conntrack_l3proto_generic.c index e7eb807fe07d..cf9ace70bece 100644 --- a/net/netfilter/nf_conntrack_l3proto_generic.c +++ b/net/netfilter/nf_conntrack_l3proto_generic.c | |||
@@ -49,10 +49,9 @@ static bool generic_invert_tuple(struct nf_conntrack_tuple *tuple, | |||
49 | return true; | 49 | return true; |
50 | } | 50 | } |
51 | 51 | ||
52 | static int generic_print_tuple(struct seq_file *s, | 52 | static void generic_print_tuple(struct seq_file *s, |
53 | const struct nf_conntrack_tuple *tuple) | 53 | const struct nf_conntrack_tuple *tuple) |
54 | { | 54 | { |
55 | return 0; | ||
56 | } | 55 | } |
57 | 56 | ||
58 | static int generic_get_l4proto(const struct sk_buff *skb, unsigned int nhoff, | 57 | static int generic_get_l4proto(const struct sk_buff *skb, unsigned int nhoff, |
diff --git a/net/netfilter/nf_conntrack_proto_dccp.c b/net/netfilter/nf_conntrack_proto_dccp.c index cb372f96f10d..6dd995c7c72b 100644 --- a/net/netfilter/nf_conntrack_proto_dccp.c +++ b/net/netfilter/nf_conntrack_proto_dccp.c | |||
@@ -618,17 +618,17 @@ out_invalid: | |||
618 | return -NF_ACCEPT; | 618 | return -NF_ACCEPT; |
619 | } | 619 | } |
620 | 620 | ||
621 | static int dccp_print_tuple(struct seq_file *s, | 621 | static void dccp_print_tuple(struct seq_file *s, |
622 | const struct nf_conntrack_tuple *tuple) | 622 | const struct nf_conntrack_tuple *tuple) |
623 | { | 623 | { |
624 | return seq_printf(s, "sport=%hu dport=%hu ", | 624 | seq_printf(s, "sport=%hu dport=%hu ", |
625 | ntohs(tuple->src.u.dccp.port), | 625 | ntohs(tuple->src.u.dccp.port), |
626 | ntohs(tuple->dst.u.dccp.port)); | 626 | ntohs(tuple->dst.u.dccp.port)); |
627 | } | 627 | } |
628 | 628 | ||
629 | static int dccp_print_conntrack(struct seq_file *s, struct nf_conn *ct) | 629 | static void dccp_print_conntrack(struct seq_file *s, struct nf_conn *ct) |
630 | { | 630 | { |
631 | return seq_printf(s, "%s ", dccp_state_names[ct->proto.dccp.state]); | 631 | seq_printf(s, "%s ", dccp_state_names[ct->proto.dccp.state]); |
632 | } | 632 | } |
633 | 633 | ||
634 | #if IS_ENABLED(CONFIG_NF_CT_NETLINK) | 634 | #if IS_ENABLED(CONFIG_NF_CT_NETLINK) |
diff --git a/net/netfilter/nf_conntrack_proto_generic.c b/net/netfilter/nf_conntrack_proto_generic.c index 957c1db66652..60865f110309 100644 --- a/net/netfilter/nf_conntrack_proto_generic.c +++ b/net/netfilter/nf_conntrack_proto_generic.c | |||
@@ -63,10 +63,9 @@ static bool generic_invert_tuple(struct nf_conntrack_tuple *tuple, | |||
63 | } | 63 | } |
64 | 64 | ||
65 | /* Print out the per-protocol part of the tuple. */ | 65 | /* Print out the per-protocol part of the tuple. */ |
66 | static int generic_print_tuple(struct seq_file *s, | 66 | static void generic_print_tuple(struct seq_file *s, |
67 | const struct nf_conntrack_tuple *tuple) | 67 | const struct nf_conntrack_tuple *tuple) |
68 | { | 68 | { |
69 | return 0; | ||
70 | } | 69 | } |
71 | 70 | ||
72 | static unsigned int *generic_get_timeouts(struct net *net) | 71 | static unsigned int *generic_get_timeouts(struct net *net) |
diff --git a/net/netfilter/nf_conntrack_proto_gre.c b/net/netfilter/nf_conntrack_proto_gre.c index d5665739e3b1..7648674f29c3 100644 --- a/net/netfilter/nf_conntrack_proto_gre.c +++ b/net/netfilter/nf_conntrack_proto_gre.c | |||
@@ -226,20 +226,20 @@ static bool gre_pkt_to_tuple(const struct sk_buff *skb, unsigned int dataoff, | |||
226 | } | 226 | } |
227 | 227 | ||
228 | /* print gre part of tuple */ | 228 | /* print gre part of tuple */ |
229 | static int gre_print_tuple(struct seq_file *s, | 229 | static void gre_print_tuple(struct seq_file *s, |
230 | const struct nf_conntrack_tuple *tuple) | 230 | const struct nf_conntrack_tuple *tuple) |
231 | { | 231 | { |
232 | return seq_printf(s, "srckey=0x%x dstkey=0x%x ", | 232 | seq_printf(s, "srckey=0x%x dstkey=0x%x ", |
233 | ntohs(tuple->src.u.gre.key), | 233 | ntohs(tuple->src.u.gre.key), |
234 | ntohs(tuple->dst.u.gre.key)); | 234 | ntohs(tuple->dst.u.gre.key)); |
235 | } | 235 | } |
236 | 236 | ||
237 | /* print private data for conntrack */ | 237 | /* print private data for conntrack */ |
238 | static int gre_print_conntrack(struct seq_file *s, struct nf_conn *ct) | 238 | static void gre_print_conntrack(struct seq_file *s, struct nf_conn *ct) |
239 | { | 239 | { |
240 | return seq_printf(s, "timeout=%u, stream_timeout=%u ", | 240 | seq_printf(s, "timeout=%u, stream_timeout=%u ", |
241 | (ct->proto.gre.timeout / HZ), | 241 | (ct->proto.gre.timeout / HZ), |
242 | (ct->proto.gre.stream_timeout / HZ)); | 242 | (ct->proto.gre.stream_timeout / HZ)); |
243 | } | 243 | } |
244 | 244 | ||
245 | static unsigned int *gre_get_timeouts(struct net *net) | 245 | static unsigned int *gre_get_timeouts(struct net *net) |
diff --git a/net/netfilter/nf_conntrack_proto_sctp.c b/net/netfilter/nf_conntrack_proto_sctp.c index 1314d33f6bcf..b45da90fad32 100644 --- a/net/netfilter/nf_conntrack_proto_sctp.c +++ b/net/netfilter/nf_conntrack_proto_sctp.c | |||
@@ -166,16 +166,16 @@ static bool sctp_invert_tuple(struct nf_conntrack_tuple *tuple, | |||
166 | } | 166 | } |
167 | 167 | ||
168 | /* Print out the per-protocol part of the tuple. */ | 168 | /* Print out the per-protocol part of the tuple. */ |
169 | static int sctp_print_tuple(struct seq_file *s, | 169 | static void sctp_print_tuple(struct seq_file *s, |
170 | const struct nf_conntrack_tuple *tuple) | 170 | const struct nf_conntrack_tuple *tuple) |
171 | { | 171 | { |
172 | return seq_printf(s, "sport=%hu dport=%hu ", | 172 | seq_printf(s, "sport=%hu dport=%hu ", |
173 | ntohs(tuple->src.u.sctp.port), | 173 | ntohs(tuple->src.u.sctp.port), |
174 | ntohs(tuple->dst.u.sctp.port)); | 174 | ntohs(tuple->dst.u.sctp.port)); |
175 | } | 175 | } |
176 | 176 | ||
177 | /* Print out the private part of the conntrack. */ | 177 | /* Print out the private part of the conntrack. */ |
178 | static int sctp_print_conntrack(struct seq_file *s, struct nf_conn *ct) | 178 | static void sctp_print_conntrack(struct seq_file *s, struct nf_conn *ct) |
179 | { | 179 | { |
180 | enum sctp_conntrack state; | 180 | enum sctp_conntrack state; |
181 | 181 | ||
@@ -183,7 +183,7 @@ static int sctp_print_conntrack(struct seq_file *s, struct nf_conn *ct) | |||
183 | state = ct->proto.sctp.state; | 183 | state = ct->proto.sctp.state; |
184 | spin_unlock_bh(&ct->lock); | 184 | spin_unlock_bh(&ct->lock); |
185 | 185 | ||
186 | return seq_printf(s, "%s ", sctp_conntrack_names[state]); | 186 | seq_printf(s, "%s ", sctp_conntrack_names[state]); |
187 | } | 187 | } |
188 | 188 | ||
189 | #define for_each_sctp_chunk(skb, sch, _sch, offset, dataoff, count) \ | 189 | #define for_each_sctp_chunk(skb, sch, _sch, offset, dataoff, count) \ |
diff --git a/net/netfilter/nf_conntrack_proto_tcp.c b/net/netfilter/nf_conntrack_proto_tcp.c index d87b6423ffb2..5caa0c41bf26 100644 --- a/net/netfilter/nf_conntrack_proto_tcp.c +++ b/net/netfilter/nf_conntrack_proto_tcp.c | |||
@@ -302,16 +302,16 @@ static bool tcp_invert_tuple(struct nf_conntrack_tuple *tuple, | |||
302 | } | 302 | } |
303 | 303 | ||
304 | /* Print out the per-protocol part of the tuple. */ | 304 | /* Print out the per-protocol part of the tuple. */ |
305 | static int tcp_print_tuple(struct seq_file *s, | 305 | static void tcp_print_tuple(struct seq_file *s, |
306 | const struct nf_conntrack_tuple *tuple) | 306 | const struct nf_conntrack_tuple *tuple) |
307 | { | 307 | { |
308 | return seq_printf(s, "sport=%hu dport=%hu ", | 308 | seq_printf(s, "sport=%hu dport=%hu ", |
309 | ntohs(tuple->src.u.tcp.port), | 309 | ntohs(tuple->src.u.tcp.port), |
310 | ntohs(tuple->dst.u.tcp.port)); | 310 | ntohs(tuple->dst.u.tcp.port)); |
311 | } | 311 | } |
312 | 312 | ||
313 | /* Print out the private part of the conntrack. */ | 313 | /* Print out the private part of the conntrack. */ |
314 | static int tcp_print_conntrack(struct seq_file *s, struct nf_conn *ct) | 314 | static void tcp_print_conntrack(struct seq_file *s, struct nf_conn *ct) |
315 | { | 315 | { |
316 | enum tcp_conntrack state; | 316 | enum tcp_conntrack state; |
317 | 317 | ||
@@ -319,7 +319,7 @@ static int tcp_print_conntrack(struct seq_file *s, struct nf_conn *ct) | |||
319 | state = ct->proto.tcp.state; | 319 | state = ct->proto.tcp.state; |
320 | spin_unlock_bh(&ct->lock); | 320 | spin_unlock_bh(&ct->lock); |
321 | 321 | ||
322 | return seq_printf(s, "%s ", tcp_conntrack_names[state]); | 322 | seq_printf(s, "%s ", tcp_conntrack_names[state]); |
323 | } | 323 | } |
324 | 324 | ||
325 | static unsigned int get_conntrack_index(const struct tcphdr *tcph) | 325 | static unsigned int get_conntrack_index(const struct tcphdr *tcph) |
diff --git a/net/netfilter/nf_conntrack_proto_udp.c b/net/netfilter/nf_conntrack_proto_udp.c index 9d7721cbce4b..6957281ffee5 100644 --- a/net/netfilter/nf_conntrack_proto_udp.c +++ b/net/netfilter/nf_conntrack_proto_udp.c | |||
@@ -63,12 +63,12 @@ static bool udp_invert_tuple(struct nf_conntrack_tuple *tuple, | |||
63 | } | 63 | } |
64 | 64 | ||
65 | /* Print out the per-protocol part of the tuple. */ | 65 | /* Print out the per-protocol part of the tuple. */ |
66 | static int udp_print_tuple(struct seq_file *s, | 66 | static void udp_print_tuple(struct seq_file *s, |
67 | const struct nf_conntrack_tuple *tuple) | 67 | const struct nf_conntrack_tuple *tuple) |
68 | { | 68 | { |
69 | return seq_printf(s, "sport=%hu dport=%hu ", | 69 | seq_printf(s, "sport=%hu dport=%hu ", |
70 | ntohs(tuple->src.u.udp.port), | 70 | ntohs(tuple->src.u.udp.port), |
71 | ntohs(tuple->dst.u.udp.port)); | 71 | ntohs(tuple->dst.u.udp.port)); |
72 | } | 72 | } |
73 | 73 | ||
74 | static unsigned int *udp_get_timeouts(struct net *net) | 74 | static unsigned int *udp_get_timeouts(struct net *net) |
diff --git a/net/netfilter/nf_conntrack_proto_udplite.c b/net/netfilter/nf_conntrack_proto_udplite.c index 2750e6c69f82..c5903d1649f9 100644 --- a/net/netfilter/nf_conntrack_proto_udplite.c +++ b/net/netfilter/nf_conntrack_proto_udplite.c | |||
@@ -71,12 +71,12 @@ static bool udplite_invert_tuple(struct nf_conntrack_tuple *tuple, | |||
71 | } | 71 | } |
72 | 72 | ||
73 | /* Print out the per-protocol part of the tuple. */ | 73 | /* Print out the per-protocol part of the tuple. */ |
74 | static int udplite_print_tuple(struct seq_file *s, | 74 | static void udplite_print_tuple(struct seq_file *s, |
75 | const struct nf_conntrack_tuple *tuple) | 75 | const struct nf_conntrack_tuple *tuple) |
76 | { | 76 | { |
77 | return seq_printf(s, "sport=%hu dport=%hu ", | 77 | seq_printf(s, "sport=%hu dport=%hu ", |
78 | ntohs(tuple->src.u.udp.port), | 78 | ntohs(tuple->src.u.udp.port), |
79 | ntohs(tuple->dst.u.udp.port)); | 79 | ntohs(tuple->dst.u.udp.port)); |
80 | } | 80 | } |
81 | 81 | ||
82 | static unsigned int *udplite_get_timeouts(struct net *net) | 82 | static unsigned int *udplite_get_timeouts(struct net *net) |
diff --git a/net/netfilter/nf_conntrack_standalone.c b/net/netfilter/nf_conntrack_standalone.c index cf65a1e040dd..fc823fa5dcf5 100644 --- a/net/netfilter/nf_conntrack_standalone.c +++ b/net/netfilter/nf_conntrack_standalone.c | |||
@@ -36,12 +36,13 @@ | |||
36 | MODULE_LICENSE("GPL"); | 36 | MODULE_LICENSE("GPL"); |
37 | 37 | ||
38 | #ifdef CONFIG_NF_CONNTRACK_PROCFS | 38 | #ifdef CONFIG_NF_CONNTRACK_PROCFS |
39 | int | 39 | void |
40 | print_tuple(struct seq_file *s, const struct nf_conntrack_tuple *tuple, | 40 | print_tuple(struct seq_file *s, const struct nf_conntrack_tuple *tuple, |
41 | const struct nf_conntrack_l3proto *l3proto, | 41 | const struct nf_conntrack_l3proto *l3proto, |
42 | const struct nf_conntrack_l4proto *l4proto) | 42 | const struct nf_conntrack_l4proto *l4proto) |
43 | { | 43 | { |
44 | return l3proto->print_tuple(s, tuple) || l4proto->print_tuple(s, tuple); | 44 | l3proto->print_tuple(s, tuple); |
45 | l4proto->print_tuple(s, tuple); | ||
45 | } | 46 | } |
46 | EXPORT_SYMBOL_GPL(print_tuple); | 47 | EXPORT_SYMBOL_GPL(print_tuple); |
47 | 48 | ||
@@ -119,7 +120,7 @@ static void ct_seq_stop(struct seq_file *s, void *v) | |||
119 | } | 120 | } |
120 | 121 | ||
121 | #ifdef CONFIG_NF_CONNTRACK_SECMARK | 122 | #ifdef CONFIG_NF_CONNTRACK_SECMARK |
122 | static int ct_show_secctx(struct seq_file *s, const struct nf_conn *ct) | 123 | static void ct_show_secctx(struct seq_file *s, const struct nf_conn *ct) |
123 | { | 124 | { |
124 | int ret; | 125 | int ret; |
125 | u32 len; | 126 | u32 len; |
@@ -127,22 +128,20 @@ static int ct_show_secctx(struct seq_file *s, const struct nf_conn *ct) | |||
127 | 128 | ||
128 | ret = security_secid_to_secctx(ct->secmark, &secctx, &len); | 129 | ret = security_secid_to_secctx(ct->secmark, &secctx, &len); |
129 | if (ret) | 130 | if (ret) |
130 | return 0; | 131 | return; |
131 | 132 | ||
132 | ret = seq_printf(s, "secctx=%s ", secctx); | 133 | seq_printf(s, "secctx=%s ", secctx); |
133 | 134 | ||
134 | security_release_secctx(secctx, len); | 135 | security_release_secctx(secctx, len); |
135 | return ret; | ||
136 | } | 136 | } |
137 | #else | 137 | #else |
138 | static inline int ct_show_secctx(struct seq_file *s, const struct nf_conn *ct) | 138 | static inline void ct_show_secctx(struct seq_file *s, const struct nf_conn *ct) |
139 | { | 139 | { |
140 | return 0; | ||
141 | } | 140 | } |
142 | #endif | 141 | #endif |
143 | 142 | ||
144 | #ifdef CONFIG_NF_CONNTRACK_TIMESTAMP | 143 | #ifdef CONFIG_NF_CONNTRACK_TIMESTAMP |
145 | static int ct_show_delta_time(struct seq_file *s, const struct nf_conn *ct) | 144 | static void ct_show_delta_time(struct seq_file *s, const struct nf_conn *ct) |
146 | { | 145 | { |
147 | struct ct_iter_state *st = s->private; | 146 | struct ct_iter_state *st = s->private; |
148 | struct nf_conn_tstamp *tstamp; | 147 | struct nf_conn_tstamp *tstamp; |
@@ -156,16 +155,15 @@ static int ct_show_delta_time(struct seq_file *s, const struct nf_conn *ct) | |||
156 | else | 155 | else |
157 | delta_time = 0; | 156 | delta_time = 0; |
158 | 157 | ||
159 | return seq_printf(s, "delta-time=%llu ", | 158 | seq_printf(s, "delta-time=%llu ", |
160 | (unsigned long long)delta_time); | 159 | (unsigned long long)delta_time); |
161 | } | 160 | } |
162 | return 0; | 161 | return; |
163 | } | 162 | } |
164 | #else | 163 | #else |
165 | static inline int | 164 | static inline void |
166 | ct_show_delta_time(struct seq_file *s, const struct nf_conn *ct) | 165 | ct_show_delta_time(struct seq_file *s, const struct nf_conn *ct) |
167 | { | 166 | { |
168 | return 0; | ||
169 | } | 167 | } |
170 | #endif | 168 | #endif |
171 | 169 | ||
@@ -192,55 +190,54 @@ static int ct_seq_show(struct seq_file *s, void *v) | |||
192 | NF_CT_ASSERT(l4proto); | 190 | NF_CT_ASSERT(l4proto); |
193 | 191 | ||
194 | ret = -ENOSPC; | 192 | ret = -ENOSPC; |
195 | if (seq_printf(s, "%-8s %u %-8s %u %ld ", | 193 | seq_printf(s, "%-8s %u %-8s %u %ld ", |
196 | l3proto->name, nf_ct_l3num(ct), | 194 | l3proto->name, nf_ct_l3num(ct), |
197 | l4proto->name, nf_ct_protonum(ct), | 195 | l4proto->name, nf_ct_protonum(ct), |
198 | timer_pending(&ct->timeout) | 196 | timer_pending(&ct->timeout) |
199 | ? (long)(ct->timeout.expires - jiffies)/HZ : 0) != 0) | 197 | ? (long)(ct->timeout.expires - jiffies)/HZ : 0); |
200 | goto release; | ||
201 | 198 | ||
202 | if (l4proto->print_conntrack && l4proto->print_conntrack(s, ct)) | 199 | if (l4proto->print_conntrack) |
203 | goto release; | 200 | l4proto->print_conntrack(s, ct); |
201 | |||
202 | print_tuple(s, &ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple, | ||
203 | l3proto, l4proto); | ||
204 | 204 | ||
205 | if (print_tuple(s, &ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple, | 205 | if (seq_has_overflowed(s)) |
206 | l3proto, l4proto)) | ||
207 | goto release; | 206 | goto release; |
208 | 207 | ||
209 | if (seq_print_acct(s, ct, IP_CT_DIR_ORIGINAL)) | 208 | if (seq_print_acct(s, ct, IP_CT_DIR_ORIGINAL)) |
210 | goto release; | 209 | goto release; |
211 | 210 | ||
212 | if (!(test_bit(IPS_SEEN_REPLY_BIT, &ct->status))) | 211 | if (!(test_bit(IPS_SEEN_REPLY_BIT, &ct->status))) |
213 | if (seq_printf(s, "[UNREPLIED] ")) | 212 | seq_printf(s, "[UNREPLIED] "); |
214 | goto release; | ||
215 | 213 | ||
216 | if (print_tuple(s, &ct->tuplehash[IP_CT_DIR_REPLY].tuple, | 214 | print_tuple(s, &ct->tuplehash[IP_CT_DIR_REPLY].tuple, |
217 | l3proto, l4proto)) | 215 | l3proto, l4proto); |
218 | goto release; | ||
219 | 216 | ||
220 | if (seq_print_acct(s, ct, IP_CT_DIR_REPLY)) | 217 | if (seq_print_acct(s, ct, IP_CT_DIR_REPLY)) |
221 | goto release; | 218 | goto release; |
222 | 219 | ||
223 | if (test_bit(IPS_ASSURED_BIT, &ct->status)) | 220 | if (test_bit(IPS_ASSURED_BIT, &ct->status)) |
224 | if (seq_printf(s, "[ASSURED] ")) | 221 | seq_printf(s, "[ASSURED] "); |
225 | goto release; | ||
226 | 222 | ||
227 | #if defined(CONFIG_NF_CONNTRACK_MARK) | 223 | if (seq_has_overflowed(s)) |
228 | if (seq_printf(s, "mark=%u ", ct->mark)) | ||
229 | goto release; | 224 | goto release; |
225 | |||
226 | #if defined(CONFIG_NF_CONNTRACK_MARK) | ||
227 | seq_printf(s, "mark=%u ", ct->mark); | ||
230 | #endif | 228 | #endif |
231 | 229 | ||
232 | if (ct_show_secctx(s, ct)) | 230 | ct_show_secctx(s, ct); |
233 | goto release; | ||
234 | 231 | ||
235 | #ifdef CONFIG_NF_CONNTRACK_ZONES | 232 | #ifdef CONFIG_NF_CONNTRACK_ZONES |
236 | if (seq_printf(s, "zone=%u ", nf_ct_zone(ct))) | 233 | seq_printf(s, "zone=%u ", nf_ct_zone(ct)); |
237 | goto release; | ||
238 | #endif | 234 | #endif |
239 | 235 | ||
240 | if (ct_show_delta_time(s, ct)) | 236 | ct_show_delta_time(s, ct); |
241 | goto release; | 237 | |
238 | seq_printf(s, "use=%u\n", atomic_read(&ct->ct_general.use)); | ||
242 | 239 | ||
243 | if (seq_printf(s, "use=%u\n", atomic_read(&ct->ct_general.use))) | 240 | if (seq_has_overflowed(s)) |
244 | goto release; | 241 | goto release; |
245 | 242 | ||
246 | ret = 0; | 243 | ret = 0; |
diff --git a/net/netfilter/nf_log.c b/net/netfilter/nf_log.c index d7197649dba6..6e3b9117db1f 100644 --- a/net/netfilter/nf_log.c +++ b/net/netfilter/nf_log.c | |||
@@ -294,19 +294,19 @@ static int seq_show(struct seq_file *s, void *v) | |||
294 | { | 294 | { |
295 | loff_t *pos = v; | 295 | loff_t *pos = v; |
296 | const struct nf_logger *logger; | 296 | const struct nf_logger *logger; |
297 | int i, ret; | 297 | int i; |
298 | struct net *net = seq_file_net(s); | 298 | struct net *net = seq_file_net(s); |
299 | 299 | ||
300 | logger = rcu_dereference_protected(net->nf.nf_loggers[*pos], | 300 | logger = rcu_dereference_protected(net->nf.nf_loggers[*pos], |
301 | lockdep_is_held(&nf_log_mutex)); | 301 | lockdep_is_held(&nf_log_mutex)); |
302 | 302 | ||
303 | if (!logger) | 303 | if (!logger) |
304 | ret = seq_printf(s, "%2lld NONE (", *pos); | 304 | seq_printf(s, "%2lld NONE (", *pos); |
305 | else | 305 | else |
306 | ret = seq_printf(s, "%2lld %s (", *pos, logger->name); | 306 | seq_printf(s, "%2lld %s (", *pos, logger->name); |
307 | 307 | ||
308 | if (ret < 0) | 308 | if (seq_has_overflowed(s)) |
309 | return ret; | 309 | return -ENOSPC; |
310 | 310 | ||
311 | for (i = 0; i < NF_LOG_TYPE_MAX; i++) { | 311 | for (i = 0; i < NF_LOG_TYPE_MAX; i++) { |
312 | if (loggers[*pos][i] == NULL) | 312 | if (loggers[*pos][i] == NULL) |
@@ -314,17 +314,19 @@ static int seq_show(struct seq_file *s, void *v) | |||
314 | 314 | ||
315 | logger = rcu_dereference_protected(loggers[*pos][i], | 315 | logger = rcu_dereference_protected(loggers[*pos][i], |
316 | lockdep_is_held(&nf_log_mutex)); | 316 | lockdep_is_held(&nf_log_mutex)); |
317 | ret = seq_printf(s, "%s", logger->name); | 317 | seq_printf(s, "%s", logger->name); |
318 | if (ret < 0) | 318 | if (i == 0 && loggers[*pos][i + 1] != NULL) |
319 | return ret; | 319 | seq_printf(s, ","); |
320 | if (i == 0 && loggers[*pos][i + 1] != NULL) { | 320 | |
321 | ret = seq_printf(s, ","); | 321 | if (seq_has_overflowed(s)) |
322 | if (ret < 0) | 322 | return -ENOSPC; |
323 | return ret; | ||
324 | } | ||
325 | } | 323 | } |
326 | 324 | ||
327 | return seq_printf(s, ")\n"); | 325 | seq_printf(s, ")\n"); |
326 | |||
327 | if (seq_has_overflowed(s)) | ||
328 | return -ENOSPC; | ||
329 | return 0; | ||
328 | } | 330 | } |
329 | 331 | ||
330 | static const struct seq_operations nflog_seq_ops = { | 332 | static const struct seq_operations nflog_seq_ops = { |
diff --git a/net/netfilter/nfnetlink_queue_core.c b/net/netfilter/nfnetlink_queue_core.c index 7c60ccd61a3e..0db8515e76da 100644 --- a/net/netfilter/nfnetlink_queue_core.c +++ b/net/netfilter/nfnetlink_queue_core.c | |||
@@ -1242,12 +1242,13 @@ static int seq_show(struct seq_file *s, void *v) | |||
1242 | { | 1242 | { |
1243 | const struct nfqnl_instance *inst = v; | 1243 | const struct nfqnl_instance *inst = v; |
1244 | 1244 | ||
1245 | return seq_printf(s, "%5d %6d %5d %1d %5d %5d %5d %8d %2d\n", | 1245 | seq_printf(s, "%5d %6d %5d %1d %5d %5d %5d %8d %2d\n", |
1246 | inst->queue_num, | 1246 | inst->queue_num, |
1247 | inst->peer_portid, inst->queue_total, | 1247 | inst->peer_portid, inst->queue_total, |
1248 | inst->copy_mode, inst->copy_range, | 1248 | inst->copy_mode, inst->copy_range, |
1249 | inst->queue_dropped, inst->queue_user_dropped, | 1249 | inst->queue_dropped, inst->queue_user_dropped, |
1250 | inst->id_sequence, 1); | 1250 | inst->id_sequence, 1); |
1251 | return seq_has_overflowed(s); | ||
1251 | } | 1252 | } |
1252 | 1253 | ||
1253 | static const struct seq_operations nfqnl_seq_ops = { | 1254 | static const struct seq_operations nfqnl_seq_ops = { |
diff --git a/net/netfilter/x_tables.c b/net/netfilter/x_tables.c index 133eb4772f12..51a459c3c649 100644 --- a/net/netfilter/x_tables.c +++ b/net/netfilter/x_tables.c | |||
@@ -947,9 +947,10 @@ static int xt_table_seq_show(struct seq_file *seq, void *v) | |||
947 | { | 947 | { |
948 | struct xt_table *table = list_entry(v, struct xt_table, list); | 948 | struct xt_table *table = list_entry(v, struct xt_table, list); |
949 | 949 | ||
950 | if (strlen(table->name)) | 950 | if (strlen(table->name)) { |
951 | return seq_printf(seq, "%s\n", table->name); | 951 | seq_printf(seq, "%s\n", table->name); |
952 | else | 952 | return seq_has_overflowed(seq); |
953 | } else | ||
953 | return 0; | 954 | return 0; |
954 | } | 955 | } |
955 | 956 | ||
@@ -1086,8 +1087,10 @@ static int xt_match_seq_show(struct seq_file *seq, void *v) | |||
1086 | if (trav->curr == trav->head) | 1087 | if (trav->curr == trav->head) |
1087 | return 0; | 1088 | return 0; |
1088 | match = list_entry(trav->curr, struct xt_match, list); | 1089 | match = list_entry(trav->curr, struct xt_match, list); |
1089 | return (*match->name == '\0') ? 0 : | 1090 | if (*match->name == '\0') |
1090 | seq_printf(seq, "%s\n", match->name); | 1091 | return 0; |
1092 | seq_printf(seq, "%s\n", match->name); | ||
1093 | return seq_has_overflowed(seq); | ||
1091 | } | 1094 | } |
1092 | return 0; | 1095 | return 0; |
1093 | } | 1096 | } |
@@ -1139,8 +1142,10 @@ static int xt_target_seq_show(struct seq_file *seq, void *v) | |||
1139 | if (trav->curr == trav->head) | 1142 | if (trav->curr == trav->head) |
1140 | return 0; | 1143 | return 0; |
1141 | target = list_entry(trav->curr, struct xt_target, list); | 1144 | target = list_entry(trav->curr, struct xt_target, list); |
1142 | return (*target->name == '\0') ? 0 : | 1145 | if (*target->name == '\0') |
1143 | seq_printf(seq, "%s\n", target->name); | 1146 | return 0; |
1147 | seq_printf(seq, "%s\n", target->name); | ||
1148 | return seq_has_overflowed(seq); | ||
1144 | } | 1149 | } |
1145 | return 0; | 1150 | return 0; |
1146 | } | 1151 | } |
diff --git a/net/netfilter/xt_hashlimit.c b/net/netfilter/xt_hashlimit.c index 05fbc2a0be46..178696852bde 100644 --- a/net/netfilter/xt_hashlimit.c +++ b/net/netfilter/xt_hashlimit.c | |||
@@ -789,7 +789,6 @@ static void dl_seq_stop(struct seq_file *s, void *v) | |||
789 | static int dl_seq_real_show(struct dsthash_ent *ent, u_int8_t family, | 789 | static int dl_seq_real_show(struct dsthash_ent *ent, u_int8_t family, |
790 | struct seq_file *s) | 790 | struct seq_file *s) |
791 | { | 791 | { |
792 | int res; | ||
793 | const struct xt_hashlimit_htable *ht = s->private; | 792 | const struct xt_hashlimit_htable *ht = s->private; |
794 | 793 | ||
795 | spin_lock(&ent->lock); | 794 | spin_lock(&ent->lock); |
@@ -798,33 +797,32 @@ static int dl_seq_real_show(struct dsthash_ent *ent, u_int8_t family, | |||
798 | 797 | ||
799 | switch (family) { | 798 | switch (family) { |
800 | case NFPROTO_IPV4: | 799 | case NFPROTO_IPV4: |
801 | res = seq_printf(s, "%ld %pI4:%u->%pI4:%u %u %u %u\n", | 800 | seq_printf(s, "%ld %pI4:%u->%pI4:%u %u %u %u\n", |
802 | (long)(ent->expires - jiffies)/HZ, | 801 | (long)(ent->expires - jiffies)/HZ, |
803 | &ent->dst.ip.src, | 802 | &ent->dst.ip.src, |
804 | ntohs(ent->dst.src_port), | 803 | ntohs(ent->dst.src_port), |
805 | &ent->dst.ip.dst, | 804 | &ent->dst.ip.dst, |
806 | ntohs(ent->dst.dst_port), | 805 | ntohs(ent->dst.dst_port), |
807 | ent->rateinfo.credit, ent->rateinfo.credit_cap, | 806 | ent->rateinfo.credit, ent->rateinfo.credit_cap, |
808 | ent->rateinfo.cost); | 807 | ent->rateinfo.cost); |
809 | break; | 808 | break; |
810 | #if IS_ENABLED(CONFIG_IP6_NF_IPTABLES) | 809 | #if IS_ENABLED(CONFIG_IP6_NF_IPTABLES) |
811 | case NFPROTO_IPV6: | 810 | case NFPROTO_IPV6: |
812 | res = seq_printf(s, "%ld %pI6:%u->%pI6:%u %u %u %u\n", | 811 | seq_printf(s, "%ld %pI6:%u->%pI6:%u %u %u %u\n", |
813 | (long)(ent->expires - jiffies)/HZ, | 812 | (long)(ent->expires - jiffies)/HZ, |
814 | &ent->dst.ip6.src, | 813 | &ent->dst.ip6.src, |
815 | ntohs(ent->dst.src_port), | 814 | ntohs(ent->dst.src_port), |
816 | &ent->dst.ip6.dst, | 815 | &ent->dst.ip6.dst, |
817 | ntohs(ent->dst.dst_port), | 816 | ntohs(ent->dst.dst_port), |
818 | ent->rateinfo.credit, ent->rateinfo.credit_cap, | 817 | ent->rateinfo.credit, ent->rateinfo.credit_cap, |
819 | ent->rateinfo.cost); | 818 | ent->rateinfo.cost); |
820 | break; | 819 | break; |
821 | #endif | 820 | #endif |
822 | default: | 821 | default: |
823 | BUG(); | 822 | BUG(); |
824 | res = 0; | ||
825 | } | 823 | } |
826 | spin_unlock(&ent->lock); | 824 | spin_unlock(&ent->lock); |
827 | return res; | 825 | return seq_has_overflowed(s); |
828 | } | 826 | } |
829 | 827 | ||
830 | static int dl_seq_show(struct seq_file *s, void *v) | 828 | static int dl_seq_show(struct seq_file *s, void *v) |
diff --git a/security/commoncap.c b/security/commoncap.c index bab0611afc1e..2915d8503054 100644 --- a/security/commoncap.c +++ b/security/commoncap.c | |||
@@ -446,7 +446,7 @@ static int get_file_caps(struct linux_binprm *bprm, bool *effective, bool *has_c | |||
446 | if (bprm->file->f_path.mnt->mnt_flags & MNT_NOSUID) | 446 | if (bprm->file->f_path.mnt->mnt_flags & MNT_NOSUID) |
447 | return 0; | 447 | return 0; |
448 | 448 | ||
449 | dentry = dget(bprm->file->f_dentry); | 449 | dentry = dget(bprm->file->f_path.dentry); |
450 | 450 | ||
451 | rc = get_vfs_caps_from_disk(dentry, &vcaps); | 451 | rc = get_vfs_caps_from_disk(dentry, &vcaps); |
452 | if (rc < 0) { | 452 | if (rc < 0) { |
diff --git a/security/integrity/ima/ima_api.c b/security/integrity/ima/ima_api.c index 86885979918c..f92be1b14089 100644 --- a/security/integrity/ima/ima_api.c +++ b/security/integrity/ima/ima_api.c | |||
@@ -196,7 +196,7 @@ int ima_collect_measurement(struct integrity_iint_cache *iint, | |||
196 | { | 196 | { |
197 | const char *audit_cause = "failed"; | 197 | const char *audit_cause = "failed"; |
198 | struct inode *inode = file_inode(file); | 198 | struct inode *inode = file_inode(file); |
199 | const char *filename = file->f_dentry->d_name.name; | 199 | const char *filename = file->f_path.dentry->d_name.name; |
200 | int result = 0; | 200 | int result = 0; |
201 | struct { | 201 | struct { |
202 | struct ima_digest_data hdr; | 202 | struct ima_digest_data hdr; |
@@ -204,7 +204,7 @@ int ima_collect_measurement(struct integrity_iint_cache *iint, | |||
204 | } hash; | 204 | } hash; |
205 | 205 | ||
206 | if (xattr_value) | 206 | if (xattr_value) |
207 | *xattr_len = ima_read_xattr(file->f_dentry, xattr_value); | 207 | *xattr_len = ima_read_xattr(file->f_path.dentry, xattr_value); |
208 | 208 | ||
209 | if (!(iint->flags & IMA_COLLECTED)) { | 209 | if (!(iint->flags & IMA_COLLECTED)) { |
210 | u64 i_version = file_inode(file)->i_version; | 210 | u64 i_version = file_inode(file)->i_version; |
diff --git a/security/integrity/ima/ima_appraise.c b/security/integrity/ima/ima_appraise.c index 7c8f41e618b6..fffcdb0b31f0 100644 --- a/security/integrity/ima/ima_appraise.c +++ b/security/integrity/ima/ima_appraise.c | |||
@@ -189,7 +189,7 @@ int ima_appraise_measurement(int func, struct integrity_iint_cache *iint, | |||
189 | { | 189 | { |
190 | static const char op[] = "appraise_data"; | 190 | static const char op[] = "appraise_data"; |
191 | char *cause = "unknown"; | 191 | char *cause = "unknown"; |
192 | struct dentry *dentry = file->f_dentry; | 192 | struct dentry *dentry = file->f_path.dentry; |
193 | struct inode *inode = dentry->d_inode; | 193 | struct inode *inode = dentry->d_inode; |
194 | enum integrity_status status = INTEGRITY_UNKNOWN; | 194 | enum integrity_status status = INTEGRITY_UNKNOWN; |
195 | int rc = xattr_len, hash_start = 0; | 195 | int rc = xattr_len, hash_start = 0; |
@@ -289,7 +289,7 @@ out: | |||
289 | */ | 289 | */ |
290 | void ima_update_xattr(struct integrity_iint_cache *iint, struct file *file) | 290 | void ima_update_xattr(struct integrity_iint_cache *iint, struct file *file) |
291 | { | 291 | { |
292 | struct dentry *dentry = file->f_dentry; | 292 | struct dentry *dentry = file->f_path.dentry; |
293 | int rc = 0; | 293 | int rc = 0; |
294 | 294 | ||
295 | /* do not collect and update hash for digital signatures */ | 295 | /* do not collect and update hash for digital signatures */ |
diff --git a/security/integrity/ima/ima_template_lib.c b/security/integrity/ima/ima_template_lib.c index 1506f0248572..bcfc36cbde6a 100644 --- a/security/integrity/ima/ima_template_lib.c +++ b/security/integrity/ima/ima_template_lib.c | |||
@@ -284,7 +284,7 @@ static int ima_eventname_init_common(struct integrity_iint_cache *iint, | |||
284 | } | 284 | } |
285 | 285 | ||
286 | if (file) { | 286 | if (file) { |
287 | cur_filename = file->f_dentry->d_name.name; | 287 | cur_filename = file->f_path.dentry->d_name.name; |
288 | cur_filename_len = strlen(cur_filename); | 288 | cur_filename_len = strlen(cur_filename); |
289 | } else | 289 | } else |
290 | /* | 290 | /* |
diff --git a/security/selinux/selinuxfs.c b/security/selinux/selinuxfs.c index c71737f6d1cc..33db1ad4fd10 100644 --- a/security/selinux/selinuxfs.c +++ b/security/selinux/selinuxfs.c | |||
@@ -1200,7 +1200,7 @@ static void sel_remove_entries(struct dentry *de) | |||
1200 | spin_lock(&de->d_lock); | 1200 | spin_lock(&de->d_lock); |
1201 | node = de->d_subdirs.next; | 1201 | node = de->d_subdirs.next; |
1202 | while (node != &de->d_subdirs) { | 1202 | while (node != &de->d_subdirs) { |
1203 | struct dentry *d = list_entry(node, struct dentry, d_u.d_child); | 1203 | struct dentry *d = list_entry(node, struct dentry, d_child); |
1204 | 1204 | ||
1205 | spin_lock_nested(&d->d_lock, DENTRY_D_LOCK_NESTED); | 1205 | spin_lock_nested(&d->d_lock, DENTRY_D_LOCK_NESTED); |
1206 | list_del_init(node); | 1206 | list_del_init(node); |
@@ -1674,12 +1674,12 @@ static void sel_remove_classes(void) | |||
1674 | 1674 | ||
1675 | list_for_each(class_node, &class_dir->d_subdirs) { | 1675 | list_for_each(class_node, &class_dir->d_subdirs) { |
1676 | struct dentry *class_subdir = list_entry(class_node, | 1676 | struct dentry *class_subdir = list_entry(class_node, |
1677 | struct dentry, d_u.d_child); | 1677 | struct dentry, d_child); |
1678 | struct list_head *class_subdir_node; | 1678 | struct list_head *class_subdir_node; |
1679 | 1679 | ||
1680 | list_for_each(class_subdir_node, &class_subdir->d_subdirs) { | 1680 | list_for_each(class_subdir_node, &class_subdir->d_subdirs) { |
1681 | struct dentry *d = list_entry(class_subdir_node, | 1681 | struct dentry *d = list_entry(class_subdir_node, |
1682 | struct dentry, d_u.d_child); | 1682 | struct dentry, d_child); |
1683 | 1683 | ||
1684 | if (d->d_inode) | 1684 | if (d->d_inode) |
1685 | if (d->d_inode->i_mode & S_IFDIR) | 1685 | if (d->d_inode->i_mode & S_IFDIR) |
diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c index d515ec25ae9f..433ae61e7f42 100644 --- a/security/smack/smack_lsm.c +++ b/security/smack/smack_lsm.c | |||
@@ -166,9 +166,9 @@ static int smk_bu_file(struct file *file, int mode, int rc) | |||
166 | return rc; | 166 | return rc; |
167 | 167 | ||
168 | smk_bu_mode(mode, acc); | 168 | smk_bu_mode(mode, acc); |
169 | pr_info("Smack Bringup: (%s %s %s) file=(%s %ld %s) %s\n", | 169 | pr_info("Smack Bringup: (%s %s %s) file=(%s %ld %pD) %s\n", |
170 | sskp->smk_known, (char *)file->f_security, acc, | 170 | sskp->smk_known, (char *)file->f_security, acc, |
171 | inode->i_sb->s_id, inode->i_ino, file->f_dentry->d_name.name, | 171 | inode->i_sb->s_id, inode->i_ino, file, |
172 | current->comm); | 172 | current->comm); |
173 | return 0; | 173 | return 0; |
174 | } | 174 | } |
@@ -189,9 +189,9 @@ static int smk_bu_credfile(const struct cred *cred, struct file *file, | |||
189 | return rc; | 189 | return rc; |
190 | 190 | ||
191 | smk_bu_mode(mode, acc); | 191 | smk_bu_mode(mode, acc); |
192 | pr_info("Smack Bringup: (%s %s %s) file=(%s %ld %s) %s\n", | 192 | pr_info("Smack Bringup: (%s %s %s) file=(%s %ld %pD) %s\n", |
193 | sskp->smk_known, smk_of_inode(inode)->smk_known, acc, | 193 | sskp->smk_known, smk_of_inode(inode)->smk_known, acc, |
194 | inode->i_sb->s_id, inode->i_ino, file->f_dentry->d_name.name, | 194 | inode->i_sb->s_id, inode->i_ino, file, |
195 | current->comm); | 195 | current->comm); |
196 | return 0; | 196 | return 0; |
197 | } | 197 | } |