diff options
398 files changed, 3202 insertions, 2897 deletions
| @@ -1,7 +1,7 @@ | |||
| 1 | VERSION = 4 | 1 | VERSION = 4 |
| 2 | PATCHLEVEL = 0 | 2 | PATCHLEVEL = 1 |
| 3 | SUBLEVEL = 0 | 3 | SUBLEVEL = 0 |
| 4 | EXTRAVERSION = | 4 | EXTRAVERSION = -rc1 |
| 5 | NAME = Hurr durr I'ma sheep | 5 | NAME = Hurr durr I'ma sheep |
| 6 | 6 | ||
| 7 | # *DOCUMENTATION* | 7 | # *DOCUMENTATION* |
diff --git a/arch/ia64/kernel/perfmon.c b/arch/ia64/kernel/perfmon.c index 5f4243f0acfa..60e02f7747ff 100644 --- a/arch/ia64/kernel/perfmon.c +++ b/arch/ia64/kernel/perfmon.c | |||
| @@ -2159,7 +2159,7 @@ static const struct file_operations pfm_file_ops = { | |||
| 2159 | static char *pfmfs_dname(struct dentry *dentry, char *buffer, int buflen) | 2159 | static char *pfmfs_dname(struct dentry *dentry, char *buffer, int buflen) |
| 2160 | { | 2160 | { |
| 2161 | return dynamic_dname(dentry, buffer, buflen, "pfm:[%lu]", | 2161 | return dynamic_dname(dentry, buffer, buflen, "pfm:[%lu]", |
| 2162 | dentry->d_inode->i_ino); | 2162 | d_inode(dentry)->i_ino); |
| 2163 | } | 2163 | } |
| 2164 | 2164 | ||
| 2165 | static const struct dentry_operations pfmfs_dentry_operations = { | 2165 | static const struct dentry_operations pfmfs_dentry_operations = { |
diff --git a/arch/powerpc/platforms/cell/spufs/inode.c b/arch/powerpc/platforms/cell/spufs/inode.c index 1a3429e1ccb5..1ba6307be4db 100644 --- a/arch/powerpc/platforms/cell/spufs/inode.c +++ b/arch/powerpc/platforms/cell/spufs/inode.c | |||
| @@ -111,7 +111,7 @@ out: | |||
| 111 | static int | 111 | static int |
| 112 | spufs_setattr(struct dentry *dentry, struct iattr *attr) | 112 | spufs_setattr(struct dentry *dentry, struct iattr *attr) |
| 113 | { | 113 | { |
| 114 | struct inode *inode = dentry->d_inode; | 114 | struct inode *inode = d_inode(dentry); |
| 115 | 115 | ||
| 116 | if ((attr->ia_valid & ATTR_SIZE) && | 116 | if ((attr->ia_valid & ATTR_SIZE) && |
| 117 | (attr->ia_size != inode->i_size)) | 117 | (attr->ia_size != inode->i_size)) |
| @@ -163,14 +163,14 @@ static void spufs_prune_dir(struct dentry *dir) | |||
| 163 | { | 163 | { |
| 164 | struct dentry *dentry, *tmp; | 164 | struct dentry *dentry, *tmp; |
| 165 | 165 | ||
| 166 | mutex_lock(&dir->d_inode->i_mutex); | 166 | mutex_lock(&d_inode(dir)->i_mutex); |
| 167 | list_for_each_entry_safe(dentry, tmp, &dir->d_subdirs, d_child) { | 167 | list_for_each_entry_safe(dentry, tmp, &dir->d_subdirs, d_child) { |
| 168 | spin_lock(&dentry->d_lock); | 168 | spin_lock(&dentry->d_lock); |
| 169 | if (!(d_unhashed(dentry)) && dentry->d_inode) { | 169 | if (!(d_unhashed(dentry)) && d_really_is_positive(dentry)) { |
| 170 | dget_dlock(dentry); | 170 | dget_dlock(dentry); |
| 171 | __d_drop(dentry); | 171 | __d_drop(dentry); |
| 172 | spin_unlock(&dentry->d_lock); | 172 | spin_unlock(&dentry->d_lock); |
| 173 | simple_unlink(dir->d_inode, dentry); | 173 | simple_unlink(d_inode(dir), dentry); |
| 174 | /* XXX: what was dcache_lock protecting here? Other | 174 | /* XXX: what was dcache_lock protecting here? Other |
| 175 | * filesystems (IB, configfs) release dcache_lock | 175 | * filesystems (IB, configfs) release dcache_lock |
| 176 | * before unlink */ | 176 | * before unlink */ |
| @@ -180,7 +180,7 @@ static void spufs_prune_dir(struct dentry *dir) | |||
| 180 | } | 180 | } |
| 181 | } | 181 | } |
| 182 | shrink_dcache_parent(dir); | 182 | shrink_dcache_parent(dir); |
| 183 | mutex_unlock(&dir->d_inode->i_mutex); | 183 | mutex_unlock(&d_inode(dir)->i_mutex); |
| 184 | } | 184 | } |
| 185 | 185 | ||
| 186 | /* Caller must hold parent->i_mutex */ | 186 | /* Caller must hold parent->i_mutex */ |
| @@ -192,7 +192,7 @@ static int spufs_rmdir(struct inode *parent, struct dentry *dir) | |||
| 192 | d_drop(dir); | 192 | d_drop(dir); |
| 193 | res = simple_rmdir(parent, dir); | 193 | res = simple_rmdir(parent, dir); |
| 194 | /* We have to give up the mm_struct */ | 194 | /* We have to give up the mm_struct */ |
| 195 | spu_forget(SPUFS_I(dir->d_inode)->i_ctx); | 195 | spu_forget(SPUFS_I(d_inode(dir))->i_ctx); |
| 196 | return res; | 196 | return res; |
| 197 | } | 197 | } |
| 198 | 198 | ||
| @@ -222,8 +222,8 @@ static int spufs_dir_close(struct inode *inode, struct file *file) | |||
| 222 | int ret; | 222 | int ret; |
| 223 | 223 | ||
| 224 | dir = file->f_path.dentry; | 224 | dir = file->f_path.dentry; |
| 225 | parent = dir->d_parent->d_inode; | 225 | parent = d_inode(dir->d_parent); |
| 226 | ctx = SPUFS_I(dir->d_inode)->i_ctx; | 226 | ctx = SPUFS_I(d_inode(dir))->i_ctx; |
| 227 | 227 | ||
| 228 | mutex_lock_nested(&parent->i_mutex, I_MUTEX_PARENT); | 228 | mutex_lock_nested(&parent->i_mutex, I_MUTEX_PARENT); |
| 229 | ret = spufs_rmdir(parent, dir); | 229 | ret = spufs_rmdir(parent, dir); |
| @@ -460,7 +460,7 @@ spufs_create_context(struct inode *inode, struct dentry *dentry, | |||
| 460 | goto out_aff_unlock; | 460 | goto out_aff_unlock; |
| 461 | 461 | ||
| 462 | if (affinity) { | 462 | if (affinity) { |
| 463 | spufs_set_affinity(flags, SPUFS_I(dentry->d_inode)->i_ctx, | 463 | spufs_set_affinity(flags, SPUFS_I(d_inode(dentry))->i_ctx, |
| 464 | neighbor); | 464 | neighbor); |
| 465 | if (neighbor) | 465 | if (neighbor) |
| 466 | put_spu_context(neighbor); | 466 | put_spu_context(neighbor); |
| @@ -504,7 +504,7 @@ spufs_mkgang(struct inode *dir, struct dentry *dentry, umode_t mode) | |||
| 504 | 504 | ||
| 505 | d_instantiate(dentry, inode); | 505 | d_instantiate(dentry, inode); |
| 506 | inc_nlink(dir); | 506 | inc_nlink(dir); |
| 507 | inc_nlink(dentry->d_inode); | 507 | inc_nlink(d_inode(dentry)); |
| 508 | return ret; | 508 | return ret; |
| 509 | 509 | ||
| 510 | out_iput: | 510 | out_iput: |
| @@ -561,7 +561,7 @@ static struct file_system_type spufs_type; | |||
| 561 | long spufs_create(struct path *path, struct dentry *dentry, | 561 | long spufs_create(struct path *path, struct dentry *dentry, |
| 562 | unsigned int flags, umode_t mode, struct file *filp) | 562 | unsigned int flags, umode_t mode, struct file *filp) |
| 563 | { | 563 | { |
| 564 | struct inode *dir = path->dentry->d_inode; | 564 | struct inode *dir = d_inode(path->dentry); |
| 565 | int ret; | 565 | int ret; |
| 566 | 566 | ||
| 567 | /* check if we are on spufs */ | 567 | /* check if we are on spufs */ |
diff --git a/arch/s390/hypfs/inode.c b/arch/s390/hypfs/inode.c index 3f5c799b7fb5..d3f896a35b98 100644 --- a/arch/s390/hypfs/inode.c +++ b/arch/s390/hypfs/inode.c | |||
| @@ -48,7 +48,7 @@ static struct dentry *hypfs_last_dentry; | |||
| 48 | static void hypfs_update_update(struct super_block *sb) | 48 | static void hypfs_update_update(struct super_block *sb) |
| 49 | { | 49 | { |
| 50 | struct hypfs_sb_info *sb_info = sb->s_fs_info; | 50 | struct hypfs_sb_info *sb_info = sb->s_fs_info; |
| 51 | struct inode *inode = sb_info->update_file->d_inode; | 51 | struct inode *inode = d_inode(sb_info->update_file); |
| 52 | 52 | ||
| 53 | sb_info->last_update = get_seconds(); | 53 | sb_info->last_update = get_seconds(); |
| 54 | inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; | 54 | inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; |
| @@ -64,7 +64,7 @@ static void hypfs_add_dentry(struct dentry *dentry) | |||
| 64 | 64 | ||
| 65 | static inline int hypfs_positive(struct dentry *dentry) | 65 | static inline int hypfs_positive(struct dentry *dentry) |
| 66 | { | 66 | { |
| 67 | return dentry->d_inode && !d_unhashed(dentry); | 67 | return d_really_is_positive(dentry) && !d_unhashed(dentry); |
| 68 | } | 68 | } |
| 69 | 69 | ||
| 70 | static void hypfs_remove(struct dentry *dentry) | 70 | static void hypfs_remove(struct dentry *dentry) |
| @@ -72,16 +72,16 @@ static void hypfs_remove(struct dentry *dentry) | |||
| 72 | struct dentry *parent; | 72 | struct dentry *parent; |
| 73 | 73 | ||
| 74 | parent = dentry->d_parent; | 74 | parent = dentry->d_parent; |
| 75 | mutex_lock(&parent->d_inode->i_mutex); | 75 | mutex_lock(&d_inode(parent)->i_mutex); |
| 76 | if (hypfs_positive(dentry)) { | 76 | if (hypfs_positive(dentry)) { |
| 77 | if (d_is_dir(dentry)) | 77 | if (d_is_dir(dentry)) |
| 78 | simple_rmdir(parent->d_inode, dentry); | 78 | simple_rmdir(d_inode(parent), dentry); |
| 79 | else | 79 | else |
| 80 | simple_unlink(parent->d_inode, dentry); | 80 | simple_unlink(d_inode(parent), dentry); |
| 81 | } | 81 | } |
| 82 | d_delete(dentry); | 82 | d_delete(dentry); |
| 83 | dput(dentry); | 83 | dput(dentry); |
| 84 | mutex_unlock(&parent->d_inode->i_mutex); | 84 | mutex_unlock(&d_inode(parent)->i_mutex); |
| 85 | } | 85 | } |
| 86 | 86 | ||
| 87 | static void hypfs_delete_tree(struct dentry *root) | 87 | static void hypfs_delete_tree(struct dentry *root) |
| @@ -336,7 +336,7 @@ static struct dentry *hypfs_create_file(struct dentry *parent, const char *name, | |||
| 336 | struct dentry *dentry; | 336 | struct dentry *dentry; |
| 337 | struct inode *inode; | 337 | struct inode *inode; |
| 338 | 338 | ||
| 339 | mutex_lock(&parent->d_inode->i_mutex); | 339 | mutex_lock(&d_inode(parent)->i_mutex); |
| 340 | dentry = lookup_one_len(name, parent, strlen(name)); | 340 | dentry = lookup_one_len(name, parent, strlen(name)); |
| 341 | if (IS_ERR(dentry)) { | 341 | if (IS_ERR(dentry)) { |
| 342 | dentry = ERR_PTR(-ENOMEM); | 342 | dentry = ERR_PTR(-ENOMEM); |
| @@ -357,14 +357,14 @@ static struct dentry *hypfs_create_file(struct dentry *parent, const char *name, | |||
| 357 | } else if (S_ISDIR(mode)) { | 357 | } else if (S_ISDIR(mode)) { |
| 358 | inode->i_op = &simple_dir_inode_operations; | 358 | inode->i_op = &simple_dir_inode_operations; |
| 359 | inode->i_fop = &simple_dir_operations; | 359 | inode->i_fop = &simple_dir_operations; |
| 360 | inc_nlink(parent->d_inode); | 360 | inc_nlink(d_inode(parent)); |
| 361 | } else | 361 | } else |
| 362 | BUG(); | 362 | BUG(); |
| 363 | inode->i_private = data; | 363 | inode->i_private = data; |
| 364 | d_instantiate(dentry, inode); | 364 | d_instantiate(dentry, inode); |
| 365 | dget(dentry); | 365 | dget(dentry); |
| 366 | fail: | 366 | fail: |
| 367 | mutex_unlock(&parent->d_inode->i_mutex); | 367 | mutex_unlock(&d_inode(parent)->i_mutex); |
| 368 | return dentry; | 368 | return dentry; |
| 369 | } | 369 | } |
| 370 | 370 | ||
diff --git a/arch/x86/ia32/ia32entry.S b/arch/x86/ia32/ia32entry.S index a821b1cd4fa7..72bf2680f819 100644 --- a/arch/x86/ia32/ia32entry.S +++ b/arch/x86/ia32/ia32entry.S | |||
| @@ -427,6 +427,13 @@ sysretl_from_sys_call: | |||
| 427 | * cs and ss are loaded from MSRs. | 427 | * cs and ss are loaded from MSRs. |
| 428 | * (Note: 32bit->32bit SYSRET is different: since r11 | 428 | * (Note: 32bit->32bit SYSRET is different: since r11 |
| 429 | * does not exist, it merely sets eflags.IF=1). | 429 | * does not exist, it merely sets eflags.IF=1). |
| 430 | * | ||
| 431 | * NB: On AMD CPUs with the X86_BUG_SYSRET_SS_ATTRS bug, the ss | ||
| 432 | * descriptor is not reinitialized. This means that we must | ||
| 433 | * avoid SYSRET with SS == NULL, which could happen if we schedule, | ||
| 434 | * exit the kernel, and re-enter using an interrupt vector. (All | ||
| 435 | * interrupt entries on x86_64 set SS to NULL.) We prevent that | ||
| 436 | * from happening by reloading SS in __switch_to. | ||
| 430 | */ | 437 | */ |
| 431 | USERGS_SYSRET32 | 438 | USERGS_SYSRET32 |
| 432 | 439 | ||
diff --git a/arch/x86/include/asm/cpufeature.h b/arch/x86/include/asm/cpufeature.h index 7ee9b94d9921..3d6606fb97d0 100644 --- a/arch/x86/include/asm/cpufeature.h +++ b/arch/x86/include/asm/cpufeature.h | |||
| @@ -265,6 +265,7 @@ | |||
| 265 | #define X86_BUG_11AP X86_BUG(5) /* Bad local APIC aka 11AP */ | 265 | #define X86_BUG_11AP X86_BUG(5) /* Bad local APIC aka 11AP */ |
| 266 | #define X86_BUG_FXSAVE_LEAK X86_BUG(6) /* FXSAVE leaks FOP/FIP/FOP */ | 266 | #define X86_BUG_FXSAVE_LEAK X86_BUG(6) /* FXSAVE leaks FOP/FIP/FOP */ |
| 267 | #define X86_BUG_CLFLUSH_MONITOR X86_BUG(7) /* AAI65, CLFLUSH required before MONITOR */ | 267 | #define X86_BUG_CLFLUSH_MONITOR X86_BUG(7) /* AAI65, CLFLUSH required before MONITOR */ |
| 268 | #define X86_BUG_SYSRET_SS_ATTRS X86_BUG(8) /* SYSRET doesn't fix up SS attrs */ | ||
| 268 | 269 | ||
| 269 | #if defined(__KERNEL__) && !defined(__ASSEMBLY__) | 270 | #if defined(__KERNEL__) && !defined(__ASSEMBLY__) |
| 270 | 271 | ||
diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c index fd470ebf924e..e4cf63301ff4 100644 --- a/arch/x86/kernel/cpu/amd.c +++ b/arch/x86/kernel/cpu/amd.c | |||
| @@ -720,6 +720,9 @@ static void init_amd(struct cpuinfo_x86 *c) | |||
| 720 | if (!cpu_has(c, X86_FEATURE_3DNOWPREFETCH)) | 720 | if (!cpu_has(c, X86_FEATURE_3DNOWPREFETCH)) |
| 721 | if (cpu_has(c, X86_FEATURE_3DNOW) || cpu_has(c, X86_FEATURE_LM)) | 721 | if (cpu_has(c, X86_FEATURE_3DNOW) || cpu_has(c, X86_FEATURE_LM)) |
| 722 | set_cpu_cap(c, X86_FEATURE_3DNOWPREFETCH); | 722 | set_cpu_cap(c, X86_FEATURE_3DNOWPREFETCH); |
| 723 | |||
| 724 | /* AMD CPUs don't reset SS attributes on SYSRET */ | ||
| 725 | set_cpu_bug(c, X86_BUG_SYSRET_SS_ATTRS); | ||
| 723 | } | 726 | } |
| 724 | 727 | ||
| 725 | #ifdef CONFIG_X86_32 | 728 | #ifdef CONFIG_X86_32 |
diff --git a/arch/x86/kernel/entry_64.S b/arch/x86/kernel/entry_64.S index c7b238494b31..02c2eff7478d 100644 --- a/arch/x86/kernel/entry_64.S +++ b/arch/x86/kernel/entry_64.S | |||
| @@ -295,6 +295,15 @@ system_call_fastpath: | |||
| 295 | * rflags from r11 (but RF and VM bits are forced to 0), | 295 | * rflags from r11 (but RF and VM bits are forced to 0), |
| 296 | * cs and ss are loaded from MSRs. | 296 | * cs and ss are loaded from MSRs. |
| 297 | * Restoration of rflags re-enables interrupts. | 297 | * Restoration of rflags re-enables interrupts. |
| 298 | * | ||
| 299 | * NB: On AMD CPUs with the X86_BUG_SYSRET_SS_ATTRS bug, the ss | ||
| 300 | * descriptor is not reinitialized. This means that we should | ||
| 301 | * avoid SYSRET with SS == NULL, which could happen if we schedule, | ||
| 302 | * exit the kernel, and re-enter using an interrupt vector. (All | ||
| 303 | * interrupt entries on x86_64 set SS to NULL.) We prevent that | ||
| 304 | * from happening by reloading SS in __switch_to. (Actually | ||
| 305 | * detecting the failure in 64-bit userspace is tricky but can be | ||
| 306 | * done.) | ||
| 298 | */ | 307 | */ |
| 299 | USERGS_SYSRET64 | 308 | USERGS_SYSRET64 |
| 300 | 309 | ||
diff --git a/arch/x86/kernel/process_64.c b/arch/x86/kernel/process_64.c index 4baaa972f52a..ddfdbf74f174 100644 --- a/arch/x86/kernel/process_64.c +++ b/arch/x86/kernel/process_64.c | |||
| @@ -419,6 +419,34 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p) | |||
| 419 | task_thread_info(prev_p)->flags & _TIF_WORK_CTXSW_PREV)) | 419 | task_thread_info(prev_p)->flags & _TIF_WORK_CTXSW_PREV)) |
| 420 | __switch_to_xtra(prev_p, next_p, tss); | 420 | __switch_to_xtra(prev_p, next_p, tss); |
| 421 | 421 | ||
| 422 | if (static_cpu_has_bug(X86_BUG_SYSRET_SS_ATTRS)) { | ||
| 423 | /* | ||
| 424 | * AMD CPUs have a misfeature: SYSRET sets the SS selector but | ||
| 425 | * does not update the cached descriptor. As a result, if we | ||
| 426 | * do SYSRET while SS is NULL, we'll end up in user mode with | ||
| 427 | * SS apparently equal to __USER_DS but actually unusable. | ||
| 428 | * | ||
| 429 | * The straightforward workaround would be to fix it up just | ||
| 430 | * before SYSRET, but that would slow down the system call | ||
| 431 | * fast paths. Instead, we ensure that SS is never NULL in | ||
| 432 | * system call context. We do this by replacing NULL SS | ||
| 433 | * selectors at every context switch. SYSCALL sets up a valid | ||
| 434 | * SS, so the only way to get NULL is to re-enter the kernel | ||
| 435 | * from CPL 3 through an interrupt. Since that can't happen | ||
| 436 | * in the same task as a running syscall, we are guaranteed to | ||
| 437 | * context switch between every interrupt vector entry and a | ||
| 438 | * subsequent SYSRET. | ||
| 439 | * | ||
| 440 | * We read SS first because SS reads are much faster than | ||
| 441 | * writes. Out of caution, we force SS to __KERNEL_DS even if | ||
| 442 | * it previously had a different non-NULL value. | ||
| 443 | */ | ||
| 444 | unsigned short ss_sel; | ||
| 445 | savesegment(ss, ss_sel); | ||
| 446 | if (ss_sel != __KERNEL_DS) | ||
| 447 | loadsegment(ss, __KERNEL_DS); | ||
| 448 | } | ||
| 449 | |||
| 422 | return prev_p; | 450 | return prev_p; |
| 423 | } | 451 | } |
| 424 | 452 | ||
diff --git a/arch/x86/kvm/assigned-dev.c b/arch/x86/kvm/assigned-dev.c index 6eb5c20ee373..d090ecf08809 100644 --- a/arch/x86/kvm/assigned-dev.c +++ b/arch/x86/kvm/assigned-dev.c | |||
| @@ -666,7 +666,7 @@ static int probe_sysfs_permissions(struct pci_dev *dev) | |||
| 666 | if (r) | 666 | if (r) |
| 667 | return r; | 667 | return r; |
| 668 | 668 | ||
| 669 | inode = path.dentry->d_inode; | 669 | inode = d_backing_inode(path.dentry); |
| 670 | 670 | ||
| 671 | r = inode_permission(inode, MAY_READ | MAY_WRITE | MAY_ACCESS); | 671 | r = inode_permission(inode, MAY_READ | MAY_WRITE | MAY_ACCESS); |
| 672 | path_put(&path); | 672 | path_put(&path); |
diff --git a/drivers/base/devtmpfs.c b/drivers/base/devtmpfs.c index 25798db14553..68f03141e432 100644 --- a/drivers/base/devtmpfs.c +++ b/drivers/base/devtmpfs.c | |||
| @@ -157,10 +157,10 @@ static int dev_mkdir(const char *name, umode_t mode) | |||
| 157 | if (IS_ERR(dentry)) | 157 | if (IS_ERR(dentry)) |
| 158 | return PTR_ERR(dentry); | 158 | return PTR_ERR(dentry); |
| 159 | 159 | ||
| 160 | err = vfs_mkdir(path.dentry->d_inode, dentry, mode); | 160 | err = vfs_mkdir(d_inode(path.dentry), dentry, mode); |
| 161 | if (!err) | 161 | if (!err) |
| 162 | /* mark as kernel-created inode */ | 162 | /* mark as kernel-created inode */ |
| 163 | dentry->d_inode->i_private = &thread; | 163 | d_inode(dentry)->i_private = &thread; |
| 164 | done_path_create(&path, dentry); | 164 | done_path_create(&path, dentry); |
| 165 | return err; | 165 | return err; |
| 166 | } | 166 | } |
| @@ -207,7 +207,7 @@ static int handle_create(const char *nodename, umode_t mode, kuid_t uid, | |||
| 207 | if (IS_ERR(dentry)) | 207 | if (IS_ERR(dentry)) |
| 208 | return PTR_ERR(dentry); | 208 | return PTR_ERR(dentry); |
| 209 | 209 | ||
| 210 | err = vfs_mknod(path.dentry->d_inode, dentry, mode, dev->devt); | 210 | err = vfs_mknod(d_inode(path.dentry), dentry, mode, dev->devt); |
| 211 | if (!err) { | 211 | if (!err) { |
| 212 | struct iattr newattrs; | 212 | struct iattr newattrs; |
| 213 | 213 | ||
| @@ -215,12 +215,12 @@ static int handle_create(const char *nodename, umode_t mode, kuid_t uid, | |||
| 215 | newattrs.ia_uid = uid; | 215 | newattrs.ia_uid = uid; |
| 216 | newattrs.ia_gid = gid; | 216 | newattrs.ia_gid = gid; |
| 217 | newattrs.ia_valid = ATTR_MODE|ATTR_UID|ATTR_GID; | 217 | newattrs.ia_valid = ATTR_MODE|ATTR_UID|ATTR_GID; |
| 218 | mutex_lock(&dentry->d_inode->i_mutex); | 218 | mutex_lock(&d_inode(dentry)->i_mutex); |
| 219 | notify_change(dentry, &newattrs, NULL); | 219 | notify_change(dentry, &newattrs, NULL); |
| 220 | mutex_unlock(&dentry->d_inode->i_mutex); | 220 | mutex_unlock(&d_inode(dentry)->i_mutex); |
| 221 | 221 | ||
| 222 | /* mark as kernel-created inode */ | 222 | /* mark as kernel-created inode */ |
| 223 | dentry->d_inode->i_private = &thread; | 223 | d_inode(dentry)->i_private = &thread; |
| 224 | } | 224 | } |
| 225 | done_path_create(&path, dentry); | 225 | done_path_create(&path, dentry); |
| 226 | return err; | 226 | return err; |
| @@ -235,16 +235,16 @@ static int dev_rmdir(const char *name) | |||
| 235 | dentry = kern_path_locked(name, &parent); | 235 | dentry = kern_path_locked(name, &parent); |
| 236 | if (IS_ERR(dentry)) | 236 | if (IS_ERR(dentry)) |
| 237 | return PTR_ERR(dentry); | 237 | return PTR_ERR(dentry); |
| 238 | if (dentry->d_inode) { | 238 | if (d_really_is_positive(dentry)) { |
| 239 | if (dentry->d_inode->i_private == &thread) | 239 | if (d_inode(dentry)->i_private == &thread) |
| 240 | err = vfs_rmdir(parent.dentry->d_inode, dentry); | 240 | err = vfs_rmdir(d_inode(parent.dentry), dentry); |
| 241 | else | 241 | else |
| 242 | err = -EPERM; | 242 | err = -EPERM; |
| 243 | } else { | 243 | } else { |
| 244 | err = -ENOENT; | 244 | err = -ENOENT; |
| 245 | } | 245 | } |
| 246 | dput(dentry); | 246 | dput(dentry); |
| 247 | mutex_unlock(&parent.dentry->d_inode->i_mutex); | 247 | mutex_unlock(&d_inode(parent.dentry)->i_mutex); |
| 248 | path_put(&parent); | 248 | path_put(&parent); |
| 249 | return err; | 249 | return err; |
| 250 | } | 250 | } |
| @@ -306,11 +306,11 @@ static int handle_remove(const char *nodename, struct device *dev) | |||
| 306 | if (IS_ERR(dentry)) | 306 | if (IS_ERR(dentry)) |
| 307 | return PTR_ERR(dentry); | 307 | return PTR_ERR(dentry); |
| 308 | 308 | ||
| 309 | if (dentry->d_inode) { | 309 | if (d_really_is_positive(dentry)) { |
| 310 | struct kstat stat; | 310 | struct kstat stat; |
| 311 | struct path p = {.mnt = parent.mnt, .dentry = dentry}; | 311 | struct path p = {.mnt = parent.mnt, .dentry = dentry}; |
| 312 | err = vfs_getattr(&p, &stat); | 312 | err = vfs_getattr(&p, &stat); |
| 313 | if (!err && dev_mynode(dev, dentry->d_inode, &stat)) { | 313 | if (!err && dev_mynode(dev, d_inode(dentry), &stat)) { |
| 314 | struct iattr newattrs; | 314 | struct iattr newattrs; |
| 315 | /* | 315 | /* |
| 316 | * before unlinking this node, reset permissions | 316 | * before unlinking this node, reset permissions |
| @@ -321,10 +321,10 @@ static int handle_remove(const char *nodename, struct device *dev) | |||
| 321 | newattrs.ia_mode = stat.mode & ~0777; | 321 | newattrs.ia_mode = stat.mode & ~0777; |
| 322 | newattrs.ia_valid = | 322 | newattrs.ia_valid = |
| 323 | ATTR_UID|ATTR_GID|ATTR_MODE; | 323 | ATTR_UID|ATTR_GID|ATTR_MODE; |
| 324 | mutex_lock(&dentry->d_inode->i_mutex); | 324 | mutex_lock(&d_inode(dentry)->i_mutex); |
| 325 | notify_change(dentry, &newattrs, NULL); | 325 | notify_change(dentry, &newattrs, NULL); |
| 326 | mutex_unlock(&dentry->d_inode->i_mutex); | 326 | mutex_unlock(&d_inode(dentry)->i_mutex); |
| 327 | err = vfs_unlink(parent.dentry->d_inode, dentry, NULL); | 327 | err = vfs_unlink(d_inode(parent.dentry), dentry, NULL); |
| 328 | if (!err || err == -ENOENT) | 328 | if (!err || err == -ENOENT) |
| 329 | deleted = 1; | 329 | deleted = 1; |
| 330 | } | 330 | } |
| @@ -332,7 +332,7 @@ static int handle_remove(const char *nodename, struct device *dev) | |||
| 332 | err = -ENOENT; | 332 | err = -ENOENT; |
| 333 | } | 333 | } |
| 334 | dput(dentry); | 334 | dput(dentry); |
| 335 | mutex_unlock(&parent.dentry->d_inode->i_mutex); | 335 | mutex_unlock(&d_inode(parent.dentry)->i_mutex); |
| 336 | 336 | ||
| 337 | path_put(&parent); | 337 | path_put(&parent); |
| 338 | if (deleted && strchr(nodename, '/')) | 338 | if (deleted && strchr(nodename, '/')) |
diff --git a/drivers/block/drbd/drbd_debugfs.c b/drivers/block/drbd/drbd_debugfs.c index 9a950022ff88..a6ee3d750c30 100644 --- a/drivers/block/drbd/drbd_debugfs.c +++ b/drivers/block/drbd/drbd_debugfs.c | |||
| @@ -424,7 +424,7 @@ static int in_flight_summary_show(struct seq_file *m, void *pos) | |||
| 424 | * So we have our own inline version of it above. :-( */ | 424 | * So we have our own inline version of it above. :-( */ |
| 425 | static inline int debugfs_positive(struct dentry *dentry) | 425 | static inline int debugfs_positive(struct dentry *dentry) |
| 426 | { | 426 | { |
| 427 | return dentry->d_inode && !d_unhashed(dentry); | 427 | return d_really_is_positive(dentry) && !d_unhashed(dentry); |
| 428 | } | 428 | } |
| 429 | 429 | ||
| 430 | /* make sure at *open* time that the respective object won't go away. */ | 430 | /* make sure at *open* time that the respective object won't go away. */ |
| @@ -439,15 +439,15 @@ static int drbd_single_open(struct file *file, int (*show)(struct seq_file *, vo | |||
| 439 | * or has debugfs_remove() already been called? */ | 439 | * or has debugfs_remove() already been called? */ |
| 440 | parent = file->f_path.dentry->d_parent; | 440 | parent = file->f_path.dentry->d_parent; |
| 441 | /* not sure if this can happen: */ | 441 | /* not sure if this can happen: */ |
| 442 | if (!parent || !parent->d_inode) | 442 | if (!parent || d_really_is_negative(parent)) |
| 443 | goto out; | 443 | goto out; |
| 444 | /* serialize with d_delete() */ | 444 | /* serialize with d_delete() */ |
| 445 | mutex_lock(&parent->d_inode->i_mutex); | 445 | mutex_lock(&d_inode(parent)->i_mutex); |
| 446 | /* Make sure the object is still alive */ | 446 | /* Make sure the object is still alive */ |
| 447 | if (debugfs_positive(file->f_path.dentry) | 447 | if (debugfs_positive(file->f_path.dentry) |
| 448 | && kref_get_unless_zero(kref)) | 448 | && kref_get_unless_zero(kref)) |
| 449 | ret = 0; | 449 | ret = 0; |
| 450 | mutex_unlock(&parent->d_inode->i_mutex); | 450 | mutex_unlock(&d_inode(parent)->i_mutex); |
| 451 | if (!ret) { | 451 | if (!ret) { |
| 452 | ret = single_open(file, show, data); | 452 | ret = single_open(file, show, data); |
| 453 | if (ret) | 453 | if (ret) |
diff --git a/drivers/i2c/busses/i2c-digicolor.c b/drivers/i2c/busses/i2c-digicolor.c index 03f1e5549896..9604024e0eb0 100644 --- a/drivers/i2c/busses/i2c-digicolor.c +++ b/drivers/i2c/busses/i2c-digicolor.c | |||
| @@ -12,11 +12,10 @@ | |||
| 12 | 12 | ||
| 13 | #include <linux/clk.h> | 13 | #include <linux/clk.h> |
| 14 | #include <linux/completion.h> | 14 | #include <linux/completion.h> |
| 15 | #include <linux/delay.h> | ||
| 15 | #include <linux/i2c.h> | 16 | #include <linux/i2c.h> |
| 16 | #include <linux/interrupt.h> | 17 | #include <linux/interrupt.h> |
| 17 | #include <linux/io.h> | 18 | #include <linux/io.h> |
| 18 | #include <linux/clk.h> | ||
| 19 | #include <linux/delay.h> | ||
| 20 | #include <linux/kernel.h> | 19 | #include <linux/kernel.h> |
| 21 | #include <linux/module.h> | 20 | #include <linux/module.h> |
| 22 | #include <linux/of.h> | 21 | #include <linux/of.h> |
diff --git a/drivers/i2c/busses/i2c-mxs.c b/drivers/i2c/busses/i2c-mxs.c index 56fceff6ba14..3e84f6c090a5 100644 --- a/drivers/i2c/busses/i2c-mxs.c +++ b/drivers/i2c/busses/i2c-mxs.c | |||
| @@ -913,7 +913,7 @@ static void __exit mxs_i2c_exit(void) | |||
| 913 | module_exit(mxs_i2c_exit); | 913 | module_exit(mxs_i2c_exit); |
| 914 | 914 | ||
| 915 | MODULE_AUTHOR("Marek Vasut <marex@denx.de>"); | 915 | MODULE_AUTHOR("Marek Vasut <marex@denx.de>"); |
| 916 | MODULE_AUTHOR("Wolfram Sang <w.sang@pengutronix.de>"); | 916 | MODULE_AUTHOR("Wolfram Sang <kernel@pengutronix.de>"); |
| 917 | MODULE_DESCRIPTION("MXS I2C Bus Driver"); | 917 | MODULE_DESCRIPTION("MXS I2C Bus Driver"); |
| 918 | MODULE_LICENSE("GPL"); | 918 | MODULE_LICENSE("GPL"); |
| 919 | MODULE_ALIAS("platform:" DRIVER_NAME); | 919 | MODULE_ALIAS("platform:" DRIVER_NAME); |
diff --git a/drivers/i2c/busses/i2c-pca-platform.c b/drivers/i2c/busses/i2c-pca-platform.c index 6336f02ec566..3bd2e7d06e4b 100644 --- a/drivers/i2c/busses/i2c-pca-platform.c +++ b/drivers/i2c/busses/i2c-pca-platform.c | |||
| @@ -285,6 +285,6 @@ static struct platform_driver i2c_pca_pf_driver = { | |||
| 285 | 285 | ||
| 286 | module_platform_driver(i2c_pca_pf_driver); | 286 | module_platform_driver(i2c_pca_pf_driver); |
| 287 | 287 | ||
| 288 | MODULE_AUTHOR("Wolfram Sang <w.sang@pengutronix.de>"); | 288 | MODULE_AUTHOR("Wolfram Sang <kernel@pengutronix.de>"); |
| 289 | MODULE_DESCRIPTION("I2C-PCA9564/PCA9665 platform driver"); | 289 | MODULE_DESCRIPTION("I2C-PCA9564/PCA9665 platform driver"); |
| 290 | MODULE_LICENSE("GPL"); | 290 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/i2c/busses/i2c-rk3x.c b/drivers/i2c/busses/i2c-rk3x.c index 5f96b1b3e3a5..019d5426fe52 100644 --- a/drivers/i2c/busses/i2c-rk3x.c +++ b/drivers/i2c/busses/i2c-rk3x.c | |||
| @@ -833,7 +833,7 @@ static int rk3x_i2c_xfer(struct i2c_adapter *adap, | |||
| 833 | clk_disable(i2c->clk); | 833 | clk_disable(i2c->clk); |
| 834 | spin_unlock_irqrestore(&i2c->lock, flags); | 834 | spin_unlock_irqrestore(&i2c->lock, flags); |
| 835 | 835 | ||
| 836 | return ret; | 836 | return ret < 0 ? ret : num; |
| 837 | } | 837 | } |
| 838 | 838 | ||
| 839 | static u32 rk3x_i2c_func(struct i2c_adapter *adap) | 839 | static u32 rk3x_i2c_func(struct i2c_adapter *adap) |
diff --git a/drivers/i2c/busses/i2c-st.c b/drivers/i2c/busses/i2c-st.c index 88057fad9dfe..ea72dca32fdf 100644 --- a/drivers/i2c/busses/i2c-st.c +++ b/drivers/i2c/busses/i2c-st.c | |||
| @@ -10,17 +10,18 @@ | |||
| 10 | * published by the Free Software Foundation. | 10 | * published by the Free Software Foundation. |
| 11 | */ | 11 | */ |
| 12 | 12 | ||
| 13 | #include <linux/module.h> | ||
| 14 | #include <linux/platform_device.h> | ||
| 15 | #include <linux/i2c.h> | ||
| 16 | #include <linux/clk.h> | 13 | #include <linux/clk.h> |
| 17 | #include <linux/io.h> | ||
| 18 | #include <linux/delay.h> | 14 | #include <linux/delay.h> |
| 19 | #include <linux/interrupt.h> | ||
| 20 | #include <linux/err.h> | 15 | #include <linux/err.h> |
| 21 | #include <linux/of.h> | 16 | #include <linux/i2c.h> |
| 17 | #include <linux/interrupt.h> | ||
| 18 | #include <linux/io.h> | ||
| 19 | #include <linux/module.h> | ||
| 22 | #include <linux/of_address.h> | 20 | #include <linux/of_address.h> |
| 23 | #include <linux/of_irq.h> | 21 | #include <linux/of_irq.h> |
| 22 | #include <linux/of.h> | ||
| 23 | #include <linux/pinctrl/consumer.h> | ||
| 24 | #include <linux/platform_device.h> | ||
| 24 | 25 | ||
| 25 | /* SSC registers */ | 26 | /* SSC registers */ |
| 26 | #define SSC_BRG 0x000 | 27 | #define SSC_BRG 0x000 |
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c index 098f698fe8f4..987c124432c5 100644 --- a/drivers/i2c/i2c-core.c +++ b/drivers/i2c/i2c-core.c | |||
| @@ -1413,6 +1413,8 @@ static int i2c_register_adapter(struct i2c_adapter *adap) | |||
| 1413 | 1413 | ||
| 1414 | dev_dbg(&adap->dev, "adapter [%s] registered\n", adap->name); | 1414 | dev_dbg(&adap->dev, "adapter [%s] registered\n", adap->name); |
| 1415 | 1415 | ||
| 1416 | pm_runtime_no_callbacks(&adap->dev); | ||
| 1417 | |||
| 1416 | #ifdef CONFIG_I2C_COMPAT | 1418 | #ifdef CONFIG_I2C_COMPAT |
| 1417 | res = class_compat_create_link(i2c_adapter_compat_class, &adap->dev, | 1419 | res = class_compat_create_link(i2c_adapter_compat_class, &adap->dev, |
| 1418 | adap->dev.parent); | 1420 | adap->dev.parent); |
diff --git a/drivers/i2c/i2c-mux.c b/drivers/i2c/i2c-mux.c index 593f7ca9adc7..06cc1ff088f1 100644 --- a/drivers/i2c/i2c-mux.c +++ b/drivers/i2c/i2c-mux.c | |||
| @@ -32,8 +32,9 @@ struct i2c_mux_priv { | |||
| 32 | struct i2c_algorithm algo; | 32 | struct i2c_algorithm algo; |
| 33 | 33 | ||
| 34 | struct i2c_adapter *parent; | 34 | struct i2c_adapter *parent; |
| 35 | void *mux_priv; /* the mux chip/device */ | 35 | struct device *mux_dev; |
| 36 | u32 chan_id; /* the channel id */ | 36 | void *mux_priv; |
| 37 | u32 chan_id; | ||
| 37 | 38 | ||
| 38 | int (*select)(struct i2c_adapter *, void *mux_priv, u32 chan_id); | 39 | int (*select)(struct i2c_adapter *, void *mux_priv, u32 chan_id); |
| 39 | int (*deselect)(struct i2c_adapter *, void *mux_priv, u32 chan_id); | 40 | int (*deselect)(struct i2c_adapter *, void *mux_priv, u32 chan_id); |
| @@ -119,6 +120,7 @@ struct i2c_adapter *i2c_add_mux_adapter(struct i2c_adapter *parent, | |||
| 119 | 120 | ||
| 120 | /* Set up private adapter data */ | 121 | /* Set up private adapter data */ |
| 121 | priv->parent = parent; | 122 | priv->parent = parent; |
| 123 | priv->mux_dev = mux_dev; | ||
| 122 | priv->mux_priv = mux_priv; | 124 | priv->mux_priv = mux_priv; |
| 123 | priv->chan_id = chan_id; | 125 | priv->chan_id = chan_id; |
| 124 | priv->select = select; | 126 | priv->select = select; |
| @@ -203,7 +205,7 @@ void i2c_del_mux_adapter(struct i2c_adapter *adap) | |||
| 203 | char symlink_name[20]; | 205 | char symlink_name[20]; |
| 204 | 206 | ||
| 205 | snprintf(symlink_name, sizeof(symlink_name), "channel-%u", priv->chan_id); | 207 | snprintf(symlink_name, sizeof(symlink_name), "channel-%u", priv->chan_id); |
| 206 | sysfs_remove_link(&adap->dev.parent->kobj, symlink_name); | 208 | sysfs_remove_link(&priv->mux_dev->kobj, symlink_name); |
| 207 | 209 | ||
| 208 | sysfs_remove_link(&priv->adap.dev.kobj, "mux_device"); | 210 | sysfs_remove_link(&priv->adap.dev.kobj, "mux_device"); |
| 209 | i2c_del_adapter(adap); | 211 | i2c_del_adapter(adap); |
diff --git a/drivers/infiniband/hw/ipath/ipath_fs.c b/drivers/infiniband/hw/ipath/ipath_fs.c index 33c45dfcbd88..1ca8e32a9592 100644 --- a/drivers/infiniband/hw/ipath/ipath_fs.c +++ b/drivers/infiniband/hw/ipath/ipath_fs.c | |||
| @@ -82,14 +82,14 @@ static int create_file(const char *name, umode_t mode, | |||
| 82 | { | 82 | { |
| 83 | int error; | 83 | int error; |
| 84 | 84 | ||
| 85 | mutex_lock(&parent->d_inode->i_mutex); | 85 | mutex_lock(&d_inode(parent)->i_mutex); |
| 86 | *dentry = lookup_one_len(name, parent, strlen(name)); | 86 | *dentry = lookup_one_len(name, parent, strlen(name)); |
| 87 | if (!IS_ERR(*dentry)) | 87 | if (!IS_ERR(*dentry)) |
| 88 | error = ipathfs_mknod(parent->d_inode, *dentry, | 88 | error = ipathfs_mknod(d_inode(parent), *dentry, |
| 89 | mode, fops, data); | 89 | mode, fops, data); |
| 90 | else | 90 | else |
| 91 | error = PTR_ERR(*dentry); | 91 | error = PTR_ERR(*dentry); |
| 92 | mutex_unlock(&parent->d_inode->i_mutex); | 92 | mutex_unlock(&d_inode(parent)->i_mutex); |
| 93 | 93 | ||
| 94 | return error; | 94 | return error; |
| 95 | } | 95 | } |
| @@ -277,11 +277,11 @@ static int remove_file(struct dentry *parent, char *name) | |||
| 277 | } | 277 | } |
| 278 | 278 | ||
| 279 | spin_lock(&tmp->d_lock); | 279 | spin_lock(&tmp->d_lock); |
| 280 | if (!d_unhashed(tmp) && tmp->d_inode) { | 280 | if (!d_unhashed(tmp) && d_really_is_positive(tmp)) { |
| 281 | dget_dlock(tmp); | 281 | dget_dlock(tmp); |
| 282 | __d_drop(tmp); | 282 | __d_drop(tmp); |
| 283 | spin_unlock(&tmp->d_lock); | 283 | spin_unlock(&tmp->d_lock); |
| 284 | simple_unlink(parent->d_inode, tmp); | 284 | simple_unlink(d_inode(parent), tmp); |
| 285 | } else | 285 | } else |
| 286 | spin_unlock(&tmp->d_lock); | 286 | spin_unlock(&tmp->d_lock); |
| 287 | 287 | ||
| @@ -302,7 +302,7 @@ static int remove_device_files(struct super_block *sb, | |||
| 302 | int ret; | 302 | int ret; |
| 303 | 303 | ||
| 304 | root = dget(sb->s_root); | 304 | root = dget(sb->s_root); |
| 305 | mutex_lock(&root->d_inode->i_mutex); | 305 | mutex_lock(&d_inode(root)->i_mutex); |
| 306 | snprintf(unit, sizeof unit, "%02d", dd->ipath_unit); | 306 | snprintf(unit, sizeof unit, "%02d", dd->ipath_unit); |
| 307 | dir = lookup_one_len(unit, root, strlen(unit)); | 307 | dir = lookup_one_len(unit, root, strlen(unit)); |
| 308 | 308 | ||
| @@ -315,10 +315,10 @@ static int remove_device_files(struct super_block *sb, | |||
| 315 | remove_file(dir, "flash"); | 315 | remove_file(dir, "flash"); |
| 316 | remove_file(dir, "atomic_counters"); | 316 | remove_file(dir, "atomic_counters"); |
| 317 | d_delete(dir); | 317 | d_delete(dir); |
| 318 | ret = simple_rmdir(root->d_inode, dir); | 318 | ret = simple_rmdir(d_inode(root), dir); |
| 319 | 319 | ||
| 320 | bail: | 320 | bail: |
| 321 | mutex_unlock(&root->d_inode->i_mutex); | 321 | mutex_unlock(&d_inode(root)->i_mutex); |
| 322 | dput(root); | 322 | dput(root); |
| 323 | return ret; | 323 | return ret; |
| 324 | } | 324 | } |
diff --git a/drivers/infiniband/hw/qib/qib_fs.c b/drivers/infiniband/hw/qib/qib_fs.c index 650897a8591e..bdd5d3857203 100644 --- a/drivers/infiniband/hw/qib/qib_fs.c +++ b/drivers/infiniband/hw/qib/qib_fs.c | |||
| @@ -89,14 +89,14 @@ static int create_file(const char *name, umode_t mode, | |||
| 89 | { | 89 | { |
| 90 | int error; | 90 | int error; |
| 91 | 91 | ||
| 92 | mutex_lock(&parent->d_inode->i_mutex); | 92 | mutex_lock(&d_inode(parent)->i_mutex); |
| 93 | *dentry = lookup_one_len(name, parent, strlen(name)); | 93 | *dentry = lookup_one_len(name, parent, strlen(name)); |
| 94 | if (!IS_ERR(*dentry)) | 94 | if (!IS_ERR(*dentry)) |
| 95 | error = qibfs_mknod(parent->d_inode, *dentry, | 95 | error = qibfs_mknod(d_inode(parent), *dentry, |
| 96 | mode, fops, data); | 96 | mode, fops, data); |
| 97 | else | 97 | else |
| 98 | error = PTR_ERR(*dentry); | 98 | error = PTR_ERR(*dentry); |
| 99 | mutex_unlock(&parent->d_inode->i_mutex); | 99 | mutex_unlock(&d_inode(parent)->i_mutex); |
| 100 | 100 | ||
| 101 | return error; | 101 | return error; |
| 102 | } | 102 | } |
| @@ -455,10 +455,10 @@ static int remove_file(struct dentry *parent, char *name) | |||
| 455 | } | 455 | } |
| 456 | 456 | ||
| 457 | spin_lock(&tmp->d_lock); | 457 | spin_lock(&tmp->d_lock); |
| 458 | if (!d_unhashed(tmp) && tmp->d_inode) { | 458 | if (!d_unhashed(tmp) && d_really_is_positive(tmp)) { |
| 459 | __d_drop(tmp); | 459 | __d_drop(tmp); |
| 460 | spin_unlock(&tmp->d_lock); | 460 | spin_unlock(&tmp->d_lock); |
| 461 | simple_unlink(parent->d_inode, tmp); | 461 | simple_unlink(d_inode(parent), tmp); |
| 462 | } else { | 462 | } else { |
| 463 | spin_unlock(&tmp->d_lock); | 463 | spin_unlock(&tmp->d_lock); |
| 464 | } | 464 | } |
| @@ -481,7 +481,7 @@ static int remove_device_files(struct super_block *sb, | |||
| 481 | int ret, i; | 481 | int ret, i; |
| 482 | 482 | ||
| 483 | root = dget(sb->s_root); | 483 | root = dget(sb->s_root); |
| 484 | mutex_lock(&root->d_inode->i_mutex); | 484 | mutex_lock(&d_inode(root)->i_mutex); |
| 485 | snprintf(unit, sizeof(unit), "%u", dd->unit); | 485 | snprintf(unit, sizeof(unit), "%u", dd->unit); |
| 486 | dir = lookup_one_len(unit, root, strlen(unit)); | 486 | dir = lookup_one_len(unit, root, strlen(unit)); |
| 487 | 487 | ||
| @@ -491,7 +491,7 @@ static int remove_device_files(struct super_block *sb, | |||
| 491 | goto bail; | 491 | goto bail; |
| 492 | } | 492 | } |
| 493 | 493 | ||
| 494 | mutex_lock(&dir->d_inode->i_mutex); | 494 | mutex_lock(&d_inode(dir)->i_mutex); |
| 495 | remove_file(dir, "counters"); | 495 | remove_file(dir, "counters"); |
| 496 | remove_file(dir, "counter_names"); | 496 | remove_file(dir, "counter_names"); |
| 497 | remove_file(dir, "portcounter_names"); | 497 | remove_file(dir, "portcounter_names"); |
| @@ -506,13 +506,13 @@ static int remove_device_files(struct super_block *sb, | |||
| 506 | } | 506 | } |
| 507 | } | 507 | } |
| 508 | remove_file(dir, "flash"); | 508 | remove_file(dir, "flash"); |
| 509 | mutex_unlock(&dir->d_inode->i_mutex); | 509 | mutex_unlock(&d_inode(dir)->i_mutex); |
| 510 | ret = simple_rmdir(root->d_inode, dir); | 510 | ret = simple_rmdir(d_inode(root), dir); |
| 511 | d_delete(dir); | 511 | d_delete(dir); |
| 512 | dput(dir); | 512 | dput(dir); |
| 513 | 513 | ||
| 514 | bail: | 514 | bail: |
| 515 | mutex_unlock(&root->d_inode->i_mutex); | 515 | mutex_unlock(&d_inode(root)->i_mutex); |
| 516 | dput(root); | 516 | dput(root); |
| 517 | return ret; | 517 | return ret; |
| 518 | } | 518 | } |
diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c index a35927cd42e5..68d43beccb7e 100644 --- a/drivers/iommu/intel-iommu.c +++ b/drivers/iommu/intel-iommu.c | |||
| @@ -50,6 +50,7 @@ | |||
| 50 | #define CONTEXT_SIZE VTD_PAGE_SIZE | 50 | #define CONTEXT_SIZE VTD_PAGE_SIZE |
| 51 | 51 | ||
| 52 | #define IS_GFX_DEVICE(pdev) ((pdev->class >> 16) == PCI_BASE_CLASS_DISPLAY) | 52 | #define IS_GFX_DEVICE(pdev) ((pdev->class >> 16) == PCI_BASE_CLASS_DISPLAY) |
| 53 | #define IS_USB_DEVICE(pdev) ((pdev->class >> 8) == PCI_CLASS_SERIAL_USB) | ||
| 53 | #define IS_ISA_DEVICE(pdev) ((pdev->class >> 8) == PCI_CLASS_BRIDGE_ISA) | 54 | #define IS_ISA_DEVICE(pdev) ((pdev->class >> 8) == PCI_CLASS_BRIDGE_ISA) |
| 54 | #define IS_AZALIA(pdev) ((pdev)->vendor == 0x8086 && (pdev)->device == 0x3a3e) | 55 | #define IS_AZALIA(pdev) ((pdev)->vendor == 0x8086 && (pdev)->device == 0x3a3e) |
| 55 | 56 | ||
| @@ -184,32 +185,11 @@ static int force_on = 0; | |||
| 184 | * 64-127: Reserved | 185 | * 64-127: Reserved |
| 185 | */ | 186 | */ |
| 186 | struct root_entry { | 187 | struct root_entry { |
| 187 | u64 val; | 188 | u64 lo; |
| 188 | u64 rsvd1; | 189 | u64 hi; |
| 189 | }; | 190 | }; |
| 190 | #define ROOT_ENTRY_NR (VTD_PAGE_SIZE/sizeof(struct root_entry)) | 191 | #define ROOT_ENTRY_NR (VTD_PAGE_SIZE/sizeof(struct root_entry)) |
| 191 | static inline bool root_present(struct root_entry *root) | ||
| 192 | { | ||
| 193 | return (root->val & 1); | ||
| 194 | } | ||
| 195 | static inline void set_root_present(struct root_entry *root) | ||
| 196 | { | ||
| 197 | root->val |= 1; | ||
| 198 | } | ||
| 199 | static inline void set_root_value(struct root_entry *root, unsigned long value) | ||
| 200 | { | ||
| 201 | root->val &= ~VTD_PAGE_MASK; | ||
| 202 | root->val |= value & VTD_PAGE_MASK; | ||
| 203 | } | ||
| 204 | 192 | ||
| 205 | static inline struct context_entry * | ||
| 206 | get_context_addr_from_root(struct root_entry *root) | ||
| 207 | { | ||
| 208 | return (struct context_entry *) | ||
| 209 | (root_present(root)?phys_to_virt( | ||
| 210 | root->val & VTD_PAGE_MASK) : | ||
| 211 | NULL); | ||
| 212 | } | ||
| 213 | 193 | ||
| 214 | /* | 194 | /* |
| 215 | * low 64 bits: | 195 | * low 64 bits: |
| @@ -682,6 +662,40 @@ static void domain_update_iommu_cap(struct dmar_domain *domain) | |||
| 682 | domain->iommu_superpage = domain_update_iommu_superpage(NULL); | 662 | domain->iommu_superpage = domain_update_iommu_superpage(NULL); |
| 683 | } | 663 | } |
| 684 | 664 | ||
| 665 | static inline struct context_entry *iommu_context_addr(struct intel_iommu *iommu, | ||
| 666 | u8 bus, u8 devfn, int alloc) | ||
| 667 | { | ||
| 668 | struct root_entry *root = &iommu->root_entry[bus]; | ||
| 669 | struct context_entry *context; | ||
| 670 | u64 *entry; | ||
| 671 | |||
| 672 | if (ecap_ecs(iommu->ecap)) { | ||
| 673 | if (devfn >= 0x80) { | ||
| 674 | devfn -= 0x80; | ||
| 675 | entry = &root->hi; | ||
| 676 | } | ||
| 677 | devfn *= 2; | ||
| 678 | } | ||
| 679 | entry = &root->lo; | ||
| 680 | if (*entry & 1) | ||
| 681 | context = phys_to_virt(*entry & VTD_PAGE_MASK); | ||
| 682 | else { | ||
| 683 | unsigned long phy_addr; | ||
| 684 | if (!alloc) | ||
| 685 | return NULL; | ||
| 686 | |||
| 687 | context = alloc_pgtable_page(iommu->node); | ||
| 688 | if (!context) | ||
| 689 | return NULL; | ||
| 690 | |||
| 691 | __iommu_flush_cache(iommu, (void *)context, CONTEXT_SIZE); | ||
| 692 | phy_addr = virt_to_phys((void *)context); | ||
| 693 | *entry = phy_addr | 1; | ||
| 694 | __iommu_flush_cache(iommu, entry, sizeof(*entry)); | ||
| 695 | } | ||
| 696 | return &context[devfn]; | ||
| 697 | } | ||
| 698 | |||
| 685 | static struct intel_iommu *device_to_iommu(struct device *dev, u8 *bus, u8 *devfn) | 699 | static struct intel_iommu *device_to_iommu(struct device *dev, u8 *bus, u8 *devfn) |
| 686 | { | 700 | { |
| 687 | struct dmar_drhd_unit *drhd = NULL; | 701 | struct dmar_drhd_unit *drhd = NULL; |
| @@ -741,75 +755,36 @@ static void domain_flush_cache(struct dmar_domain *domain, | |||
| 741 | clflush_cache_range(addr, size); | 755 | clflush_cache_range(addr, size); |
| 742 | } | 756 | } |
| 743 | 757 | ||
| 744 | /* Gets context entry for a given bus and devfn */ | ||
| 745 | static struct context_entry * device_to_context_entry(struct intel_iommu *iommu, | ||
| 746 | u8 bus, u8 devfn) | ||
| 747 | { | ||
| 748 | struct root_entry *root; | ||
| 749 | struct context_entry *context; | ||
| 750 | unsigned long phy_addr; | ||
| 751 | unsigned long flags; | ||
| 752 | |||
| 753 | spin_lock_irqsave(&iommu->lock, flags); | ||
| 754 | root = &iommu->root_entry[bus]; | ||
| 755 | context = get_context_addr_from_root(root); | ||
| 756 | if (!context) { | ||
| 757 | context = (struct context_entry *) | ||
| 758 | alloc_pgtable_page(iommu->node); | ||
| 759 | if (!context) { | ||
| 760 | spin_unlock_irqrestore(&iommu->lock, flags); | ||
| 761 | return NULL; | ||
| 762 | } | ||
| 763 | __iommu_flush_cache(iommu, (void *)context, CONTEXT_SIZE); | ||
| 764 | phy_addr = virt_to_phys((void *)context); | ||
| 765 | set_root_value(root, phy_addr); | ||
| 766 | set_root_present(root); | ||
| 767 | __iommu_flush_cache(iommu, root, sizeof(*root)); | ||
| 768 | } | ||
| 769 | spin_unlock_irqrestore(&iommu->lock, flags); | ||
| 770 | return &context[devfn]; | ||
| 771 | } | ||
| 772 | |||
| 773 | static int device_context_mapped(struct intel_iommu *iommu, u8 bus, u8 devfn) | 758 | static int device_context_mapped(struct intel_iommu *iommu, u8 bus, u8 devfn) |
| 774 | { | 759 | { |
| 775 | struct root_entry *root; | ||
| 776 | struct context_entry *context; | 760 | struct context_entry *context; |
| 777 | int ret; | 761 | int ret = 0; |
| 778 | unsigned long flags; | 762 | unsigned long flags; |
| 779 | 763 | ||
| 780 | spin_lock_irqsave(&iommu->lock, flags); | 764 | spin_lock_irqsave(&iommu->lock, flags); |
| 781 | root = &iommu->root_entry[bus]; | 765 | context = iommu_context_addr(iommu, bus, devfn, 0); |
| 782 | context = get_context_addr_from_root(root); | 766 | if (context) |
| 783 | if (!context) { | 767 | ret = context_present(context); |
| 784 | ret = 0; | ||
| 785 | goto out; | ||
| 786 | } | ||
| 787 | ret = context_present(&context[devfn]); | ||
| 788 | out: | ||
| 789 | spin_unlock_irqrestore(&iommu->lock, flags); | 768 | spin_unlock_irqrestore(&iommu->lock, flags); |
| 790 | return ret; | 769 | return ret; |
| 791 | } | 770 | } |
| 792 | 771 | ||
| 793 | static void clear_context_table(struct intel_iommu *iommu, u8 bus, u8 devfn) | 772 | static void clear_context_table(struct intel_iommu *iommu, u8 bus, u8 devfn) |
| 794 | { | 773 | { |
| 795 | struct root_entry *root; | ||
| 796 | struct context_entry *context; | 774 | struct context_entry *context; |
| 797 | unsigned long flags; | 775 | unsigned long flags; |
| 798 | 776 | ||
| 799 | spin_lock_irqsave(&iommu->lock, flags); | 777 | spin_lock_irqsave(&iommu->lock, flags); |
| 800 | root = &iommu->root_entry[bus]; | 778 | context = iommu_context_addr(iommu, bus, devfn, 0); |
| 801 | context = get_context_addr_from_root(root); | ||
| 802 | if (context) { | 779 | if (context) { |
| 803 | context_clear_entry(&context[devfn]); | 780 | context_clear_entry(context); |
| 804 | __iommu_flush_cache(iommu, &context[devfn], \ | 781 | __iommu_flush_cache(iommu, context, sizeof(*context)); |
| 805 | sizeof(*context)); | ||
| 806 | } | 782 | } |
| 807 | spin_unlock_irqrestore(&iommu->lock, flags); | 783 | spin_unlock_irqrestore(&iommu->lock, flags); |
| 808 | } | 784 | } |
| 809 | 785 | ||
| 810 | static void free_context_table(struct intel_iommu *iommu) | 786 | static void free_context_table(struct intel_iommu *iommu) |
| 811 | { | 787 | { |
| 812 | struct root_entry *root; | ||
| 813 | int i; | 788 | int i; |
| 814 | unsigned long flags; | 789 | unsigned long flags; |
| 815 | struct context_entry *context; | 790 | struct context_entry *context; |
| @@ -819,10 +794,17 @@ static void free_context_table(struct intel_iommu *iommu) | |||
| 819 | goto out; | 794 | goto out; |
| 820 | } | 795 | } |
| 821 | for (i = 0; i < ROOT_ENTRY_NR; i++) { | 796 | for (i = 0; i < ROOT_ENTRY_NR; i++) { |
| 822 | root = &iommu->root_entry[i]; | 797 | context = iommu_context_addr(iommu, i, 0, 0); |
| 823 | context = get_context_addr_from_root(root); | 798 | if (context) |
| 799 | free_pgtable_page(context); | ||
| 800 | |||
| 801 | if (!ecap_ecs(iommu->ecap)) | ||
| 802 | continue; | ||
| 803 | |||
| 804 | context = iommu_context_addr(iommu, i, 0x80, 0); | ||
| 824 | if (context) | 805 | if (context) |
| 825 | free_pgtable_page(context); | 806 | free_pgtable_page(context); |
| 807 | |||
| 826 | } | 808 | } |
| 827 | free_pgtable_page(iommu->root_entry); | 809 | free_pgtable_page(iommu->root_entry); |
| 828 | iommu->root_entry = NULL; | 810 | iommu->root_entry = NULL; |
| @@ -1146,14 +1128,16 @@ static int iommu_alloc_root_entry(struct intel_iommu *iommu) | |||
| 1146 | 1128 | ||
| 1147 | static void iommu_set_root_entry(struct intel_iommu *iommu) | 1129 | static void iommu_set_root_entry(struct intel_iommu *iommu) |
| 1148 | { | 1130 | { |
| 1149 | void *addr; | 1131 | u64 addr; |
| 1150 | u32 sts; | 1132 | u32 sts; |
| 1151 | unsigned long flag; | 1133 | unsigned long flag; |
| 1152 | 1134 | ||
| 1153 | addr = iommu->root_entry; | 1135 | addr = virt_to_phys(iommu->root_entry); |
| 1136 | if (ecap_ecs(iommu->ecap)) | ||
| 1137 | addr |= DMA_RTADDR_RTT; | ||
| 1154 | 1138 | ||
| 1155 | raw_spin_lock_irqsave(&iommu->register_lock, flag); | 1139 | raw_spin_lock_irqsave(&iommu->register_lock, flag); |
| 1156 | dmar_writeq(iommu->reg + DMAR_RTADDR_REG, virt_to_phys(addr)); | 1140 | dmar_writeq(iommu->reg + DMAR_RTADDR_REG, addr); |
| 1157 | 1141 | ||
| 1158 | writel(iommu->gcmd | DMA_GCMD_SRTP, iommu->reg + DMAR_GCMD_REG); | 1142 | writel(iommu->gcmd | DMA_GCMD_SRTP, iommu->reg + DMAR_GCMD_REG); |
| 1159 | 1143 | ||
| @@ -1800,7 +1784,9 @@ static int domain_context_mapping_one(struct dmar_domain *domain, | |||
| 1800 | BUG_ON(translation != CONTEXT_TT_PASS_THROUGH && | 1784 | BUG_ON(translation != CONTEXT_TT_PASS_THROUGH && |
| 1801 | translation != CONTEXT_TT_MULTI_LEVEL); | 1785 | translation != CONTEXT_TT_MULTI_LEVEL); |
| 1802 | 1786 | ||
| 1803 | context = device_to_context_entry(iommu, bus, devfn); | 1787 | spin_lock_irqsave(&iommu->lock, flags); |
| 1788 | context = iommu_context_addr(iommu, bus, devfn, 1); | ||
| 1789 | spin_unlock_irqrestore(&iommu->lock, flags); | ||
| 1804 | if (!context) | 1790 | if (!context) |
| 1805 | return -ENOMEM; | 1791 | return -ENOMEM; |
| 1806 | spin_lock_irqsave(&iommu->lock, flags); | 1792 | spin_lock_irqsave(&iommu->lock, flags); |
| @@ -2564,6 +2550,10 @@ static bool device_has_rmrr(struct device *dev) | |||
| 2564 | * In both cases we assume that PCI USB devices with RMRRs have them largely | 2550 | * In both cases we assume that PCI USB devices with RMRRs have them largely |
| 2565 | * for historical reasons and that the RMRR space is not actively used post | 2551 | * for historical reasons and that the RMRR space is not actively used post |
| 2566 | * boot. This exclusion may change if vendors begin to abuse it. | 2552 | * boot. This exclusion may change if vendors begin to abuse it. |
| 2553 | * | ||
| 2554 | * The same exception is made for graphics devices, with the requirement that | ||
| 2555 | * any use of the RMRR regions will be torn down before assigning the device | ||
| 2556 | * to a guest. | ||
| 2567 | */ | 2557 | */ |
| 2568 | static bool device_is_rmrr_locked(struct device *dev) | 2558 | static bool device_is_rmrr_locked(struct device *dev) |
| 2569 | { | 2559 | { |
| @@ -2573,7 +2563,7 @@ static bool device_is_rmrr_locked(struct device *dev) | |||
| 2573 | if (dev_is_pci(dev)) { | 2563 | if (dev_is_pci(dev)) { |
| 2574 | struct pci_dev *pdev = to_pci_dev(dev); | 2564 | struct pci_dev *pdev = to_pci_dev(dev); |
| 2575 | 2565 | ||
| 2576 | if ((pdev->class >> 8) == PCI_CLASS_SERIAL_USB) | 2566 | if (IS_USB_DEVICE(pdev) || IS_GFX_DEVICE(pdev)) |
| 2577 | return false; | 2567 | return false; |
| 2578 | } | 2568 | } |
| 2579 | 2569 | ||
diff --git a/drivers/iommu/intel_irq_remapping.c b/drivers/iommu/intel_irq_remapping.c index 6c25b3c5b729..5709ae9c3e77 100644 --- a/drivers/iommu/intel_irq_remapping.c +++ b/drivers/iommu/intel_irq_remapping.c | |||
| @@ -637,10 +637,7 @@ static int __init intel_enable_irq_remapping(void) | |||
| 637 | if (x2apic_supported()) { | 637 | if (x2apic_supported()) { |
| 638 | eim = !dmar_x2apic_optout(); | 638 | eim = !dmar_x2apic_optout(); |
| 639 | if (!eim) | 639 | if (!eim) |
| 640 | printk(KERN_WARNING | 640 | pr_info("x2apic is disabled because BIOS sets x2apic opt out bit. You can use 'intremap=no_x2apic_optout' to override the BIOS setting.\n"); |
| 641 | "Your BIOS is broken and requested that x2apic be disabled.\n" | ||
| 642 | "This will slightly decrease performance.\n" | ||
| 643 | "Use 'intremap=no_x2apic_optout' to override BIOS request.\n"); | ||
| 644 | } | 641 | } |
| 645 | 642 | ||
| 646 | for_each_iommu(iommu, drhd) { | 643 | for_each_iommu(iommu, drhd) { |
diff --git a/drivers/mtd/ubi/build.c b/drivers/mtd/ubi/build.c index 9690cf9aaef5..b7f824d5ee88 100644 --- a/drivers/mtd/ubi/build.c +++ b/drivers/mtd/ubi/build.c | |||
| @@ -1169,9 +1169,9 @@ static struct mtd_info * __init open_mtd_by_chdev(const char *mtd_dev) | |||
| 1169 | return ERR_PTR(err); | 1169 | return ERR_PTR(err); |
| 1170 | 1170 | ||
| 1171 | /* MTD device number is defined by the major / minor numbers */ | 1171 | /* MTD device number is defined by the major / minor numbers */ |
| 1172 | major = imajor(path.dentry->d_inode); | 1172 | major = imajor(d_backing_inode(path.dentry)); |
| 1173 | minor = iminor(path.dentry->d_inode); | 1173 | minor = iminor(d_backing_inode(path.dentry)); |
| 1174 | mode = path.dentry->d_inode->i_mode; | 1174 | mode = d_backing_inode(path.dentry)->i_mode; |
| 1175 | path_put(&path); | 1175 | path_put(&path); |
| 1176 | if (major != MTD_CHAR_MAJOR || !S_ISCHR(mode)) | 1176 | if (major != MTD_CHAR_MAJOR || !S_ISCHR(mode)) |
| 1177 | return ERR_PTR(-EINVAL); | 1177 | return ERR_PTR(-EINVAL); |
diff --git a/drivers/mtd/ubi/kapi.c b/drivers/mtd/ubi/kapi.c index 478e00cf2d9e..e844887732fb 100644 --- a/drivers/mtd/ubi/kapi.c +++ b/drivers/mtd/ubi/kapi.c | |||
| @@ -314,7 +314,7 @@ struct ubi_volume_desc *ubi_open_volume_path(const char *pathname, int mode) | |||
| 314 | if (error) | 314 | if (error) |
| 315 | return ERR_PTR(error); | 315 | return ERR_PTR(error); |
| 316 | 316 | ||
| 317 | inode = path.dentry->d_inode; | 317 | inode = d_backing_inode(path.dentry); |
| 318 | mod = inode->i_mode; | 318 | mod = inode->i_mode; |
| 319 | ubi_num = ubi_major2num(imajor(inode)); | 319 | ubi_num = ubi_major2num(imajor(inode)); |
| 320 | vol_id = iminor(inode) - 1; | 320 | vol_id = iminor(inode) - 1; |
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c index f0285bcbe598..371f75e782e5 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c | |||
| @@ -538,7 +538,7 @@ static ssize_t tp_la_write(struct file *file, const char __user *buf, | |||
| 538 | char s[32]; | 538 | char s[32]; |
| 539 | unsigned long val; | 539 | unsigned long val; |
| 540 | size_t size = min(sizeof(s) - 1, count); | 540 | size_t size = min(sizeof(s) - 1, count); |
| 541 | struct adapter *adap = FILE_DATA(file)->i_private; | 541 | struct adapter *adap = file_inode(file)->i_private; |
| 542 | 542 | ||
| 543 | if (copy_from_user(s, buf, size)) | 543 | if (copy_from_user(s, buf, size)) |
| 544 | return -EFAULT; | 544 | return -EFAULT; |
| @@ -647,7 +647,7 @@ static int pm_stats_open(struct inode *inode, struct file *file) | |||
| 647 | static ssize_t pm_stats_clear(struct file *file, const char __user *buf, | 647 | static ssize_t pm_stats_clear(struct file *file, const char __user *buf, |
| 648 | size_t count, loff_t *pos) | 648 | size_t count, loff_t *pos) |
| 649 | { | 649 | { |
| 650 | struct adapter *adap = FILE_DATA(file)->i_private; | 650 | struct adapter *adap = file_inode(file)->i_private; |
| 651 | 651 | ||
| 652 | t4_write_reg(adap, PM_RX_STAT_CONFIG_A, 0); | 652 | t4_write_reg(adap, PM_RX_STAT_CONFIG_A, 0); |
| 653 | t4_write_reg(adap, PM_TX_STAT_CONFIG_A, 0); | 653 | t4_write_reg(adap, PM_TX_STAT_CONFIG_A, 0); |
| @@ -1005,7 +1005,7 @@ static ssize_t mbox_write(struct file *file, const char __user *buf, | |||
| 1005 | &data[7], &c) < 8 || c != '\n') | 1005 | &data[7], &c) < 8 || c != '\n') |
| 1006 | return -EINVAL; | 1006 | return -EINVAL; |
| 1007 | 1007 | ||
| 1008 | ino = FILE_DATA(file); | 1008 | ino = file_inode(file); |
| 1009 | mbox = (uintptr_t)ino->i_private & 7; | 1009 | mbox = (uintptr_t)ino->i_private & 7; |
| 1010 | adap = ino->i_private - mbox; | 1010 | adap = ino->i_private - mbox; |
| 1011 | addr = adap->regs + PF_REG(mbox, CIM_PF_MAILBOX_DATA_A); | 1011 | addr = adap->regs + PF_REG(mbox, CIM_PF_MAILBOX_DATA_A); |
| @@ -1034,7 +1034,7 @@ static ssize_t flash_read(struct file *file, char __user *buf, size_t count, | |||
| 1034 | loff_t *ppos) | 1034 | loff_t *ppos) |
| 1035 | { | 1035 | { |
| 1036 | loff_t pos = *ppos; | 1036 | loff_t pos = *ppos; |
| 1037 | loff_t avail = FILE_DATA(file)->i_size; | 1037 | loff_t avail = file_inode(file)->i_size; |
| 1038 | struct adapter *adap = file->private_data; | 1038 | struct adapter *adap = file->private_data; |
| 1039 | 1039 | ||
| 1040 | if (pos < 0) | 1040 | if (pos < 0) |
| @@ -1479,7 +1479,7 @@ static ssize_t rss_key_write(struct file *file, const char __user *buf, | |||
| 1479 | int i, j; | 1479 | int i, j; |
| 1480 | u32 key[10]; | 1480 | u32 key[10]; |
| 1481 | char s[100], *p; | 1481 | char s[100], *p; |
| 1482 | struct adapter *adap = FILE_DATA(file)->i_private; | 1482 | struct adapter *adap = file_inode(file)->i_private; |
| 1483 | 1483 | ||
| 1484 | if (count > sizeof(s) - 1) | 1484 | if (count > sizeof(s) - 1) |
| 1485 | return -EINVAL; | 1485 | return -EINVAL; |
| @@ -1951,12 +1951,6 @@ static const struct file_operations mem_debugfs_fops = { | |||
| 1951 | .llseek = default_llseek, | 1951 | .llseek = default_llseek, |
| 1952 | }; | 1952 | }; |
| 1953 | 1953 | ||
| 1954 | static void set_debugfs_file_size(struct dentry *de, loff_t size) | ||
| 1955 | { | ||
| 1956 | if (!IS_ERR(de) && de->d_inode) | ||
| 1957 | de->d_inode->i_size = size; | ||
| 1958 | } | ||
| 1959 | |||
| 1960 | static void add_debugfs_mem(struct adapter *adap, const char *name, | 1954 | static void add_debugfs_mem(struct adapter *adap, const char *name, |
| 1961 | unsigned int idx, unsigned int size_mb) | 1955 | unsigned int idx, unsigned int size_mb) |
| 1962 | { | 1956 | { |
| @@ -2072,9 +2066,8 @@ int t4_setup_debugfs(struct adapter *adap) | |||
| 2072 | } | 2066 | } |
| 2073 | } | 2067 | } |
| 2074 | 2068 | ||
| 2075 | de = debugfs_create_file("flash", S_IRUSR, adap->debugfs_root, adap, | 2069 | de = debugfs_create_file_size("flash", S_IRUSR, adap->debugfs_root, adap, |
| 2076 | &flash_debugfs_fops); | 2070 | &flash_debugfs_fops, adap->params.sf_size); |
| 2077 | set_debugfs_file_size(de, adap->params.sf_size); | ||
| 2078 | 2071 | ||
| 2079 | return 0; | 2072 | return 0; |
| 2080 | } | 2073 | } |
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.h b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.h index 8f418ba868bd..23f43a0f8950 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.h +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.h | |||
| @@ -37,8 +37,6 @@ | |||
| 37 | 37 | ||
| 38 | #include <linux/export.h> | 38 | #include <linux/export.h> |
| 39 | 39 | ||
| 40 | #define FILE_DATA(_file) ((_file)->f_path.dentry->d_inode) | ||
| 41 | |||
| 42 | #define DEFINE_SIMPLE_DEBUGFS_FILE(name) \ | 40 | #define DEFINE_SIMPLE_DEBUGFS_FILE(name) \ |
| 43 | static int name##_open(struct inode *inode, struct file *file) \ | 41 | static int name##_open(struct inode *inode, struct file *file) \ |
| 44 | { \ | 42 | { \ |
diff --git a/drivers/oprofile/oprofilefs.c b/drivers/oprofile/oprofilefs.c index 3f493459378f..dd92c5edf219 100644 --- a/drivers/oprofile/oprofilefs.c +++ b/drivers/oprofile/oprofilefs.c | |||
| @@ -138,22 +138,22 @@ static int __oprofilefs_create_file(struct dentry *root, char const *name, | |||
| 138 | struct dentry *dentry; | 138 | struct dentry *dentry; |
| 139 | struct inode *inode; | 139 | struct inode *inode; |
| 140 | 140 | ||
| 141 | mutex_lock(&root->d_inode->i_mutex); | 141 | mutex_lock(&d_inode(root)->i_mutex); |
| 142 | dentry = d_alloc_name(root, name); | 142 | dentry = d_alloc_name(root, name); |
| 143 | if (!dentry) { | 143 | if (!dentry) { |
| 144 | mutex_unlock(&root->d_inode->i_mutex); | 144 | mutex_unlock(&d_inode(root)->i_mutex); |
| 145 | return -ENOMEM; | 145 | return -ENOMEM; |
| 146 | } | 146 | } |
| 147 | inode = oprofilefs_get_inode(root->d_sb, S_IFREG | perm); | 147 | inode = oprofilefs_get_inode(root->d_sb, S_IFREG | perm); |
| 148 | if (!inode) { | 148 | if (!inode) { |
| 149 | dput(dentry); | 149 | dput(dentry); |
| 150 | mutex_unlock(&root->d_inode->i_mutex); | 150 | mutex_unlock(&d_inode(root)->i_mutex); |
| 151 | return -ENOMEM; | 151 | return -ENOMEM; |
| 152 | } | 152 | } |
| 153 | inode->i_fop = fops; | 153 | inode->i_fop = fops; |
| 154 | inode->i_private = priv; | 154 | inode->i_private = priv; |
| 155 | d_add(dentry, inode); | 155 | d_add(dentry, inode); |
| 156 | mutex_unlock(&root->d_inode->i_mutex); | 156 | mutex_unlock(&d_inode(root)->i_mutex); |
| 157 | return 0; | 157 | return 0; |
| 158 | } | 158 | } |
| 159 | 159 | ||
| @@ -215,22 +215,22 @@ struct dentry *oprofilefs_mkdir(struct dentry *parent, char const *name) | |||
| 215 | struct dentry *dentry; | 215 | struct dentry *dentry; |
| 216 | struct inode *inode; | 216 | struct inode *inode; |
| 217 | 217 | ||
| 218 | mutex_lock(&parent->d_inode->i_mutex); | 218 | mutex_lock(&d_inode(parent)->i_mutex); |
| 219 | dentry = d_alloc_name(parent, name); | 219 | dentry = d_alloc_name(parent, name); |
| 220 | if (!dentry) { | 220 | if (!dentry) { |
| 221 | mutex_unlock(&parent->d_inode->i_mutex); | 221 | mutex_unlock(&d_inode(parent)->i_mutex); |
| 222 | return NULL; | 222 | return NULL; |
| 223 | } | 223 | } |
| 224 | inode = oprofilefs_get_inode(parent->d_sb, S_IFDIR | 0755); | 224 | inode = oprofilefs_get_inode(parent->d_sb, S_IFDIR | 0755); |
| 225 | if (!inode) { | 225 | if (!inode) { |
| 226 | dput(dentry); | 226 | dput(dentry); |
| 227 | mutex_unlock(&parent->d_inode->i_mutex); | 227 | mutex_unlock(&d_inode(parent)->i_mutex); |
| 228 | return NULL; | 228 | return NULL; |
| 229 | } | 229 | } |
| 230 | inode->i_op = &simple_dir_inode_operations; | 230 | inode->i_op = &simple_dir_inode_operations; |
| 231 | inode->i_fop = &simple_dir_operations; | 231 | inode->i_fop = &simple_dir_operations; |
| 232 | d_add(dentry, inode); | 232 | d_add(dentry, inode); |
| 233 | mutex_unlock(&parent->d_inode->i_mutex); | 233 | mutex_unlock(&d_inode(parent)->i_mutex); |
| 234 | return dentry; | 234 | return dentry; |
| 235 | } | 235 | } |
| 236 | 236 | ||
diff --git a/drivers/staging/lustre/lustre/llite/dcache.c b/drivers/staging/lustre/lustre/llite/dcache.c index fe1fd05423e9..5af01351306d 100644 --- a/drivers/staging/lustre/lustre/llite/dcache.c +++ b/drivers/staging/lustre/lustre/llite/dcache.c | |||
| @@ -153,7 +153,7 @@ static int ll_ddelete(const struct dentry *de) | |||
| 153 | 153 | ||
| 154 | CDEBUG(D_DENTRY, "%s dentry %pd (%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, de, de->d_parent, de->d_inode, | 156 | de, de, de->d_parent, d_inode(de), |
| 157 | d_unhashed(de) ? "" : "hashed,", | 157 | d_unhashed(de) ? "" : "hashed,", |
| 158 | list_empty(&de->d_subdirs) ? "" : "subdirs"); | 158 | list_empty(&de->d_subdirs) ? "" : "subdirs"); |
| 159 | 159 | ||
| @@ -167,8 +167,8 @@ static int ll_ddelete(const struct dentry *de) | |||
| 167 | #if 0 | 167 | #if 0 |
| 168 | /* if not ldlm lock for this inode, set i_nlink to 0 so that | 168 | /* if not ldlm lock for this inode, set i_nlink to 0 so that |
| 169 | * this inode can be recycled later b=20433 */ | 169 | * this inode can be recycled later b=20433 */ |
| 170 | if (de->d_inode && !find_cbdata(de->d_inode)) | 170 | if (d_really_is_positive(de) && !find_cbdata(d_inode(de))) |
| 171 | clear_nlink(de->d_inode); | 171 | clear_nlink(d_inode(de)); |
| 172 | #endif | 172 | #endif |
| 173 | 173 | ||
| 174 | if (d_lustre_invalid((struct dentry *)de)) | 174 | if (d_lustre_invalid((struct dentry *)de)) |
| @@ -181,7 +181,7 @@ int ll_d_init(struct dentry *de) | |||
| 181 | LASSERT(de != NULL); | 181 | LASSERT(de != NULL); |
| 182 | 182 | ||
| 183 | CDEBUG(D_DENTRY, "ldd on dentry %pd (%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, de, de->d_parent, de->d_inode, | 184 | de, de, de->d_parent, d_inode(de), |
| 185 | d_count(de)); | 185 | d_count(de)); |
| 186 | 186 | ||
| 187 | if (de->d_fsdata == NULL) { | 187 | if (de->d_fsdata == NULL) { |
| @@ -261,7 +261,7 @@ void ll_invalidate_aliases(struct inode *inode) | |||
| 261 | ll_d_hlist_for_each_entry(dentry, p, &inode->i_dentry, d_u.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 %pd (%p) parent %p inode %p flags %d\n", | 262 | CDEBUG(D_DENTRY, "dentry in drop %pd (%p) parent %p inode %p flags %d\n", |
| 263 | dentry, dentry, dentry->d_parent, | 263 | dentry, dentry, dentry->d_parent, |
| 264 | dentry->d_inode, dentry->d_flags); | 264 | d_inode(dentry), dentry->d_flags); |
| 265 | 265 | ||
| 266 | d_lustre_invalidate(dentry, 0); | 266 | d_lustre_invalidate(dentry, 0); |
| 267 | } | 267 | } |
| @@ -309,7 +309,7 @@ void ll_lookup_finish_locks(struct lookup_intent *it, struct inode *inode) | |||
| 309 | static int ll_revalidate_dentry(struct dentry *dentry, | 309 | static int ll_revalidate_dentry(struct dentry *dentry, |
| 310 | unsigned int lookup_flags) | 310 | unsigned int lookup_flags) |
| 311 | { | 311 | { |
| 312 | struct inode *dir = dentry->d_parent->d_inode; | 312 | struct inode *dir = d_inode(dentry->d_parent); |
| 313 | 313 | ||
| 314 | /* | 314 | /* |
| 315 | * if open&create is set, talk to MDS to make sure file is created if | 315 | * if open&create is set, talk to MDS to make sure file is created if |
| @@ -329,7 +329,7 @@ static int ll_revalidate_dentry(struct dentry *dentry, | |||
| 329 | if (lookup_flags & LOOKUP_RCU) | 329 | if (lookup_flags & LOOKUP_RCU) |
| 330 | return -ECHILD; | 330 | return -ECHILD; |
| 331 | 331 | ||
| 332 | do_statahead_enter(dir, &dentry, dentry->d_inode == NULL); | 332 | do_statahead_enter(dir, &dentry, d_inode(dentry) == NULL); |
| 333 | ll_statahead_mark(dir, dentry); | 333 | ll_statahead_mark(dir, dentry); |
| 334 | return 1; | 334 | return 1; |
| 335 | } | 335 | } |
diff --git a/drivers/staging/lustre/lustre/llite/file.c b/drivers/staging/lustre/lustre/llite/file.c index 529062ea112b..4b44c634fcc3 100644 --- a/drivers/staging/lustre/lustre/llite/file.c +++ b/drivers/staging/lustre/lustre/llite/file.c | |||
| @@ -388,7 +388,7 @@ int ll_file_release(struct inode *inode, struct file *file) | |||
| 388 | static int ll_intent_file_open(struct dentry *dentry, void *lmm, | 388 | static int ll_intent_file_open(struct dentry *dentry, void *lmm, |
| 389 | int lmmsize, struct lookup_intent *itp) | 389 | int lmmsize, struct lookup_intent *itp) |
| 390 | { | 390 | { |
| 391 | struct inode *inode = dentry->d_inode; | 391 | struct inode *inode = d_inode(dentry); |
| 392 | struct ll_sb_info *sbi = ll_i2sbi(inode); | 392 | struct ll_sb_info *sbi = ll_i2sbi(inode); |
| 393 | struct dentry *parent = dentry->d_parent; | 393 | struct dentry *parent = dentry->d_parent; |
| 394 | const char *name = dentry->d_name.name; | 394 | const char *name = dentry->d_name.name; |
| @@ -413,7 +413,7 @@ static int ll_intent_file_open(struct dentry *dentry, void *lmm, | |||
| 413 | opc = LUSTRE_OPC_CREATE; | 413 | opc = LUSTRE_OPC_CREATE; |
| 414 | } | 414 | } |
| 415 | 415 | ||
| 416 | op_data = ll_prep_md_op_data(NULL, parent->d_inode, | 416 | op_data = ll_prep_md_op_data(NULL, d_inode(parent), |
| 417 | inode, name, len, | 417 | inode, name, len, |
| 418 | O_RDWR, opc, NULL); | 418 | O_RDWR, opc, NULL); |
| 419 | if (IS_ERR(op_data)) | 419 | if (IS_ERR(op_data)) |
| @@ -2896,7 +2896,7 @@ static int ll_inode_revalidate_fini(struct inode *inode, int rc) | |||
| 2896 | 2896 | ||
| 2897 | static int __ll_inode_revalidate(struct dentry *dentry, __u64 ibits) | 2897 | static int __ll_inode_revalidate(struct dentry *dentry, __u64 ibits) |
| 2898 | { | 2898 | { |
| 2899 | struct inode *inode = dentry->d_inode; | 2899 | struct inode *inode = d_inode(dentry); |
| 2900 | struct ptlrpc_request *req = NULL; | 2900 | struct ptlrpc_request *req = NULL; |
| 2901 | struct obd_export *exp; | 2901 | struct obd_export *exp; |
| 2902 | int rc = 0; | 2902 | int rc = 0; |
| @@ -2948,12 +2948,12 @@ static int __ll_inode_revalidate(struct dentry *dentry, __u64 ibits) | |||
| 2948 | do_lookup() -> ll_revalidate_it(). We cannot use d_drop | 2948 | do_lookup() -> ll_revalidate_it(). We cannot use d_drop |
| 2949 | here to preserve get_cwd functionality on 2.6. | 2949 | here to preserve get_cwd functionality on 2.6. |
| 2950 | Bug 10503 */ | 2950 | Bug 10503 */ |
| 2951 | if (!dentry->d_inode->i_nlink) | 2951 | if (!d_inode(dentry)->i_nlink) |
| 2952 | d_lustre_invalidate(dentry, 0); | 2952 | d_lustre_invalidate(dentry, 0); |
| 2953 | 2953 | ||
| 2954 | ll_lookup_finish_locks(&oit, inode); | 2954 | ll_lookup_finish_locks(&oit, inode); |
| 2955 | } else if (!ll_have_md_lock(dentry->d_inode, &ibits, LCK_MINMODE)) { | 2955 | } else if (!ll_have_md_lock(d_inode(dentry), &ibits, LCK_MINMODE)) { |
| 2956 | struct ll_sb_info *sbi = ll_i2sbi(dentry->d_inode); | 2956 | struct ll_sb_info *sbi = ll_i2sbi(d_inode(dentry)); |
| 2957 | u64 valid = OBD_MD_FLGETATTR; | 2957 | u64 valid = OBD_MD_FLGETATTR; |
| 2958 | struct md_op_data *op_data; | 2958 | struct md_op_data *op_data; |
| 2959 | int ealen = 0; | 2959 | int ealen = 0; |
| @@ -2991,7 +2991,7 @@ out: | |||
| 2991 | 2991 | ||
| 2992 | static int ll_inode_revalidate(struct dentry *dentry, __u64 ibits) | 2992 | static int ll_inode_revalidate(struct dentry *dentry, __u64 ibits) |
| 2993 | { | 2993 | { |
| 2994 | struct inode *inode = dentry->d_inode; | 2994 | struct inode *inode = d_inode(dentry); |
| 2995 | int rc; | 2995 | int rc; |
| 2996 | 2996 | ||
| 2997 | rc = __ll_inode_revalidate(dentry, ibits); | 2997 | rc = __ll_inode_revalidate(dentry, ibits); |
| @@ -3019,7 +3019,7 @@ static int ll_inode_revalidate(struct dentry *dentry, __u64 ibits) | |||
| 3019 | 3019 | ||
| 3020 | int ll_getattr(struct vfsmount *mnt, struct dentry *de, struct kstat *stat) | 3020 | int ll_getattr(struct vfsmount *mnt, struct dentry *de, struct kstat *stat) |
| 3021 | { | 3021 | { |
| 3022 | struct inode *inode = de->d_inode; | 3022 | struct inode *inode = d_inode(de); |
| 3023 | struct ll_sb_info *sbi = ll_i2sbi(inode); | 3023 | struct ll_sb_info *sbi = ll_i2sbi(inode); |
| 3024 | struct ll_inode_info *lli = ll_i2info(inode); | 3024 | struct ll_inode_info *lli = ll_i2info(inode); |
| 3025 | int res = 0; | 3025 | int res = 0; |
diff --git a/drivers/staging/lustre/lustre/llite/llite_internal.h b/drivers/staging/lustre/lustre/llite/llite_internal.h index e7422f5c9c6f..5f918e3c4683 100644 --- a/drivers/staging/lustre/lustre/llite/llite_internal.h +++ b/drivers/staging/lustre/lustre/llite/llite_internal.h | |||
| @@ -1488,7 +1488,7 @@ static inline void d_lustre_invalidate(struct dentry *dentry, int nested) | |||
| 1488 | { | 1488 | { |
| 1489 | CDEBUG(D_DENTRY, "invalidate dentry %pd (%p) parent %p inode %p refc %d\n", | 1489 | CDEBUG(D_DENTRY, "invalidate dentry %pd (%p) parent %p inode %p refc %d\n", |
| 1490 | dentry, dentry, | 1490 | dentry, dentry, |
| 1491 | dentry->d_parent, dentry->d_inode, d_count(dentry)); | 1491 | dentry->d_parent, d_inode(dentry), d_count(dentry)); |
| 1492 | 1492 | ||
| 1493 | spin_lock_nested(&dentry->d_lock, | 1493 | spin_lock_nested(&dentry->d_lock, |
| 1494 | nested ? DENTRY_D_LOCK_NESTED : DENTRY_D_LOCK_NORMAL); | 1494 | nested ? DENTRY_D_LOCK_NESTED : DENTRY_D_LOCK_NORMAL); |
diff --git a/drivers/staging/lustre/lustre/llite/llite_lib.c b/drivers/staging/lustre/lustre/llite/llite_lib.c index bf1ec277a1dc..a27af7882170 100644 --- a/drivers/staging/lustre/lustre/llite/llite_lib.c +++ b/drivers/staging/lustre/lustre/llite/llite_lib.c | |||
| @@ -1166,7 +1166,7 @@ static int ll_md_setattr(struct dentry *dentry, struct md_op_data *op_data, | |||
| 1166 | struct md_open_data **mod) | 1166 | struct md_open_data **mod) |
| 1167 | { | 1167 | { |
| 1168 | struct lustre_md md; | 1168 | struct lustre_md md; |
| 1169 | struct inode *inode = dentry->d_inode; | 1169 | struct inode *inode = d_inode(dentry); |
| 1170 | struct ll_sb_info *sbi = ll_i2sbi(inode); | 1170 | struct ll_sb_info *sbi = ll_i2sbi(inode); |
| 1171 | struct ptlrpc_request *request = NULL; | 1171 | struct ptlrpc_request *request = NULL; |
| 1172 | int rc, ia_valid; | 1172 | int rc, ia_valid; |
| @@ -1290,7 +1290,7 @@ static int ll_setattr_ost(struct inode *inode, struct iattr *attr) | |||
| 1290 | */ | 1290 | */ |
| 1291 | int ll_setattr_raw(struct dentry *dentry, struct iattr *attr, bool hsm_import) | 1291 | int ll_setattr_raw(struct dentry *dentry, struct iattr *attr, bool hsm_import) |
| 1292 | { | 1292 | { |
| 1293 | struct inode *inode = dentry->d_inode; | 1293 | struct inode *inode = d_inode(dentry); |
| 1294 | struct ll_inode_info *lli = ll_i2info(inode); | 1294 | struct ll_inode_info *lli = ll_i2info(inode); |
| 1295 | struct md_op_data *op_data = NULL; | 1295 | struct md_op_data *op_data = NULL; |
| 1296 | struct md_open_data *mod = NULL; | 1296 | struct md_open_data *mod = NULL; |
| @@ -1465,7 +1465,7 @@ out: | |||
| 1465 | 1465 | ||
| 1466 | int ll_setattr(struct dentry *de, struct iattr *attr) | 1466 | int ll_setattr(struct dentry *de, struct iattr *attr) |
| 1467 | { | 1467 | { |
| 1468 | int mode = de->d_inode->i_mode; | 1468 | int mode = d_inode(de)->i_mode; |
| 1469 | 1469 | ||
| 1470 | if ((attr->ia_valid & (ATTR_CTIME|ATTR_SIZE|ATTR_MODE)) == | 1470 | if ((attr->ia_valid & (ATTR_CTIME|ATTR_SIZE|ATTR_MODE)) == |
| 1471 | (ATTR_CTIME|ATTR_SIZE|ATTR_MODE)) | 1471 | (ATTR_CTIME|ATTR_SIZE|ATTR_MODE)) |
diff --git a/drivers/staging/lustre/lustre/llite/llite_nfs.c b/drivers/staging/lustre/lustre/llite/llite_nfs.c index 243a7840457f..db43b81386f7 100644 --- a/drivers/staging/lustre/lustre/llite/llite_nfs.c +++ b/drivers/staging/lustre/lustre/llite/llite_nfs.c | |||
| @@ -230,11 +230,11 @@ static int ll_nfs_get_name_filldir(struct dir_context *ctx, const char *name, | |||
| 230 | static int ll_get_name(struct dentry *dentry, char *name, | 230 | static int ll_get_name(struct dentry *dentry, char *name, |
| 231 | struct dentry *child) | 231 | struct dentry *child) |
| 232 | { | 232 | { |
| 233 | struct inode *dir = dentry->d_inode; | 233 | struct inode *dir = d_inode(dentry); |
| 234 | int rc; | 234 | int rc; |
| 235 | struct ll_getname_data lgd = { | 235 | struct ll_getname_data lgd = { |
| 236 | .lgd_name = name, | 236 | .lgd_name = name, |
| 237 | .lgd_fid = ll_i2info(child->d_inode)->lli_fid, | 237 | .lgd_fid = ll_i2info(d_inode(child))->lli_fid, |
| 238 | .ctx.actor = ll_nfs_get_name_filldir, | 238 | .ctx.actor = ll_nfs_get_name_filldir, |
| 239 | }; | 239 | }; |
| 240 | 240 | ||
| @@ -282,7 +282,7 @@ static struct dentry *ll_fh_to_parent(struct super_block *sb, struct fid *fid, | |||
| 282 | static struct dentry *ll_get_parent(struct dentry *dchild) | 282 | static struct dentry *ll_get_parent(struct dentry *dchild) |
| 283 | { | 283 | { |
| 284 | struct ptlrpc_request *req = NULL; | 284 | struct ptlrpc_request *req = NULL; |
| 285 | struct inode *dir = dchild->d_inode; | 285 | struct inode *dir = d_inode(dchild); |
| 286 | struct ll_sb_info *sbi; | 286 | struct ll_sb_info *sbi; |
| 287 | struct dentry *result = NULL; | 287 | struct dentry *result = NULL; |
| 288 | struct mdt_body *body; | 288 | struct mdt_body *body; |
diff --git a/drivers/staging/lustre/lustre/llite/namei.c b/drivers/staging/lustre/lustre/llite/namei.c index 49f1cb067ea2..5a25dcd10126 100644 --- a/drivers/staging/lustre/lustre/llite/namei.c +++ b/drivers/staging/lustre/lustre/llite/namei.c | |||
| @@ -155,7 +155,7 @@ static void ll_invalidate_negative_children(struct inode *dir) | |||
| 155 | list_for_each_entry_safe(child, tmp_subdir, | 155 | list_for_each_entry_safe(child, tmp_subdir, |
| 156 | &dentry->d_subdirs, | 156 | &dentry->d_subdirs, |
| 157 | d_child) { | 157 | d_child) { |
| 158 | if (child->d_inode == NULL) | 158 | if (d_really_is_negative(child)) |
| 159 | d_lustre_invalidate(child, 1); | 159 | d_lustre_invalidate(child, 1); |
| 160 | } | 160 | } |
| 161 | } | 161 | } |
| @@ -392,7 +392,7 @@ struct dentry *ll_splice_alias(struct inode *inode, struct dentry *de) | |||
| 392 | iput(inode); | 392 | iput(inode); |
| 393 | CDEBUG(D_DENTRY, | 393 | CDEBUG(D_DENTRY, |
| 394 | "Reuse dentry %p inode %p refc %d flags %#x\n", | 394 | "Reuse dentry %p inode %p refc %d flags %#x\n", |
| 395 | new, new->d_inode, d_count(new), new->d_flags); | 395 | new, d_inode(new), d_count(new), new->d_flags); |
| 396 | return new; | 396 | return new; |
| 397 | } | 397 | } |
| 398 | } | 398 | } |
| @@ -401,7 +401,7 @@ struct dentry *ll_splice_alias(struct inode *inode, struct dentry *de) | |||
| 401 | return ERR_PTR(rc); | 401 | return ERR_PTR(rc); |
| 402 | d_add(de, inode); | 402 | d_add(de, inode); |
| 403 | CDEBUG(D_DENTRY, "Add dentry %p inode %p refc %d flags %#x\n", | 403 | CDEBUG(D_DENTRY, "Add dentry %p inode %p refc %d flags %#x\n", |
| 404 | de, de->d_inode, d_count(de), de->d_flags); | 404 | de, d_inode(de), d_count(de), de->d_flags); |
| 405 | return de; | 405 | return de; |
| 406 | } | 406 | } |
| 407 | 407 | ||
| @@ -448,7 +448,7 @@ static int ll_lookup_it_finish(struct ptlrpc_request *request, | |||
| 448 | !it_disposition(it, DISP_OPEN_CREATE)) { | 448 | !it_disposition(it, DISP_OPEN_CREATE)) { |
| 449 | /* With DISP_OPEN_CREATE dentry will | 449 | /* With DISP_OPEN_CREATE dentry will |
| 450 | instantiated in ll_create_it. */ | 450 | instantiated in ll_create_it. */ |
| 451 | LASSERT((*de)->d_inode == NULL); | 451 | LASSERT(d_inode(*de) == NULL); |
| 452 | d_instantiate(*de, inode); | 452 | d_instantiate(*de, inode); |
| 453 | } | 453 | } |
| 454 | 454 | ||
| @@ -541,7 +541,7 @@ static struct dentry *ll_lookup_it(struct inode *parent, struct dentry *dentry, | |||
| 541 | goto out; | 541 | goto out; |
| 542 | } | 542 | } |
| 543 | 543 | ||
| 544 | inode = dentry->d_inode; | 544 | inode = d_inode(dentry); |
| 545 | if ((it->it_op & IT_OPEN) && inode && | 545 | if ((it->it_op & IT_OPEN) && inode && |
| 546 | !S_ISREG(inode->i_mode) && | 546 | !S_ISREG(inode->i_mode) && |
| 547 | !S_ISDIR(inode->i_mode)) { | 547 | !S_ISDIR(inode->i_mode)) { |
| @@ -638,9 +638,9 @@ static int ll_atomic_open(struct inode *dir, struct dentry *dentry, | |||
| 638 | 638 | ||
| 639 | *opened |= FILE_CREATED; | 639 | *opened |= FILE_CREATED; |
| 640 | } | 640 | } |
| 641 | if (dentry->d_inode && it_disposition(it, DISP_OPEN_OPEN)) { | 641 | if (d_really_is_positive(dentry) && it_disposition(it, DISP_OPEN_OPEN)) { |
| 642 | /* Open dentry. */ | 642 | /* Open dentry. */ |
| 643 | if (S_ISFIFO(dentry->d_inode->i_mode)) { | 643 | if (S_ISFIFO(d_inode(dentry)->i_mode)) { |
| 644 | /* We cannot call open here as it would | 644 | /* We cannot call open here as it would |
| 645 | * deadlock. | 645 | * deadlock. |
| 646 | */ | 646 | */ |
| @@ -862,8 +862,8 @@ static int ll_create_nd(struct inode *dir, struct dentry *dentry, | |||
| 862 | 862 | ||
| 863 | static inline void ll_get_child_fid(struct dentry *child, struct lu_fid *fid) | 863 | static inline void ll_get_child_fid(struct dentry *child, struct lu_fid *fid) |
| 864 | { | 864 | { |
| 865 | if (child->d_inode) | 865 | if (d_really_is_positive(child)) |
| 866 | *fid = *ll_inode2fid(child->d_inode); | 866 | *fid = *ll_inode2fid(d_inode(child)); |
| 867 | } | 867 | } |
| 868 | 868 | ||
| 869 | /** | 869 | /** |
| @@ -1076,7 +1076,7 @@ static int ll_symlink(struct inode *dir, struct dentry *dentry, | |||
| 1076 | static int ll_link(struct dentry *old_dentry, struct inode *dir, | 1076 | static int ll_link(struct dentry *old_dentry, struct inode *dir, |
| 1077 | struct dentry *new_dentry) | 1077 | struct dentry *new_dentry) |
| 1078 | { | 1078 | { |
| 1079 | struct inode *src = old_dentry->d_inode; | 1079 | struct inode *src = d_inode(old_dentry); |
| 1080 | struct ll_sb_info *sbi = ll_i2sbi(dir); | 1080 | struct ll_sb_info *sbi = ll_i2sbi(dir); |
| 1081 | struct ptlrpc_request *request = NULL; | 1081 | struct ptlrpc_request *request = NULL; |
| 1082 | struct md_op_data *op_data; | 1082 | struct md_op_data *op_data; |
diff --git a/drivers/staging/lustre/lustre/llite/statahead.c b/drivers/staging/lustre/lustre/llite/statahead.c index b75562c6b5de..7f8071242f23 100644 --- a/drivers/staging/lustre/lustre/llite/statahead.c +++ b/drivers/staging/lustre/lustre/llite/statahead.c | |||
| @@ -880,7 +880,7 @@ static int do_sa_lookup(struct inode *dir, struct ll_sa_entry *entry) | |||
| 880 | static int do_sa_revalidate(struct inode *dir, struct ll_sa_entry *entry, | 880 | static int do_sa_revalidate(struct inode *dir, struct ll_sa_entry *entry, |
| 881 | struct dentry *dentry) | 881 | struct dentry *dentry) |
| 882 | { | 882 | { |
| 883 | struct inode *inode = dentry->d_inode; | 883 | struct inode *inode = d_inode(dentry); |
| 884 | struct lookup_intent it = { .it_op = IT_GETATTR, | 884 | struct lookup_intent it = { .it_op = IT_GETATTR, |
| 885 | .d.lustre.it_lock_handle = 0 }; | 885 | .d.lustre.it_lock_handle = 0 }; |
| 886 | struct md_enqueue_info *minfo; | 886 | struct md_enqueue_info *minfo; |
| @@ -926,7 +926,7 @@ static int do_sa_revalidate(struct inode *dir, struct ll_sa_entry *entry, | |||
| 926 | static void ll_statahead_one(struct dentry *parent, const char *entry_name, | 926 | static void ll_statahead_one(struct dentry *parent, const char *entry_name, |
| 927 | int entry_name_len) | 927 | int entry_name_len) |
| 928 | { | 928 | { |
| 929 | struct inode *dir = parent->d_inode; | 929 | struct inode *dir = d_inode(parent); |
| 930 | struct ll_inode_info *lli = ll_i2info(dir); | 930 | struct ll_inode_info *lli = ll_i2info(dir); |
| 931 | struct ll_statahead_info *sai = lli->lli_sai; | 931 | struct ll_statahead_info *sai = lli->lli_sai; |
| 932 | struct dentry *dentry = NULL; | 932 | struct dentry *dentry = NULL; |
| @@ -944,8 +944,8 @@ static void ll_statahead_one(struct dentry *parent, const char *entry_name, | |||
| 944 | rc = do_sa_lookup(dir, entry); | 944 | rc = do_sa_lookup(dir, entry); |
| 945 | } else { | 945 | } else { |
| 946 | rc = do_sa_revalidate(dir, entry, dentry); | 946 | rc = do_sa_revalidate(dir, entry, dentry); |
| 947 | if (rc == 1 && agl_should_run(sai, dentry->d_inode)) | 947 | if (rc == 1 && agl_should_run(sai, d_inode(dentry))) |
| 948 | ll_agl_add(sai, dentry->d_inode, entry->se_index); | 948 | ll_agl_add(sai, d_inode(dentry), entry->se_index); |
| 949 | } | 949 | } |
| 950 | 950 | ||
| 951 | if (dentry != NULL) | 951 | if (dentry != NULL) |
| @@ -968,7 +968,7 @@ static void ll_statahead_one(struct dentry *parent, const char *entry_name, | |||
| 968 | static int ll_agl_thread(void *arg) | 968 | static int ll_agl_thread(void *arg) |
| 969 | { | 969 | { |
| 970 | struct dentry *parent = (struct dentry *)arg; | 970 | struct dentry *parent = (struct dentry *)arg; |
| 971 | struct inode *dir = parent->d_inode; | 971 | struct inode *dir = d_inode(parent); |
| 972 | struct ll_inode_info *plli = ll_i2info(dir); | 972 | struct ll_inode_info *plli = ll_i2info(dir); |
| 973 | struct ll_inode_info *clli; | 973 | struct ll_inode_info *clli; |
| 974 | struct ll_sb_info *sbi = ll_i2sbi(dir); | 974 | struct ll_sb_info *sbi = ll_i2sbi(dir); |
| @@ -1042,7 +1042,7 @@ static void ll_start_agl(struct dentry *parent, struct ll_statahead_info *sai) | |||
| 1042 | CDEBUG(D_READA, "start agl thread: sai %p, parent %pd\n", | 1042 | CDEBUG(D_READA, "start agl thread: sai %p, parent %pd\n", |
| 1043 | sai, parent); | 1043 | sai, parent); |
| 1044 | 1044 | ||
| 1045 | plli = ll_i2info(parent->d_inode); | 1045 | plli = ll_i2info(d_inode(parent)); |
| 1046 | task = kthread_run(ll_agl_thread, parent, | 1046 | task = kthread_run(ll_agl_thread, parent, |
| 1047 | "ll_agl_%u", plli->lli_opendir_pid); | 1047 | "ll_agl_%u", plli->lli_opendir_pid); |
| 1048 | if (IS_ERR(task)) { | 1048 | if (IS_ERR(task)) { |
| @@ -1059,7 +1059,7 @@ static void ll_start_agl(struct dentry *parent, struct ll_statahead_info *sai) | |||
| 1059 | static int ll_statahead_thread(void *arg) | 1059 | static int ll_statahead_thread(void *arg) |
| 1060 | { | 1060 | { |
| 1061 | struct dentry *parent = (struct dentry *)arg; | 1061 | struct dentry *parent = (struct dentry *)arg; |
| 1062 | struct inode *dir = parent->d_inode; | 1062 | struct inode *dir = d_inode(parent); |
| 1063 | struct ll_inode_info *plli = ll_i2info(dir); | 1063 | struct ll_inode_info *plli = ll_i2info(dir); |
| 1064 | struct ll_inode_info *clli; | 1064 | struct ll_inode_info *clli; |
| 1065 | struct ll_sb_info *sbi = ll_i2sbi(dir); | 1065 | struct ll_sb_info *sbi = ll_i2sbi(dir); |
| @@ -1604,7 +1604,7 @@ int do_statahead_enter(struct inode *dir, struct dentry **dentryp, | |||
| 1604 | rc = md_revalidate_lock(ll_i2mdexp(dir), &it, | 1604 | rc = md_revalidate_lock(ll_i2mdexp(dir), &it, |
| 1605 | ll_inode2fid(inode), &bits); | 1605 | ll_inode2fid(inode), &bits); |
| 1606 | if (rc == 1) { | 1606 | if (rc == 1) { |
| 1607 | if ((*dentryp)->d_inode == NULL) { | 1607 | if (d_inode(*dentryp) == NULL) { |
| 1608 | struct dentry *alias; | 1608 | struct dentry *alias; |
| 1609 | 1609 | ||
| 1610 | alias = ll_splice_alias(inode, | 1610 | alias = ll_splice_alias(inode, |
| @@ -1614,13 +1614,13 @@ int do_statahead_enter(struct inode *dir, struct dentry **dentryp, | |||
| 1614 | return PTR_ERR(alias); | 1614 | return PTR_ERR(alias); |
| 1615 | } | 1615 | } |
| 1616 | *dentryp = alias; | 1616 | *dentryp = alias; |
| 1617 | } else if ((*dentryp)->d_inode != inode) { | 1617 | } else if (d_inode(*dentryp) != inode) { |
| 1618 | /* revalidate, but inode is recreated */ | 1618 | /* revalidate, but inode is recreated */ |
| 1619 | CDEBUG(D_READA, | 1619 | CDEBUG(D_READA, |
| 1620 | "stale dentry %pd inode %lu/%u, statahead inode %lu/%u\n", | 1620 | "stale dentry %pd inode %lu/%u, statahead inode %lu/%u\n", |
| 1621 | *dentryp, | 1621 | *dentryp, |
| 1622 | (*dentryp)->d_inode->i_ino, | 1622 | d_inode(*dentryp)->i_ino, |
| 1623 | (*dentryp)->d_inode->i_generation, | 1623 | d_inode(*dentryp)->i_generation, |
| 1624 | inode->i_ino, | 1624 | inode->i_ino, |
| 1625 | inode->i_generation); | 1625 | inode->i_generation); |
| 1626 | ll_sai_unplug(sai, entry); | 1626 | ll_sai_unplug(sai, entry); |
| @@ -1666,8 +1666,8 @@ int do_statahead_enter(struct inode *dir, struct dentry **dentryp, | |||
| 1666 | 1666 | ||
| 1667 | /* get parent reference count here, and put it in ll_statahead_thread */ | 1667 | /* get parent reference count here, and put it in ll_statahead_thread */ |
| 1668 | parent = dget((*dentryp)->d_parent); | 1668 | parent = dget((*dentryp)->d_parent); |
| 1669 | if (unlikely(sai->sai_inode != parent->d_inode)) { | 1669 | if (unlikely(sai->sai_inode != d_inode(parent))) { |
| 1670 | struct ll_inode_info *nlli = ll_i2info(parent->d_inode); | 1670 | struct ll_inode_info *nlli = ll_i2info(d_inode(parent)); |
| 1671 | 1671 | ||
| 1672 | CWARN("Race condition, someone changed %pd just now: old parent "DFID", new parent "DFID"\n", | 1672 | CWARN("Race condition, someone changed %pd just now: old parent "DFID", new parent "DFID"\n", |
| 1673 | *dentryp, | 1673 | *dentryp, |
| @@ -1689,7 +1689,7 @@ int do_statahead_enter(struct inode *dir, struct dentry **dentryp, | |||
| 1689 | ll_sai_get(sai); | 1689 | ll_sai_get(sai); |
| 1690 | lli->lli_sai = sai; | 1690 | lli->lli_sai = sai; |
| 1691 | 1691 | ||
| 1692 | plli = ll_i2info(parent->d_inode); | 1692 | plli = ll_i2info(d_inode(parent)); |
| 1693 | rc = PTR_ERR(kthread_run(ll_statahead_thread, parent, | 1693 | rc = PTR_ERR(kthread_run(ll_statahead_thread, parent, |
| 1694 | "ll_sa_%u", plli->lli_opendir_pid)); | 1694 | "ll_sa_%u", plli->lli_opendir_pid)); |
| 1695 | thread = &sai->sai_thread; | 1695 | thread = &sai->sai_thread; |
diff --git a/drivers/staging/lustre/lustre/llite/symlink.c b/drivers/staging/lustre/lustre/llite/symlink.c index 686b6a574cc5..3711e671a4df 100644 --- a/drivers/staging/lustre/lustre/llite/symlink.c +++ b/drivers/staging/lustre/lustre/llite/symlink.c | |||
| @@ -120,7 +120,7 @@ failed: | |||
| 120 | 120 | ||
| 121 | static void *ll_follow_link(struct dentry *dentry, struct nameidata *nd) | 121 | static void *ll_follow_link(struct dentry *dentry, struct nameidata *nd) |
| 122 | { | 122 | { |
| 123 | struct inode *inode = dentry->d_inode; | 123 | struct inode *inode = d_inode(dentry); |
| 124 | struct ptlrpc_request *request = NULL; | 124 | struct ptlrpc_request *request = NULL; |
| 125 | int rc; | 125 | int rc; |
| 126 | char *symname = NULL; | 126 | char *symname = NULL; |
diff --git a/drivers/staging/lustre/lustre/llite/xattr.c b/drivers/staging/lustre/lustre/llite/xattr.c index b439936b4524..e0fcbe1395fd 100644 --- a/drivers/staging/lustre/lustre/llite/xattr.c +++ b/drivers/staging/lustre/lustre/llite/xattr.c | |||
| @@ -214,7 +214,7 @@ int ll_setxattr_common(struct inode *inode, const char *name, | |||
| 214 | int ll_setxattr(struct dentry *dentry, const char *name, | 214 | int ll_setxattr(struct dentry *dentry, const char *name, |
| 215 | const void *value, size_t size, int flags) | 215 | const void *value, size_t size, int flags) |
| 216 | { | 216 | { |
| 217 | struct inode *inode = dentry->d_inode; | 217 | struct inode *inode = d_inode(dentry); |
| 218 | 218 | ||
| 219 | LASSERT(inode); | 219 | LASSERT(inode); |
| 220 | LASSERT(name); | 220 | LASSERT(name); |
| @@ -267,7 +267,7 @@ int ll_setxattr(struct dentry *dentry, const char *name, | |||
| 267 | 267 | ||
| 268 | int ll_removexattr(struct dentry *dentry, const char *name) | 268 | int ll_removexattr(struct dentry *dentry, const char *name) |
| 269 | { | 269 | { |
| 270 | struct inode *inode = dentry->d_inode; | 270 | struct inode *inode = d_inode(dentry); |
| 271 | 271 | ||
| 272 | LASSERT(inode); | 272 | LASSERT(inode); |
| 273 | LASSERT(name); | 273 | LASSERT(name); |
| @@ -457,7 +457,7 @@ out: | |||
| 457 | ssize_t ll_getxattr(struct dentry *dentry, const char *name, | 457 | ssize_t ll_getxattr(struct dentry *dentry, const char *name, |
| 458 | void *buffer, size_t size) | 458 | void *buffer, size_t size) |
| 459 | { | 459 | { |
| 460 | struct inode *inode = dentry->d_inode; | 460 | struct inode *inode = d_inode(dentry); |
| 461 | 461 | ||
| 462 | LASSERT(inode); | 462 | LASSERT(inode); |
| 463 | LASSERT(name); | 463 | LASSERT(name); |
| @@ -545,7 +545,7 @@ out: | |||
| 545 | 545 | ||
| 546 | ssize_t ll_listxattr(struct dentry *dentry, char *buffer, size_t size) | 546 | ssize_t ll_listxattr(struct dentry *dentry, char *buffer, size_t size) |
| 547 | { | 547 | { |
| 548 | struct inode *inode = dentry->d_inode; | 548 | struct inode *inode = d_inode(dentry); |
| 549 | int rc = 0, rc2 = 0; | 549 | int rc = 0, rc2 = 0; |
| 550 | struct lov_mds_md *lmm = NULL; | 550 | struct lov_mds_md *lmm = NULL; |
| 551 | struct ptlrpc_request *request = NULL; | 551 | struct ptlrpc_request *request = NULL; |
diff --git a/drivers/usb/gadget/legacy/inode.c b/drivers/usb/gadget/legacy/inode.c index 6af58c6dba5e..2030565c6789 100644 --- a/drivers/usb/gadget/legacy/inode.c +++ b/drivers/usb/gadget/legacy/inode.c | |||
| @@ -1505,7 +1505,7 @@ static void destroy_ep_files (struct dev_data *dev) | |||
| 1505 | list_del_init (&ep->epfiles); | 1505 | list_del_init (&ep->epfiles); |
| 1506 | dentry = ep->dentry; | 1506 | dentry = ep->dentry; |
| 1507 | ep->dentry = NULL; | 1507 | ep->dentry = NULL; |
| 1508 | parent = dentry->d_parent->d_inode; | 1508 | parent = d_inode(dentry->d_parent); |
| 1509 | 1509 | ||
| 1510 | /* break link to controller */ | 1510 | /* break link to controller */ |
| 1511 | if (ep->state == STATE_EP_ENABLED) | 1511 | if (ep->state == STATE_EP_ENABLED) |
diff --git a/fs/9p/acl.c b/fs/9p/acl.c index 8482f2d11606..31c010372660 100644 --- a/fs/9p/acl.c +++ b/fs/9p/acl.c | |||
| @@ -247,7 +247,7 @@ static int v9fs_xattr_get_acl(struct dentry *dentry, const char *name, | |||
| 247 | if ((v9ses->flags & V9FS_ACCESS_MASK) != V9FS_ACCESS_CLIENT) | 247 | if ((v9ses->flags & V9FS_ACCESS_MASK) != V9FS_ACCESS_CLIENT) |
| 248 | return v9fs_remote_get_acl(dentry, name, buffer, size, type); | 248 | return v9fs_remote_get_acl(dentry, name, buffer, size, type); |
| 249 | 249 | ||
| 250 | acl = v9fs_get_cached_acl(dentry->d_inode, type); | 250 | acl = v9fs_get_cached_acl(d_inode(dentry), type); |
| 251 | if (IS_ERR(acl)) | 251 | if (IS_ERR(acl)) |
| 252 | return PTR_ERR(acl); | 252 | return PTR_ERR(acl); |
| 253 | if (acl == NULL) | 253 | if (acl == NULL) |
| @@ -285,7 +285,7 @@ static int v9fs_xattr_set_acl(struct dentry *dentry, const char *name, | |||
| 285 | int retval; | 285 | int retval; |
| 286 | struct posix_acl *acl; | 286 | struct posix_acl *acl; |
| 287 | struct v9fs_session_info *v9ses; | 287 | struct v9fs_session_info *v9ses; |
| 288 | struct inode *inode = dentry->d_inode; | 288 | struct inode *inode = d_inode(dentry); |
| 289 | 289 | ||
| 290 | if (strcmp(name, "") != 0) | 290 | if (strcmp(name, "") != 0) |
| 291 | return -EINVAL; | 291 | return -EINVAL; |
diff --git a/fs/9p/vfs_dentry.c b/fs/9p/vfs_dentry.c index a345b2d659cc..bd456c668d39 100644 --- a/fs/9p/vfs_dentry.c +++ b/fs/9p/vfs_dentry.c | |||
| @@ -53,7 +53,7 @@ static int v9fs_cached_dentry_delete(const struct dentry *dentry) | |||
| 53 | dentry, dentry); | 53 | dentry, dentry); |
| 54 | 54 | ||
| 55 | /* Don't cache negative dentries */ | 55 | /* Don't cache negative dentries */ |
| 56 | if (!dentry->d_inode) | 56 | if (d_really_is_negative(dentry)) |
| 57 | return 1; | 57 | return 1; |
| 58 | return 0; | 58 | return 0; |
| 59 | } | 59 | } |
| @@ -83,7 +83,7 @@ static int v9fs_lookup_revalidate(struct dentry *dentry, unsigned int flags) | |||
| 83 | if (flags & LOOKUP_RCU) | 83 | if (flags & LOOKUP_RCU) |
| 84 | return -ECHILD; | 84 | return -ECHILD; |
| 85 | 85 | ||
| 86 | inode = dentry->d_inode; | 86 | inode = d_inode(dentry); |
| 87 | if (!inode) | 87 | if (!inode) |
| 88 | goto out_valid; | 88 | goto out_valid; |
| 89 | 89 | ||
diff --git a/fs/9p/vfs_dir.c b/fs/9p/vfs_dir.c index 76c3b1ab6361..5cc00e56206e 100644 --- a/fs/9p/vfs_dir.c +++ b/fs/9p/vfs_dir.c | |||
| @@ -138,6 +138,8 @@ static int v9fs_dir_readdir(struct file *file, struct dir_context *ctx) | |||
| 138 | &err); | 138 | &err); |
| 139 | if (err) | 139 | if (err) |
| 140 | return err; | 140 | return err; |
| 141 | if (n == 0) | ||
| 142 | return 0; | ||
| 141 | 143 | ||
| 142 | rdir->head = 0; | 144 | rdir->head = 0; |
| 143 | rdir->tail = n; | 145 | rdir->tail = n; |
diff --git a/fs/9p/vfs_inode.c b/fs/9p/vfs_inode.c index 3662f1d1d9cf..703342e309f5 100644 --- a/fs/9p/vfs_inode.c +++ b/fs/9p/vfs_inode.c | |||
| @@ -595,7 +595,7 @@ static int v9fs_remove(struct inode *dir, struct dentry *dentry, int flags) | |||
| 595 | dir, dentry, flags); | 595 | dir, dentry, flags); |
| 596 | 596 | ||
| 597 | v9ses = v9fs_inode2v9ses(dir); | 597 | v9ses = v9fs_inode2v9ses(dir); |
| 598 | inode = dentry->d_inode; | 598 | inode = d_inode(dentry); |
| 599 | dfid = v9fs_fid_lookup(dentry->d_parent); | 599 | dfid = v9fs_fid_lookup(dentry->d_parent); |
| 600 | if (IS_ERR(dfid)) { | 600 | if (IS_ERR(dfid)) { |
| 601 | retval = PTR_ERR(dfid); | 601 | retval = PTR_ERR(dfid); |
| @@ -864,7 +864,7 @@ v9fs_vfs_atomic_open(struct inode *dir, struct dentry *dentry, | |||
| 864 | } | 864 | } |
| 865 | 865 | ||
| 866 | /* Only creates */ | 866 | /* Only creates */ |
| 867 | if (!(flags & O_CREAT) || dentry->d_inode) | 867 | if (!(flags & O_CREAT) || d_really_is_positive(dentry)) |
| 868 | return finish_no_open(file, res); | 868 | return finish_no_open(file, res); |
| 869 | 869 | ||
| 870 | err = 0; | 870 | err = 0; |
| @@ -881,7 +881,7 @@ v9fs_vfs_atomic_open(struct inode *dir, struct dentry *dentry, | |||
| 881 | } | 881 | } |
| 882 | 882 | ||
| 883 | v9fs_invalidate_inode_attr(dir); | 883 | v9fs_invalidate_inode_attr(dir); |
| 884 | v9inode = V9FS_I(dentry->d_inode); | 884 | v9inode = V9FS_I(d_inode(dentry)); |
| 885 | mutex_lock(&v9inode->v_mutex); | 885 | mutex_lock(&v9inode->v_mutex); |
| 886 | if ((v9ses->cache == CACHE_LOOSE || v9ses->cache == CACHE_FSCACHE) && | 886 | if ((v9ses->cache == CACHE_LOOSE || v9ses->cache == CACHE_FSCACHE) && |
| 887 | !v9inode->writeback_fid && | 887 | !v9inode->writeback_fid && |
| @@ -908,7 +908,7 @@ v9fs_vfs_atomic_open(struct inode *dir, struct dentry *dentry, | |||
| 908 | 908 | ||
| 909 | file->private_data = fid; | 909 | file->private_data = fid; |
| 910 | if (v9ses->cache == CACHE_LOOSE || v9ses->cache == CACHE_FSCACHE) | 910 | if (v9ses->cache == CACHE_LOOSE || v9ses->cache == CACHE_FSCACHE) |
| 911 | v9fs_cache_inode_set_cookie(dentry->d_inode, file); | 911 | v9fs_cache_inode_set_cookie(d_inode(dentry), file); |
| 912 | 912 | ||
| 913 | *opened |= FILE_CREATED; | 913 | *opened |= FILE_CREATED; |
| 914 | out: | 914 | out: |
| @@ -969,8 +969,8 @@ v9fs_vfs_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
| 969 | 969 | ||
| 970 | p9_debug(P9_DEBUG_VFS, "\n"); | 970 | p9_debug(P9_DEBUG_VFS, "\n"); |
| 971 | retval = 0; | 971 | retval = 0; |
| 972 | old_inode = old_dentry->d_inode; | 972 | old_inode = d_inode(old_dentry); |
| 973 | new_inode = new_dentry->d_inode; | 973 | new_inode = d_inode(new_dentry); |
| 974 | v9ses = v9fs_inode2v9ses(old_inode); | 974 | v9ses = v9fs_inode2v9ses(old_inode); |
| 975 | oldfid = v9fs_fid_lookup(old_dentry); | 975 | oldfid = v9fs_fid_lookup(old_dentry); |
| 976 | if (IS_ERR(oldfid)) | 976 | if (IS_ERR(oldfid)) |
| @@ -1061,7 +1061,7 @@ v9fs_vfs_getattr(struct vfsmount *mnt, struct dentry *dentry, | |||
| 1061 | p9_debug(P9_DEBUG_VFS, "dentry: %p\n", dentry); | 1061 | p9_debug(P9_DEBUG_VFS, "dentry: %p\n", dentry); |
| 1062 | v9ses = v9fs_dentry2v9ses(dentry); | 1062 | v9ses = v9fs_dentry2v9ses(dentry); |
| 1063 | if (v9ses->cache == CACHE_LOOSE || v9ses->cache == CACHE_FSCACHE) { | 1063 | if (v9ses->cache == CACHE_LOOSE || v9ses->cache == CACHE_FSCACHE) { |
| 1064 | generic_fillattr(dentry->d_inode, stat); | 1064 | generic_fillattr(d_inode(dentry), stat); |
| 1065 | return 0; | 1065 | return 0; |
| 1066 | } | 1066 | } |
| 1067 | fid = v9fs_fid_lookup(dentry); | 1067 | fid = v9fs_fid_lookup(dentry); |
| @@ -1072,8 +1072,8 @@ v9fs_vfs_getattr(struct vfsmount *mnt, struct dentry *dentry, | |||
| 1072 | if (IS_ERR(st)) | 1072 | if (IS_ERR(st)) |
| 1073 | return PTR_ERR(st); | 1073 | return PTR_ERR(st); |
| 1074 | 1074 | ||
| 1075 | v9fs_stat2inode(st, dentry->d_inode, dentry->d_inode->i_sb); | 1075 | v9fs_stat2inode(st, d_inode(dentry), d_inode(dentry)->i_sb); |
| 1076 | generic_fillattr(dentry->d_inode, stat); | 1076 | generic_fillattr(d_inode(dentry), stat); |
| 1077 | 1077 | ||
| 1078 | p9stat_free(st); | 1078 | p9stat_free(st); |
| 1079 | kfree(st); | 1079 | kfree(st); |
| @@ -1095,7 +1095,7 @@ static int v9fs_vfs_setattr(struct dentry *dentry, struct iattr *iattr) | |||
| 1095 | struct p9_wstat wstat; | 1095 | struct p9_wstat wstat; |
| 1096 | 1096 | ||
| 1097 | p9_debug(P9_DEBUG_VFS, "\n"); | 1097 | p9_debug(P9_DEBUG_VFS, "\n"); |
| 1098 | retval = inode_change_ok(dentry->d_inode, iattr); | 1098 | retval = inode_change_ok(d_inode(dentry), iattr); |
| 1099 | if (retval) | 1099 | if (retval) |
| 1100 | return retval; | 1100 | return retval; |
| 1101 | 1101 | ||
| @@ -1128,20 +1128,20 @@ static int v9fs_vfs_setattr(struct dentry *dentry, struct iattr *iattr) | |||
| 1128 | 1128 | ||
| 1129 | /* Write all dirty data */ | 1129 | /* Write all dirty data */ |
| 1130 | if (d_is_reg(dentry)) | 1130 | if (d_is_reg(dentry)) |
| 1131 | filemap_write_and_wait(dentry->d_inode->i_mapping); | 1131 | filemap_write_and_wait(d_inode(dentry)->i_mapping); |
| 1132 | 1132 | ||
| 1133 | retval = p9_client_wstat(fid, &wstat); | 1133 | retval = p9_client_wstat(fid, &wstat); |
| 1134 | if (retval < 0) | 1134 | if (retval < 0) |
| 1135 | return retval; | 1135 | return retval; |
| 1136 | 1136 | ||
| 1137 | if ((iattr->ia_valid & ATTR_SIZE) && | 1137 | if ((iattr->ia_valid & ATTR_SIZE) && |
| 1138 | iattr->ia_size != i_size_read(dentry->d_inode)) | 1138 | iattr->ia_size != i_size_read(d_inode(dentry))) |
| 1139 | truncate_setsize(dentry->d_inode, iattr->ia_size); | 1139 | truncate_setsize(d_inode(dentry), iattr->ia_size); |
| 1140 | 1140 | ||
| 1141 | v9fs_invalidate_inode_attr(dentry->d_inode); | 1141 | v9fs_invalidate_inode_attr(d_inode(dentry)); |
| 1142 | 1142 | ||
| 1143 | setattr_copy(dentry->d_inode, iattr); | 1143 | setattr_copy(d_inode(dentry), iattr); |
| 1144 | mark_inode_dirty(dentry->d_inode); | 1144 | mark_inode_dirty(d_inode(dentry)); |
| 1145 | return 0; | 1145 | return 0; |
| 1146 | } | 1146 | } |
| 1147 | 1147 | ||
| @@ -1403,7 +1403,7 @@ v9fs_vfs_link(struct dentry *old_dentry, struct inode *dir, | |||
| 1403 | retval = v9fs_vfs_mkspecial(dir, dentry, P9_DMLINK, name); | 1403 | retval = v9fs_vfs_mkspecial(dir, dentry, P9_DMLINK, name); |
| 1404 | __putname(name); | 1404 | __putname(name); |
| 1405 | if (!retval) { | 1405 | if (!retval) { |
| 1406 | v9fs_refresh_inode(oldfid, old_dentry->d_inode); | 1406 | v9fs_refresh_inode(oldfid, d_inode(old_dentry)); |
| 1407 | v9fs_invalidate_inode_attr(dir); | 1407 | v9fs_invalidate_inode_attr(dir); |
| 1408 | } | 1408 | } |
| 1409 | clunk_fid: | 1409 | clunk_fid: |
diff --git a/fs/9p/vfs_inode_dotl.c b/fs/9p/vfs_inode_dotl.c index 6054c16b8fae..9861c7c951a6 100644 --- a/fs/9p/vfs_inode_dotl.c +++ b/fs/9p/vfs_inode_dotl.c | |||
| @@ -265,7 +265,7 @@ v9fs_vfs_atomic_open_dotl(struct inode *dir, struct dentry *dentry, | |||
| 265 | } | 265 | } |
| 266 | 266 | ||
| 267 | /* Only creates */ | 267 | /* Only creates */ |
| 268 | if (!(flags & O_CREAT) || dentry->d_inode) | 268 | if (!(flags & O_CREAT) || d_really_is_positive(dentry)) |
| 269 | return finish_no_open(file, res); | 269 | return finish_no_open(file, res); |
| 270 | 270 | ||
| 271 | v9ses = v9fs_inode2v9ses(dir); | 271 | v9ses = v9fs_inode2v9ses(dir); |
| @@ -481,7 +481,7 @@ v9fs_vfs_getattr_dotl(struct vfsmount *mnt, struct dentry *dentry, | |||
| 481 | p9_debug(P9_DEBUG_VFS, "dentry: %p\n", dentry); | 481 | p9_debug(P9_DEBUG_VFS, "dentry: %p\n", dentry); |
| 482 | v9ses = v9fs_dentry2v9ses(dentry); | 482 | v9ses = v9fs_dentry2v9ses(dentry); |
| 483 | if (v9ses->cache == CACHE_LOOSE || v9ses->cache == CACHE_FSCACHE) { | 483 | if (v9ses->cache == CACHE_LOOSE || v9ses->cache == CACHE_FSCACHE) { |
| 484 | generic_fillattr(dentry->d_inode, stat); | 484 | generic_fillattr(d_inode(dentry), stat); |
| 485 | return 0; | 485 | return 0; |
| 486 | } | 486 | } |
| 487 | fid = v9fs_fid_lookup(dentry); | 487 | fid = v9fs_fid_lookup(dentry); |
| @@ -496,8 +496,8 @@ v9fs_vfs_getattr_dotl(struct vfsmount *mnt, struct dentry *dentry, | |||
| 496 | if (IS_ERR(st)) | 496 | if (IS_ERR(st)) |
| 497 | return PTR_ERR(st); | 497 | return PTR_ERR(st); |
| 498 | 498 | ||
| 499 | v9fs_stat2inode_dotl(st, dentry->d_inode); | 499 | v9fs_stat2inode_dotl(st, d_inode(dentry)); |
| 500 | generic_fillattr(dentry->d_inode, stat); | 500 | generic_fillattr(d_inode(dentry), stat); |
| 501 | /* Change block size to what the server returned */ | 501 | /* Change block size to what the server returned */ |
| 502 | stat->blksize = st->st_blksize; | 502 | stat->blksize = st->st_blksize; |
| 503 | 503 | ||
| @@ -557,7 +557,7 @@ int v9fs_vfs_setattr_dotl(struct dentry *dentry, struct iattr *iattr) | |||
| 557 | int retval; | 557 | int retval; |
| 558 | struct p9_fid *fid; | 558 | struct p9_fid *fid; |
| 559 | struct p9_iattr_dotl p9attr; | 559 | struct p9_iattr_dotl p9attr; |
| 560 | struct inode *inode = dentry->d_inode; | 560 | struct inode *inode = d_inode(dentry); |
| 561 | 561 | ||
| 562 | p9_debug(P9_DEBUG_VFS, "\n"); | 562 | p9_debug(P9_DEBUG_VFS, "\n"); |
| 563 | 563 | ||
| @@ -795,10 +795,10 @@ v9fs_vfs_link_dotl(struct dentry *old_dentry, struct inode *dir, | |||
| 795 | if (IS_ERR(fid)) | 795 | if (IS_ERR(fid)) |
| 796 | return PTR_ERR(fid); | 796 | return PTR_ERR(fid); |
| 797 | 797 | ||
| 798 | v9fs_refresh_inode_dotl(fid, old_dentry->d_inode); | 798 | v9fs_refresh_inode_dotl(fid, d_inode(old_dentry)); |
| 799 | } | 799 | } |
| 800 | ihold(old_dentry->d_inode); | 800 | ihold(d_inode(old_dentry)); |
| 801 | d_instantiate(dentry, old_dentry->d_inode); | 801 | d_instantiate(dentry, d_inode(old_dentry)); |
| 802 | 802 | ||
| 803 | return err; | 803 | return err; |
| 804 | } | 804 | } |
diff --git a/fs/9p/vfs_super.c b/fs/9p/vfs_super.c index 0afd0382822b..e99a338a4638 100644 --- a/fs/9p/vfs_super.c +++ b/fs/9p/vfs_super.c | |||
| @@ -168,8 +168,8 @@ static struct dentry *v9fs_mount(struct file_system_type *fs_type, int flags, | |||
| 168 | retval = PTR_ERR(st); | 168 | retval = PTR_ERR(st); |
| 169 | goto release_sb; | 169 | goto release_sb; |
| 170 | } | 170 | } |
| 171 | root->d_inode->i_ino = v9fs_qid2ino(&st->qid); | 171 | d_inode(root)->i_ino = v9fs_qid2ino(&st->qid); |
| 172 | v9fs_stat2inode_dotl(st, root->d_inode); | 172 | v9fs_stat2inode_dotl(st, d_inode(root)); |
| 173 | kfree(st); | 173 | kfree(st); |
| 174 | } else { | 174 | } else { |
| 175 | struct p9_wstat *st = NULL; | 175 | struct p9_wstat *st = NULL; |
| @@ -179,8 +179,8 @@ static struct dentry *v9fs_mount(struct file_system_type *fs_type, int flags, | |||
| 179 | goto release_sb; | 179 | goto release_sb; |
| 180 | } | 180 | } |
| 181 | 181 | ||
| 182 | root->d_inode->i_ino = v9fs_qid2ino(&st->qid); | 182 | d_inode(root)->i_ino = v9fs_qid2ino(&st->qid); |
| 183 | v9fs_stat2inode(st, root->d_inode, sb); | 183 | v9fs_stat2inode(st, d_inode(root), sb); |
| 184 | 184 | ||
| 185 | p9stat_free(st); | 185 | p9stat_free(st); |
| 186 | kfree(st); | 186 | kfree(st); |
diff --git a/fs/adfs/inode.c b/fs/adfs/inode.c index b9acadafa4a1..335055d828e4 100644 --- a/fs/adfs/inode.c +++ b/fs/adfs/inode.c | |||
| @@ -298,7 +298,7 @@ out: | |||
| 298 | int | 298 | int |
| 299 | adfs_notify_change(struct dentry *dentry, struct iattr *attr) | 299 | adfs_notify_change(struct dentry *dentry, struct iattr *attr) |
| 300 | { | 300 | { |
| 301 | struct inode *inode = dentry->d_inode; | 301 | struct inode *inode = d_inode(dentry); |
| 302 | struct super_block *sb = inode->i_sb; | 302 | struct super_block *sb = inode->i_sb; |
| 303 | unsigned int ia_valid = attr->ia_valid; | 303 | unsigned int ia_valid = attr->ia_valid; |
| 304 | int error; | 304 | int error; |
diff --git a/fs/affs/amigaffs.c b/fs/affs/amigaffs.c index 5022ac96aa40..a8f463c028ce 100644 --- a/fs/affs/amigaffs.c +++ b/fs/affs/amigaffs.c | |||
| @@ -138,7 +138,7 @@ affs_fix_dcache(struct inode *inode, u32 entry_ino) | |||
| 138 | static int | 138 | static int |
| 139 | affs_remove_link(struct dentry *dentry) | 139 | affs_remove_link(struct dentry *dentry) |
| 140 | { | 140 | { |
| 141 | struct inode *dir, *inode = dentry->d_inode; | 141 | struct inode *dir, *inode = d_inode(dentry); |
| 142 | struct super_block *sb = inode->i_sb; | 142 | struct super_block *sb = inode->i_sb; |
| 143 | struct buffer_head *bh = NULL, *link_bh = NULL; | 143 | struct buffer_head *bh = NULL, *link_bh = NULL; |
| 144 | u32 link_ino, ino; | 144 | u32 link_ino, ino; |
| @@ -268,11 +268,11 @@ affs_remove_header(struct dentry *dentry) | |||
| 268 | struct buffer_head *bh = NULL; | 268 | struct buffer_head *bh = NULL; |
| 269 | int retval; | 269 | int retval; |
| 270 | 270 | ||
| 271 | dir = dentry->d_parent->d_inode; | 271 | dir = d_inode(dentry->d_parent); |
| 272 | sb = dir->i_sb; | 272 | sb = dir->i_sb; |
| 273 | 273 | ||
| 274 | retval = -ENOENT; | 274 | retval = -ENOENT; |
| 275 | inode = dentry->d_inode; | 275 | inode = d_inode(dentry); |
| 276 | if (!inode) | 276 | if (!inode) |
| 277 | goto done; | 277 | goto done; |
| 278 | 278 | ||
| @@ -471,10 +471,9 @@ affs_warning(struct super_block *sb, const char *function, const char *fmt, ...) | |||
| 471 | bool | 471 | bool |
| 472 | affs_nofilenametruncate(const struct dentry *dentry) | 472 | affs_nofilenametruncate(const struct dentry *dentry) |
| 473 | { | 473 | { |
| 474 | struct inode *inode = dentry->d_inode; | 474 | struct inode *inode = d_inode(dentry); |
| 475 | 475 | ||
| 476 | return affs_test_opt(AFFS_SB(inode->i_sb)->s_flags, SF_NO_TRUNCATE); | 476 | return affs_test_opt(AFFS_SB(inode->i_sb)->s_flags, SF_NO_TRUNCATE); |
| 477 | |||
| 478 | } | 477 | } |
| 479 | 478 | ||
| 480 | /* Check if the name is valid for a affs object. */ | 479 | /* Check if the name is valid for a affs object. */ |
diff --git a/fs/affs/inode.c b/fs/affs/inode.c index 9628003ccd2f..a022f4accd76 100644 --- a/fs/affs/inode.c +++ b/fs/affs/inode.c | |||
| @@ -213,7 +213,7 @@ affs_write_inode(struct inode *inode, struct writeback_control *wbc) | |||
| 213 | int | 213 | int |
| 214 | affs_notify_change(struct dentry *dentry, struct iattr *attr) | 214 | affs_notify_change(struct dentry *dentry, struct iattr *attr) |
| 215 | { | 215 | { |
| 216 | struct inode *inode = dentry->d_inode; | 216 | struct inode *inode = d_inode(dentry); |
| 217 | int error; | 217 | int error; |
| 218 | 218 | ||
| 219 | pr_debug("notify_change(%lu,0x%x)\n", inode->i_ino, attr->ia_valid); | 219 | pr_debug("notify_change(%lu,0x%x)\n", inode->i_ino, attr->ia_valid); |
diff --git a/fs/affs/namei.c b/fs/affs/namei.c index ec8ca0efb960..181e05b46e72 100644 --- a/fs/affs/namei.c +++ b/fs/affs/namei.c | |||
| @@ -251,7 +251,7 @@ int | |||
| 251 | affs_unlink(struct inode *dir, struct dentry *dentry) | 251 | affs_unlink(struct inode *dir, struct dentry *dentry) |
| 252 | { | 252 | { |
| 253 | pr_debug("%s(dir=%lu, %lu \"%pd\")\n", __func__, dir->i_ino, | 253 | pr_debug("%s(dir=%lu, %lu \"%pd\")\n", __func__, dir->i_ino, |
| 254 | dentry->d_inode->i_ino, dentry); | 254 | d_inode(dentry)->i_ino, dentry); |
| 255 | 255 | ||
| 256 | return affs_remove_header(dentry); | 256 | return affs_remove_header(dentry); |
| 257 | } | 257 | } |
| @@ -320,7 +320,7 @@ int | |||
| 320 | affs_rmdir(struct inode *dir, struct dentry *dentry) | 320 | affs_rmdir(struct inode *dir, struct dentry *dentry) |
| 321 | { | 321 | { |
| 322 | pr_debug("%s(dir=%lu, %lu \"%pd\")\n", __func__, dir->i_ino, | 322 | pr_debug("%s(dir=%lu, %lu \"%pd\")\n", __func__, dir->i_ino, |
| 323 | dentry->d_inode->i_ino, dentry); | 323 | d_inode(dentry)->i_ino, dentry); |
| 324 | 324 | ||
| 325 | return affs_remove_header(dentry); | 325 | return affs_remove_header(dentry); |
| 326 | } | 326 | } |
| @@ -403,7 +403,7 @@ err: | |||
| 403 | int | 403 | int |
| 404 | affs_link(struct dentry *old_dentry, struct inode *dir, struct dentry *dentry) | 404 | affs_link(struct dentry *old_dentry, struct inode *dir, struct dentry *dentry) |
| 405 | { | 405 | { |
| 406 | struct inode *inode = old_dentry->d_inode; | 406 | struct inode *inode = d_inode(old_dentry); |
| 407 | 407 | ||
| 408 | pr_debug("%s(%lu, %lu, \"%pd\")\n", __func__, inode->i_ino, dir->i_ino, | 408 | pr_debug("%s(%lu, %lu, \"%pd\")\n", __func__, inode->i_ino, dir->i_ino, |
| 409 | dentry); | 409 | dentry); |
| @@ -430,13 +430,13 @@ affs_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
| 430 | return retval; | 430 | return retval; |
| 431 | 431 | ||
| 432 | /* Unlink destination if it already exists */ | 432 | /* Unlink destination if it already exists */ |
| 433 | if (new_dentry->d_inode) { | 433 | if (d_really_is_positive(new_dentry)) { |
| 434 | retval = affs_remove_header(new_dentry); | 434 | retval = affs_remove_header(new_dentry); |
| 435 | if (retval) | 435 | if (retval) |
| 436 | return retval; | 436 | return retval; |
| 437 | } | 437 | } |
| 438 | 438 | ||
| 439 | bh = affs_bread(sb, old_dentry->d_inode->i_ino); | 439 | bh = affs_bread(sb, d_inode(old_dentry)->i_ino); |
| 440 | if (!bh) | 440 | if (!bh) |
| 441 | return -EIO; | 441 | return -EIO; |
| 442 | 442 | ||
diff --git a/fs/afs/dir.c b/fs/afs/dir.c index 4ec35e9130e1..e10e17788f06 100644 --- a/fs/afs/dir.c +++ b/fs/afs/dir.c | |||
| @@ -505,7 +505,7 @@ static struct dentry *afs_lookup(struct inode *dir, struct dentry *dentry, | |||
| 505 | _enter("{%x:%u},%p{%pd},", | 505 | _enter("{%x:%u},%p{%pd},", |
| 506 | vnode->fid.vid, vnode->fid.vnode, dentry, dentry); | 506 | vnode->fid.vid, vnode->fid.vnode, dentry, dentry); |
| 507 | 507 | ||
| 508 | ASSERTCMP(dentry->d_inode, ==, NULL); | 508 | ASSERTCMP(d_inode(dentry), ==, NULL); |
| 509 | 509 | ||
| 510 | if (dentry->d_name.len >= AFSNAMEMAX) { | 510 | if (dentry->d_name.len >= AFSNAMEMAX) { |
| 511 | _leave(" = -ENAMETOOLONG"); | 511 | _leave(" = -ENAMETOOLONG"); |
| @@ -563,8 +563,8 @@ success: | |||
| 563 | _leave(" = 0 { vn=%u u=%u } -> { ino=%lu v=%u }", | 563 | _leave(" = 0 { vn=%u u=%u } -> { ino=%lu v=%u }", |
| 564 | fid.vnode, | 564 | fid.vnode, |
| 565 | fid.unique, | 565 | fid.unique, |
| 566 | dentry->d_inode->i_ino, | 566 | d_inode(dentry)->i_ino, |
| 567 | dentry->d_inode->i_generation); | 567 | d_inode(dentry)->i_generation); |
| 568 | 568 | ||
| 569 | return NULL; | 569 | return NULL; |
| 570 | } | 570 | } |
| @@ -586,9 +586,9 @@ static int afs_d_revalidate(struct dentry *dentry, unsigned int flags) | |||
| 586 | if (flags & LOOKUP_RCU) | 586 | if (flags & LOOKUP_RCU) |
| 587 | return -ECHILD; | 587 | return -ECHILD; |
| 588 | 588 | ||
| 589 | vnode = AFS_FS_I(dentry->d_inode); | 589 | vnode = AFS_FS_I(d_inode(dentry)); |
| 590 | 590 | ||
| 591 | if (dentry->d_inode) | 591 | if (d_really_is_positive(dentry)) |
| 592 | _enter("{v={%x:%u} n=%pd fl=%lx},", | 592 | _enter("{v={%x:%u} n=%pd fl=%lx},", |
| 593 | vnode->fid.vid, vnode->fid.vnode, dentry, | 593 | vnode->fid.vid, vnode->fid.vnode, dentry, |
| 594 | vnode->flags); | 594 | vnode->flags); |
| @@ -601,7 +601,7 @@ static int afs_d_revalidate(struct dentry *dentry, unsigned int flags) | |||
| 601 | 601 | ||
| 602 | /* lock down the parent dentry so we can peer at it */ | 602 | /* lock down the parent dentry so we can peer at it */ |
| 603 | parent = dget_parent(dentry); | 603 | parent = dget_parent(dentry); |
| 604 | dir = AFS_FS_I(parent->d_inode); | 604 | dir = AFS_FS_I(d_inode(parent)); |
| 605 | 605 | ||
| 606 | /* validate the parent directory */ | 606 | /* validate the parent directory */ |
| 607 | if (test_bit(AFS_VNODE_MODIFIED, &dir->flags)) | 607 | if (test_bit(AFS_VNODE_MODIFIED, &dir->flags)) |
| @@ -623,9 +623,9 @@ static int afs_d_revalidate(struct dentry *dentry, unsigned int flags) | |||
| 623 | switch (ret) { | 623 | switch (ret) { |
| 624 | case 0: | 624 | case 0: |
| 625 | /* the filename maps to something */ | 625 | /* the filename maps to something */ |
| 626 | if (!dentry->d_inode) | 626 | if (d_really_is_negative(dentry)) |
| 627 | goto out_bad; | 627 | goto out_bad; |
| 628 | if (is_bad_inode(dentry->d_inode)) { | 628 | if (is_bad_inode(d_inode(dentry))) { |
| 629 | printk("kAFS: afs_d_revalidate: %pd2 has bad inode\n", | 629 | printk("kAFS: afs_d_revalidate: %pd2 has bad inode\n", |
| 630 | dentry); | 630 | dentry); |
| 631 | goto out_bad; | 631 | goto out_bad; |
| @@ -647,7 +647,7 @@ static int afs_d_revalidate(struct dentry *dentry, unsigned int flags) | |||
| 647 | _debug("%pd: file deleted (uq %u -> %u I:%u)", | 647 | _debug("%pd: file deleted (uq %u -> %u I:%u)", |
| 648 | dentry, fid.unique, | 648 | dentry, fid.unique, |
| 649 | vnode->fid.unique, | 649 | vnode->fid.unique, |
| 650 | dentry->d_inode->i_generation); | 650 | d_inode(dentry)->i_generation); |
| 651 | spin_lock(&vnode->lock); | 651 | spin_lock(&vnode->lock); |
| 652 | set_bit(AFS_VNODE_DELETED, &vnode->flags); | 652 | set_bit(AFS_VNODE_DELETED, &vnode->flags); |
| 653 | spin_unlock(&vnode->lock); | 653 | spin_unlock(&vnode->lock); |
| @@ -658,7 +658,7 @@ static int afs_d_revalidate(struct dentry *dentry, unsigned int flags) | |||
| 658 | case -ENOENT: | 658 | case -ENOENT: |
| 659 | /* the filename is unknown */ | 659 | /* the filename is unknown */ |
| 660 | _debug("%pd: dirent not found", dentry); | 660 | _debug("%pd: dirent not found", dentry); |
| 661 | if (dentry->d_inode) | 661 | if (d_really_is_positive(dentry)) |
| 662 | goto not_found; | 662 | goto not_found; |
| 663 | goto out_valid; | 663 | goto out_valid; |
| 664 | 664 | ||
| @@ -703,9 +703,9 @@ static int afs_d_delete(const struct dentry *dentry) | |||
| 703 | if (dentry->d_flags & DCACHE_NFSFS_RENAMED) | 703 | if (dentry->d_flags & DCACHE_NFSFS_RENAMED) |
| 704 | goto zap; | 704 | goto zap; |
| 705 | 705 | ||
| 706 | if (dentry->d_inode && | 706 | if (d_really_is_positive(dentry) && |
| 707 | (test_bit(AFS_VNODE_DELETED, &AFS_FS_I(dentry->d_inode)->flags) || | 707 | (test_bit(AFS_VNODE_DELETED, &AFS_FS_I(d_inode(dentry))->flags) || |
| 708 | test_bit(AFS_VNODE_PSEUDODIR, &AFS_FS_I(dentry->d_inode)->flags))) | 708 | test_bit(AFS_VNODE_PSEUDODIR, &AFS_FS_I(d_inode(dentry))->flags))) |
| 709 | goto zap; | 709 | goto zap; |
| 710 | 710 | ||
| 711 | _leave(" = 0 [keep]"); | 711 | _leave(" = 0 [keep]"); |
| @@ -814,8 +814,8 @@ static int afs_rmdir(struct inode *dir, struct dentry *dentry) | |||
| 814 | if (ret < 0) | 814 | if (ret < 0) |
| 815 | goto rmdir_error; | 815 | goto rmdir_error; |
| 816 | 816 | ||
| 817 | if (dentry->d_inode) { | 817 | if (d_really_is_positive(dentry)) { |
| 818 | vnode = AFS_FS_I(dentry->d_inode); | 818 | vnode = AFS_FS_I(d_inode(dentry)); |
| 819 | clear_nlink(&vnode->vfs_inode); | 819 | clear_nlink(&vnode->vfs_inode); |
| 820 | set_bit(AFS_VNODE_DELETED, &vnode->flags); | 820 | set_bit(AFS_VNODE_DELETED, &vnode->flags); |
| 821 | afs_discard_callback_on_delete(vnode); | 821 | afs_discard_callback_on_delete(vnode); |
| @@ -856,8 +856,8 @@ static int afs_unlink(struct inode *dir, struct dentry *dentry) | |||
| 856 | goto error; | 856 | goto error; |
| 857 | } | 857 | } |
| 858 | 858 | ||
| 859 | if (dentry->d_inode) { | 859 | if (d_really_is_positive(dentry)) { |
| 860 | vnode = AFS_FS_I(dentry->d_inode); | 860 | vnode = AFS_FS_I(d_inode(dentry)); |
| 861 | 861 | ||
| 862 | /* make sure we have a callback promise on the victim */ | 862 | /* make sure we have a callback promise on the victim */ |
| 863 | ret = afs_validate(vnode, key); | 863 | ret = afs_validate(vnode, key); |
| @@ -869,7 +869,7 @@ static int afs_unlink(struct inode *dir, struct dentry *dentry) | |||
| 869 | if (ret < 0) | 869 | if (ret < 0) |
| 870 | goto remove_error; | 870 | goto remove_error; |
| 871 | 871 | ||
| 872 | if (dentry->d_inode) { | 872 | if (d_really_is_positive(dentry)) { |
| 873 | /* if the file wasn't deleted due to excess hard links, the | 873 | /* if the file wasn't deleted due to excess hard links, the |
| 874 | * fileserver will break the callback promise on the file - if | 874 | * fileserver will break the callback promise on the file - if |
| 875 | * it had one - before it returns to us, and if it was deleted, | 875 | * it had one - before it returns to us, and if it was deleted, |
| @@ -879,7 +879,7 @@ static int afs_unlink(struct inode *dir, struct dentry *dentry) | |||
| 879 | * or it was outstanding on a different server, then it won't | 879 | * or it was outstanding on a different server, then it won't |
| 880 | * break it either... | 880 | * break it either... |
| 881 | */ | 881 | */ |
| 882 | vnode = AFS_FS_I(dentry->d_inode); | 882 | vnode = AFS_FS_I(d_inode(dentry)); |
| 883 | if (test_bit(AFS_VNODE_DELETED, &vnode->flags)) | 883 | if (test_bit(AFS_VNODE_DELETED, &vnode->flags)) |
| 884 | _debug("AFS_VNODE_DELETED"); | 884 | _debug("AFS_VNODE_DELETED"); |
| 885 | if (test_bit(AFS_VNODE_CB_BROKEN, &vnode->flags)) | 885 | if (test_bit(AFS_VNODE_CB_BROKEN, &vnode->flags)) |
| @@ -977,7 +977,7 @@ static int afs_link(struct dentry *from, struct inode *dir, | |||
| 977 | struct key *key; | 977 | struct key *key; |
| 978 | int ret; | 978 | int ret; |
| 979 | 979 | ||
| 980 | vnode = AFS_FS_I(from->d_inode); | 980 | vnode = AFS_FS_I(d_inode(from)); |
| 981 | dvnode = AFS_FS_I(dir); | 981 | dvnode = AFS_FS_I(dir); |
| 982 | 982 | ||
| 983 | _enter("{%x:%u},{%x:%u},{%pd}", | 983 | _enter("{%x:%u},{%x:%u},{%pd}", |
| @@ -1089,7 +1089,7 @@ static int afs_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
| 1089 | struct key *key; | 1089 | struct key *key; |
| 1090 | int ret; | 1090 | int ret; |
| 1091 | 1091 | ||
| 1092 | vnode = AFS_FS_I(old_dentry->d_inode); | 1092 | vnode = AFS_FS_I(d_inode(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 | ||
diff --git a/fs/afs/inode.c b/fs/afs/inode.c index 8a1d38ef0fc2..e06f5a23352a 100644 --- a/fs/afs/inode.c +++ b/fs/afs/inode.c | |||
| @@ -379,7 +379,7 @@ int afs_getattr(struct vfsmount *mnt, struct dentry *dentry, | |||
| 379 | { | 379 | { |
| 380 | struct inode *inode; | 380 | struct inode *inode; |
| 381 | 381 | ||
| 382 | inode = dentry->d_inode; | 382 | inode = d_inode(dentry); |
| 383 | 383 | ||
| 384 | _enter("{ ino=%lu v=%u }", inode->i_ino, inode->i_generation); | 384 | _enter("{ ino=%lu v=%u }", inode->i_ino, inode->i_generation); |
| 385 | 385 | ||
| @@ -458,7 +458,7 @@ void afs_evict_inode(struct inode *inode) | |||
| 458 | */ | 458 | */ |
| 459 | int afs_setattr(struct dentry *dentry, struct iattr *attr) | 459 | int afs_setattr(struct dentry *dentry, struct iattr *attr) |
| 460 | { | 460 | { |
| 461 | struct afs_vnode *vnode = AFS_FS_I(dentry->d_inode); | 461 | struct afs_vnode *vnode = AFS_FS_I(d_inode(dentry)); |
| 462 | struct key *key; | 462 | struct key *key; |
| 463 | int ret; | 463 | int ret; |
| 464 | 464 | ||
diff --git a/fs/afs/mntpt.c b/fs/afs/mntpt.c index 938c5ab06d5a..ccd0b212e82a 100644 --- a/fs/afs/mntpt.c +++ b/fs/afs/mntpt.c | |||
| @@ -134,7 +134,7 @@ static struct vfsmount *afs_mntpt_do_automount(struct dentry *mntpt) | |||
| 134 | 134 | ||
| 135 | _enter("{%pd}", mntpt); | 135 | _enter("{%pd}", mntpt); |
| 136 | 136 | ||
| 137 | BUG_ON(!mntpt->d_inode); | 137 | BUG_ON(!d_inode(mntpt)); |
| 138 | 138 | ||
| 139 | ret = -ENOMEM; | 139 | ret = -ENOMEM; |
| 140 | devname = (char *) get_zeroed_page(GFP_KERNEL); | 140 | devname = (char *) get_zeroed_page(GFP_KERNEL); |
| @@ -145,7 +145,7 @@ static struct vfsmount *afs_mntpt_do_automount(struct dentry *mntpt) | |||
| 145 | if (!options) | 145 | if (!options) |
| 146 | goto error_no_options; | 146 | goto error_no_options; |
| 147 | 147 | ||
| 148 | vnode = AFS_FS_I(mntpt->d_inode); | 148 | vnode = AFS_FS_I(d_inode(mntpt)); |
| 149 | if (test_bit(AFS_VNODE_PSEUDODIR, &vnode->flags)) { | 149 | if (test_bit(AFS_VNODE_PSEUDODIR, &vnode->flags)) { |
| 150 | /* if the directory is a pseudo directory, use the d_name */ | 150 | /* if the directory is a pseudo directory, use the d_name */ |
| 151 | static const char afs_root_cell[] = ":root.cell."; | 151 | static const char afs_root_cell[] = ":root.cell."; |
| @@ -169,14 +169,14 @@ static struct vfsmount *afs_mntpt_do_automount(struct dentry *mntpt) | |||
| 169 | } | 169 | } |
| 170 | } else { | 170 | } else { |
| 171 | /* read the contents of the AFS special symlink */ | 171 | /* read the contents of the AFS special symlink */ |
| 172 | loff_t size = i_size_read(mntpt->d_inode); | 172 | loff_t size = i_size_read(d_inode(mntpt)); |
| 173 | char *buf; | 173 | char *buf; |
| 174 | 174 | ||
| 175 | ret = -EINVAL; | 175 | ret = -EINVAL; |
| 176 | if (size > PAGE_SIZE - 1) | 176 | if (size > PAGE_SIZE - 1) |
| 177 | goto error_no_page; | 177 | goto error_no_page; |
| 178 | 178 | ||
| 179 | page = read_mapping_page(mntpt->d_inode->i_mapping, 0, NULL); | 179 | page = read_mapping_page(d_inode(mntpt)->i_mapping, 0, NULL); |
| 180 | if (IS_ERR(page)) { | 180 | if (IS_ERR(page)) { |
| 181 | ret = PTR_ERR(page); | 181 | ret = PTR_ERR(page); |
| 182 | goto error_no_page; | 182 | goto error_no_page; |
diff --git a/fs/afs/super.c b/fs/afs/super.c index c4861557e385..1fb4a5129f7d 100644 --- a/fs/afs/super.c +++ b/fs/afs/super.c | |||
| @@ -529,7 +529,7 @@ static void afs_destroy_inode(struct inode *inode) | |||
| 529 | static int afs_statfs(struct dentry *dentry, struct kstatfs *buf) | 529 | static int afs_statfs(struct dentry *dentry, struct kstatfs *buf) |
| 530 | { | 530 | { |
| 531 | struct afs_volume_status vs; | 531 | struct afs_volume_status vs; |
| 532 | struct afs_vnode *vnode = AFS_FS_I(dentry->d_inode); | 532 | struct afs_vnode *vnode = AFS_FS_I(d_inode(dentry)); |
| 533 | struct key *key; | 533 | struct key *key; |
| 534 | int ret; | 534 | int ret; |
| 535 | 535 | ||
diff --git a/fs/autofs4/autofs_i.h b/fs/autofs4/autofs_i.h index d10e619632ab..5b700ef1e59d 100644 --- a/fs/autofs4/autofs_i.h +++ b/fs/autofs4/autofs_i.h | |||
| @@ -235,12 +235,12 @@ static inline u32 autofs4_get_dev(struct autofs_sb_info *sbi) | |||
| 235 | 235 | ||
| 236 | static inline u64 autofs4_get_ino(struct autofs_sb_info *sbi) | 236 | static inline u64 autofs4_get_ino(struct autofs_sb_info *sbi) |
| 237 | { | 237 | { |
| 238 | return sbi->sb->s_root->d_inode->i_ino; | 238 | return d_inode(sbi->sb->s_root)->i_ino; |
| 239 | } | 239 | } |
| 240 | 240 | ||
| 241 | static inline int simple_positive(struct dentry *dentry) | 241 | static inline int simple_positive(struct dentry *dentry) |
| 242 | { | 242 | { |
| 243 | return dentry->d_inode && !d_unhashed(dentry); | 243 | return d_really_is_positive(dentry) && !d_unhashed(dentry); |
| 244 | } | 244 | } |
| 245 | 245 | ||
| 246 | static inline void __autofs4_add_expiring(struct dentry *dentry) | 246 | static inline void __autofs4_add_expiring(struct dentry *dentry) |
diff --git a/fs/autofs4/expire.c b/fs/autofs4/expire.c index 11dd118f75e2..1cebc3c52fa5 100644 --- a/fs/autofs4/expire.c +++ b/fs/autofs4/expire.c | |||
| @@ -374,7 +374,7 @@ static struct dentry *should_expire(struct dentry *dentry, | |||
| 374 | return NULL; | 374 | return NULL; |
| 375 | } | 375 | } |
| 376 | 376 | ||
| 377 | if (dentry->d_inode && d_is_symlink(dentry)) { | 377 | if (d_really_is_positive(dentry) && d_is_symlink(dentry)) { |
| 378 | DPRINTK("checking symlink %p %pd", dentry, dentry); | 378 | DPRINTK("checking symlink %p %pd", dentry, dentry); |
| 379 | /* | 379 | /* |
| 380 | * A symlink can't be "busy" in the usual sense so | 380 | * A symlink can't be "busy" in the usual sense so |
diff --git a/fs/autofs4/inode.c b/fs/autofs4/inode.c index 1c55388ae633..a3ae0b2aeb5a 100644 --- a/fs/autofs4/inode.c +++ b/fs/autofs4/inode.c | |||
| @@ -71,7 +71,7 @@ void autofs4_kill_sb(struct super_block *sb) | |||
| 71 | static int autofs4_show_options(struct seq_file *m, struct dentry *root) | 71 | static int autofs4_show_options(struct seq_file *m, struct dentry *root) |
| 72 | { | 72 | { |
| 73 | struct autofs_sb_info *sbi = autofs4_sbi(root->d_sb); | 73 | struct autofs_sb_info *sbi = autofs4_sbi(root->d_sb); |
| 74 | struct inode *root_inode = root->d_sb->s_root->d_inode; | 74 | struct inode *root_inode = d_inode(root->d_sb->s_root); |
| 75 | 75 | ||
| 76 | if (!sbi) | 76 | if (!sbi) |
| 77 | return 0; | 77 | return 0; |
| @@ -352,8 +352,8 @@ struct inode *autofs4_get_inode(struct super_block *sb, umode_t mode) | |||
| 352 | 352 | ||
| 353 | inode->i_mode = mode; | 353 | inode->i_mode = mode; |
| 354 | if (sb->s_root) { | 354 | if (sb->s_root) { |
| 355 | inode->i_uid = sb->s_root->d_inode->i_uid; | 355 | inode->i_uid = d_inode(sb->s_root)->i_uid; |
| 356 | inode->i_gid = sb->s_root->d_inode->i_gid; | 356 | inode->i_gid = d_inode(sb->s_root)->i_gid; |
| 357 | } | 357 | } |
| 358 | inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; | 358 | inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; |
| 359 | inode->i_ino = get_next_ino(); | 359 | inode->i_ino = get_next_ino(); |
diff --git a/fs/autofs4/root.c b/fs/autofs4/root.c index 7e44fdd03e2d..c6d7d3dbd52a 100644 --- a/fs/autofs4/root.c +++ b/fs/autofs4/root.c | |||
| @@ -240,7 +240,7 @@ static struct dentry *autofs4_lookup_expiring(struct dentry *dentry, | |||
| 240 | spin_lock(&expiring->d_lock); | 240 | spin_lock(&expiring->d_lock); |
| 241 | 241 | ||
| 242 | /* We've already been dentry_iput or unlinked */ | 242 | /* We've already been dentry_iput or unlinked */ |
| 243 | if (!expiring->d_inode) | 243 | if (d_really_is_negative(expiring)) |
| 244 | goto next; | 244 | goto next; |
| 245 | 245 | ||
| 246 | qstr = &expiring->d_name; | 246 | qstr = &expiring->d_name; |
| @@ -371,7 +371,7 @@ static struct vfsmount *autofs4_d_automount(struct path *path) | |||
| 371 | * having d_mountpoint() true, so there's no need to call back | 371 | * having d_mountpoint() true, so there's no need to call back |
| 372 | * to the daemon. | 372 | * to the daemon. |
| 373 | */ | 373 | */ |
| 374 | if (dentry->d_inode && d_is_symlink(dentry)) { | 374 | if (d_really_is_positive(dentry) && d_is_symlink(dentry)) { |
| 375 | spin_unlock(&sbi->fs_lock); | 375 | spin_unlock(&sbi->fs_lock); |
| 376 | goto done; | 376 | goto done; |
| 377 | } | 377 | } |
| @@ -459,7 +459,7 @@ static int autofs4_d_manage(struct dentry *dentry, bool rcu_walk) | |||
| 459 | return 0; | 459 | return 0; |
| 460 | if (d_mountpoint(dentry)) | 460 | if (d_mountpoint(dentry)) |
| 461 | return 0; | 461 | return 0; |
| 462 | inode = ACCESS_ONCE(dentry->d_inode); | 462 | inode = d_inode_rcu(dentry); |
| 463 | if (inode && S_ISLNK(inode->i_mode)) | 463 | if (inode && S_ISLNK(inode->i_mode)) |
| 464 | return -EISDIR; | 464 | return -EISDIR; |
| 465 | if (list_empty(&dentry->d_subdirs)) | 465 | if (list_empty(&dentry->d_subdirs)) |
| @@ -485,7 +485,7 @@ static int autofs4_d_manage(struct dentry *dentry, bool rcu_walk) | |||
| 485 | * an incorrect ELOOP error return. | 485 | * an incorrect ELOOP error return. |
| 486 | */ | 486 | */ |
| 487 | if ((!d_mountpoint(dentry) && !simple_empty(dentry)) || | 487 | if ((!d_mountpoint(dentry) && !simple_empty(dentry)) || |
| 488 | (dentry->d_inode && d_is_symlink(dentry))) | 488 | (d_really_is_positive(dentry) && d_is_symlink(dentry))) |
| 489 | status = -EISDIR; | 489 | status = -EISDIR; |
| 490 | } | 490 | } |
| 491 | spin_unlock(&sbi->fs_lock); | 491 | spin_unlock(&sbi->fs_lock); |
| @@ -625,8 +625,8 @@ static int autofs4_dir_unlink(struct inode *dir, struct dentry *dentry) | |||
| 625 | } | 625 | } |
| 626 | dput(ino->dentry); | 626 | dput(ino->dentry); |
| 627 | 627 | ||
| 628 | dentry->d_inode->i_size = 0; | 628 | d_inode(dentry)->i_size = 0; |
| 629 | clear_nlink(dentry->d_inode); | 629 | clear_nlink(d_inode(dentry)); |
| 630 | 630 | ||
| 631 | dir->i_mtime = CURRENT_TIME; | 631 | dir->i_mtime = CURRENT_TIME; |
| 632 | 632 | ||
| @@ -719,8 +719,8 @@ static int autofs4_dir_rmdir(struct inode *dir, struct dentry *dentry) | |||
| 719 | atomic_dec(&p_ino->count); | 719 | atomic_dec(&p_ino->count); |
| 720 | } | 720 | } |
| 721 | dput(ino->dentry); | 721 | dput(ino->dentry); |
| 722 | dentry->d_inode->i_size = 0; | 722 | d_inode(dentry)->i_size = 0; |
| 723 | clear_nlink(dentry->d_inode); | 723 | clear_nlink(d_inode(dentry)); |
| 724 | 724 | ||
| 725 | if (dir->i_nlink) | 725 | if (dir->i_nlink) |
| 726 | drop_nlink(dir); | 726 | drop_nlink(dir); |
| @@ -839,7 +839,7 @@ static inline int autofs4_ask_umount(struct vfsmount *mnt, int __user *p) | |||
| 839 | */ | 839 | */ |
| 840 | int is_autofs4_dentry(struct dentry *dentry) | 840 | int is_autofs4_dentry(struct dentry *dentry) |
| 841 | { | 841 | { |
| 842 | return dentry && dentry->d_inode && | 842 | return dentry && d_really_is_positive(dentry) && |
| 843 | dentry->d_op == &autofs4_dentry_operations && | 843 | dentry->d_op == &autofs4_dentry_operations && |
| 844 | dentry->d_fsdata != NULL; | 844 | dentry->d_fsdata != NULL; |
| 845 | } | 845 | } |
diff --git a/fs/autofs4/symlink.c b/fs/autofs4/symlink.c index 1e8ea192be2b..de58cc7b8076 100644 --- a/fs/autofs4/symlink.c +++ b/fs/autofs4/symlink.c | |||
| @@ -18,7 +18,7 @@ static void *autofs4_follow_link(struct dentry *dentry, struct nameidata *nd) | |||
| 18 | struct autofs_info *ino = autofs4_dentry_ino(dentry); | 18 | struct autofs_info *ino = autofs4_dentry_ino(dentry); |
| 19 | if (ino && !autofs4_oz_mode(sbi)) | 19 | if (ino && !autofs4_oz_mode(sbi)) |
| 20 | ino->last_used = jiffies; | 20 | ino->last_used = jiffies; |
| 21 | nd_set_link(nd, dentry->d_inode->i_private); | 21 | nd_set_link(nd, d_inode(dentry)->i_private); |
| 22 | return NULL; | 22 | return NULL; |
| 23 | } | 23 | } |
| 24 | 24 | ||
diff --git a/fs/autofs4/waitq.c b/fs/autofs4/waitq.c index 2ad05ab93db8..35b755e79c2d 100644 --- a/fs/autofs4/waitq.c +++ b/fs/autofs4/waitq.c | |||
| @@ -322,7 +322,7 @@ static int validate_request(struct autofs_wait_queue **wait, | |||
| 322 | * continue on and create a new request. | 322 | * continue on and create a new request. |
| 323 | */ | 323 | */ |
| 324 | if (!IS_ROOT(dentry)) { | 324 | if (!IS_ROOT(dentry)) { |
| 325 | if (dentry->d_inode && d_unhashed(dentry)) { | 325 | if (d_really_is_positive(dentry) && d_unhashed(dentry)) { |
| 326 | struct dentry *parent = dentry->d_parent; | 326 | struct dentry *parent = dentry->d_parent; |
| 327 | new = d_lookup(parent, &dentry->d_name); | 327 | new = d_lookup(parent, &dentry->d_name); |
| 328 | if (new) | 328 | if (new) |
| @@ -364,7 +364,7 @@ int autofs4_wait(struct autofs_sb_info *sbi, struct dentry *dentry, | |||
| 364 | if (pid == 0 || tgid == 0) | 364 | if (pid == 0 || tgid == 0) |
| 365 | return -ENOENT; | 365 | return -ENOENT; |
| 366 | 366 | ||
| 367 | if (!dentry->d_inode) { | 367 | if (d_really_is_negative(dentry)) { |
| 368 | /* | 368 | /* |
| 369 | * A wait for a negative dentry is invalid for certain | 369 | * A wait for a negative dentry is invalid for certain |
| 370 | * cases. A direct or offset mount "always" has its mount | 370 | * cases. A direct or offset mount "always" has its mount |
diff --git a/fs/befs/linuxvfs.c b/fs/befs/linuxvfs.c index 16e0a48bfccd..7943533c3868 100644 --- a/fs/befs/linuxvfs.c +++ b/fs/befs/linuxvfs.c | |||
| @@ -471,7 +471,7 @@ static void * | |||
| 471 | befs_follow_link(struct dentry *dentry, struct nameidata *nd) | 471 | befs_follow_link(struct dentry *dentry, struct nameidata *nd) |
| 472 | { | 472 | { |
| 473 | struct super_block *sb = dentry->d_sb; | 473 | struct super_block *sb = dentry->d_sb; |
| 474 | struct befs_inode_info *befs_ino = BEFS_I(dentry->d_inode); | 474 | struct befs_inode_info *befs_ino = BEFS_I(d_inode(dentry)); |
| 475 | befs_data_stream *data = &befs_ino->i_data.ds; | 475 | befs_data_stream *data = &befs_ino->i_data.ds; |
| 476 | befs_off_t len = data->size; | 476 | befs_off_t len = data->size; |
| 477 | char *link; | 477 | char *link; |
| @@ -501,7 +501,7 @@ befs_follow_link(struct dentry *dentry, struct nameidata *nd) | |||
| 501 | static void * | 501 | static void * |
| 502 | befs_fast_follow_link(struct dentry *dentry, struct nameidata *nd) | 502 | befs_fast_follow_link(struct dentry *dentry, struct nameidata *nd) |
| 503 | { | 503 | { |
| 504 | struct befs_inode_info *befs_ino = BEFS_I(dentry->d_inode); | 504 | struct befs_inode_info *befs_ino = BEFS_I(d_inode(dentry)); |
| 505 | 505 | ||
| 506 | nd_set_link(nd, befs_ino->i_data.symlink); | 506 | nd_set_link(nd, befs_ino->i_data.symlink); |
| 507 | return NULL; | 507 | return NULL; |
diff --git a/fs/bfs/dir.c b/fs/bfs/dir.c index 7a8182770649..3ec6113146c0 100644 --- a/fs/bfs/dir.c +++ b/fs/bfs/dir.c | |||
| @@ -153,7 +153,7 @@ static struct dentry *bfs_lookup(struct inode *dir, struct dentry *dentry, | |||
| 153 | static int bfs_link(struct dentry *old, struct inode *dir, | 153 | static int bfs_link(struct dentry *old, struct inode *dir, |
| 154 | struct dentry *new) | 154 | struct dentry *new) |
| 155 | { | 155 | { |
| 156 | struct inode *inode = old->d_inode; | 156 | struct inode *inode = d_inode(old); |
| 157 | struct bfs_sb_info *info = BFS_SB(inode->i_sb); | 157 | struct bfs_sb_info *info = BFS_SB(inode->i_sb); |
| 158 | int err; | 158 | int err; |
| 159 | 159 | ||
| @@ -176,7 +176,7 @@ static int bfs_link(struct dentry *old, struct inode *dir, | |||
| 176 | static int bfs_unlink(struct inode *dir, struct dentry *dentry) | 176 | static int bfs_unlink(struct inode *dir, struct dentry *dentry) |
| 177 | { | 177 | { |
| 178 | int error = -ENOENT; | 178 | int error = -ENOENT; |
| 179 | struct inode *inode = dentry->d_inode; | 179 | struct inode *inode = d_inode(dentry); |
| 180 | struct buffer_head *bh; | 180 | struct buffer_head *bh; |
| 181 | struct bfs_dirent *de; | 181 | struct bfs_dirent *de; |
| 182 | struct bfs_sb_info *info = BFS_SB(inode->i_sb); | 182 | struct bfs_sb_info *info = BFS_SB(inode->i_sb); |
| @@ -216,7 +216,7 @@ static int bfs_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
| 216 | int error = -ENOENT; | 216 | int error = -ENOENT; |
| 217 | 217 | ||
| 218 | old_bh = new_bh = NULL; | 218 | old_bh = new_bh = NULL; |
| 219 | old_inode = old_dentry->d_inode; | 219 | old_inode = d_inode(old_dentry); |
| 220 | if (S_ISDIR(old_inode->i_mode)) | 220 | if (S_ISDIR(old_inode->i_mode)) |
| 221 | return -EINVAL; | 221 | return -EINVAL; |
| 222 | 222 | ||
| @@ -231,7 +231,7 @@ static int bfs_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
| 231 | goto end_rename; | 231 | goto end_rename; |
| 232 | 232 | ||
| 233 | error = -EPERM; | 233 | error = -EPERM; |
| 234 | new_inode = new_dentry->d_inode; | 234 | new_inode = d_inode(new_dentry); |
| 235 | new_bh = bfs_find_entry(new_dir, | 235 | new_bh = bfs_find_entry(new_dir, |
| 236 | new_dentry->d_name.name, | 236 | new_dentry->d_name.name, |
| 237 | new_dentry->d_name.len, &new_de); | 237 | new_dentry->d_name.len, &new_de); |
diff --git a/fs/binfmt_misc.c b/fs/binfmt_misc.c index 9dcb05409ba7..78f005f37847 100644 --- a/fs/binfmt_misc.c +++ b/fs/binfmt_misc.c | |||
| @@ -591,7 +591,7 @@ static void kill_node(Node *e) | |||
| 591 | write_unlock(&entries_lock); | 591 | write_unlock(&entries_lock); |
| 592 | 592 | ||
| 593 | if (dentry) { | 593 | if (dentry) { |
| 594 | drop_nlink(dentry->d_inode); | 594 | drop_nlink(d_inode(dentry)); |
| 595 | d_drop(dentry); | 595 | d_drop(dentry); |
| 596 | dput(dentry); | 596 | dput(dentry); |
| 597 | simple_release_fs(&bm_mnt, &entry_count); | 597 | simple_release_fs(&bm_mnt, &entry_count); |
| @@ -638,11 +638,11 @@ static ssize_t bm_entry_write(struct file *file, const char __user *buffer, | |||
| 638 | case 3: | 638 | case 3: |
| 639 | /* Delete this handler. */ | 639 | /* Delete this handler. */ |
| 640 | root = dget(file->f_path.dentry->d_sb->s_root); | 640 | root = dget(file->f_path.dentry->d_sb->s_root); |
| 641 | mutex_lock(&root->d_inode->i_mutex); | 641 | mutex_lock(&d_inode(root)->i_mutex); |
| 642 | 642 | ||
| 643 | kill_node(e); | 643 | kill_node(e); |
| 644 | 644 | ||
| 645 | mutex_unlock(&root->d_inode->i_mutex); | 645 | mutex_unlock(&d_inode(root)->i_mutex); |
| 646 | dput(root); | 646 | dput(root); |
| 647 | break; | 647 | break; |
| 648 | default: | 648 | default: |
| @@ -675,14 +675,14 @@ static ssize_t bm_register_write(struct file *file, const char __user *buffer, | |||
| 675 | return PTR_ERR(e); | 675 | return PTR_ERR(e); |
| 676 | 676 | ||
| 677 | root = dget(sb->s_root); | 677 | root = dget(sb->s_root); |
| 678 | mutex_lock(&root->d_inode->i_mutex); | 678 | mutex_lock(&d_inode(root)->i_mutex); |
| 679 | dentry = lookup_one_len(e->name, root, strlen(e->name)); | 679 | dentry = lookup_one_len(e->name, root, strlen(e->name)); |
| 680 | err = PTR_ERR(dentry); | 680 | err = PTR_ERR(dentry); |
| 681 | if (IS_ERR(dentry)) | 681 | if (IS_ERR(dentry)) |
| 682 | goto out; | 682 | goto out; |
| 683 | 683 | ||
| 684 | err = -EEXIST; | 684 | err = -EEXIST; |
| 685 | if (dentry->d_inode) | 685 | if (d_really_is_positive(dentry)) |
| 686 | goto out2; | 686 | goto out2; |
| 687 | 687 | ||
| 688 | inode = bm_get_inode(sb, S_IFREG | 0644); | 688 | inode = bm_get_inode(sb, S_IFREG | 0644); |
| @@ -711,7 +711,7 @@ static ssize_t bm_register_write(struct file *file, const char __user *buffer, | |||
| 711 | out2: | 711 | out2: |
| 712 | dput(dentry); | 712 | dput(dentry); |
| 713 | out: | 713 | out: |
| 714 | mutex_unlock(&root->d_inode->i_mutex); | 714 | mutex_unlock(&d_inode(root)->i_mutex); |
| 715 | dput(root); | 715 | dput(root); |
| 716 | 716 | ||
| 717 | if (err) { | 717 | if (err) { |
| @@ -754,12 +754,12 @@ static ssize_t bm_status_write(struct file *file, const char __user *buffer, | |||
| 754 | case 3: | 754 | case 3: |
| 755 | /* Delete all handlers. */ | 755 | /* Delete all handlers. */ |
| 756 | root = dget(file->f_path.dentry->d_sb->s_root); | 756 | root = dget(file->f_path.dentry->d_sb->s_root); |
| 757 | mutex_lock(&root->d_inode->i_mutex); | 757 | mutex_lock(&d_inode(root)->i_mutex); |
| 758 | 758 | ||
| 759 | while (!list_empty(&entries)) | 759 | while (!list_empty(&entries)) |
| 760 | kill_node(list_entry(entries.next, Node, list)); | 760 | kill_node(list_entry(entries.next, Node, list)); |
| 761 | 761 | ||
| 762 | mutex_unlock(&root->d_inode->i_mutex); | 762 | mutex_unlock(&d_inode(root)->i_mutex); |
| 763 | dput(root); | 763 | dput(root); |
| 764 | break; | 764 | break; |
| 765 | default: | 765 | default: |
diff --git a/fs/block_dev.c b/fs/block_dev.c index 897ee0503932..c7e4163ede87 100644 --- a/fs/block_dev.c +++ b/fs/block_dev.c | |||
| @@ -152,7 +152,8 @@ blkdev_direct_IO(struct kiocb *iocb, struct iov_iter *iter, loff_t offset) | |||
| 152 | struct inode *inode = file->f_mapping->host; | 152 | struct inode *inode = file->f_mapping->host; |
| 153 | 153 | ||
| 154 | return __blockdev_direct_IO(iocb, inode, I_BDEV(inode), iter, offset, | 154 | return __blockdev_direct_IO(iocb, inode, I_BDEV(inode), iter, offset, |
| 155 | blkdev_get_block, NULL, NULL, 0); | 155 | blkdev_get_block, NULL, NULL, |
| 156 | DIO_SKIP_DIO_COUNT); | ||
| 156 | } | 157 | } |
| 157 | 158 | ||
| 158 | int __sync_blockdev(struct block_device *bdev, int wait) | 159 | int __sync_blockdev(struct block_device *bdev, int wait) |
| @@ -1716,7 +1717,7 @@ struct block_device *lookup_bdev(const char *pathname) | |||
| 1716 | if (error) | 1717 | if (error) |
| 1717 | return ERR_PTR(error); | 1718 | return ERR_PTR(error); |
| 1718 | 1719 | ||
| 1719 | inode = path.dentry->d_inode; | 1720 | inode = d_backing_inode(path.dentry); |
| 1720 | error = -ENOTBLK; | 1721 | error = -ENOTBLK; |
| 1721 | if (!S_ISBLK(inode->i_mode)) | 1722 | if (!S_ISBLK(inode->i_mode)) |
| 1722 | goto fail; | 1723 | goto fail; |
diff --git a/fs/btrfs/export.c b/fs/btrfs/export.c index 37d164540c3a..8d052209f473 100644 --- a/fs/btrfs/export.c +++ b/fs/btrfs/export.c | |||
| @@ -152,7 +152,7 @@ static struct dentry *btrfs_fh_to_dentry(struct super_block *sb, struct fid *fh, | |||
| 152 | 152 | ||
| 153 | static struct dentry *btrfs_get_parent(struct dentry *child) | 153 | static struct dentry *btrfs_get_parent(struct dentry *child) |
| 154 | { | 154 | { |
| 155 | struct inode *dir = child->d_inode; | 155 | struct inode *dir = d_inode(child); |
| 156 | struct btrfs_root *root = BTRFS_I(dir)->root; | 156 | struct btrfs_root *root = BTRFS_I(dir)->root; |
| 157 | struct btrfs_path *path; | 157 | struct btrfs_path *path; |
| 158 | struct extent_buffer *leaf; | 158 | struct extent_buffer *leaf; |
| @@ -220,8 +220,8 @@ fail: | |||
| 220 | static int btrfs_get_name(struct dentry *parent, char *name, | 220 | static int btrfs_get_name(struct dentry *parent, char *name, |
| 221 | struct dentry *child) | 221 | struct dentry *child) |
| 222 | { | 222 | { |
| 223 | struct inode *inode = child->d_inode; | 223 | struct inode *inode = d_inode(child); |
| 224 | struct inode *dir = parent->d_inode; | 224 | struct inode *dir = d_inode(parent); |
| 225 | struct btrfs_path *path; | 225 | struct btrfs_path *path; |
| 226 | struct btrfs_root *root = BTRFS_I(dir)->root; | 226 | struct btrfs_root *root = BTRFS_I(dir)->root; |
| 227 | struct btrfs_inode_ref *iref; | 227 | struct btrfs_inode_ref *iref; |
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c index 467620a3b1f9..b072e17479aa 100644 --- a/fs/btrfs/file.c +++ b/fs/btrfs/file.c | |||
| @@ -1862,7 +1862,7 @@ static int start_ordered_ops(struct inode *inode, loff_t start, loff_t end) | |||
| 1862 | int btrfs_sync_file(struct file *file, loff_t start, loff_t end, int datasync) | 1862 | int btrfs_sync_file(struct file *file, loff_t start, loff_t end, int datasync) |
| 1863 | { | 1863 | { |
| 1864 | struct dentry *dentry = file->f_path.dentry; | 1864 | struct dentry *dentry = file->f_path.dentry; |
| 1865 | struct inode *inode = dentry->d_inode; | 1865 | struct inode *inode = d_inode(dentry); |
| 1866 | struct btrfs_root *root = BTRFS_I(inode)->root; | 1866 | struct btrfs_root *root = BTRFS_I(inode)->root; |
| 1867 | struct btrfs_trans_handle *trans; | 1867 | struct btrfs_trans_handle *trans; |
| 1868 | struct btrfs_log_ctx ctx; | 1868 | struct btrfs_log_ctx ctx; |
diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c index 253cb74b0e27..81fa75a8e1f3 100644 --- a/fs/btrfs/free-space-cache.c +++ b/fs/btrfs/free-space-cache.c | |||
| @@ -1119,10 +1119,7 @@ static int flush_dirty_cache(struct inode *inode) | |||
| 1119 | } | 1119 | } |
| 1120 | 1120 | ||
| 1121 | static void noinline_for_stack | 1121 | static void noinline_for_stack |
| 1122 | cleanup_write_cache_enospc(struct inode *inode, | 1122 | cleanup_bitmap_list(struct list_head *bitmap_list) |
| 1123 | struct btrfs_io_ctl *io_ctl, | ||
| 1124 | struct extent_state **cached_state, | ||
| 1125 | struct list_head *bitmap_list) | ||
| 1126 | { | 1123 | { |
| 1127 | struct list_head *pos, *n; | 1124 | struct list_head *pos, *n; |
| 1128 | 1125 | ||
| @@ -1131,6 +1128,14 @@ cleanup_write_cache_enospc(struct inode *inode, | |||
| 1131 | list_entry(pos, struct btrfs_free_space, list); | 1128 | list_entry(pos, struct btrfs_free_space, list); |
| 1132 | list_del_init(&entry->list); | 1129 | list_del_init(&entry->list); |
| 1133 | } | 1130 | } |
| 1131 | } | ||
| 1132 | |||
| 1133 | static void noinline_for_stack | ||
| 1134 | cleanup_write_cache_enospc(struct inode *inode, | ||
| 1135 | struct btrfs_io_ctl *io_ctl, | ||
| 1136 | struct extent_state **cached_state, | ||
| 1137 | struct list_head *bitmap_list) | ||
| 1138 | { | ||
| 1134 | io_ctl_drop_pages(io_ctl); | 1139 | io_ctl_drop_pages(io_ctl); |
| 1135 | unlock_extent_cached(&BTRFS_I(inode)->io_tree, 0, | 1140 | unlock_extent_cached(&BTRFS_I(inode)->io_tree, 0, |
| 1136 | i_size_read(inode) - 1, cached_state, | 1141 | i_size_read(inode) - 1, cached_state, |
| @@ -1149,7 +1154,8 @@ int btrfs_wait_cache_io(struct btrfs_root *root, | |||
| 1149 | if (!inode) | 1154 | if (!inode) |
| 1150 | return 0; | 1155 | return 0; |
| 1151 | 1156 | ||
| 1152 | root = root->fs_info->tree_root; | 1157 | if (block_group) |
| 1158 | root = root->fs_info->tree_root; | ||
| 1153 | 1159 | ||
| 1154 | /* Flush the dirty pages in the cache file. */ | 1160 | /* Flush the dirty pages in the cache file. */ |
| 1155 | ret = flush_dirty_cache(inode); | 1161 | ret = flush_dirty_cache(inode); |
| @@ -1265,11 +1271,8 @@ static int __btrfs_write_out_cache(struct btrfs_root *root, struct inode *inode, | |||
| 1265 | ret = write_cache_extent_entries(io_ctl, ctl, | 1271 | ret = write_cache_extent_entries(io_ctl, ctl, |
| 1266 | block_group, &entries, &bitmaps, | 1272 | block_group, &entries, &bitmaps, |
| 1267 | &bitmap_list); | 1273 | &bitmap_list); |
| 1268 | spin_unlock(&ctl->tree_lock); | 1274 | if (ret) |
| 1269 | if (ret) { | 1275 | goto out_nospc_locked; |
| 1270 | mutex_unlock(&ctl->cache_writeout_mutex); | ||
| 1271 | goto out_nospc; | ||
| 1272 | } | ||
| 1273 | 1276 | ||
| 1274 | /* | 1277 | /* |
| 1275 | * Some spaces that are freed in the current transaction are pinned, | 1278 | * Some spaces that are freed in the current transaction are pinned, |
| @@ -1280,17 +1283,14 @@ static int __btrfs_write_out_cache(struct btrfs_root *root, struct inode *inode, | |||
| 1280 | * the dirty list and redo it. No locking needed | 1283 | * the dirty list and redo it. No locking needed |
| 1281 | */ | 1284 | */ |
| 1282 | ret = write_pinned_extent_entries(root, block_group, io_ctl, &entries); | 1285 | ret = write_pinned_extent_entries(root, block_group, io_ctl, &entries); |
| 1283 | if (ret) { | 1286 | if (ret) |
| 1284 | mutex_unlock(&ctl->cache_writeout_mutex); | 1287 | goto out_nospc_locked; |
| 1285 | goto out_nospc; | ||
| 1286 | } | ||
| 1287 | 1288 | ||
| 1288 | /* | 1289 | /* |
| 1289 | * At last, we write out all the bitmaps and keep cache_writeout_mutex | 1290 | * At last, we write out all the bitmaps and keep cache_writeout_mutex |
| 1290 | * locked while doing it because a concurrent trim can be manipulating | 1291 | * locked while doing it because a concurrent trim can be manipulating |
| 1291 | * or freeing the bitmap. | 1292 | * or freeing the bitmap. |
| 1292 | */ | 1293 | */ |
| 1293 | spin_lock(&ctl->tree_lock); | ||
| 1294 | ret = write_bitmap_entries(io_ctl, &bitmap_list); | 1294 | ret = write_bitmap_entries(io_ctl, &bitmap_list); |
| 1295 | spin_unlock(&ctl->tree_lock); | 1295 | spin_unlock(&ctl->tree_lock); |
| 1296 | mutex_unlock(&ctl->cache_writeout_mutex); | 1296 | mutex_unlock(&ctl->cache_writeout_mutex); |
| @@ -1343,6 +1343,11 @@ out: | |||
| 1343 | iput(inode); | 1343 | iput(inode); |
| 1344 | return ret; | 1344 | return ret; |
| 1345 | 1345 | ||
| 1346 | out_nospc_locked: | ||
| 1347 | cleanup_bitmap_list(&bitmap_list); | ||
| 1348 | spin_unlock(&ctl->tree_lock); | ||
| 1349 | mutex_unlock(&ctl->cache_writeout_mutex); | ||
| 1350 | |||
| 1346 | out_nospc: | 1351 | out_nospc: |
| 1347 | cleanup_write_cache_enospc(inode, io_ctl, &cached_state, &bitmap_list); | 1352 | cleanup_write_cache_enospc(inode, io_ctl, &cached_state, &bitmap_list); |
| 1348 | 1353 | ||
| @@ -3463,9 +3468,12 @@ int btrfs_write_out_ino_cache(struct btrfs_root *root, | |||
| 3463 | if (!btrfs_test_opt(root, INODE_MAP_CACHE)) | 3468 | if (!btrfs_test_opt(root, INODE_MAP_CACHE)) |
| 3464 | return 0; | 3469 | return 0; |
| 3465 | 3470 | ||
| 3471 | memset(&io_ctl, 0, sizeof(io_ctl)); | ||
| 3466 | ret = __btrfs_write_out_cache(root, inode, ctl, NULL, &io_ctl, | 3472 | ret = __btrfs_write_out_cache(root, inode, ctl, NULL, &io_ctl, |
| 3467 | trans, path, 0) || | 3473 | trans, path, 0); |
| 3468 | btrfs_wait_cache_io(root, trans, NULL, &io_ctl, path, 0); | 3474 | if (!ret) |
| 3475 | ret = btrfs_wait_cache_io(root, trans, NULL, &io_ctl, path, 0); | ||
| 3476 | |||
| 3469 | if (ret) { | 3477 | if (ret) { |
| 3470 | btrfs_delalloc_release_metadata(inode, inode->i_size); | 3478 | btrfs_delalloc_release_metadata(inode, inode->i_size); |
| 3471 | #ifdef DEBUG | 3479 | #ifdef DEBUG |
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 56f00a25c003..ada4d24ed11b 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c | |||
| @@ -4020,16 +4020,16 @@ static int btrfs_unlink(struct inode *dir, struct dentry *dentry) | |||
| 4020 | { | 4020 | { |
| 4021 | struct btrfs_root *root = BTRFS_I(dir)->root; | 4021 | struct btrfs_root *root = BTRFS_I(dir)->root; |
| 4022 | struct btrfs_trans_handle *trans; | 4022 | struct btrfs_trans_handle *trans; |
| 4023 | struct inode *inode = dentry->d_inode; | 4023 | struct inode *inode = d_inode(dentry); |
| 4024 | int ret; | 4024 | int ret; |
| 4025 | 4025 | ||
| 4026 | trans = __unlink_start_trans(dir); | 4026 | trans = __unlink_start_trans(dir); |
| 4027 | if (IS_ERR(trans)) | 4027 | if (IS_ERR(trans)) |
| 4028 | return PTR_ERR(trans); | 4028 | return PTR_ERR(trans); |
| 4029 | 4029 | ||
| 4030 | btrfs_record_unlink_dir(trans, dir, dentry->d_inode, 0); | 4030 | btrfs_record_unlink_dir(trans, dir, d_inode(dentry), 0); |
| 4031 | 4031 | ||
| 4032 | ret = btrfs_unlink_inode(trans, root, dir, dentry->d_inode, | 4032 | ret = btrfs_unlink_inode(trans, root, dir, d_inode(dentry), |
| 4033 | dentry->d_name.name, dentry->d_name.len); | 4033 | dentry->d_name.name, dentry->d_name.len); |
| 4034 | if (ret) | 4034 | if (ret) |
| 4035 | goto out; | 4035 | goto out; |
| @@ -4128,7 +4128,7 @@ out: | |||
| 4128 | 4128 | ||
| 4129 | static int btrfs_rmdir(struct inode *dir, struct dentry *dentry) | 4129 | static int btrfs_rmdir(struct inode *dir, struct dentry *dentry) |
| 4130 | { | 4130 | { |
| 4131 | struct inode *inode = dentry->d_inode; | 4131 | struct inode *inode = d_inode(dentry); |
| 4132 | int err = 0; | 4132 | int err = 0; |
| 4133 | struct btrfs_root *root = BTRFS_I(dir)->root; | 4133 | struct btrfs_root *root = BTRFS_I(dir)->root; |
| 4134 | struct btrfs_trans_handle *trans; | 4134 | struct btrfs_trans_handle *trans; |
| @@ -4155,7 +4155,7 @@ static int btrfs_rmdir(struct inode *dir, struct dentry *dentry) | |||
| 4155 | goto out; | 4155 | goto out; |
| 4156 | 4156 | ||
| 4157 | /* now the directory is empty */ | 4157 | /* now the directory is empty */ |
| 4158 | err = btrfs_unlink_inode(trans, root, dir, dentry->d_inode, | 4158 | err = btrfs_unlink_inode(trans, root, dir, d_inode(dentry), |
| 4159 | dentry->d_name.name, dentry->d_name.len); | 4159 | dentry->d_name.name, dentry->d_name.len); |
| 4160 | if (!err) | 4160 | if (!err) |
| 4161 | btrfs_i_size_write(inode, 0); | 4161 | btrfs_i_size_write(inode, 0); |
| @@ -4915,7 +4915,7 @@ static int btrfs_setsize(struct inode *inode, struct iattr *attr) | |||
| 4915 | 4915 | ||
| 4916 | static int btrfs_setattr(struct dentry *dentry, struct iattr *attr) | 4916 | static int btrfs_setattr(struct dentry *dentry, struct iattr *attr) |
| 4917 | { | 4917 | { |
| 4918 | struct inode *inode = dentry->d_inode; | 4918 | struct inode *inode = d_inode(dentry); |
| 4919 | struct btrfs_root *root = BTRFS_I(inode)->root; | 4919 | struct btrfs_root *root = BTRFS_I(inode)->root; |
| 4920 | int err; | 4920 | int err; |
| 4921 | 4921 | ||
| @@ -5547,10 +5547,10 @@ struct inode *btrfs_lookup_dentry(struct inode *dir, struct dentry *dentry) | |||
| 5547 | static int btrfs_dentry_delete(const struct dentry *dentry) | 5547 | static int btrfs_dentry_delete(const struct dentry *dentry) |
| 5548 | { | 5548 | { |
| 5549 | struct btrfs_root *root; | 5549 | struct btrfs_root *root; |
| 5550 | struct inode *inode = dentry->d_inode; | 5550 | struct inode *inode = d_inode(dentry); |
| 5551 | 5551 | ||
| 5552 | if (!inode && !IS_ROOT(dentry)) | 5552 | if (!inode && !IS_ROOT(dentry)) |
| 5553 | inode = dentry->d_parent->d_inode; | 5553 | inode = d_inode(dentry->d_parent); |
| 5554 | 5554 | ||
| 5555 | if (inode) { | 5555 | if (inode) { |
| 5556 | root = BTRFS_I(inode)->root; | 5556 | root = BTRFS_I(inode)->root; |
| @@ -6357,7 +6357,7 @@ static int btrfs_link(struct dentry *old_dentry, struct inode *dir, | |||
| 6357 | { | 6357 | { |
| 6358 | struct btrfs_trans_handle *trans; | 6358 | struct btrfs_trans_handle *trans; |
| 6359 | struct btrfs_root *root = BTRFS_I(dir)->root; | 6359 | struct btrfs_root *root = BTRFS_I(dir)->root; |
| 6360 | struct inode *inode = old_dentry->d_inode; | 6360 | struct inode *inode = d_inode(old_dentry); |
| 6361 | u64 index; | 6361 | u64 index; |
| 6362 | int err; | 6362 | int err; |
| 6363 | int drop_inode = 0; | 6363 | int drop_inode = 0; |
| @@ -8260,7 +8260,7 @@ static ssize_t btrfs_direct_IO(struct kiocb *iocb, struct iov_iter *iter, | |||
| 8260 | if (check_direct_IO(BTRFS_I(inode)->root, iocb, iter, offset)) | 8260 | if (check_direct_IO(BTRFS_I(inode)->root, iocb, iter, offset)) |
| 8261 | return 0; | 8261 | return 0; |
| 8262 | 8262 | ||
| 8263 | atomic_inc(&inode->i_dio_count); | 8263 | inode_dio_begin(inode); |
| 8264 | smp_mb__after_atomic(); | 8264 | smp_mb__after_atomic(); |
| 8265 | 8265 | ||
| 8266 | /* | 8266 | /* |
| @@ -8300,7 +8300,7 @@ static ssize_t btrfs_direct_IO(struct kiocb *iocb, struct iov_iter *iter, | |||
| 8300 | current->journal_info = &outstanding_extents; | 8300 | current->journal_info = &outstanding_extents; |
| 8301 | } else if (test_bit(BTRFS_INODE_READDIO_NEED_LOCK, | 8301 | } else if (test_bit(BTRFS_INODE_READDIO_NEED_LOCK, |
| 8302 | &BTRFS_I(inode)->runtime_flags)) { | 8302 | &BTRFS_I(inode)->runtime_flags)) { |
| 8303 | inode_dio_done(inode); | 8303 | inode_dio_end(inode); |
| 8304 | flags = DIO_LOCKING | DIO_SKIP_HOLES; | 8304 | flags = DIO_LOCKING | DIO_SKIP_HOLES; |
| 8305 | wakeup = false; | 8305 | wakeup = false; |
| 8306 | } | 8306 | } |
| @@ -8319,7 +8319,7 @@ static ssize_t btrfs_direct_IO(struct kiocb *iocb, struct iov_iter *iter, | |||
| 8319 | } | 8319 | } |
| 8320 | out: | 8320 | out: |
| 8321 | if (wakeup) | 8321 | if (wakeup) |
| 8322 | inode_dio_done(inode); | 8322 | inode_dio_end(inode); |
| 8323 | if (relock) | 8323 | if (relock) |
| 8324 | mutex_lock(&inode->i_mutex); | 8324 | mutex_lock(&inode->i_mutex); |
| 8325 | 8325 | ||
| @@ -9006,7 +9006,7 @@ static int btrfs_getattr(struct vfsmount *mnt, | |||
| 9006 | struct dentry *dentry, struct kstat *stat) | 9006 | struct dentry *dentry, struct kstat *stat) |
| 9007 | { | 9007 | { |
| 9008 | u64 delalloc_bytes; | 9008 | u64 delalloc_bytes; |
| 9009 | struct inode *inode = dentry->d_inode; | 9009 | struct inode *inode = d_inode(dentry); |
| 9010 | u32 blocksize = inode->i_sb->s_blocksize; | 9010 | u32 blocksize = inode->i_sb->s_blocksize; |
| 9011 | 9011 | ||
| 9012 | generic_fillattr(inode, stat); | 9012 | generic_fillattr(inode, stat); |
| @@ -9027,8 +9027,8 @@ static int btrfs_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
| 9027 | struct btrfs_trans_handle *trans; | 9027 | struct btrfs_trans_handle *trans; |
| 9028 | struct btrfs_root *root = BTRFS_I(old_dir)->root; | 9028 | struct btrfs_root *root = BTRFS_I(old_dir)->root; |
| 9029 | struct btrfs_root *dest = BTRFS_I(new_dir)->root; | 9029 | struct btrfs_root *dest = BTRFS_I(new_dir)->root; |
| 9030 | struct inode *new_inode = new_dentry->d_inode; | 9030 | struct inode *new_inode = d_inode(new_dentry); |
| 9031 | struct inode *old_inode = old_dentry->d_inode; | 9031 | struct inode *old_inode = d_inode(old_dentry); |
| 9032 | struct timespec ctime = CURRENT_TIME; | 9032 | struct timespec ctime = CURRENT_TIME; |
| 9033 | u64 index = 0; | 9033 | u64 index = 0; |
| 9034 | u64 root_objectid; | 9034 | u64 root_objectid; |
| @@ -9140,7 +9140,7 @@ static int btrfs_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
| 9140 | old_dentry->d_name.len); | 9140 | old_dentry->d_name.len); |
| 9141 | } else { | 9141 | } else { |
| 9142 | ret = __btrfs_unlink_inode(trans, root, old_dir, | 9142 | ret = __btrfs_unlink_inode(trans, root, old_dir, |
| 9143 | old_dentry->d_inode, | 9143 | d_inode(old_dentry), |
| 9144 | old_dentry->d_name.name, | 9144 | old_dentry->d_name.name, |
| 9145 | old_dentry->d_name.len); | 9145 | old_dentry->d_name.len); |
| 9146 | if (!ret) | 9146 | if (!ret) |
| @@ -9164,12 +9164,12 @@ static int btrfs_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
| 9164 | BUG_ON(new_inode->i_nlink == 0); | 9164 | BUG_ON(new_inode->i_nlink == 0); |
| 9165 | } else { | 9165 | } else { |
| 9166 | ret = btrfs_unlink_inode(trans, dest, new_dir, | 9166 | ret = btrfs_unlink_inode(trans, dest, new_dir, |
| 9167 | new_dentry->d_inode, | 9167 | d_inode(new_dentry), |
| 9168 | new_dentry->d_name.name, | 9168 | new_dentry->d_name.name, |
| 9169 | new_dentry->d_name.len); | 9169 | new_dentry->d_name.len); |
| 9170 | } | 9170 | } |
| 9171 | if (!ret && new_inode->i_nlink == 0) | 9171 | if (!ret && new_inode->i_nlink == 0) |
| 9172 | ret = btrfs_orphan_add(trans, new_dentry->d_inode); | 9172 | ret = btrfs_orphan_add(trans, d_inode(new_dentry)); |
| 9173 | if (ret) { | 9173 | if (ret) { |
| 9174 | btrfs_abort_transaction(trans, root, ret); | 9174 | btrfs_abort_transaction(trans, root, ret); |
| 9175 | goto out_fail; | 9175 | goto out_fail; |
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index ca5d968f4c37..b05653f182c2 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c | |||
| @@ -724,7 +724,7 @@ static int create_snapshot(struct btrfs_root *root, struct inode *dir, | |||
| 724 | if (ret) | 724 | if (ret) |
| 725 | goto fail; | 725 | goto fail; |
| 726 | 726 | ||
| 727 | inode = btrfs_lookup_dentry(dentry->d_parent->d_inode, dentry); | 727 | inode = btrfs_lookup_dentry(d_inode(dentry->d_parent), dentry); |
| 728 | if (IS_ERR(inode)) { | 728 | if (IS_ERR(inode)) { |
| 729 | ret = PTR_ERR(inode); | 729 | ret = PTR_ERR(inode); |
| 730 | goto fail; | 730 | goto fail; |
| @@ -768,10 +768,10 @@ static int btrfs_may_delete(struct inode *dir, struct dentry *victim, int isdir) | |||
| 768 | { | 768 | { |
| 769 | int error; | 769 | int error; |
| 770 | 770 | ||
| 771 | if (!victim->d_inode) | 771 | if (d_really_is_negative(victim)) |
| 772 | return -ENOENT; | 772 | return -ENOENT; |
| 773 | 773 | ||
| 774 | BUG_ON(victim->d_parent->d_inode != dir); | 774 | BUG_ON(d_inode(victim->d_parent) != dir); |
| 775 | audit_inode_child(dir, victim, AUDIT_TYPE_CHILD_DELETE); | 775 | audit_inode_child(dir, victim, AUDIT_TYPE_CHILD_DELETE); |
| 776 | 776 | ||
| 777 | error = inode_permission(dir, MAY_WRITE | MAY_EXEC); | 777 | error = inode_permission(dir, MAY_WRITE | MAY_EXEC); |
| @@ -779,8 +779,8 @@ static int btrfs_may_delete(struct inode *dir, struct dentry *victim, int isdir) | |||
| 779 | return error; | 779 | return error; |
| 780 | if (IS_APPEND(dir)) | 780 | if (IS_APPEND(dir)) |
| 781 | return -EPERM; | 781 | return -EPERM; |
| 782 | if (check_sticky(dir, victim->d_inode) || IS_APPEND(victim->d_inode) || | 782 | if (check_sticky(dir, d_inode(victim)) || IS_APPEND(d_inode(victim)) || |
| 783 | IS_IMMUTABLE(victim->d_inode) || IS_SWAPFILE(victim->d_inode)) | 783 | IS_IMMUTABLE(d_inode(victim)) || IS_SWAPFILE(d_inode(victim))) |
| 784 | return -EPERM; | 784 | return -EPERM; |
| 785 | if (isdir) { | 785 | if (isdir) { |
| 786 | if (!d_is_dir(victim)) | 786 | if (!d_is_dir(victim)) |
| @@ -799,7 +799,7 @@ static int btrfs_may_delete(struct inode *dir, struct dentry *victim, int isdir) | |||
| 799 | /* copy of may_create in fs/namei.c() */ | 799 | /* copy of may_create in fs/namei.c() */ |
| 800 | static inline int btrfs_may_create(struct inode *dir, struct dentry *child) | 800 | static inline int btrfs_may_create(struct inode *dir, struct dentry *child) |
| 801 | { | 801 | { |
| 802 | if (child->d_inode) | 802 | if (d_really_is_positive(child)) |
| 803 | return -EEXIST; | 803 | return -EEXIST; |
| 804 | if (IS_DEADDIR(dir)) | 804 | if (IS_DEADDIR(dir)) |
| 805 | return -ENOENT; | 805 | return -ENOENT; |
| @@ -817,7 +817,7 @@ static noinline int btrfs_mksubvol(struct path *parent, | |||
| 817 | u64 *async_transid, bool readonly, | 817 | u64 *async_transid, bool readonly, |
| 818 | struct btrfs_qgroup_inherit *inherit) | 818 | struct btrfs_qgroup_inherit *inherit) |
| 819 | { | 819 | { |
| 820 | struct inode *dir = parent->dentry->d_inode; | 820 | struct inode *dir = d_inode(parent->dentry); |
| 821 | struct dentry *dentry; | 821 | struct dentry *dentry; |
| 822 | int error; | 822 | int error; |
| 823 | 823 | ||
| @@ -831,7 +831,7 @@ static noinline int btrfs_mksubvol(struct path *parent, | |||
| 831 | goto out_unlock; | 831 | goto out_unlock; |
| 832 | 832 | ||
| 833 | error = -EEXIST; | 833 | error = -EEXIST; |
| 834 | if (dentry->d_inode) | 834 | if (d_really_is_positive(dentry)) |
| 835 | goto out_dput; | 835 | goto out_dput; |
| 836 | 836 | ||
| 837 | error = btrfs_may_create(dir, dentry); | 837 | error = btrfs_may_create(dir, dentry); |
| @@ -2301,7 +2301,7 @@ static noinline int btrfs_ioctl_snap_destroy(struct file *file, | |||
| 2301 | { | 2301 | { |
| 2302 | struct dentry *parent = file->f_path.dentry; | 2302 | struct dentry *parent = file->f_path.dentry; |
| 2303 | struct dentry *dentry; | 2303 | struct dentry *dentry; |
| 2304 | struct inode *dir = parent->d_inode; | 2304 | struct inode *dir = d_inode(parent); |
| 2305 | struct inode *inode; | 2305 | struct inode *inode; |
| 2306 | struct btrfs_root *root = BTRFS_I(dir)->root; | 2306 | struct btrfs_root *root = BTRFS_I(dir)->root; |
| 2307 | struct btrfs_root *dest = NULL; | 2307 | struct btrfs_root *dest = NULL; |
| @@ -2340,12 +2340,12 @@ static noinline int btrfs_ioctl_snap_destroy(struct file *file, | |||
| 2340 | goto out_unlock_dir; | 2340 | goto out_unlock_dir; |
| 2341 | } | 2341 | } |
| 2342 | 2342 | ||
| 2343 | if (!dentry->d_inode) { | 2343 | if (d_really_is_negative(dentry)) { |
| 2344 | err = -ENOENT; | 2344 | err = -ENOENT; |
| 2345 | goto out_dput; | 2345 | goto out_dput; |
| 2346 | } | 2346 | } |
| 2347 | 2347 | ||
| 2348 | inode = dentry->d_inode; | 2348 | inode = d_inode(dentry); |
| 2349 | dest = BTRFS_I(inode)->root; | 2349 | dest = BTRFS_I(inode)->root; |
| 2350 | if (!capable(CAP_SYS_ADMIN)) { | 2350 | if (!capable(CAP_SYS_ADMIN)) { |
| 2351 | /* | 2351 | /* |
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c index f2c9f9db3b19..9e66f5e724db 100644 --- a/fs/btrfs/super.c +++ b/fs/btrfs/super.c | |||
| @@ -925,7 +925,7 @@ setup_root: | |||
| 925 | * a reference to the dentry. We will have already gotten a reference | 925 | * a reference to the dentry. We will have already gotten a reference |
| 926 | * to the inode in btrfs_fill_super so we're good to go. | 926 | * to the inode in btrfs_fill_super so we're good to go. |
| 927 | */ | 927 | */ |
| 928 | if (!new && sb->s_root->d_inode == inode) { | 928 | if (!new && d_inode(sb->s_root) == inode) { |
| 929 | iput(inode); | 929 | iput(inode); |
| 930 | return dget(sb->s_root); | 930 | return dget(sb->s_root); |
| 931 | } | 931 | } |
| @@ -1230,7 +1230,7 @@ static struct dentry *mount_subvol(const char *subvol_name, int flags, | |||
| 1230 | 1230 | ||
| 1231 | root = mount_subtree(mnt, subvol_name); | 1231 | root = mount_subtree(mnt, subvol_name); |
| 1232 | 1232 | ||
| 1233 | if (!IS_ERR(root) && !is_subvolume_inode(root->d_inode)) { | 1233 | if (!IS_ERR(root) && !is_subvolume_inode(d_inode(root))) { |
| 1234 | struct super_block *s = root->d_sb; | 1234 | struct super_block *s = root->d_sb; |
| 1235 | dput(root); | 1235 | dput(root); |
| 1236 | root = ERR_PTR(-EINVAL); | 1236 | root = ERR_PTR(-EINVAL); |
| @@ -1895,8 +1895,8 @@ static int btrfs_statfs(struct dentry *dentry, struct kstatfs *buf) | |||
| 1895 | buf->f_fsid.val[0] = be32_to_cpu(fsid[0]) ^ be32_to_cpu(fsid[2]); | 1895 | buf->f_fsid.val[0] = be32_to_cpu(fsid[0]) ^ be32_to_cpu(fsid[2]); |
| 1896 | buf->f_fsid.val[1] = be32_to_cpu(fsid[1]) ^ be32_to_cpu(fsid[3]); | 1896 | buf->f_fsid.val[1] = be32_to_cpu(fsid[1]) ^ be32_to_cpu(fsid[3]); |
| 1897 | /* Mask in the root object ID too, to disambiguate subvols */ | 1897 | /* Mask in the root object ID too, to disambiguate subvols */ |
| 1898 | buf->f_fsid.val[0] ^= BTRFS_I(dentry->d_inode)->root->objectid >> 32; | 1898 | buf->f_fsid.val[0] ^= BTRFS_I(d_inode(dentry))->root->objectid >> 32; |
| 1899 | buf->f_fsid.val[1] ^= BTRFS_I(dentry->d_inode)->root->objectid; | 1899 | buf->f_fsid.val[1] ^= BTRFS_I(d_inode(dentry))->root->objectid; |
| 1900 | 1900 | ||
| 1901 | return 0; | 1901 | return 0; |
| 1902 | } | 1902 | } |
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c index a089b5944efc..d04968374e9d 100644 --- a/fs/btrfs/tree-log.c +++ b/fs/btrfs/tree-log.c | |||
| @@ -4474,9 +4474,9 @@ static noinline int check_parent_dirs_for_sync(struct btrfs_trans_handle *trans, | |||
| 4474 | goto out; | 4474 | goto out; |
| 4475 | 4475 | ||
| 4476 | if (!S_ISDIR(inode->i_mode)) { | 4476 | if (!S_ISDIR(inode->i_mode)) { |
| 4477 | if (!parent || !parent->d_inode || sb != parent->d_inode->i_sb) | 4477 | if (!parent || d_really_is_negative(parent) || sb != d_inode(parent)->i_sb) |
| 4478 | goto out; | 4478 | goto out; |
| 4479 | inode = parent->d_inode; | 4479 | inode = d_inode(parent); |
| 4480 | } | 4480 | } |
| 4481 | 4481 | ||
| 4482 | while (1) { | 4482 | while (1) { |
| @@ -4502,7 +4502,7 @@ static noinline int check_parent_dirs_for_sync(struct btrfs_trans_handle *trans, | |||
| 4502 | break; | 4502 | break; |
| 4503 | } | 4503 | } |
| 4504 | 4504 | ||
| 4505 | if (!parent || !parent->d_inode || sb != parent->d_inode->i_sb) | 4505 | if (!parent || d_really_is_negative(parent) || sb != d_inode(parent)->i_sb) |
| 4506 | break; | 4506 | break; |
| 4507 | 4507 | ||
| 4508 | if (IS_ROOT(parent)) | 4508 | if (IS_ROOT(parent)) |
| @@ -4511,7 +4511,7 @@ static noinline int check_parent_dirs_for_sync(struct btrfs_trans_handle *trans, | |||
| 4511 | parent = dget_parent(parent); | 4511 | parent = dget_parent(parent); |
| 4512 | dput(old_parent); | 4512 | dput(old_parent); |
| 4513 | old_parent = parent; | 4513 | old_parent = parent; |
| 4514 | inode = parent->d_inode; | 4514 | inode = d_inode(parent); |
| 4515 | 4515 | ||
| 4516 | } | 4516 | } |
| 4517 | dput(old_parent); | 4517 | dput(old_parent); |
| @@ -4777,10 +4777,10 @@ static int btrfs_log_inode_parent(struct btrfs_trans_handle *trans, | |||
| 4777 | log_dentries = true; | 4777 | log_dentries = true; |
| 4778 | 4778 | ||
| 4779 | while (1) { | 4779 | while (1) { |
| 4780 | if (!parent || !parent->d_inode || sb != parent->d_inode->i_sb) | 4780 | if (!parent || d_really_is_negative(parent) || sb != d_inode(parent)->i_sb) |
| 4781 | break; | 4781 | break; |
| 4782 | 4782 | ||
| 4783 | inode = parent->d_inode; | 4783 | inode = d_inode(parent); |
| 4784 | if (root != BTRFS_I(inode)->root) | 4784 | if (root != BTRFS_I(inode)->root) |
| 4785 | break; | 4785 | break; |
| 4786 | 4786 | ||
| @@ -4845,7 +4845,7 @@ int btrfs_log_dentry_safe(struct btrfs_trans_handle *trans, | |||
| 4845 | struct dentry *parent = dget_parent(dentry); | 4845 | struct dentry *parent = dget_parent(dentry); |
| 4846 | int ret; | 4846 | int ret; |
| 4847 | 4847 | ||
| 4848 | ret = btrfs_log_inode_parent(trans, root, dentry->d_inode, parent, | 4848 | ret = btrfs_log_inode_parent(trans, root, d_inode(dentry), parent, |
| 4849 | start, end, 0, ctx); | 4849 | start, end, 0, ctx); |
| 4850 | dput(parent); | 4850 | dput(parent); |
| 4851 | 4851 | ||
diff --git a/fs/btrfs/xattr.c b/fs/btrfs/xattr.c index 45ea704be030..6f518c90e1c1 100644 --- a/fs/btrfs/xattr.c +++ b/fs/btrfs/xattr.c | |||
| @@ -261,7 +261,7 @@ out: | |||
| 261 | ssize_t btrfs_listxattr(struct dentry *dentry, char *buffer, size_t size) | 261 | ssize_t btrfs_listxattr(struct dentry *dentry, char *buffer, size_t size) |
| 262 | { | 262 | { |
| 263 | struct btrfs_key key, found_key; | 263 | struct btrfs_key key, found_key; |
| 264 | struct inode *inode = dentry->d_inode; | 264 | struct inode *inode = d_inode(dentry); |
| 265 | struct btrfs_root *root = BTRFS_I(inode)->root; | 265 | struct btrfs_root *root = BTRFS_I(inode)->root; |
| 266 | struct btrfs_path *path; | 266 | struct btrfs_path *path; |
| 267 | struct extent_buffer *leaf; | 267 | struct extent_buffer *leaf; |
| @@ -411,13 +411,13 @@ ssize_t btrfs_getxattr(struct dentry *dentry, const char *name, | |||
| 411 | ret = btrfs_is_valid_xattr(name); | 411 | ret = btrfs_is_valid_xattr(name); |
| 412 | if (ret) | 412 | if (ret) |
| 413 | return ret; | 413 | return ret; |
| 414 | return __btrfs_getxattr(dentry->d_inode, name, buffer, size); | 414 | return __btrfs_getxattr(d_inode(dentry), name, buffer, size); |
| 415 | } | 415 | } |
| 416 | 416 | ||
| 417 | int btrfs_setxattr(struct dentry *dentry, const char *name, const void *value, | 417 | int btrfs_setxattr(struct dentry *dentry, const char *name, const void *value, |
| 418 | size_t size, int flags) | 418 | size_t size, int flags) |
| 419 | { | 419 | { |
| 420 | struct btrfs_root *root = BTRFS_I(dentry->d_inode)->root; | 420 | struct btrfs_root *root = BTRFS_I(d_inode(dentry))->root; |
| 421 | int ret; | 421 | int ret; |
| 422 | 422 | ||
| 423 | /* | 423 | /* |
| @@ -440,19 +440,19 @@ int btrfs_setxattr(struct dentry *dentry, const char *name, const void *value, | |||
| 440 | return ret; | 440 | return ret; |
| 441 | 441 | ||
| 442 | if (!strncmp(name, XATTR_BTRFS_PREFIX, XATTR_BTRFS_PREFIX_LEN)) | 442 | if (!strncmp(name, XATTR_BTRFS_PREFIX, XATTR_BTRFS_PREFIX_LEN)) |
| 443 | return btrfs_set_prop(dentry->d_inode, name, | 443 | return btrfs_set_prop(d_inode(dentry), name, |
| 444 | value, size, flags); | 444 | value, size, flags); |
| 445 | 445 | ||
| 446 | if (size == 0) | 446 | if (size == 0) |
| 447 | value = ""; /* empty EA, do not remove */ | 447 | value = ""; /* empty EA, do not remove */ |
| 448 | 448 | ||
| 449 | return __btrfs_setxattr(NULL, dentry->d_inode, name, value, size, | 449 | return __btrfs_setxattr(NULL, d_inode(dentry), name, value, size, |
| 450 | flags); | 450 | flags); |
| 451 | } | 451 | } |
| 452 | 452 | ||
| 453 | int btrfs_removexattr(struct dentry *dentry, const char *name) | 453 | int btrfs_removexattr(struct dentry *dentry, const char *name) |
| 454 | { | 454 | { |
| 455 | struct btrfs_root *root = BTRFS_I(dentry->d_inode)->root; | 455 | struct btrfs_root *root = BTRFS_I(d_inode(dentry))->root; |
| 456 | int ret; | 456 | int ret; |
| 457 | 457 | ||
| 458 | /* | 458 | /* |
| @@ -475,10 +475,10 @@ int btrfs_removexattr(struct dentry *dentry, const char *name) | |||
| 475 | return ret; | 475 | return ret; |
| 476 | 476 | ||
| 477 | if (!strncmp(name, XATTR_BTRFS_PREFIX, XATTR_BTRFS_PREFIX_LEN)) | 477 | if (!strncmp(name, XATTR_BTRFS_PREFIX, XATTR_BTRFS_PREFIX_LEN)) |
| 478 | return btrfs_set_prop(dentry->d_inode, name, | 478 | return btrfs_set_prop(d_inode(dentry), name, |
| 479 | NULL, 0, XATTR_REPLACE); | 479 | NULL, 0, XATTR_REPLACE); |
| 480 | 480 | ||
| 481 | return __btrfs_setxattr(NULL, dentry->d_inode, name, NULL, 0, | 481 | return __btrfs_setxattr(NULL, d_inode(dentry), name, NULL, 0, |
| 482 | XATTR_REPLACE); | 482 | XATTR_REPLACE); |
| 483 | } | 483 | } |
| 484 | 484 | ||
diff --git a/fs/cachefiles/bind.c b/fs/cachefiles/bind.c index fbb08e97438d..6af790fc3df8 100644 --- a/fs/cachefiles/bind.c +++ b/fs/cachefiles/bind.c | |||
| @@ -123,11 +123,11 @@ static int cachefiles_daemon_add_cache(struct cachefiles_cache *cache) | |||
| 123 | 123 | ||
| 124 | /* check parameters */ | 124 | /* check parameters */ |
| 125 | ret = -EOPNOTSUPP; | 125 | ret = -EOPNOTSUPP; |
| 126 | if (!root->d_inode || | 126 | if (d_is_negative(root) || |
| 127 | !root->d_inode->i_op->lookup || | 127 | !d_backing_inode(root)->i_op->lookup || |
| 128 | !root->d_inode->i_op->mkdir || | 128 | !d_backing_inode(root)->i_op->mkdir || |
| 129 | !root->d_inode->i_op->setxattr || | 129 | !d_backing_inode(root)->i_op->setxattr || |
| 130 | !root->d_inode->i_op->getxattr || | 130 | !d_backing_inode(root)->i_op->getxattr || |
| 131 | !root->d_sb->s_op->statfs || | 131 | !root->d_sb->s_op->statfs || |
| 132 | !root->d_sb->s_op->sync_fs) | 132 | !root->d_sb->s_op->sync_fs) |
| 133 | goto error_unsupported; | 133 | goto error_unsupported; |
diff --git a/fs/cachefiles/interface.c b/fs/cachefiles/interface.c index 232426214fdd..afa023dded5b 100644 --- a/fs/cachefiles/interface.c +++ b/fs/cachefiles/interface.c | |||
| @@ -441,12 +441,12 @@ static int cachefiles_attr_changed(struct fscache_object *_object) | |||
| 441 | 441 | ||
| 442 | fscache_set_store_limit(&object->fscache, ni_size); | 442 | fscache_set_store_limit(&object->fscache, ni_size); |
| 443 | 443 | ||
| 444 | oi_size = i_size_read(object->backer->d_inode); | 444 | oi_size = i_size_read(d_backing_inode(object->backer)); |
| 445 | if (oi_size == ni_size) | 445 | if (oi_size == ni_size) |
| 446 | return 0; | 446 | return 0; |
| 447 | 447 | ||
| 448 | cachefiles_begin_secure(cache, &saved_cred); | 448 | cachefiles_begin_secure(cache, &saved_cred); |
| 449 | mutex_lock(&object->backer->d_inode->i_mutex); | 449 | mutex_lock(&d_inode(object->backer)->i_mutex); |
| 450 | 450 | ||
| 451 | /* if there's an extension to a partial page at the end of the backing | 451 | /* if there's an extension to a partial page at the end of the backing |
| 452 | * file, we need to discard the partial page so that we pick up new | 452 | * file, we need to discard the partial page so that we pick up new |
| @@ -465,7 +465,7 @@ static int cachefiles_attr_changed(struct fscache_object *_object) | |||
| 465 | ret = notify_change(object->backer, &newattrs, NULL); | 465 | ret = notify_change(object->backer, &newattrs, NULL); |
| 466 | 466 | ||
| 467 | truncate_failed: | 467 | truncate_failed: |
| 468 | mutex_unlock(&object->backer->d_inode->i_mutex); | 468 | mutex_unlock(&d_inode(object->backer)->i_mutex); |
| 469 | cachefiles_end_secure(cache, saved_cred); | 469 | cachefiles_end_secure(cache, saved_cred); |
| 470 | 470 | ||
| 471 | if (ret == -EIO) { | 471 | if (ret == -EIO) { |
diff --git a/fs/cachefiles/namei.c b/fs/cachefiles/namei.c index 1e51714eb33e..ab857ab9f40d 100644 --- a/fs/cachefiles/namei.c +++ b/fs/cachefiles/namei.c | |||
| @@ -286,13 +286,13 @@ static int cachefiles_bury_object(struct cachefiles_cache *cache, | |||
| 286 | if (ret < 0) { | 286 | if (ret < 0) { |
| 287 | cachefiles_io_error(cache, "Unlink security error"); | 287 | cachefiles_io_error(cache, "Unlink security error"); |
| 288 | } else { | 288 | } else { |
| 289 | ret = vfs_unlink(dir->d_inode, rep, NULL); | 289 | ret = vfs_unlink(d_inode(dir), rep, NULL); |
| 290 | 290 | ||
| 291 | if (preemptive) | 291 | if (preemptive) |
| 292 | cachefiles_mark_object_buried(cache, rep); | 292 | cachefiles_mark_object_buried(cache, rep); |
| 293 | } | 293 | } |
| 294 | 294 | ||
| 295 | mutex_unlock(&dir->d_inode->i_mutex); | 295 | mutex_unlock(&d_inode(dir)->i_mutex); |
| 296 | 296 | ||
| 297 | if (ret == -EIO) | 297 | if (ret == -EIO) |
| 298 | cachefiles_io_error(cache, "Unlink failed"); | 298 | cachefiles_io_error(cache, "Unlink failed"); |
| @@ -303,7 +303,7 @@ static int cachefiles_bury_object(struct cachefiles_cache *cache, | |||
| 303 | 303 | ||
| 304 | /* directories have to be moved to the graveyard */ | 304 | /* directories have to be moved to the graveyard */ |
| 305 | _debug("move stale object to graveyard"); | 305 | _debug("move stale object to graveyard"); |
| 306 | mutex_unlock(&dir->d_inode->i_mutex); | 306 | mutex_unlock(&d_inode(dir)->i_mutex); |
| 307 | 307 | ||
| 308 | try_again: | 308 | try_again: |
| 309 | /* first step is to make up a grave dentry in the graveyard */ | 309 | /* first step is to make up a grave dentry in the graveyard */ |
| @@ -355,7 +355,7 @@ try_again: | |||
| 355 | return -EIO; | 355 | return -EIO; |
| 356 | } | 356 | } |
| 357 | 357 | ||
| 358 | if (grave->d_inode) { | 358 | if (d_is_positive(grave)) { |
| 359 | unlock_rename(cache->graveyard, dir); | 359 | unlock_rename(cache->graveyard, dir); |
| 360 | dput(grave); | 360 | dput(grave); |
| 361 | grave = NULL; | 361 | grave = NULL; |
| @@ -387,8 +387,8 @@ try_again: | |||
| 387 | if (ret < 0) { | 387 | if (ret < 0) { |
| 388 | cachefiles_io_error(cache, "Rename security error %d", ret); | 388 | cachefiles_io_error(cache, "Rename security error %d", ret); |
| 389 | } else { | 389 | } else { |
| 390 | ret = vfs_rename(dir->d_inode, rep, | 390 | ret = vfs_rename(d_inode(dir), rep, |
| 391 | cache->graveyard->d_inode, grave, NULL, 0); | 391 | d_inode(cache->graveyard), grave, NULL, 0); |
| 392 | if (ret != 0 && ret != -ENOMEM) | 392 | if (ret != 0 && ret != -ENOMEM) |
| 393 | cachefiles_io_error(cache, | 393 | cachefiles_io_error(cache, |
| 394 | "Rename failed with error %d", ret); | 394 | "Rename failed with error %d", ret); |
| @@ -415,18 +415,18 @@ int cachefiles_delete_object(struct cachefiles_cache *cache, | |||
| 415 | _enter(",OBJ%x{%p}", object->fscache.debug_id, object->dentry); | 415 | _enter(",OBJ%x{%p}", object->fscache.debug_id, object->dentry); |
| 416 | 416 | ||
| 417 | ASSERT(object->dentry); | 417 | ASSERT(object->dentry); |
| 418 | ASSERT(object->dentry->d_inode); | 418 | ASSERT(d_backing_inode(object->dentry)); |
| 419 | ASSERT(object->dentry->d_parent); | 419 | ASSERT(object->dentry->d_parent); |
| 420 | 420 | ||
| 421 | dir = dget_parent(object->dentry); | 421 | dir = dget_parent(object->dentry); |
| 422 | 422 | ||
| 423 | mutex_lock_nested(&dir->d_inode->i_mutex, I_MUTEX_PARENT); | 423 | mutex_lock_nested(&d_inode(dir)->i_mutex, I_MUTEX_PARENT); |
| 424 | 424 | ||
| 425 | if (test_bit(CACHEFILES_OBJECT_BURIED, &object->flags)) { | 425 | if (test_bit(CACHEFILES_OBJECT_BURIED, &object->flags)) { |
| 426 | /* object allocation for the same key preemptively deleted this | 426 | /* object allocation for the same key preemptively deleted this |
| 427 | * object's file so that it could create its own file */ | 427 | * object's file so that it could create its own file */ |
| 428 | _debug("object preemptively buried"); | 428 | _debug("object preemptively buried"); |
| 429 | mutex_unlock(&dir->d_inode->i_mutex); | 429 | mutex_unlock(&d_inode(dir)->i_mutex); |
| 430 | ret = 0; | 430 | ret = 0; |
| 431 | } else { | 431 | } else { |
| 432 | /* we need to check that our parent is _still_ our parent - it | 432 | /* we need to check that our parent is _still_ our parent - it |
| @@ -438,7 +438,7 @@ int cachefiles_delete_object(struct cachefiles_cache *cache, | |||
| 438 | /* it got moved, presumably by cachefilesd culling it, | 438 | /* it got moved, presumably by cachefilesd culling it, |
| 439 | * so it's no longer in the key path and we can ignore | 439 | * so it's no longer in the key path and we can ignore |
| 440 | * it */ | 440 | * it */ |
| 441 | mutex_unlock(&dir->d_inode->i_mutex); | 441 | mutex_unlock(&d_inode(dir)->i_mutex); |
| 442 | ret = 0; | 442 | ret = 0; |
| 443 | } | 443 | } |
| 444 | } | 444 | } |
| @@ -473,7 +473,7 @@ int cachefiles_walk_to_object(struct cachefiles_object *parent, | |||
| 473 | path.mnt = cache->mnt; | 473 | path.mnt = cache->mnt; |
| 474 | 474 | ||
| 475 | ASSERT(parent->dentry); | 475 | ASSERT(parent->dentry); |
| 476 | ASSERT(parent->dentry->d_inode); | 476 | ASSERT(d_backing_inode(parent->dentry)); |
| 477 | 477 | ||
| 478 | if (!(d_is_dir(parent->dentry))) { | 478 | if (!(d_is_dir(parent->dentry))) { |
| 479 | // TODO: convert file to dir | 479 | // TODO: convert file to dir |
| @@ -497,7 +497,7 @@ lookup_again: | |||
| 497 | /* search the current directory for the element name */ | 497 | /* search the current directory for the element name */ |
| 498 | _debug("lookup '%s'", name); | 498 | _debug("lookup '%s'", name); |
| 499 | 499 | ||
| 500 | mutex_lock_nested(&dir->d_inode->i_mutex, I_MUTEX_PARENT); | 500 | mutex_lock_nested(&d_inode(dir)->i_mutex, I_MUTEX_PARENT); |
| 501 | 501 | ||
| 502 | start = jiffies; | 502 | start = jiffies; |
| 503 | next = lookup_one_len(name, dir, nlen); | 503 | next = lookup_one_len(name, dir, nlen); |
| @@ -505,21 +505,21 @@ lookup_again: | |||
| 505 | if (IS_ERR(next)) | 505 | if (IS_ERR(next)) |
| 506 | goto lookup_error; | 506 | goto lookup_error; |
| 507 | 507 | ||
| 508 | _debug("next -> %p %s", next, next->d_inode ? "positive" : "negative"); | 508 | _debug("next -> %p %s", next, d_backing_inode(next) ? "positive" : "negative"); |
| 509 | 509 | ||
| 510 | if (!key) | 510 | if (!key) |
| 511 | object->new = !next->d_inode; | 511 | object->new = !d_backing_inode(next); |
| 512 | 512 | ||
| 513 | /* if this element of the path doesn't exist, then the lookup phase | 513 | /* if this element of the path doesn't exist, then the lookup phase |
| 514 | * failed, and we can release any readers in the certain knowledge that | 514 | * failed, and we can release any readers in the certain knowledge that |
| 515 | * there's nothing for them to actually read */ | 515 | * there's nothing for them to actually read */ |
| 516 | if (!next->d_inode) | 516 | if (d_is_negative(next)) |
| 517 | fscache_object_lookup_negative(&object->fscache); | 517 | fscache_object_lookup_negative(&object->fscache); |
| 518 | 518 | ||
| 519 | /* we need to create the object if it's negative */ | 519 | /* we need to create the object if it's negative */ |
| 520 | if (key || object->type == FSCACHE_COOKIE_TYPE_INDEX) { | 520 | if (key || object->type == FSCACHE_COOKIE_TYPE_INDEX) { |
| 521 | /* index objects and intervening tree levels must be subdirs */ | 521 | /* index objects and intervening tree levels must be subdirs */ |
| 522 | if (!next->d_inode) { | 522 | if (d_is_negative(next)) { |
| 523 | ret = cachefiles_has_space(cache, 1, 0); | 523 | ret = cachefiles_has_space(cache, 1, 0); |
| 524 | if (ret < 0) | 524 | if (ret < 0) |
| 525 | goto create_error; | 525 | goto create_error; |
| @@ -529,26 +529,26 @@ lookup_again: | |||
| 529 | if (ret < 0) | 529 | if (ret < 0) |
| 530 | goto create_error; | 530 | goto create_error; |
| 531 | start = jiffies; | 531 | start = jiffies; |
| 532 | ret = vfs_mkdir(dir->d_inode, next, 0); | 532 | ret = vfs_mkdir(d_inode(dir), next, 0); |
| 533 | cachefiles_hist(cachefiles_mkdir_histogram, start); | 533 | cachefiles_hist(cachefiles_mkdir_histogram, start); |
| 534 | if (ret < 0) | 534 | if (ret < 0) |
| 535 | goto create_error; | 535 | goto create_error; |
| 536 | 536 | ||
| 537 | ASSERT(next->d_inode); | 537 | ASSERT(d_backing_inode(next)); |
| 538 | 538 | ||
| 539 | _debug("mkdir -> %p{%p{ino=%lu}}", | 539 | _debug("mkdir -> %p{%p{ino=%lu}}", |
| 540 | next, next->d_inode, next->d_inode->i_ino); | 540 | next, d_backing_inode(next), d_backing_inode(next)->i_ino); |
| 541 | 541 | ||
| 542 | } else if (!d_can_lookup(next)) { | 542 | } else if (!d_can_lookup(next)) { |
| 543 | pr_err("inode %lu is not a directory\n", | 543 | pr_err("inode %lu is not a directory\n", |
| 544 | next->d_inode->i_ino); | 544 | d_backing_inode(next)->i_ino); |
| 545 | ret = -ENOBUFS; | 545 | ret = -ENOBUFS; |
| 546 | goto error; | 546 | goto error; |
| 547 | } | 547 | } |
| 548 | 548 | ||
| 549 | } else { | 549 | } else { |
| 550 | /* non-index objects start out life as files */ | 550 | /* non-index objects start out life as files */ |
| 551 | if (!next->d_inode) { | 551 | if (d_is_negative(next)) { |
| 552 | ret = cachefiles_has_space(cache, 1, 0); | 552 | ret = cachefiles_has_space(cache, 1, 0); |
| 553 | if (ret < 0) | 553 | if (ret < 0) |
| 554 | goto create_error; | 554 | goto create_error; |
| @@ -558,21 +558,21 @@ lookup_again: | |||
| 558 | if (ret < 0) | 558 | if (ret < 0) |
| 559 | goto create_error; | 559 | goto create_error; |
| 560 | start = jiffies; | 560 | start = jiffies; |
| 561 | ret = vfs_create(dir->d_inode, next, S_IFREG, true); | 561 | ret = vfs_create(d_inode(dir), next, S_IFREG, true); |
| 562 | cachefiles_hist(cachefiles_create_histogram, start); | 562 | cachefiles_hist(cachefiles_create_histogram, start); |
| 563 | if (ret < 0) | 563 | if (ret < 0) |
| 564 | goto create_error; | 564 | goto create_error; |
| 565 | 565 | ||
| 566 | ASSERT(next->d_inode); | 566 | ASSERT(d_backing_inode(next)); |
| 567 | 567 | ||
| 568 | _debug("create -> %p{%p{ino=%lu}}", | 568 | _debug("create -> %p{%p{ino=%lu}}", |
| 569 | next, next->d_inode, next->d_inode->i_ino); | 569 | next, d_backing_inode(next), d_backing_inode(next)->i_ino); |
| 570 | 570 | ||
| 571 | } else if (!d_can_lookup(next) && | 571 | } else if (!d_can_lookup(next) && |
| 572 | !d_is_reg(next) | 572 | !d_is_reg(next) |
| 573 | ) { | 573 | ) { |
| 574 | pr_err("inode %lu is not a file or directory\n", | 574 | pr_err("inode %lu is not a file or directory\n", |
| 575 | next->d_inode->i_ino); | 575 | d_backing_inode(next)->i_ino); |
| 576 | ret = -ENOBUFS; | 576 | ret = -ENOBUFS; |
| 577 | goto error; | 577 | goto error; |
| 578 | } | 578 | } |
| @@ -581,7 +581,7 @@ lookup_again: | |||
| 581 | /* process the next component */ | 581 | /* process the next component */ |
| 582 | if (key) { | 582 | if (key) { |
| 583 | _debug("advance"); | 583 | _debug("advance"); |
| 584 | mutex_unlock(&dir->d_inode->i_mutex); | 584 | mutex_unlock(&d_inode(dir)->i_mutex); |
| 585 | dput(dir); | 585 | dput(dir); |
| 586 | dir = next; | 586 | dir = next; |
| 587 | next = NULL; | 587 | next = NULL; |
| @@ -617,7 +617,7 @@ lookup_again: | |||
| 617 | /* note that we're now using this object */ | 617 | /* note that we're now using this object */ |
| 618 | ret = cachefiles_mark_object_active(cache, object); | 618 | ret = cachefiles_mark_object_active(cache, object); |
| 619 | 619 | ||
| 620 | mutex_unlock(&dir->d_inode->i_mutex); | 620 | mutex_unlock(&d_inode(dir)->i_mutex); |
| 621 | dput(dir); | 621 | dput(dir); |
| 622 | dir = NULL; | 622 | dir = NULL; |
| 623 | 623 | ||
| @@ -646,7 +646,7 @@ lookup_again: | |||
| 646 | const struct address_space_operations *aops; | 646 | const struct address_space_operations *aops; |
| 647 | 647 | ||
| 648 | ret = -EPERM; | 648 | ret = -EPERM; |
| 649 | aops = object->dentry->d_inode->i_mapping->a_ops; | 649 | aops = d_backing_inode(object->dentry)->i_mapping->a_ops; |
| 650 | if (!aops->bmap) | 650 | if (!aops->bmap) |
| 651 | goto check_error; | 651 | goto check_error; |
| 652 | 652 | ||
| @@ -659,7 +659,7 @@ lookup_again: | |||
| 659 | object->new = 0; | 659 | object->new = 0; |
| 660 | fscache_obtained_object(&object->fscache); | 660 | fscache_obtained_object(&object->fscache); |
| 661 | 661 | ||
| 662 | _leave(" = 0 [%lu]", object->dentry->d_inode->i_ino); | 662 | _leave(" = 0 [%lu]", d_backing_inode(object->dentry)->i_ino); |
| 663 | return 0; | 663 | return 0; |
| 664 | 664 | ||
| 665 | create_error: | 665 | create_error: |
| @@ -695,7 +695,7 @@ lookup_error: | |||
| 695 | cachefiles_io_error(cache, "Lookup failed"); | 695 | cachefiles_io_error(cache, "Lookup failed"); |
| 696 | next = NULL; | 696 | next = NULL; |
| 697 | error: | 697 | error: |
| 698 | mutex_unlock(&dir->d_inode->i_mutex); | 698 | mutex_unlock(&d_inode(dir)->i_mutex); |
| 699 | dput(next); | 699 | dput(next); |
| 700 | error_out2: | 700 | error_out2: |
| 701 | dput(dir); | 701 | dput(dir); |
| @@ -719,7 +719,7 @@ struct dentry *cachefiles_get_directory(struct cachefiles_cache *cache, | |||
| 719 | _enter(",,%s", dirname); | 719 | _enter(",,%s", dirname); |
| 720 | 720 | ||
| 721 | /* search the current directory for the element name */ | 721 | /* search the current directory for the element name */ |
| 722 | mutex_lock(&dir->d_inode->i_mutex); | 722 | mutex_lock(&d_inode(dir)->i_mutex); |
| 723 | 723 | ||
| 724 | start = jiffies; | 724 | start = jiffies; |
| 725 | subdir = lookup_one_len(dirname, dir, strlen(dirname)); | 725 | subdir = lookup_one_len(dirname, dir, strlen(dirname)); |
| @@ -731,10 +731,10 @@ struct dentry *cachefiles_get_directory(struct cachefiles_cache *cache, | |||
| 731 | } | 731 | } |
| 732 | 732 | ||
| 733 | _debug("subdir -> %p %s", | 733 | _debug("subdir -> %p %s", |
| 734 | subdir, subdir->d_inode ? "positive" : "negative"); | 734 | subdir, d_backing_inode(subdir) ? "positive" : "negative"); |
| 735 | 735 | ||
| 736 | /* we need to create the subdir if it doesn't exist yet */ | 736 | /* we need to create the subdir if it doesn't exist yet */ |
| 737 | if (!subdir->d_inode) { | 737 | if (d_is_negative(subdir)) { |
| 738 | ret = cachefiles_has_space(cache, 1, 0); | 738 | ret = cachefiles_has_space(cache, 1, 0); |
| 739 | if (ret < 0) | 739 | if (ret < 0) |
| 740 | goto mkdir_error; | 740 | goto mkdir_error; |
| @@ -746,22 +746,22 @@ struct dentry *cachefiles_get_directory(struct cachefiles_cache *cache, | |||
| 746 | ret = security_path_mkdir(&path, subdir, 0700); | 746 | ret = security_path_mkdir(&path, subdir, 0700); |
| 747 | if (ret < 0) | 747 | if (ret < 0) |
| 748 | goto mkdir_error; | 748 | goto mkdir_error; |
| 749 | ret = vfs_mkdir(dir->d_inode, subdir, 0700); | 749 | ret = vfs_mkdir(d_inode(dir), subdir, 0700); |
| 750 | if (ret < 0) | 750 | if (ret < 0) |
| 751 | goto mkdir_error; | 751 | goto mkdir_error; |
| 752 | 752 | ||
| 753 | ASSERT(subdir->d_inode); | 753 | ASSERT(d_backing_inode(subdir)); |
| 754 | 754 | ||
| 755 | _debug("mkdir -> %p{%p{ino=%lu}}", | 755 | _debug("mkdir -> %p{%p{ino=%lu}}", |
| 756 | subdir, | 756 | subdir, |
| 757 | subdir->d_inode, | 757 | d_backing_inode(subdir), |
| 758 | subdir->d_inode->i_ino); | 758 | d_backing_inode(subdir)->i_ino); |
| 759 | } | 759 | } |
| 760 | 760 | ||
| 761 | mutex_unlock(&dir->d_inode->i_mutex); | 761 | mutex_unlock(&d_inode(dir)->i_mutex); |
| 762 | 762 | ||
| 763 | /* we need to make sure the subdir is a directory */ | 763 | /* we need to make sure the subdir is a directory */ |
| 764 | ASSERT(subdir->d_inode); | 764 | ASSERT(d_backing_inode(subdir)); |
| 765 | 765 | ||
| 766 | if (!d_can_lookup(subdir)) { | 766 | if (!d_can_lookup(subdir)) { |
| 767 | pr_err("%s is not a directory\n", dirname); | 767 | pr_err("%s is not a directory\n", dirname); |
| @@ -770,18 +770,18 @@ struct dentry *cachefiles_get_directory(struct cachefiles_cache *cache, | |||
| 770 | } | 770 | } |
| 771 | 771 | ||
| 772 | ret = -EPERM; | 772 | ret = -EPERM; |
| 773 | if (!subdir->d_inode->i_op->setxattr || | 773 | if (!d_backing_inode(subdir)->i_op->setxattr || |
| 774 | !subdir->d_inode->i_op->getxattr || | 774 | !d_backing_inode(subdir)->i_op->getxattr || |
| 775 | !subdir->d_inode->i_op->lookup || | 775 | !d_backing_inode(subdir)->i_op->lookup || |
| 776 | !subdir->d_inode->i_op->mkdir || | 776 | !d_backing_inode(subdir)->i_op->mkdir || |
| 777 | !subdir->d_inode->i_op->create || | 777 | !d_backing_inode(subdir)->i_op->create || |
| 778 | (!subdir->d_inode->i_op->rename && | 778 | (!d_backing_inode(subdir)->i_op->rename && |
| 779 | !subdir->d_inode->i_op->rename2) || | 779 | !d_backing_inode(subdir)->i_op->rename2) || |
| 780 | !subdir->d_inode->i_op->rmdir || | 780 | !d_backing_inode(subdir)->i_op->rmdir || |
| 781 | !subdir->d_inode->i_op->unlink) | 781 | !d_backing_inode(subdir)->i_op->unlink) |
| 782 | goto check_error; | 782 | goto check_error; |
| 783 | 783 | ||
| 784 | _leave(" = [%lu]", subdir->d_inode->i_ino); | 784 | _leave(" = [%lu]", d_backing_inode(subdir)->i_ino); |
| 785 | return subdir; | 785 | return subdir; |
| 786 | 786 | ||
| 787 | check_error: | 787 | check_error: |
| @@ -790,19 +790,19 @@ check_error: | |||
| 790 | return ERR_PTR(ret); | 790 | return ERR_PTR(ret); |
| 791 | 791 | ||
| 792 | mkdir_error: | 792 | mkdir_error: |
| 793 | mutex_unlock(&dir->d_inode->i_mutex); | 793 | mutex_unlock(&d_inode(dir)->i_mutex); |
| 794 | dput(subdir); | 794 | dput(subdir); |
| 795 | pr_err("mkdir %s failed with error %d\n", dirname, ret); | 795 | pr_err("mkdir %s failed with error %d\n", dirname, ret); |
| 796 | return ERR_PTR(ret); | 796 | return ERR_PTR(ret); |
| 797 | 797 | ||
| 798 | lookup_error: | 798 | lookup_error: |
| 799 | mutex_unlock(&dir->d_inode->i_mutex); | 799 | mutex_unlock(&d_inode(dir)->i_mutex); |
| 800 | ret = PTR_ERR(subdir); | 800 | ret = PTR_ERR(subdir); |
| 801 | pr_err("Lookup %s failed with error %d\n", dirname, ret); | 801 | pr_err("Lookup %s failed with error %d\n", dirname, ret); |
| 802 | return ERR_PTR(ret); | 802 | return ERR_PTR(ret); |
| 803 | 803 | ||
| 804 | nomem_d_alloc: | 804 | nomem_d_alloc: |
| 805 | mutex_unlock(&dir->d_inode->i_mutex); | 805 | mutex_unlock(&d_inode(dir)->i_mutex); |
| 806 | _leave(" = -ENOMEM"); | 806 | _leave(" = -ENOMEM"); |
| 807 | return ERR_PTR(-ENOMEM); | 807 | return ERR_PTR(-ENOMEM); |
| 808 | } | 808 | } |
| @@ -827,7 +827,7 @@ static struct dentry *cachefiles_check_active(struct cachefiles_cache *cache, | |||
| 827 | // dir, filename); | 827 | // dir, filename); |
| 828 | 828 | ||
| 829 | /* look up the victim */ | 829 | /* look up the victim */ |
| 830 | mutex_lock_nested(&dir->d_inode->i_mutex, I_MUTEX_PARENT); | 830 | mutex_lock_nested(&d_inode(dir)->i_mutex, I_MUTEX_PARENT); |
| 831 | 831 | ||
| 832 | start = jiffies; | 832 | start = jiffies; |
| 833 | victim = lookup_one_len(filename, dir, strlen(filename)); | 833 | victim = lookup_one_len(filename, dir, strlen(filename)); |
| @@ -836,13 +836,13 @@ static struct dentry *cachefiles_check_active(struct cachefiles_cache *cache, | |||
| 836 | goto lookup_error; | 836 | goto lookup_error; |
| 837 | 837 | ||
| 838 | //_debug("victim -> %p %s", | 838 | //_debug("victim -> %p %s", |
| 839 | // victim, victim->d_inode ? "positive" : "negative"); | 839 | // victim, d_backing_inode(victim) ? "positive" : "negative"); |
| 840 | 840 | ||
| 841 | /* if the object is no longer there then we probably retired the object | 841 | /* if the object is no longer there then we probably retired the object |
| 842 | * at the netfs's request whilst the cull was in progress | 842 | * at the netfs's request whilst the cull was in progress |
| 843 | */ | 843 | */ |
| 844 | if (!victim->d_inode) { | 844 | if (d_is_negative(victim)) { |
| 845 | mutex_unlock(&dir->d_inode->i_mutex); | 845 | mutex_unlock(&d_inode(dir)->i_mutex); |
| 846 | dput(victim); | 846 | dput(victim); |
| 847 | _leave(" = -ENOENT [absent]"); | 847 | _leave(" = -ENOENT [absent]"); |
| 848 | return ERR_PTR(-ENOENT); | 848 | return ERR_PTR(-ENOENT); |
| @@ -871,13 +871,13 @@ static struct dentry *cachefiles_check_active(struct cachefiles_cache *cache, | |||
| 871 | 871 | ||
| 872 | object_in_use: | 872 | object_in_use: |
| 873 | read_unlock(&cache->active_lock); | 873 | read_unlock(&cache->active_lock); |
| 874 | mutex_unlock(&dir->d_inode->i_mutex); | 874 | mutex_unlock(&d_inode(dir)->i_mutex); |
| 875 | dput(victim); | 875 | dput(victim); |
| 876 | //_leave(" = -EBUSY [in use]"); | 876 | //_leave(" = -EBUSY [in use]"); |
| 877 | return ERR_PTR(-EBUSY); | 877 | return ERR_PTR(-EBUSY); |
| 878 | 878 | ||
| 879 | lookup_error: | 879 | lookup_error: |
| 880 | mutex_unlock(&dir->d_inode->i_mutex); | 880 | mutex_unlock(&d_inode(dir)->i_mutex); |
| 881 | ret = PTR_ERR(victim); | 881 | ret = PTR_ERR(victim); |
| 882 | if (ret == -ENOENT) { | 882 | if (ret == -ENOENT) { |
| 883 | /* file or dir now absent - probably retired by netfs */ | 883 | /* file or dir now absent - probably retired by netfs */ |
| @@ -913,7 +913,7 @@ int cachefiles_cull(struct cachefiles_cache *cache, struct dentry *dir, | |||
| 913 | return PTR_ERR(victim); | 913 | return PTR_ERR(victim); |
| 914 | 914 | ||
| 915 | _debug("victim -> %p %s", | 915 | _debug("victim -> %p %s", |
| 916 | victim, victim->d_inode ? "positive" : "negative"); | 916 | victim, d_backing_inode(victim) ? "positive" : "negative"); |
| 917 | 917 | ||
| 918 | /* okay... the victim is not being used so we can cull it | 918 | /* okay... the victim is not being used so we can cull it |
| 919 | * - start by marking it as stale | 919 | * - start by marking it as stale |
| @@ -936,7 +936,7 @@ int cachefiles_cull(struct cachefiles_cache *cache, struct dentry *dir, | |||
| 936 | return 0; | 936 | return 0; |
| 937 | 937 | ||
| 938 | error_unlock: | 938 | error_unlock: |
| 939 | mutex_unlock(&dir->d_inode->i_mutex); | 939 | mutex_unlock(&d_inode(dir)->i_mutex); |
| 940 | error: | 940 | error: |
| 941 | dput(victim); | 941 | dput(victim); |
| 942 | if (ret == -ENOENT) { | 942 | if (ret == -ENOENT) { |
| @@ -971,7 +971,7 @@ int cachefiles_check_in_use(struct cachefiles_cache *cache, struct dentry *dir, | |||
| 971 | if (IS_ERR(victim)) | 971 | if (IS_ERR(victim)) |
| 972 | return PTR_ERR(victim); | 972 | return PTR_ERR(victim); |
| 973 | 973 | ||
| 974 | mutex_unlock(&dir->d_inode->i_mutex); | 974 | mutex_unlock(&d_inode(dir)->i_mutex); |
| 975 | dput(victim); | 975 | dput(victim); |
| 976 | //_leave(" = 0"); | 976 | //_leave(" = 0"); |
| 977 | return 0; | 977 | return 0; |
diff --git a/fs/cachefiles/rdwr.c b/fs/cachefiles/rdwr.c index c6cd8d7a4eef..3cbb0e834694 100644 --- a/fs/cachefiles/rdwr.c +++ b/fs/cachefiles/rdwr.c | |||
| @@ -74,12 +74,12 @@ static int cachefiles_read_waiter(wait_queue_t *wait, unsigned mode, | |||
| 74 | static int cachefiles_read_reissue(struct cachefiles_object *object, | 74 | static int cachefiles_read_reissue(struct cachefiles_object *object, |
| 75 | struct cachefiles_one_read *monitor) | 75 | struct cachefiles_one_read *monitor) |
| 76 | { | 76 | { |
| 77 | struct address_space *bmapping = object->backer->d_inode->i_mapping; | 77 | struct address_space *bmapping = d_backing_inode(object->backer)->i_mapping; |
| 78 | struct page *backpage = monitor->back_page, *backpage2; | 78 | struct page *backpage = monitor->back_page, *backpage2; |
| 79 | int ret; | 79 | int ret; |
| 80 | 80 | ||
| 81 | _enter("{ino=%lx},{%lx,%lx}", | 81 | _enter("{ino=%lx},{%lx,%lx}", |
| 82 | object->backer->d_inode->i_ino, | 82 | d_backing_inode(object->backer)->i_ino, |
| 83 | backpage->index, backpage->flags); | 83 | backpage->index, backpage->flags); |
| 84 | 84 | ||
| 85 | /* skip if the page was truncated away completely */ | 85 | /* skip if the page was truncated away completely */ |
| @@ -157,7 +157,7 @@ static void cachefiles_read_copier(struct fscache_operation *_op) | |||
| 157 | object = container_of(op->op.object, | 157 | object = container_of(op->op.object, |
| 158 | struct cachefiles_object, fscache); | 158 | struct cachefiles_object, fscache); |
| 159 | 159 | ||
| 160 | _enter("{ino=%lu}", object->backer->d_inode->i_ino); | 160 | _enter("{ino=%lu}", d_backing_inode(object->backer)->i_ino); |
| 161 | 161 | ||
| 162 | max = 8; | 162 | max = 8; |
| 163 | spin_lock_irq(&object->work_lock); | 163 | spin_lock_irq(&object->work_lock); |
| @@ -247,7 +247,7 @@ static int cachefiles_read_backing_file_one(struct cachefiles_object *object, | |||
| 247 | init_waitqueue_func_entry(&monitor->monitor, cachefiles_read_waiter); | 247 | init_waitqueue_func_entry(&monitor->monitor, cachefiles_read_waiter); |
| 248 | 248 | ||
| 249 | /* attempt to get hold of the backing page */ | 249 | /* attempt to get hold of the backing page */ |
| 250 | bmapping = object->backer->d_inode->i_mapping; | 250 | bmapping = d_backing_inode(object->backer)->i_mapping; |
| 251 | newpage = NULL; | 251 | newpage = NULL; |
| 252 | 252 | ||
| 253 | for (;;) { | 253 | for (;;) { |
| @@ -408,7 +408,7 @@ int cachefiles_read_or_alloc_page(struct fscache_retrieval *op, | |||
| 408 | if (!object->backer) | 408 | if (!object->backer) |
| 409 | goto enobufs; | 409 | goto enobufs; |
| 410 | 410 | ||
| 411 | inode = object->backer->d_inode; | 411 | inode = d_backing_inode(object->backer); |
| 412 | ASSERT(S_ISREG(inode->i_mode)); | 412 | ASSERT(S_ISREG(inode->i_mode)); |
| 413 | ASSERT(inode->i_mapping->a_ops->bmap); | 413 | ASSERT(inode->i_mapping->a_ops->bmap); |
| 414 | ASSERT(inode->i_mapping->a_ops->readpages); | 414 | ASSERT(inode->i_mapping->a_ops->readpages); |
| @@ -468,7 +468,7 @@ static int cachefiles_read_backing_file(struct cachefiles_object *object, | |||
| 468 | struct list_head *list) | 468 | struct list_head *list) |
| 469 | { | 469 | { |
| 470 | struct cachefiles_one_read *monitor = NULL; | 470 | struct cachefiles_one_read *monitor = NULL; |
| 471 | struct address_space *bmapping = object->backer->d_inode->i_mapping; | 471 | struct address_space *bmapping = d_backing_inode(object->backer)->i_mapping; |
| 472 | struct page *newpage = NULL, *netpage, *_n, *backpage = NULL; | 472 | struct page *newpage = NULL, *netpage, *_n, *backpage = NULL; |
| 473 | int ret = 0; | 473 | int ret = 0; |
| 474 | 474 | ||
| @@ -705,7 +705,7 @@ int cachefiles_read_or_alloc_pages(struct fscache_retrieval *op, | |||
| 705 | if (cachefiles_has_space(cache, 0, *nr_pages) < 0) | 705 | if (cachefiles_has_space(cache, 0, *nr_pages) < 0) |
| 706 | space = 0; | 706 | space = 0; |
| 707 | 707 | ||
| 708 | inode = object->backer->d_inode; | 708 | inode = d_backing_inode(object->backer); |
| 709 | ASSERT(S_ISREG(inode->i_mode)); | 709 | ASSERT(S_ISREG(inode->i_mode)); |
| 710 | ASSERT(inode->i_mapping->a_ops->bmap); | 710 | ASSERT(inode->i_mapping->a_ops->bmap); |
| 711 | ASSERT(inode->i_mapping->a_ops->readpages); | 711 | ASSERT(inode->i_mapping->a_ops->readpages); |
diff --git a/fs/cachefiles/security.c b/fs/cachefiles/security.c index 396c18ea2764..31bbc0528b11 100644 --- a/fs/cachefiles/security.c +++ b/fs/cachefiles/security.c | |||
| @@ -55,14 +55,14 @@ static int cachefiles_check_cache_dir(struct cachefiles_cache *cache, | |||
| 55 | { | 55 | { |
| 56 | int ret; | 56 | int ret; |
| 57 | 57 | ||
| 58 | ret = security_inode_mkdir(root->d_inode, root, 0); | 58 | ret = security_inode_mkdir(d_backing_inode(root), root, 0); |
| 59 | if (ret < 0) { | 59 | if (ret < 0) { |
| 60 | pr_err("Security denies permission to make dirs: error %d", | 60 | pr_err("Security denies permission to make dirs: error %d", |
| 61 | ret); | 61 | ret); |
| 62 | return ret; | 62 | return ret; |
| 63 | } | 63 | } |
| 64 | 64 | ||
| 65 | ret = security_inode_create(root->d_inode, root, 0); | 65 | ret = security_inode_create(d_backing_inode(root), root, 0); |
| 66 | if (ret < 0) | 66 | if (ret < 0) |
| 67 | pr_err("Security denies permission to create files: error %d", | 67 | pr_err("Security denies permission to create files: error %d", |
| 68 | ret); | 68 | ret); |
| @@ -95,7 +95,7 @@ int cachefiles_determine_cache_security(struct cachefiles_cache *cache, | |||
| 95 | 95 | ||
| 96 | /* use the cache root dir's security context as the basis with | 96 | /* use the cache root dir's security context as the basis with |
| 97 | * which create files */ | 97 | * which create files */ |
| 98 | ret = set_create_files_as(new, root->d_inode); | 98 | ret = set_create_files_as(new, d_backing_inode(root)); |
| 99 | if (ret < 0) { | 99 | if (ret < 0) { |
| 100 | abort_creds(new); | 100 | abort_creds(new); |
| 101 | cachefiles_begin_secure(cache, _saved_cred); | 101 | cachefiles_begin_secure(cache, _saved_cred); |
diff --git a/fs/cachefiles/xattr.c b/fs/cachefiles/xattr.c index a8a68745e11d..d31c1a72d8a5 100644 --- a/fs/cachefiles/xattr.c +++ b/fs/cachefiles/xattr.c | |||
| @@ -33,7 +33,7 @@ int cachefiles_check_object_type(struct cachefiles_object *object) | |||
| 33 | int ret; | 33 | int ret; |
| 34 | 34 | ||
| 35 | ASSERT(dentry); | 35 | ASSERT(dentry); |
| 36 | ASSERT(dentry->d_inode); | 36 | ASSERT(d_backing_inode(dentry)); |
| 37 | 37 | ||
| 38 | if (!object->fscache.cookie) | 38 | if (!object->fscache.cookie) |
| 39 | strcpy(type, "C3"); | 39 | strcpy(type, "C3"); |
| @@ -52,7 +52,7 @@ int cachefiles_check_object_type(struct cachefiles_object *object) | |||
| 52 | 52 | ||
| 53 | if (ret != -EEXIST) { | 53 | if (ret != -EEXIST) { |
| 54 | pr_err("Can't set xattr on %pd [%lu] (err %d)\n", | 54 | pr_err("Can't set xattr on %pd [%lu] (err %d)\n", |
| 55 | dentry, dentry->d_inode->i_ino, | 55 | dentry, d_backing_inode(dentry)->i_ino, |
| 56 | -ret); | 56 | -ret); |
| 57 | goto error; | 57 | goto error; |
| 58 | } | 58 | } |
| @@ -64,7 +64,7 @@ int cachefiles_check_object_type(struct cachefiles_object *object) | |||
| 64 | goto bad_type_length; | 64 | goto bad_type_length; |
| 65 | 65 | ||
| 66 | pr_err("Can't read xattr on %pd [%lu] (err %d)\n", | 66 | pr_err("Can't read xattr on %pd [%lu] (err %d)\n", |
| 67 | dentry, dentry->d_inode->i_ino, | 67 | dentry, d_backing_inode(dentry)->i_ino, |
| 68 | -ret); | 68 | -ret); |
| 69 | goto error; | 69 | goto error; |
| 70 | } | 70 | } |
| @@ -84,14 +84,14 @@ error: | |||
| 84 | 84 | ||
| 85 | bad_type_length: | 85 | bad_type_length: |
| 86 | pr_err("Cache object %lu type xattr length incorrect\n", | 86 | pr_err("Cache object %lu type xattr length incorrect\n", |
| 87 | dentry->d_inode->i_ino); | 87 | d_backing_inode(dentry)->i_ino); |
| 88 | ret = -EIO; | 88 | ret = -EIO; |
| 89 | goto error; | 89 | goto error; |
| 90 | 90 | ||
| 91 | bad_type: | 91 | bad_type: |
| 92 | xtype[2] = 0; | 92 | xtype[2] = 0; |
| 93 | pr_err("Cache object %pd [%lu] type %s not %s\n", | 93 | pr_err("Cache object %pd [%lu] type %s not %s\n", |
| 94 | dentry, dentry->d_inode->i_ino, | 94 | dentry, d_backing_inode(dentry)->i_ino, |
| 95 | xtype, type); | 95 | xtype, type); |
| 96 | ret = -EIO; | 96 | ret = -EIO; |
| 97 | goto error; | 97 | goto error; |
| @@ -165,7 +165,7 @@ int cachefiles_check_auxdata(struct cachefiles_object *object) | |||
| 165 | int ret; | 165 | int ret; |
| 166 | 166 | ||
| 167 | ASSERT(dentry); | 167 | ASSERT(dentry); |
| 168 | ASSERT(dentry->d_inode); | 168 | ASSERT(d_backing_inode(dentry)); |
| 169 | ASSERT(object->fscache.cookie->def->check_aux); | 169 | ASSERT(object->fscache.cookie->def->check_aux); |
| 170 | 170 | ||
| 171 | auxbuf = kmalloc(sizeof(struct cachefiles_xattr) + 512, GFP_KERNEL); | 171 | auxbuf = kmalloc(sizeof(struct cachefiles_xattr) + 512, GFP_KERNEL); |
| @@ -204,7 +204,7 @@ int cachefiles_check_object_xattr(struct cachefiles_object *object, | |||
| 204 | _enter("%p,#%d", object, auxdata->len); | 204 | _enter("%p,#%d", object, auxdata->len); |
| 205 | 205 | ||
| 206 | ASSERT(dentry); | 206 | ASSERT(dentry); |
| 207 | ASSERT(dentry->d_inode); | 207 | ASSERT(d_backing_inode(dentry)); |
| 208 | 208 | ||
| 209 | auxbuf = kmalloc(sizeof(struct cachefiles_xattr) + 512, cachefiles_gfp); | 209 | auxbuf = kmalloc(sizeof(struct cachefiles_xattr) + 512, cachefiles_gfp); |
| 210 | if (!auxbuf) { | 210 | if (!auxbuf) { |
| @@ -225,7 +225,7 @@ int cachefiles_check_object_xattr(struct cachefiles_object *object, | |||
| 225 | 225 | ||
| 226 | cachefiles_io_error_obj(object, | 226 | cachefiles_io_error_obj(object, |
| 227 | "Can't read xattr on %lu (err %d)", | 227 | "Can't read xattr on %lu (err %d)", |
| 228 | dentry->d_inode->i_ino, -ret); | 228 | d_backing_inode(dentry)->i_ino, -ret); |
| 229 | goto error; | 229 | goto error; |
| 230 | } | 230 | } |
| 231 | 231 | ||
| @@ -276,7 +276,7 @@ int cachefiles_check_object_xattr(struct cachefiles_object *object, | |||
| 276 | cachefiles_io_error_obj(object, | 276 | cachefiles_io_error_obj(object, |
| 277 | "Can't update xattr on %lu" | 277 | "Can't update xattr on %lu" |
| 278 | " (error %d)", | 278 | " (error %d)", |
| 279 | dentry->d_inode->i_ino, -ret); | 279 | d_backing_inode(dentry)->i_ino, -ret); |
| 280 | goto error; | 280 | goto error; |
| 281 | } | 281 | } |
| 282 | } | 282 | } |
| @@ -291,7 +291,7 @@ error: | |||
| 291 | 291 | ||
| 292 | bad_type_length: | 292 | bad_type_length: |
| 293 | pr_err("Cache object %lu xattr length incorrect\n", | 293 | pr_err("Cache object %lu xattr length incorrect\n", |
| 294 | dentry->d_inode->i_ino); | 294 | d_backing_inode(dentry)->i_ino); |
| 295 | ret = -EIO; | 295 | ret = -EIO; |
| 296 | goto error; | 296 | goto error; |
| 297 | 297 | ||
| @@ -316,7 +316,7 @@ int cachefiles_remove_object_xattr(struct cachefiles_cache *cache, | |||
| 316 | cachefiles_io_error(cache, | 316 | cachefiles_io_error(cache, |
| 317 | "Can't remove xattr from %lu" | 317 | "Can't remove xattr from %lu" |
| 318 | " (error %d)", | 318 | " (error %d)", |
| 319 | dentry->d_inode->i_ino, -ret); | 319 | d_backing_inode(dentry)->i_ino, -ret); |
| 320 | } | 320 | } |
| 321 | 321 | ||
| 322 | _leave(" = %d", ret); | 322 | _leave(" = %d", ret); |
diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c index 11631c4c7d14..be5ea6af8366 100644 --- a/fs/ceph/caps.c +++ b/fs/ceph/caps.c | |||
| @@ -3422,7 +3422,7 @@ int ceph_encode_inode_release(void **p, struct inode *inode, | |||
| 3422 | int ceph_encode_dentry_release(void **p, struct dentry *dentry, | 3422 | int ceph_encode_dentry_release(void **p, struct dentry *dentry, |
| 3423 | int mds, int drop, int unless) | 3423 | int mds, int drop, int unless) |
| 3424 | { | 3424 | { |
| 3425 | struct inode *dir = dentry->d_parent->d_inode; | 3425 | struct inode *dir = d_inode(dentry->d_parent); |
| 3426 | struct ceph_mds_request_release *rel = *p; | 3426 | struct ceph_mds_request_release *rel = *p; |
| 3427 | struct ceph_dentry_info *di = ceph_dentry(dentry); | 3427 | struct ceph_dentry_info *di = ceph_dentry(dentry); |
| 3428 | int force = 0; | 3428 | int force = 0; |
diff --git a/fs/ceph/debugfs.c b/fs/ceph/debugfs.c index 1b2355109b9f..31f831471ed2 100644 --- a/fs/ceph/debugfs.c +++ b/fs/ceph/debugfs.c | |||
| @@ -84,7 +84,7 @@ static int mdsc_show(struct seq_file *s, void *p) | |||
| 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/%pd (%s)", | 86 | seq_printf(s, " #%llx/%pd (%s)", |
| 87 | ceph_ino(req->r_dentry->d_parent->d_inode), | 87 | ceph_ino(d_inode(req->r_dentry->d_parent)), |
| 88 | req->r_dentry, | 88 | req->r_dentry, |
| 89 | path ? path : ""); | 89 | path ? path : ""); |
| 90 | spin_unlock(&req->r_dentry->d_lock); | 90 | spin_unlock(&req->r_dentry->d_lock); |
diff --git a/fs/ceph/dir.c b/fs/ceph/dir.c index e729b79812b4..4248307fea90 100644 --- a/fs/ceph/dir.c +++ b/fs/ceph/dir.c | |||
| @@ -49,9 +49,9 @@ int ceph_init_dentry(struct dentry *dentry) | |||
| 49 | goto out_unlock; | 49 | goto out_unlock; |
| 50 | } | 50 | } |
| 51 | 51 | ||
| 52 | if (ceph_snap(dentry->d_parent->d_inode) == CEPH_NOSNAP) | 52 | if (ceph_snap(d_inode(dentry->d_parent)) == CEPH_NOSNAP) |
| 53 | d_set_d_op(dentry, &ceph_dentry_ops); | 53 | d_set_d_op(dentry, &ceph_dentry_ops); |
| 54 | else if (ceph_snap(dentry->d_parent->d_inode) == CEPH_SNAPDIR) | 54 | else if (ceph_snap(d_inode(dentry->d_parent)) == CEPH_SNAPDIR) |
| 55 | d_set_d_op(dentry, &ceph_snapdir_dentry_ops); | 55 | d_set_d_op(dentry, &ceph_snapdir_dentry_ops); |
| 56 | else | 56 | else |
| 57 | d_set_d_op(dentry, &ceph_snap_dentry_ops); | 57 | d_set_d_op(dentry, &ceph_snap_dentry_ops); |
| @@ -77,7 +77,7 @@ struct inode *ceph_get_dentry_parent_inode(struct dentry *dentry) | |||
| 77 | 77 | ||
| 78 | spin_lock(&dentry->d_lock); | 78 | spin_lock(&dentry->d_lock); |
| 79 | if (!IS_ROOT(dentry)) { | 79 | if (!IS_ROOT(dentry)) { |
| 80 | inode = dentry->d_parent->d_inode; | 80 | inode = d_inode(dentry->d_parent); |
| 81 | ihold(inode); | 81 | ihold(inode); |
| 82 | } | 82 | } |
| 83 | spin_unlock(&dentry->d_lock); | 83 | spin_unlock(&dentry->d_lock); |
| @@ -122,7 +122,7 @@ static int __dcache_readdir(struct file *file, struct dir_context *ctx, | |||
| 122 | { | 122 | { |
| 123 | struct ceph_file_info *fi = file->private_data; | 123 | struct ceph_file_info *fi = file->private_data; |
| 124 | struct dentry *parent = file->f_path.dentry; | 124 | struct dentry *parent = file->f_path.dentry; |
| 125 | struct inode *dir = parent->d_inode; | 125 | struct inode *dir = d_inode(parent); |
| 126 | struct list_head *p; | 126 | struct list_head *p; |
| 127 | struct dentry *dentry, *last; | 127 | struct dentry *dentry, *last; |
| 128 | struct ceph_dentry_info *di; | 128 | struct ceph_dentry_info *di; |
| @@ -161,15 +161,15 @@ more: | |||
| 161 | } | 161 | } |
| 162 | spin_lock_nested(&dentry->d_lock, DENTRY_D_LOCK_NESTED); | 162 | spin_lock_nested(&dentry->d_lock, DENTRY_D_LOCK_NESTED); |
| 163 | if (di->lease_shared_gen == shared_gen && | 163 | if (di->lease_shared_gen == shared_gen && |
| 164 | !d_unhashed(dentry) && dentry->d_inode && | 164 | !d_unhashed(dentry) && d_really_is_positive(dentry) && |
| 165 | ceph_snap(dentry->d_inode) != CEPH_SNAPDIR && | 165 | ceph_snap(d_inode(dentry)) != CEPH_SNAPDIR && |
| 166 | ceph_ino(dentry->d_inode) != CEPH_INO_CEPH && | 166 | ceph_ino(d_inode(dentry)) != CEPH_INO_CEPH && |
| 167 | fpos_cmp(ctx->pos, di->offset) <= 0) | 167 | fpos_cmp(ctx->pos, di->offset) <= 0) |
| 168 | break; | 168 | break; |
| 169 | dout(" skipping %p %pd at %llu (%llu)%s%s\n", dentry, | 169 | dout(" skipping %p %pd at %llu (%llu)%s%s\n", dentry, |
| 170 | dentry, di->offset, | 170 | dentry, di->offset, |
| 171 | ctx->pos, d_unhashed(dentry) ? " unhashed" : "", | 171 | ctx->pos, d_unhashed(dentry) ? " unhashed" : "", |
| 172 | !dentry->d_inode ? " null" : ""); | 172 | !d_inode(dentry) ? " null" : ""); |
| 173 | spin_unlock(&dentry->d_lock); | 173 | spin_unlock(&dentry->d_lock); |
| 174 | p = p->prev; | 174 | p = p->prev; |
| 175 | dentry = list_entry(p, struct dentry, d_child); | 175 | dentry = list_entry(p, struct dentry, d_child); |
| @@ -189,11 +189,11 @@ more: | |||
| 189 | } | 189 | } |
| 190 | 190 | ||
| 191 | dout(" %llu (%llu) dentry %p %pd %p\n", di->offset, ctx->pos, | 191 | dout(" %llu (%llu) dentry %p %pd %p\n", di->offset, ctx->pos, |
| 192 | dentry, dentry, dentry->d_inode); | 192 | dentry, dentry, d_inode(dentry)); |
| 193 | if (!dir_emit(ctx, dentry->d_name.name, | 193 | if (!dir_emit(ctx, dentry->d_name.name, |
| 194 | dentry->d_name.len, | 194 | dentry->d_name.len, |
| 195 | ceph_translate_ino(dentry->d_sb, dentry->d_inode->i_ino), | 195 | ceph_translate_ino(dentry->d_sb, d_inode(dentry)->i_ino), |
| 196 | dentry->d_inode->i_mode >> 12)) { | 196 | d_inode(dentry)->i_mode >> 12)) { |
| 197 | if (last) { | 197 | if (last) { |
| 198 | /* remember our position */ | 198 | /* remember our position */ |
| 199 | fi->dentry = last; | 199 | fi->dentry = last; |
| @@ -543,7 +543,7 @@ int ceph_handle_snapdir(struct ceph_mds_request *req, | |||
| 543 | struct dentry *dentry, int err) | 543 | struct dentry *dentry, int err) |
| 544 | { | 544 | { |
| 545 | struct ceph_fs_client *fsc = ceph_sb_to_client(dentry->d_sb); | 545 | struct ceph_fs_client *fsc = ceph_sb_to_client(dentry->d_sb); |
| 546 | struct inode *parent = dentry->d_parent->d_inode; /* we hold i_mutex */ | 546 | struct inode *parent = d_inode(dentry->d_parent); /* we hold i_mutex */ |
| 547 | 547 | ||
| 548 | /* .snap dir? */ | 548 | /* .snap dir? */ |
| 549 | if (err == -ENOENT && | 549 | if (err == -ENOENT && |
| @@ -579,8 +579,8 @@ struct dentry *ceph_finish_lookup(struct ceph_mds_request *req, | |||
| 579 | err = 0; | 579 | err = 0; |
| 580 | if (!req->r_reply_info.head->is_dentry) { | 580 | if (!req->r_reply_info.head->is_dentry) { |
| 581 | dout("ENOENT and no trace, dentry %p inode %p\n", | 581 | dout("ENOENT and no trace, dentry %p inode %p\n", |
| 582 | dentry, dentry->d_inode); | 582 | dentry, d_inode(dentry)); |
| 583 | if (dentry->d_inode) { | 583 | if (d_really_is_positive(dentry)) { |
| 584 | d_drop(dentry); | 584 | d_drop(dentry); |
| 585 | err = -ENOENT; | 585 | err = -ENOENT; |
| 586 | } else { | 586 | } else { |
| @@ -627,7 +627,7 @@ static struct dentry *ceph_lookup(struct inode *dir, struct dentry *dentry, | |||
| 627 | return ERR_PTR(err); | 627 | return ERR_PTR(err); |
| 628 | 628 | ||
| 629 | /* can we conclude ENOENT locally? */ | 629 | /* can we conclude ENOENT locally? */ |
| 630 | if (dentry->d_inode == NULL) { | 630 | if (d_really_is_negative(dentry)) { |
| 631 | struct ceph_inode_info *ci = ceph_inode(dir); | 631 | struct ceph_inode_info *ci = ceph_inode(dir); |
| 632 | struct ceph_dentry_info *di = ceph_dentry(dentry); | 632 | struct ceph_dentry_info *di = ceph_dentry(dentry); |
| 633 | 633 | ||
| @@ -734,7 +734,7 @@ static int ceph_mknod(struct inode *dir, struct dentry *dentry, | |||
| 734 | ceph_mdsc_put_request(req); | 734 | ceph_mdsc_put_request(req); |
| 735 | out: | 735 | out: |
| 736 | if (!err) | 736 | if (!err) |
| 737 | ceph_init_inode_acls(dentry->d_inode, &acls); | 737 | ceph_init_inode_acls(d_inode(dentry), &acls); |
| 738 | else | 738 | else |
| 739 | d_drop(dentry); | 739 | d_drop(dentry); |
| 740 | ceph_release_acls_info(&acls); | 740 | ceph_release_acls_info(&acls); |
| @@ -835,7 +835,7 @@ static int ceph_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) | |||
| 835 | ceph_mdsc_put_request(req); | 835 | ceph_mdsc_put_request(req); |
| 836 | out: | 836 | out: |
| 837 | if (!err) | 837 | if (!err) |
| 838 | ceph_init_inode_acls(dentry->d_inode, &acls); | 838 | ceph_init_inode_acls(d_inode(dentry), &acls); |
| 839 | else | 839 | else |
| 840 | d_drop(dentry); | 840 | d_drop(dentry); |
| 841 | ceph_release_acls_info(&acls); | 841 | ceph_release_acls_info(&acls); |
| @@ -872,8 +872,8 @@ static int ceph_link(struct dentry *old_dentry, struct inode *dir, | |||
| 872 | if (err) { | 872 | if (err) { |
| 873 | d_drop(dentry); | 873 | d_drop(dentry); |
| 874 | } else if (!req->r_reply_info.head->is_dentry) { | 874 | } else if (!req->r_reply_info.head->is_dentry) { |
| 875 | ihold(old_dentry->d_inode); | 875 | ihold(d_inode(old_dentry)); |
| 876 | d_instantiate(dentry, old_dentry->d_inode); | 876 | d_instantiate(dentry, d_inode(old_dentry)); |
| 877 | } | 877 | } |
| 878 | ceph_mdsc_put_request(req); | 878 | ceph_mdsc_put_request(req); |
| 879 | return err; | 879 | return err; |
| @@ -906,7 +906,7 @@ static int ceph_unlink(struct inode *dir, struct dentry *dentry) | |||
| 906 | { | 906 | { |
| 907 | struct ceph_fs_client *fsc = ceph_sb_to_client(dir->i_sb); | 907 | struct ceph_fs_client *fsc = ceph_sb_to_client(dir->i_sb); |
| 908 | struct ceph_mds_client *mdsc = fsc->mdsc; | 908 | struct ceph_mds_client *mdsc = fsc->mdsc; |
| 909 | struct inode *inode = dentry->d_inode; | 909 | struct inode *inode = d_inode(dentry); |
| 910 | struct ceph_mds_request *req; | 910 | struct ceph_mds_request *req; |
| 911 | int err = -EROFS; | 911 | int err = -EROFS; |
| 912 | int op; | 912 | int op; |
| @@ -975,8 +975,8 @@ static int ceph_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
| 975 | req->r_dentry_unless = CEPH_CAP_FILE_EXCL; | 975 | req->r_dentry_unless = CEPH_CAP_FILE_EXCL; |
| 976 | /* release LINK_RDCACHE on source inode (mds will lock it) */ | 976 | /* release LINK_RDCACHE on source inode (mds will lock it) */ |
| 977 | req->r_old_inode_drop = CEPH_CAP_LINK_SHARED; | 977 | req->r_old_inode_drop = CEPH_CAP_LINK_SHARED; |
| 978 | if (new_dentry->d_inode) | 978 | if (d_really_is_positive(new_dentry)) |
| 979 | req->r_inode_drop = drop_caps_for_unlink(new_dentry->d_inode); | 979 | req->r_inode_drop = drop_caps_for_unlink(d_inode(new_dentry)); |
| 980 | err = ceph_mdsc_do_request(mdsc, old_dir, req); | 980 | err = ceph_mdsc_do_request(mdsc, old_dir, req); |
| 981 | if (!err && !req->r_reply_info.head->is_dentry) { | 981 | if (!err && !req->r_reply_info.head->is_dentry) { |
| 982 | /* | 982 | /* |
| @@ -1042,7 +1042,7 @@ static int dentry_lease_is_valid(struct dentry *dentry) | |||
| 1042 | if (di->lease_renew_after && | 1042 | if (di->lease_renew_after && |
| 1043 | time_after(jiffies, di->lease_renew_after)) { | 1043 | time_after(jiffies, di->lease_renew_after)) { |
| 1044 | /* we should renew */ | 1044 | /* we should renew */ |
| 1045 | dir = dentry->d_parent->d_inode; | 1045 | dir = d_inode(dentry->d_parent); |
| 1046 | session = ceph_get_mds_session(s); | 1046 | session = ceph_get_mds_session(s); |
| 1047 | seq = di->lease_seq; | 1047 | seq = di->lease_seq; |
| 1048 | di->lease_renew_after = 0; | 1048 | di->lease_renew_after = 0; |
| @@ -1092,22 +1092,22 @@ static int ceph_d_revalidate(struct dentry *dentry, unsigned int flags) | |||
| 1092 | return -ECHILD; | 1092 | return -ECHILD; |
| 1093 | 1093 | ||
| 1094 | dout("d_revalidate %p '%pd' inode %p offset %lld\n", dentry, | 1094 | dout("d_revalidate %p '%pd' inode %p offset %lld\n", dentry, |
| 1095 | dentry, dentry->d_inode, ceph_dentry(dentry)->offset); | 1095 | dentry, d_inode(dentry), ceph_dentry(dentry)->offset); |
| 1096 | 1096 | ||
| 1097 | dir = ceph_get_dentry_parent_inode(dentry); | 1097 | dir = ceph_get_dentry_parent_inode(dentry); |
| 1098 | 1098 | ||
| 1099 | /* always trust cached snapped dentries, snapdir dentry */ | 1099 | /* always trust cached snapped dentries, snapdir dentry */ |
| 1100 | if (ceph_snap(dir) != CEPH_NOSNAP) { | 1100 | if (ceph_snap(dir) != CEPH_NOSNAP) { |
| 1101 | dout("d_revalidate %p '%pd' inode %p is SNAPPED\n", dentry, | 1101 | dout("d_revalidate %p '%pd' inode %p is SNAPPED\n", dentry, |
| 1102 | dentry, dentry->d_inode); | 1102 | dentry, d_inode(dentry)); |
| 1103 | valid = 1; | 1103 | valid = 1; |
| 1104 | } else if (dentry->d_inode && | 1104 | } else if (d_really_is_positive(dentry) && |
| 1105 | ceph_snap(dentry->d_inode) == CEPH_SNAPDIR) { | 1105 | ceph_snap(d_inode(dentry)) == CEPH_SNAPDIR) { |
| 1106 | valid = 1; | 1106 | valid = 1; |
| 1107 | } else if (dentry_lease_is_valid(dentry) || | 1107 | } else if (dentry_lease_is_valid(dentry) || |
| 1108 | dir_lease_is_valid(dir, dentry)) { | 1108 | dir_lease_is_valid(dir, dentry)) { |
| 1109 | if (dentry->d_inode) | 1109 | if (d_really_is_positive(dentry)) |
| 1110 | valid = ceph_is_any_caps(dentry->d_inode); | 1110 | valid = ceph_is_any_caps(d_inode(dentry)); |
| 1111 | else | 1111 | else |
| 1112 | valid = 1; | 1112 | valid = 1; |
| 1113 | } | 1113 | } |
| @@ -1169,7 +1169,7 @@ static void ceph_d_prune(struct dentry *dentry) | |||
| 1169 | * we hold d_lock, so d_parent is stable, and d_fsdata is never | 1169 | * we hold d_lock, so d_parent is stable, and d_fsdata is never |
| 1170 | * cleared until d_release | 1170 | * cleared until d_release |
| 1171 | */ | 1171 | */ |
| 1172 | ceph_dir_clear_complete(dentry->d_parent->d_inode); | 1172 | ceph_dir_clear_complete(d_inode(dentry->d_parent)); |
| 1173 | } | 1173 | } |
| 1174 | 1174 | ||
| 1175 | /* | 1175 | /* |
diff --git a/fs/ceph/export.c b/fs/ceph/export.c index 8d7d782f4382..fe02ae7f056a 100644 --- a/fs/ceph/export.c +++ b/fs/ceph/export.c | |||
| @@ -136,8 +136,8 @@ static struct dentry *__get_parent(struct super_block *sb, | |||
| 136 | return ERR_CAST(req); | 136 | return ERR_CAST(req); |
| 137 | 137 | ||
| 138 | if (child) { | 138 | if (child) { |
| 139 | req->r_inode = child->d_inode; | 139 | req->r_inode = d_inode(child); |
| 140 | ihold(child->d_inode); | 140 | ihold(d_inode(child)); |
| 141 | } else { | 141 | } else { |
| 142 | req->r_ino1 = (struct ceph_vino) { | 142 | req->r_ino1 = (struct ceph_vino) { |
| 143 | .ino = ino, | 143 | .ino = ino, |
| @@ -164,7 +164,7 @@ static struct dentry *__get_parent(struct super_block *sb, | |||
| 164 | return ERR_PTR(err); | 164 | return ERR_PTR(err); |
| 165 | } | 165 | } |
| 166 | dout("__get_parent ino %llx parent %p ino %llx.%llx\n", | 166 | dout("__get_parent ino %llx parent %p ino %llx.%llx\n", |
| 167 | child ? ceph_ino(child->d_inode) : ino, | 167 | child ? ceph_ino(d_inode(child)) : ino, |
| 168 | dentry, ceph_vinop(inode)); | 168 | dentry, ceph_vinop(inode)); |
| 169 | return dentry; | 169 | return dentry; |
| 170 | } | 170 | } |
| @@ -172,11 +172,11 @@ static struct dentry *__get_parent(struct super_block *sb, | |||
| 172 | static struct dentry *ceph_get_parent(struct dentry *child) | 172 | static struct dentry *ceph_get_parent(struct dentry *child) |
| 173 | { | 173 | { |
| 174 | /* don't re-export snaps */ | 174 | /* don't re-export snaps */ |
| 175 | if (ceph_snap(child->d_inode) != CEPH_NOSNAP) | 175 | if (ceph_snap(d_inode(child)) != CEPH_NOSNAP) |
| 176 | return ERR_PTR(-EINVAL); | 176 | return ERR_PTR(-EINVAL); |
| 177 | 177 | ||
| 178 | dout("get_parent %p ino %llx.%llx\n", | 178 | dout("get_parent %p ino %llx.%llx\n", |
| 179 | child, ceph_vinop(child->d_inode)); | 179 | child, ceph_vinop(d_inode(child))); |
| 180 | return __get_parent(child->d_sb, child, 0); | 180 | return __get_parent(child->d_sb, child, 0); |
| 181 | } | 181 | } |
| 182 | 182 | ||
| @@ -209,32 +209,32 @@ static int ceph_get_name(struct dentry *parent, char *name, | |||
| 209 | struct ceph_mds_request *req; | 209 | struct ceph_mds_request *req; |
| 210 | int err; | 210 | int err; |
| 211 | 211 | ||
| 212 | mdsc = ceph_inode_to_client(child->d_inode)->mdsc; | 212 | mdsc = ceph_inode_to_client(d_inode(child))->mdsc; |
| 213 | req = ceph_mdsc_create_request(mdsc, CEPH_MDS_OP_LOOKUPNAME, | 213 | req = ceph_mdsc_create_request(mdsc, CEPH_MDS_OP_LOOKUPNAME, |
| 214 | USE_ANY_MDS); | 214 | USE_ANY_MDS); |
| 215 | if (IS_ERR(req)) | 215 | if (IS_ERR(req)) |
| 216 | return PTR_ERR(req); | 216 | return PTR_ERR(req); |
| 217 | 217 | ||
| 218 | mutex_lock(&parent->d_inode->i_mutex); | 218 | mutex_lock(&d_inode(parent)->i_mutex); |
| 219 | 219 | ||
| 220 | req->r_inode = child->d_inode; | 220 | req->r_inode = d_inode(child); |
| 221 | ihold(child->d_inode); | 221 | ihold(d_inode(child)); |
| 222 | req->r_ino2 = ceph_vino(parent->d_inode); | 222 | req->r_ino2 = ceph_vino(d_inode(parent)); |
| 223 | req->r_locked_dir = parent->d_inode; | 223 | req->r_locked_dir = d_inode(parent); |
| 224 | req->r_num_caps = 2; | 224 | req->r_num_caps = 2; |
| 225 | err = ceph_mdsc_do_request(mdsc, NULL, req); | 225 | err = ceph_mdsc_do_request(mdsc, NULL, req); |
| 226 | 226 | ||
| 227 | mutex_unlock(&parent->d_inode->i_mutex); | 227 | mutex_unlock(&d_inode(parent)->i_mutex); |
| 228 | 228 | ||
| 229 | if (!err) { | 229 | if (!err) { |
| 230 | struct ceph_mds_reply_info_parsed *rinfo = &req->r_reply_info; | 230 | struct ceph_mds_reply_info_parsed *rinfo = &req->r_reply_info; |
| 231 | memcpy(name, rinfo->dname, rinfo->dname_len); | 231 | memcpy(name, rinfo->dname, rinfo->dname_len); |
| 232 | name[rinfo->dname_len] = 0; | 232 | name[rinfo->dname_len] = 0; |
| 233 | dout("get_name %p ino %llx.%llx name %s\n", | 233 | dout("get_name %p ino %llx.%llx name %s\n", |
| 234 | child, ceph_vinop(child->d_inode), name); | 234 | child, ceph_vinop(d_inode(child)), name); |
| 235 | } else { | 235 | } else { |
| 236 | dout("get_name %p ino %llx.%llx err %d\n", | 236 | dout("get_name %p ino %llx.%llx err %d\n", |
| 237 | child, ceph_vinop(child->d_inode), err); | 237 | child, ceph_vinop(d_inode(child)), err); |
| 238 | } | 238 | } |
| 239 | 239 | ||
| 240 | ceph_mdsc_put_request(req); | 240 | ceph_mdsc_put_request(req); |
diff --git a/fs/ceph/file.c b/fs/ceph/file.c index b9b8eb225f66..3b6b522b4b31 100644 --- a/fs/ceph/file.c +++ b/fs/ceph/file.c | |||
| @@ -291,14 +291,14 @@ int ceph_atomic_open(struct inode *dir, struct dentry *dentry, | |||
| 291 | } | 291 | } |
| 292 | if (err) | 292 | if (err) |
| 293 | goto out_req; | 293 | goto out_req; |
| 294 | if (dn || dentry->d_inode == NULL || d_is_symlink(dentry)) { | 294 | if (dn || d_really_is_negative(dentry) || d_is_symlink(dentry)) { |
| 295 | /* make vfs retry on splice, ENOENT, or symlink */ | 295 | /* make vfs retry on splice, ENOENT, or symlink */ |
| 296 | dout("atomic_open finish_no_open on dn %p\n", dn); | 296 | dout("atomic_open finish_no_open on dn %p\n", dn); |
| 297 | err = finish_no_open(file, dn); | 297 | err = finish_no_open(file, dn); |
| 298 | } else { | 298 | } else { |
| 299 | dout("atomic_open finish_open on dn %p\n", dn); | 299 | dout("atomic_open finish_open on dn %p\n", dn); |
| 300 | if (req->r_op == CEPH_MDS_OP_CREATE && req->r_reply_info.has_create_ino) { | 300 | if (req->r_op == CEPH_MDS_OP_CREATE && req->r_reply_info.has_create_ino) { |
| 301 | ceph_init_inode_acls(dentry->d_inode, &acls); | 301 | ceph_init_inode_acls(d_inode(dentry), &acls); |
| 302 | *opened |= FILE_CREATED; | 302 | *opened |= FILE_CREATED; |
| 303 | } | 303 | } |
| 304 | err = finish_open(file, dentry, ceph_open, opened); | 304 | err = finish_open(file, dentry, ceph_open, opened); |
diff --git a/fs/ceph/inode.c b/fs/ceph/inode.c index 119c43c80638..e876e1944519 100644 --- a/fs/ceph/inode.c +++ b/fs/ceph/inode.c | |||
| @@ -940,7 +940,7 @@ static void update_dentry_lease(struct dentry *dentry, | |||
| 940 | dentry, duration, ttl); | 940 | dentry, duration, ttl); |
| 941 | 941 | ||
| 942 | /* make lease_rdcache_gen match directory */ | 942 | /* make lease_rdcache_gen match directory */ |
| 943 | dir = dentry->d_parent->d_inode; | 943 | dir = d_inode(dentry->d_parent); |
| 944 | di->lease_shared_gen = ceph_inode(dir)->i_shared_gen; | 944 | di->lease_shared_gen = ceph_inode(dir)->i_shared_gen; |
| 945 | 945 | ||
| 946 | if (duration == 0) | 946 | if (duration == 0) |
| @@ -980,7 +980,7 @@ static struct dentry *splice_dentry(struct dentry *dn, struct inode *in, | |||
| 980 | { | 980 | { |
| 981 | struct dentry *realdn; | 981 | struct dentry *realdn; |
| 982 | 982 | ||
| 983 | BUG_ON(dn->d_inode); | 983 | BUG_ON(d_inode(dn)); |
| 984 | 984 | ||
| 985 | /* dn must be unhashed */ | 985 | /* dn must be unhashed */ |
| 986 | if (!d_unhashed(dn)) | 986 | if (!d_unhashed(dn)) |
| @@ -998,13 +998,13 @@ static struct dentry *splice_dentry(struct dentry *dn, struct inode *in, | |||
| 998 | "inode %p ino %llx.%llx\n", | 998 | "inode %p ino %llx.%llx\n", |
| 999 | dn, d_count(dn), | 999 | dn, d_count(dn), |
| 1000 | realdn, d_count(realdn), | 1000 | realdn, d_count(realdn), |
| 1001 | realdn->d_inode, ceph_vinop(realdn->d_inode)); | 1001 | d_inode(realdn), ceph_vinop(d_inode(realdn))); |
| 1002 | dput(dn); | 1002 | dput(dn); |
| 1003 | dn = realdn; | 1003 | dn = realdn; |
| 1004 | } else { | 1004 | } else { |
| 1005 | BUG_ON(!ceph_dentry(dn)); | 1005 | BUG_ON(!ceph_dentry(dn)); |
| 1006 | dout("dn %p attached to %p ino %llx.%llx\n", | 1006 | dout("dn %p attached to %p ino %llx.%llx\n", |
| 1007 | dn, dn->d_inode, ceph_vinop(dn->d_inode)); | 1007 | dn, d_inode(dn), ceph_vinop(d_inode(dn))); |
| 1008 | } | 1008 | } |
| 1009 | if ((!prehash || *prehash) && d_unhashed(dn)) | 1009 | if ((!prehash || *prehash) && d_unhashed(dn)) |
| 1010 | d_rehash(dn); | 1010 | d_rehash(dn); |
| @@ -1125,11 +1125,11 @@ retry_lookup: | |||
| 1125 | dput(parent); | 1125 | dput(parent); |
| 1126 | goto done; | 1126 | goto done; |
| 1127 | } | 1127 | } |
| 1128 | } else if (dn->d_inode && | 1128 | } else if (d_really_is_positive(dn) && |
| 1129 | (ceph_ino(dn->d_inode) != vino.ino || | 1129 | (ceph_ino(d_inode(dn)) != vino.ino || |
| 1130 | ceph_snap(dn->d_inode) != vino.snap)) { | 1130 | ceph_snap(d_inode(dn)) != vino.snap)) { |
| 1131 | dout(" dn %p points to wrong inode %p\n", | 1131 | dout(" dn %p points to wrong inode %p\n", |
| 1132 | dn, dn->d_inode); | 1132 | dn, d_inode(dn)); |
| 1133 | d_delete(dn); | 1133 | d_delete(dn); |
| 1134 | dput(dn); | 1134 | dput(dn); |
| 1135 | goto retry_lookup; | 1135 | goto retry_lookup; |
| @@ -1183,7 +1183,7 @@ retry_lookup: | |||
| 1183 | 1183 | ||
| 1184 | BUG_ON(!dn); | 1184 | BUG_ON(!dn); |
| 1185 | BUG_ON(!dir); | 1185 | BUG_ON(!dir); |
| 1186 | BUG_ON(dn->d_parent->d_inode != dir); | 1186 | BUG_ON(d_inode(dn->d_parent) != dir); |
| 1187 | BUG_ON(ceph_ino(dir) != | 1187 | BUG_ON(ceph_ino(dir) != |
| 1188 | le64_to_cpu(rinfo->diri.in->ino)); | 1188 | le64_to_cpu(rinfo->diri.in->ino)); |
| 1189 | BUG_ON(ceph_snap(dir) != | 1189 | BUG_ON(ceph_snap(dir) != |
| @@ -1235,7 +1235,7 @@ retry_lookup: | |||
| 1235 | /* null dentry? */ | 1235 | /* null dentry? */ |
| 1236 | if (!rinfo->head->is_target) { | 1236 | if (!rinfo->head->is_target) { |
| 1237 | dout("fill_trace null dentry\n"); | 1237 | dout("fill_trace null dentry\n"); |
| 1238 | if (dn->d_inode) { | 1238 | if (d_really_is_positive(dn)) { |
| 1239 | ceph_dir_clear_ordered(dir); | 1239 | ceph_dir_clear_ordered(dir); |
| 1240 | dout("d_delete %p\n", dn); | 1240 | dout("d_delete %p\n", dn); |
| 1241 | d_delete(dn); | 1241 | d_delete(dn); |
| @@ -1252,7 +1252,7 @@ retry_lookup: | |||
| 1252 | } | 1252 | } |
| 1253 | 1253 | ||
| 1254 | /* attach proper inode */ | 1254 | /* attach proper inode */ |
| 1255 | if (!dn->d_inode) { | 1255 | if (d_really_is_negative(dn)) { |
| 1256 | ceph_dir_clear_ordered(dir); | 1256 | ceph_dir_clear_ordered(dir); |
| 1257 | ihold(in); | 1257 | ihold(in); |
| 1258 | dn = splice_dentry(dn, in, &have_lease); | 1258 | dn = splice_dentry(dn, in, &have_lease); |
| @@ -1261,9 +1261,9 @@ retry_lookup: | |||
| 1261 | goto done; | 1261 | goto done; |
| 1262 | } | 1262 | } |
| 1263 | req->r_dentry = dn; /* may have spliced */ | 1263 | req->r_dentry = dn; /* may have spliced */ |
| 1264 | } else if (dn->d_inode && dn->d_inode != in) { | 1264 | } else if (d_really_is_positive(dn) && d_inode(dn) != in) { |
| 1265 | dout(" %p links to %p %llx.%llx, not %llx.%llx\n", | 1265 | dout(" %p links to %p %llx.%llx, not %llx.%llx\n", |
| 1266 | dn, dn->d_inode, ceph_vinop(dn->d_inode), | 1266 | dn, d_inode(dn), ceph_vinop(d_inode(dn)), |
| 1267 | ceph_vinop(in)); | 1267 | ceph_vinop(in)); |
| 1268 | have_lease = false; | 1268 | have_lease = false; |
| 1269 | } | 1269 | } |
| @@ -1363,7 +1363,7 @@ int ceph_readdir_prepopulate(struct ceph_mds_request *req, | |||
| 1363 | return readdir_prepopulate_inodes_only(req, session); | 1363 | return readdir_prepopulate_inodes_only(req, session); |
| 1364 | 1364 | ||
| 1365 | if (le32_to_cpu(rinfo->head->op) == CEPH_MDS_OP_LSSNAP) { | 1365 | if (le32_to_cpu(rinfo->head->op) == CEPH_MDS_OP_LSSNAP) { |
| 1366 | snapdir = ceph_get_snapdir(parent->d_inode); | 1366 | snapdir = ceph_get_snapdir(d_inode(parent)); |
| 1367 | parent = d_find_alias(snapdir); | 1367 | parent = d_find_alias(snapdir); |
| 1368 | dout("readdir_prepopulate %d items under SNAPDIR dn %p\n", | 1368 | dout("readdir_prepopulate %d items under SNAPDIR dn %p\n", |
| 1369 | rinfo->dir_nr, parent); | 1369 | rinfo->dir_nr, parent); |
| @@ -1371,7 +1371,7 @@ int ceph_readdir_prepopulate(struct ceph_mds_request *req, | |||
| 1371 | dout("readdir_prepopulate %d items under dn %p\n", | 1371 | dout("readdir_prepopulate %d items under dn %p\n", |
| 1372 | rinfo->dir_nr, parent); | 1372 | rinfo->dir_nr, parent); |
| 1373 | if (rinfo->dir_dir) | 1373 | if (rinfo->dir_dir) |
| 1374 | ceph_fill_dirfrag(parent->d_inode, rinfo->dir_dir); | 1374 | ceph_fill_dirfrag(d_inode(parent), rinfo->dir_dir); |
| 1375 | } | 1375 | } |
| 1376 | 1376 | ||
| 1377 | /* FIXME: release caps/leases if error occurs */ | 1377 | /* FIXME: release caps/leases if error occurs */ |
| @@ -1405,11 +1405,11 @@ retry_lookup: | |||
| 1405 | err = ret; | 1405 | err = ret; |
| 1406 | goto out; | 1406 | goto out; |
| 1407 | } | 1407 | } |
| 1408 | } else if (dn->d_inode && | 1408 | } else if (d_really_is_positive(dn) && |
| 1409 | (ceph_ino(dn->d_inode) != vino.ino || | 1409 | (ceph_ino(d_inode(dn)) != vino.ino || |
| 1410 | ceph_snap(dn->d_inode) != vino.snap)) { | 1410 | ceph_snap(d_inode(dn)) != vino.snap)) { |
| 1411 | dout(" dn %p points to wrong inode %p\n", | 1411 | dout(" dn %p points to wrong inode %p\n", |
| 1412 | dn, dn->d_inode); | 1412 | dn, d_inode(dn)); |
| 1413 | d_delete(dn); | 1413 | d_delete(dn); |
| 1414 | dput(dn); | 1414 | dput(dn); |
| 1415 | goto retry_lookup; | 1415 | goto retry_lookup; |
| @@ -1423,8 +1423,8 @@ retry_lookup: | |||
| 1423 | } | 1423 | } |
| 1424 | 1424 | ||
| 1425 | /* inode */ | 1425 | /* inode */ |
| 1426 | if (dn->d_inode) { | 1426 | if (d_really_is_positive(dn)) { |
| 1427 | in = dn->d_inode; | 1427 | in = d_inode(dn); |
| 1428 | } else { | 1428 | } else { |
| 1429 | in = ceph_get_inode(parent->d_sb, vino); | 1429 | in = ceph_get_inode(parent->d_sb, vino); |
| 1430 | if (IS_ERR(in)) { | 1430 | if (IS_ERR(in)) { |
| @@ -1440,13 +1440,13 @@ retry_lookup: | |||
| 1440 | req->r_request_started, -1, | 1440 | req->r_request_started, -1, |
| 1441 | &req->r_caps_reservation) < 0) { | 1441 | &req->r_caps_reservation) < 0) { |
| 1442 | pr_err("fill_inode badness on %p\n", in); | 1442 | pr_err("fill_inode badness on %p\n", in); |
| 1443 | if (!dn->d_inode) | 1443 | if (d_really_is_negative(dn)) |
| 1444 | iput(in); | 1444 | iput(in); |
| 1445 | d_drop(dn); | 1445 | d_drop(dn); |
| 1446 | goto next_item; | 1446 | goto next_item; |
| 1447 | } | 1447 | } |
| 1448 | 1448 | ||
| 1449 | if (!dn->d_inode) { | 1449 | if (d_really_is_negative(dn)) { |
| 1450 | struct dentry *realdn = splice_dentry(dn, in, NULL); | 1450 | struct dentry *realdn = splice_dentry(dn, in, NULL); |
| 1451 | if (IS_ERR(realdn)) { | 1451 | if (IS_ERR(realdn)) { |
| 1452 | err = PTR_ERR(realdn); | 1452 | err = PTR_ERR(realdn); |
| @@ -1693,7 +1693,7 @@ retry: | |||
| 1693 | */ | 1693 | */ |
| 1694 | static void *ceph_sym_follow_link(struct dentry *dentry, struct nameidata *nd) | 1694 | static void *ceph_sym_follow_link(struct dentry *dentry, struct nameidata *nd) |
| 1695 | { | 1695 | { |
| 1696 | struct ceph_inode_info *ci = ceph_inode(dentry->d_inode); | 1696 | struct ceph_inode_info *ci = ceph_inode(d_inode(dentry)); |
| 1697 | nd_set_link(nd, ci->i_symlink); | 1697 | nd_set_link(nd, ci->i_symlink); |
| 1698 | return NULL; | 1698 | return NULL; |
| 1699 | } | 1699 | } |
| @@ -1714,7 +1714,7 @@ static const struct inode_operations ceph_symlink_iops = { | |||
| 1714 | */ | 1714 | */ |
| 1715 | int ceph_setattr(struct dentry *dentry, struct iattr *attr) | 1715 | int ceph_setattr(struct dentry *dentry, struct iattr *attr) |
| 1716 | { | 1716 | { |
| 1717 | struct inode *inode = dentry->d_inode; | 1717 | struct inode *inode = d_inode(dentry); |
| 1718 | struct ceph_inode_info *ci = ceph_inode(inode); | 1718 | struct ceph_inode_info *ci = ceph_inode(inode); |
| 1719 | const unsigned int ia_valid = attr->ia_valid; | 1719 | const unsigned int ia_valid = attr->ia_valid; |
| 1720 | struct ceph_mds_request *req; | 1720 | struct ceph_mds_request *req; |
| @@ -1990,7 +1990,7 @@ int ceph_permission(struct inode *inode, int mask) | |||
| 1990 | int ceph_getattr(struct vfsmount *mnt, struct dentry *dentry, | 1990 | int ceph_getattr(struct vfsmount *mnt, struct dentry *dentry, |
| 1991 | struct kstat *stat) | 1991 | struct kstat *stat) |
| 1992 | { | 1992 | { |
| 1993 | struct inode *inode = dentry->d_inode; | 1993 | struct inode *inode = d_inode(dentry); |
| 1994 | struct ceph_inode_info *ci = ceph_inode(inode); | 1994 | struct ceph_inode_info *ci = ceph_inode(inode); |
| 1995 | int err; | 1995 | int err; |
| 1996 | 1996 | ||
diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c index 0a2eb32ffe43..84f37f34f9aa 100644 --- a/fs/ceph/mds_client.c +++ b/fs/ceph/mds_client.c | |||
| @@ -679,7 +679,7 @@ static struct dentry *get_nonsnap_parent(struct dentry *dentry) | |||
| 679 | * except to resplice to another snapdir, and either the old or new | 679 | * except to resplice to another snapdir, and either the old or new |
| 680 | * result is a valid result. | 680 | * result is a valid result. |
| 681 | */ | 681 | */ |
| 682 | while (!IS_ROOT(dentry) && ceph_snap(dentry->d_inode) != CEPH_NOSNAP) | 682 | while (!IS_ROOT(dentry) && ceph_snap(d_inode(dentry)) != CEPH_NOSNAP) |
| 683 | dentry = dentry->d_parent; | 683 | dentry = dentry->d_parent; |
| 684 | return dentry; | 684 | return dentry; |
| 685 | } | 685 | } |
| @@ -716,20 +716,20 @@ static int __choose_mds(struct ceph_mds_client *mdsc, | |||
| 716 | } else if (req->r_dentry) { | 716 | } else if (req->r_dentry) { |
| 717 | /* ignore race with rename; old or new d_parent is okay */ | 717 | /* ignore race with rename; old or new d_parent is okay */ |
| 718 | struct dentry *parent = req->r_dentry->d_parent; | 718 | struct dentry *parent = req->r_dentry->d_parent; |
| 719 | struct inode *dir = parent->d_inode; | 719 | struct inode *dir = d_inode(parent); |
| 720 | 720 | ||
| 721 | if (dir->i_sb != mdsc->fsc->sb) { | 721 | if (dir->i_sb != mdsc->fsc->sb) { |
| 722 | /* not this fs! */ | 722 | /* not this fs! */ |
| 723 | inode = req->r_dentry->d_inode; | 723 | inode = d_inode(req->r_dentry); |
| 724 | } else if (ceph_snap(dir) != CEPH_NOSNAP) { | 724 | } else if (ceph_snap(dir) != CEPH_NOSNAP) { |
| 725 | /* direct snapped/virtual snapdir requests | 725 | /* direct snapped/virtual snapdir requests |
| 726 | * based on parent dir inode */ | 726 | * based on parent dir inode */ |
| 727 | struct dentry *dn = get_nonsnap_parent(parent); | 727 | struct dentry *dn = get_nonsnap_parent(parent); |
| 728 | inode = dn->d_inode; | 728 | inode = d_inode(dn); |
| 729 | dout("__choose_mds using nonsnap parent %p\n", inode); | 729 | dout("__choose_mds using nonsnap parent %p\n", inode); |
| 730 | } else { | 730 | } else { |
| 731 | /* dentry target */ | 731 | /* dentry target */ |
| 732 | inode = req->r_dentry->d_inode; | 732 | inode = d_inode(req->r_dentry); |
| 733 | if (!inode || mode == USE_AUTH_MDS) { | 733 | if (!inode || mode == USE_AUTH_MDS) { |
| 734 | /* dir + name */ | 734 | /* dir + name */ |
| 735 | inode = dir; | 735 | inode = dir; |
| @@ -1732,7 +1732,7 @@ retry: | |||
| 1732 | seq = read_seqbegin(&rename_lock); | 1732 | seq = read_seqbegin(&rename_lock); |
| 1733 | rcu_read_lock(); | 1733 | rcu_read_lock(); |
| 1734 | for (temp = dentry; !IS_ROOT(temp);) { | 1734 | for (temp = dentry; !IS_ROOT(temp);) { |
| 1735 | struct inode *inode = temp->d_inode; | 1735 | struct inode *inode = d_inode(temp); |
| 1736 | if (inode && ceph_snap(inode) == CEPH_SNAPDIR) | 1736 | if (inode && ceph_snap(inode) == CEPH_SNAPDIR) |
| 1737 | len++; /* slash only */ | 1737 | len++; /* slash only */ |
| 1738 | else if (stop_on_nosnap && inode && | 1738 | else if (stop_on_nosnap && inode && |
| @@ -1756,7 +1756,7 @@ retry: | |||
| 1756 | struct inode *inode; | 1756 | struct inode *inode; |
| 1757 | 1757 | ||
| 1758 | spin_lock(&temp->d_lock); | 1758 | spin_lock(&temp->d_lock); |
| 1759 | inode = temp->d_inode; | 1759 | inode = d_inode(temp); |
| 1760 | if (inode && ceph_snap(inode) == CEPH_SNAPDIR) { | 1760 | if (inode && ceph_snap(inode) == CEPH_SNAPDIR) { |
| 1761 | dout("build_path path+%d: %p SNAPDIR\n", | 1761 | dout("build_path path+%d: %p SNAPDIR\n", |
| 1762 | pos, temp); | 1762 | pos, temp); |
| @@ -1790,7 +1790,7 @@ retry: | |||
| 1790 | goto retry; | 1790 | goto retry; |
| 1791 | } | 1791 | } |
| 1792 | 1792 | ||
| 1793 | *base = ceph_ino(temp->d_inode); | 1793 | *base = ceph_ino(d_inode(temp)); |
| 1794 | *plen = len; | 1794 | *plen = len; |
| 1795 | dout("build_path on %p %d built %llx '%.*s'\n", | 1795 | dout("build_path on %p %d built %llx '%.*s'\n", |
| 1796 | dentry, d_count(dentry), *base, len, path); | 1796 | dentry, d_count(dentry), *base, len, path); |
| @@ -1803,8 +1803,8 @@ static int build_dentry_path(struct dentry *dentry, | |||
| 1803 | { | 1803 | { |
| 1804 | char *path; | 1804 | char *path; |
| 1805 | 1805 | ||
| 1806 | if (ceph_snap(dentry->d_parent->d_inode) == CEPH_NOSNAP) { | 1806 | if (ceph_snap(d_inode(dentry->d_parent)) == CEPH_NOSNAP) { |
| 1807 | *pino = ceph_ino(dentry->d_parent->d_inode); | 1807 | *pino = ceph_ino(d_inode(dentry->d_parent)); |
| 1808 | *ppath = dentry->d_name.name; | 1808 | *ppath = dentry->d_name.name; |
| 1809 | *ppathlen = dentry->d_name.len; | 1809 | *ppathlen = dentry->d_name.len; |
| 1810 | return 0; | 1810 | return 0; |
| @@ -1945,7 +1945,7 @@ static struct ceph_msg *create_request_message(struct ceph_mds_client *mdsc, | |||
| 1945 | releases = 0; | 1945 | releases = 0; |
| 1946 | if (req->r_inode_drop) | 1946 | if (req->r_inode_drop) |
| 1947 | releases += ceph_encode_inode_release(&p, | 1947 | releases += ceph_encode_inode_release(&p, |
| 1948 | req->r_inode ? req->r_inode : req->r_dentry->d_inode, | 1948 | req->r_inode ? req->r_inode : d_inode(req->r_dentry), |
| 1949 | mds, req->r_inode_drop, req->r_inode_unless, 0); | 1949 | mds, req->r_inode_drop, req->r_inode_unless, 0); |
| 1950 | if (req->r_dentry_drop) | 1950 | if (req->r_dentry_drop) |
| 1951 | releases += ceph_encode_dentry_release(&p, req->r_dentry, | 1951 | releases += ceph_encode_dentry_release(&p, req->r_dentry, |
| @@ -1955,7 +1955,7 @@ static struct ceph_msg *create_request_message(struct ceph_mds_client *mdsc, | |||
| 1955 | mds, req->r_old_dentry_drop, req->r_old_dentry_unless); | 1955 | mds, req->r_old_dentry_drop, req->r_old_dentry_unless); |
| 1956 | if (req->r_old_inode_drop) | 1956 | if (req->r_old_inode_drop) |
| 1957 | releases += ceph_encode_inode_release(&p, | 1957 | releases += ceph_encode_inode_release(&p, |
| 1958 | req->r_old_dentry->d_inode, | 1958 | d_inode(req->r_old_dentry), |
| 1959 | mds, req->r_old_inode_drop, req->r_old_inode_unless, 0); | 1959 | mds, req->r_old_inode_drop, req->r_old_inode_unless, 0); |
| 1960 | 1960 | ||
| 1961 | if (drop_cap_releases) { | 1961 | if (drop_cap_releases) { |
diff --git a/fs/ceph/super.c b/fs/ceph/super.c index e463ebd69a9c..4e9905374078 100644 --- a/fs/ceph/super.c +++ b/fs/ceph/super.c | |||
| @@ -44,7 +44,7 @@ static void ceph_put_super(struct super_block *s) | |||
| 44 | 44 | ||
| 45 | static int ceph_statfs(struct dentry *dentry, struct kstatfs *buf) | 45 | static int ceph_statfs(struct dentry *dentry, struct kstatfs *buf) |
| 46 | { | 46 | { |
| 47 | struct ceph_fs_client *fsc = ceph_inode_to_client(dentry->d_inode); | 47 | struct ceph_fs_client *fsc = ceph_inode_to_client(d_inode(dentry)); |
| 48 | struct ceph_monmap *monmap = fsc->client->monc.monmap; | 48 | struct ceph_monmap *monmap = fsc->client->monc.monmap; |
| 49 | struct ceph_statfs st; | 49 | struct ceph_statfs st; |
| 50 | u64 fsid; | 50 | u64 fsid; |
| @@ -972,7 +972,7 @@ static struct dentry *ceph_mount(struct file_system_type *fs_type, | |||
| 972 | if (IS_ERR(res)) | 972 | if (IS_ERR(res)) |
| 973 | goto out_splat; | 973 | goto out_splat; |
| 974 | dout("root %p inode %p ino %llx.%llx\n", res, | 974 | dout("root %p inode %p ino %llx.%llx\n", res, |
| 975 | res->d_inode, ceph_vinop(res->d_inode)); | 975 | d_inode(res), ceph_vinop(d_inode(res))); |
| 976 | return res; | 976 | return res; |
| 977 | 977 | ||
| 978 | out_splat: | 978 | out_splat: |
diff --git a/fs/ceph/xattr.c b/fs/ceph/xattr.c index 5c4c9c256931..cd7ffad4041d 100644 --- a/fs/ceph/xattr.c +++ b/fs/ceph/xattr.c | |||
| @@ -776,12 +776,12 @@ ssize_t ceph_getxattr(struct dentry *dentry, const char *name, void *value, | |||
| 776 | if (!strncmp(name, XATTR_SYSTEM_PREFIX, XATTR_SYSTEM_PREFIX_LEN)) | 776 | if (!strncmp(name, XATTR_SYSTEM_PREFIX, XATTR_SYSTEM_PREFIX_LEN)) |
| 777 | return generic_getxattr(dentry, name, value, size); | 777 | return generic_getxattr(dentry, name, value, size); |
| 778 | 778 | ||
| 779 | return __ceph_getxattr(dentry->d_inode, name, value, size); | 779 | return __ceph_getxattr(d_inode(dentry), name, value, size); |
| 780 | } | 780 | } |
| 781 | 781 | ||
| 782 | ssize_t ceph_listxattr(struct dentry *dentry, char *names, size_t size) | 782 | ssize_t ceph_listxattr(struct dentry *dentry, char *names, size_t size) |
| 783 | { | 783 | { |
| 784 | struct inode *inode = dentry->d_inode; | 784 | struct inode *inode = d_inode(dentry); |
| 785 | struct ceph_inode_info *ci = ceph_inode(inode); | 785 | struct ceph_inode_info *ci = ceph_inode(inode); |
| 786 | struct ceph_vxattr *vxattrs = ceph_inode_vxattrs(inode); | 786 | struct ceph_vxattr *vxattrs = ceph_inode_vxattrs(inode); |
| 787 | u32 vir_namelen = 0; | 787 | u32 vir_namelen = 0; |
| @@ -847,7 +847,7 @@ static int ceph_sync_setxattr(struct dentry *dentry, const char *name, | |||
| 847 | const char *value, size_t size, int flags) | 847 | const char *value, size_t size, int flags) |
| 848 | { | 848 | { |
| 849 | struct ceph_fs_client *fsc = ceph_sb_to_client(dentry->d_sb); | 849 | struct ceph_fs_client *fsc = ceph_sb_to_client(dentry->d_sb); |
| 850 | struct inode *inode = dentry->d_inode; | 850 | struct inode *inode = d_inode(dentry); |
| 851 | struct ceph_inode_info *ci = ceph_inode(inode); | 851 | struct ceph_inode_info *ci = ceph_inode(inode); |
| 852 | struct ceph_mds_request *req; | 852 | struct ceph_mds_request *req; |
| 853 | struct ceph_mds_client *mdsc = fsc->mdsc; | 853 | struct ceph_mds_client *mdsc = fsc->mdsc; |
| @@ -908,7 +908,7 @@ out: | |||
| 908 | int __ceph_setxattr(struct dentry *dentry, const char *name, | 908 | int __ceph_setxattr(struct dentry *dentry, const char *name, |
| 909 | const void *value, size_t size, int flags) | 909 | const void *value, size_t size, int flags) |
| 910 | { | 910 | { |
| 911 | struct inode *inode = dentry->d_inode; | 911 | struct inode *inode = d_inode(dentry); |
| 912 | struct ceph_vxattr *vxattr; | 912 | struct ceph_vxattr *vxattr; |
| 913 | struct ceph_inode_info *ci = ceph_inode(inode); | 913 | struct ceph_inode_info *ci = ceph_inode(inode); |
| 914 | int issued; | 914 | int issued; |
| @@ -1002,7 +1002,7 @@ out: | |||
| 1002 | int ceph_setxattr(struct dentry *dentry, const char *name, | 1002 | int ceph_setxattr(struct dentry *dentry, const char *name, |
| 1003 | const void *value, size_t size, int flags) | 1003 | const void *value, size_t size, int flags) |
| 1004 | { | 1004 | { |
| 1005 | if (ceph_snap(dentry->d_inode) != CEPH_NOSNAP) | 1005 | if (ceph_snap(d_inode(dentry)) != CEPH_NOSNAP) |
| 1006 | return -EROFS; | 1006 | return -EROFS; |
| 1007 | 1007 | ||
| 1008 | if (!strncmp(name, XATTR_SYSTEM_PREFIX, XATTR_SYSTEM_PREFIX_LEN)) | 1008 | if (!strncmp(name, XATTR_SYSTEM_PREFIX, XATTR_SYSTEM_PREFIX_LEN)) |
| @@ -1018,7 +1018,7 @@ static int ceph_send_removexattr(struct dentry *dentry, const char *name) | |||
| 1018 | { | 1018 | { |
| 1019 | struct ceph_fs_client *fsc = ceph_sb_to_client(dentry->d_sb); | 1019 | struct ceph_fs_client *fsc = ceph_sb_to_client(dentry->d_sb); |
| 1020 | struct ceph_mds_client *mdsc = fsc->mdsc; | 1020 | struct ceph_mds_client *mdsc = fsc->mdsc; |
| 1021 | struct inode *inode = dentry->d_inode; | 1021 | struct inode *inode = d_inode(dentry); |
| 1022 | struct ceph_mds_request *req; | 1022 | struct ceph_mds_request *req; |
| 1023 | int err; | 1023 | int err; |
| 1024 | 1024 | ||
| @@ -1041,7 +1041,7 @@ static int ceph_send_removexattr(struct dentry *dentry, const char *name) | |||
| 1041 | 1041 | ||
| 1042 | int __ceph_removexattr(struct dentry *dentry, const char *name) | 1042 | int __ceph_removexattr(struct dentry *dentry, const char *name) |
| 1043 | { | 1043 | { |
| 1044 | struct inode *inode = dentry->d_inode; | 1044 | struct inode *inode = d_inode(dentry); |
| 1045 | struct ceph_vxattr *vxattr; | 1045 | struct ceph_vxattr *vxattr; |
| 1046 | struct ceph_inode_info *ci = ceph_inode(inode); | 1046 | struct ceph_inode_info *ci = ceph_inode(inode); |
| 1047 | int issued; | 1047 | int issued; |
| @@ -1107,7 +1107,7 @@ out: | |||
| 1107 | 1107 | ||
| 1108 | int ceph_removexattr(struct dentry *dentry, const char *name) | 1108 | int ceph_removexattr(struct dentry *dentry, const char *name) |
| 1109 | { | 1109 | { |
| 1110 | if (ceph_snap(dentry->d_inode) != CEPH_NOSNAP) | 1110 | if (ceph_snap(d_inode(dentry)) != CEPH_NOSNAP) |
| 1111 | return -EROFS; | 1111 | return -EROFS; |
| 1112 | 1112 | ||
| 1113 | if (!strncmp(name, XATTR_SYSTEM_PREFIX, XATTR_SYSTEM_PREFIX_LEN)) | 1113 | if (!strncmp(name, XATTR_SYSTEM_PREFIX, XATTR_SYSTEM_PREFIX_LEN)) |
diff --git a/fs/cifs/cifs_dfs_ref.c b/fs/cifs/cifs_dfs_ref.c index b8602f199815..430e0348c99e 100644 --- a/fs/cifs/cifs_dfs_ref.c +++ b/fs/cifs/cifs_dfs_ref.c | |||
| @@ -301,7 +301,7 @@ static struct vfsmount *cifs_dfs_do_automount(struct dentry *mntpt) | |||
| 301 | if (full_path == NULL) | 301 | if (full_path == NULL) |
| 302 | goto cdda_exit; | 302 | goto cdda_exit; |
| 303 | 303 | ||
| 304 | cifs_sb = CIFS_SB(mntpt->d_inode->i_sb); | 304 | cifs_sb = CIFS_SB(d_inode(mntpt)->i_sb); |
| 305 | tlink = cifs_sb_tlink(cifs_sb); | 305 | tlink = cifs_sb_tlink(cifs_sb); |
| 306 | if (IS_ERR(tlink)) { | 306 | if (IS_ERR(tlink)) { |
| 307 | mnt = ERR_CAST(tlink); | 307 | mnt = ERR_CAST(tlink); |
diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c index eaab4b2a0595..f5089bde3635 100644 --- a/fs/cifs/cifsfs.c +++ b/fs/cifs/cifsfs.c | |||
| @@ -607,7 +607,7 @@ cifs_get_root(struct smb_vol *vol, struct super_block *sb) | |||
| 607 | p = s = full_path; | 607 | p = s = full_path; |
| 608 | 608 | ||
| 609 | do { | 609 | do { |
| 610 | struct inode *dir = dentry->d_inode; | 610 | struct inode *dir = d_inode(dentry); |
| 611 | struct dentry *child; | 611 | struct dentry *child; |
| 612 | 612 | ||
| 613 | if (!dir) { | 613 | if (!dir) { |
diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c index fa13d5e79f64..84650a51c7c4 100644 --- a/fs/cifs/cifssmb.c +++ b/fs/cifs/cifssmb.c | |||
| @@ -1898,7 +1898,7 @@ static void | |||
| 1898 | cifs_writev_requeue(struct cifs_writedata *wdata) | 1898 | cifs_writev_requeue(struct cifs_writedata *wdata) |
| 1899 | { | 1899 | { |
| 1900 | int i, rc = 0; | 1900 | int i, rc = 0; |
| 1901 | struct inode *inode = wdata->cfile->dentry->d_inode; | 1901 | struct inode *inode = d_inode(wdata->cfile->dentry); |
| 1902 | struct TCP_Server_Info *server; | 1902 | struct TCP_Server_Info *server; |
| 1903 | unsigned int rest_len; | 1903 | unsigned int rest_len; |
| 1904 | 1904 | ||
| @@ -1981,7 +1981,7 @@ cifs_writev_complete(struct work_struct *work) | |||
| 1981 | { | 1981 | { |
| 1982 | struct cifs_writedata *wdata = container_of(work, | 1982 | struct cifs_writedata *wdata = container_of(work, |
| 1983 | struct cifs_writedata, work); | 1983 | struct cifs_writedata, work); |
| 1984 | struct inode *inode = wdata->cfile->dentry->d_inode; | 1984 | struct inode *inode = d_inode(wdata->cfile->dentry); |
| 1985 | int i = 0; | 1985 | int i = 0; |
| 1986 | 1986 | ||
| 1987 | if (wdata->result == 0) { | 1987 | if (wdata->result == 0) { |
diff --git a/fs/cifs/dir.c b/fs/cifs/dir.c index b72bc29cba23..338d56936f6a 100644 --- a/fs/cifs/dir.c +++ b/fs/cifs/dir.c | |||
| @@ -745,13 +745,13 @@ cifs_lookup(struct inode *parent_dir_inode, struct dentry *direntry, | |||
| 745 | goto lookup_out; | 745 | goto lookup_out; |
| 746 | } | 746 | } |
| 747 | 747 | ||
| 748 | if (direntry->d_inode != NULL) { | 748 | if (d_really_is_positive(direntry)) { |
| 749 | cifs_dbg(FYI, "non-NULL inode in lookup\n"); | 749 | cifs_dbg(FYI, "non-NULL inode in lookup\n"); |
| 750 | } else { | 750 | } else { |
| 751 | cifs_dbg(FYI, "NULL inode in lookup\n"); | 751 | cifs_dbg(FYI, "NULL inode in lookup\n"); |
| 752 | } | 752 | } |
| 753 | cifs_dbg(FYI, "Full path: %s inode = 0x%p\n", | 753 | cifs_dbg(FYI, "Full path: %s inode = 0x%p\n", |
| 754 | full_path, direntry->d_inode); | 754 | full_path, d_inode(direntry)); |
| 755 | 755 | ||
| 756 | if (pTcon->unix_ext) { | 756 | if (pTcon->unix_ext) { |
| 757 | rc = cifs_get_inode_info_unix(&newInode, full_path, | 757 | rc = cifs_get_inode_info_unix(&newInode, full_path, |
| @@ -792,7 +792,7 @@ cifs_d_revalidate(struct dentry *direntry, unsigned int flags) | |||
| 792 | if (flags & LOOKUP_RCU) | 792 | if (flags & LOOKUP_RCU) |
| 793 | return -ECHILD; | 793 | return -ECHILD; |
| 794 | 794 | ||
| 795 | if (direntry->d_inode) { | 795 | if (d_really_is_positive(direntry)) { |
| 796 | if (cifs_revalidate_dentry(direntry)) | 796 | if (cifs_revalidate_dentry(direntry)) |
| 797 | return 0; | 797 | return 0; |
| 798 | else { | 798 | else { |
| @@ -803,7 +803,7 @@ cifs_d_revalidate(struct dentry *direntry, unsigned int flags) | |||
| 803 | * attributes will have been updated by | 803 | * attributes will have been updated by |
| 804 | * cifs_revalidate_dentry(). | 804 | * cifs_revalidate_dentry(). |
| 805 | */ | 805 | */ |
| 806 | if (IS_AUTOMOUNT(direntry->d_inode) && | 806 | if (IS_AUTOMOUNT(d_inode(direntry)) && |
| 807 | !(direntry->d_flags & DCACHE_NEED_AUTOMOUNT)) { | 807 | !(direntry->d_flags & DCACHE_NEED_AUTOMOUNT)) { |
| 808 | spin_lock(&direntry->d_lock); | 808 | spin_lock(&direntry->d_lock); |
| 809 | direntry->d_flags |= DCACHE_NEED_AUTOMOUNT; | 809 | direntry->d_flags |= DCACHE_NEED_AUTOMOUNT; |
diff --git a/fs/cifs/file.c b/fs/cifs/file.c index ca2bc5406306..cafbf10521d5 100644 --- a/fs/cifs/file.c +++ b/fs/cifs/file.c | |||
| @@ -273,7 +273,7 @@ cifs_new_fileinfo(struct cifs_fid *fid, struct file *file, | |||
| 273 | struct tcon_link *tlink, __u32 oplock) | 273 | struct tcon_link *tlink, __u32 oplock) |
| 274 | { | 274 | { |
| 275 | struct dentry *dentry = file->f_path.dentry; | 275 | struct dentry *dentry = file->f_path.dentry; |
| 276 | struct inode *inode = dentry->d_inode; | 276 | struct inode *inode = d_inode(dentry); |
| 277 | struct cifsInodeInfo *cinode = CIFS_I(inode); | 277 | struct cifsInodeInfo *cinode = CIFS_I(inode); |
| 278 | struct cifsFileInfo *cfile; | 278 | struct cifsFileInfo *cfile; |
| 279 | struct cifs_fid_locks *fdlocks; | 279 | struct cifs_fid_locks *fdlocks; |
| @@ -357,7 +357,7 @@ cifsFileInfo_get(struct cifsFileInfo *cifs_file) | |||
| 357 | */ | 357 | */ |
| 358 | void cifsFileInfo_put(struct cifsFileInfo *cifs_file) | 358 | void cifsFileInfo_put(struct cifsFileInfo *cifs_file) |
| 359 | { | 359 | { |
| 360 | struct inode *inode = cifs_file->dentry->d_inode; | 360 | struct inode *inode = d_inode(cifs_file->dentry); |
| 361 | struct cifs_tcon *tcon = tlink_tcon(cifs_file->tlink); | 361 | struct cifs_tcon *tcon = tlink_tcon(cifs_file->tlink); |
| 362 | struct TCP_Server_Info *server = tcon->ses->server; | 362 | struct TCP_Server_Info *server = tcon->ses->server; |
| 363 | struct cifsInodeInfo *cifsi = CIFS_I(inode); | 363 | struct cifsInodeInfo *cifsi = CIFS_I(inode); |
| @@ -386,7 +386,7 @@ void cifsFileInfo_put(struct cifsFileInfo *cifs_file) | |||
| 386 | 386 | ||
| 387 | if (list_empty(&cifsi->openFileList)) { | 387 | if (list_empty(&cifsi->openFileList)) { |
| 388 | cifs_dbg(FYI, "closing last open instance for inode %p\n", | 388 | cifs_dbg(FYI, "closing last open instance for inode %p\n", |
| 389 | cifs_file->dentry->d_inode); | 389 | d_inode(cifs_file->dentry)); |
| 390 | /* | 390 | /* |
| 391 | * In strict cache mode we need invalidate mapping on the last | 391 | * In strict cache mode we need invalidate mapping on the last |
| 392 | * close because it may cause a error when we open this file | 392 | * close because it may cause a error when we open this file |
| @@ -572,7 +572,7 @@ static int | |||
| 572 | cifs_relock_file(struct cifsFileInfo *cfile) | 572 | cifs_relock_file(struct cifsFileInfo *cfile) |
| 573 | { | 573 | { |
| 574 | struct cifs_sb_info *cifs_sb = CIFS_SB(cfile->dentry->d_sb); | 574 | struct cifs_sb_info *cifs_sb = CIFS_SB(cfile->dentry->d_sb); |
| 575 | struct cifsInodeInfo *cinode = CIFS_I(cfile->dentry->d_inode); | 575 | struct cifsInodeInfo *cinode = CIFS_I(d_inode(cfile->dentry)); |
| 576 | struct cifs_tcon *tcon = tlink_tcon(cfile->tlink); | 576 | struct cifs_tcon *tcon = tlink_tcon(cfile->tlink); |
| 577 | int rc = 0; | 577 | int rc = 0; |
| 578 | 578 | ||
| @@ -620,7 +620,7 @@ cifs_reopen_file(struct cifsFileInfo *cfile, bool can_flush) | |||
| 620 | return rc; | 620 | return rc; |
| 621 | } | 621 | } |
| 622 | 622 | ||
| 623 | inode = cfile->dentry->d_inode; | 623 | inode = d_inode(cfile->dentry); |
| 624 | cifs_sb = CIFS_SB(inode->i_sb); | 624 | cifs_sb = CIFS_SB(inode->i_sb); |
| 625 | tcon = tlink_tcon(cfile->tlink); | 625 | tcon = tlink_tcon(cfile->tlink); |
| 626 | server = tcon->ses->server; | 626 | server = tcon->ses->server; |
| @@ -874,7 +874,7 @@ cifs_find_lock_conflict(struct cifsFileInfo *cfile, __u64 offset, __u64 length, | |||
| 874 | { | 874 | { |
| 875 | bool rc = false; | 875 | bool rc = false; |
| 876 | struct cifs_fid_locks *cur; | 876 | struct cifs_fid_locks *cur; |
| 877 | struct cifsInodeInfo *cinode = CIFS_I(cfile->dentry->d_inode); | 877 | struct cifsInodeInfo *cinode = CIFS_I(d_inode(cfile->dentry)); |
| 878 | 878 | ||
| 879 | list_for_each_entry(cur, &cinode->llist, llist) { | 879 | list_for_each_entry(cur, &cinode->llist, llist) { |
| 880 | rc = cifs_find_fid_lock_conflict(cur, offset, length, type, | 880 | rc = cifs_find_fid_lock_conflict(cur, offset, length, type, |
| @@ -899,7 +899,7 @@ cifs_lock_test(struct cifsFileInfo *cfile, __u64 offset, __u64 length, | |||
| 899 | { | 899 | { |
| 900 | int rc = 0; | 900 | int rc = 0; |
| 901 | struct cifsLockInfo *conf_lock; | 901 | struct cifsLockInfo *conf_lock; |
| 902 | struct cifsInodeInfo *cinode = CIFS_I(cfile->dentry->d_inode); | 902 | struct cifsInodeInfo *cinode = CIFS_I(d_inode(cfile->dentry)); |
| 903 | struct TCP_Server_Info *server = tlink_tcon(cfile->tlink)->ses->server; | 903 | struct TCP_Server_Info *server = tlink_tcon(cfile->tlink)->ses->server; |
| 904 | bool exist; | 904 | bool exist; |
| 905 | 905 | ||
| @@ -927,7 +927,7 @@ cifs_lock_test(struct cifsFileInfo *cfile, __u64 offset, __u64 length, | |||
| 927 | static void | 927 | static void |
| 928 | cifs_lock_add(struct cifsFileInfo *cfile, struct cifsLockInfo *lock) | 928 | cifs_lock_add(struct cifsFileInfo *cfile, struct cifsLockInfo *lock) |
| 929 | { | 929 | { |
| 930 | struct cifsInodeInfo *cinode = CIFS_I(cfile->dentry->d_inode); | 930 | struct cifsInodeInfo *cinode = CIFS_I(d_inode(cfile->dentry)); |
| 931 | down_write(&cinode->lock_sem); | 931 | down_write(&cinode->lock_sem); |
| 932 | list_add_tail(&lock->llist, &cfile->llist->locks); | 932 | list_add_tail(&lock->llist, &cfile->llist->locks); |
| 933 | up_write(&cinode->lock_sem); | 933 | up_write(&cinode->lock_sem); |
| @@ -944,7 +944,7 @@ cifs_lock_add_if(struct cifsFileInfo *cfile, struct cifsLockInfo *lock, | |||
| 944 | bool wait) | 944 | bool wait) |
| 945 | { | 945 | { |
| 946 | struct cifsLockInfo *conf_lock; | 946 | struct cifsLockInfo *conf_lock; |
| 947 | struct cifsInodeInfo *cinode = CIFS_I(cfile->dentry->d_inode); | 947 | struct cifsInodeInfo *cinode = CIFS_I(d_inode(cfile->dentry)); |
| 948 | bool exist; | 948 | bool exist; |
| 949 | int rc = 0; | 949 | int rc = 0; |
| 950 | 950 | ||
| @@ -1125,7 +1125,7 @@ struct lock_to_push { | |||
| 1125 | static int | 1125 | static int |
| 1126 | cifs_push_posix_locks(struct cifsFileInfo *cfile) | 1126 | cifs_push_posix_locks(struct cifsFileInfo *cfile) |
| 1127 | { | 1127 | { |
| 1128 | struct inode *inode = cfile->dentry->d_inode; | 1128 | struct inode *inode = d_inode(cfile->dentry); |
| 1129 | struct cifs_tcon *tcon = tlink_tcon(cfile->tlink); | 1129 | struct cifs_tcon *tcon = tlink_tcon(cfile->tlink); |
| 1130 | struct file_lock *flock; | 1130 | struct file_lock *flock; |
| 1131 | struct file_lock_context *flctx = inode->i_flctx; | 1131 | struct file_lock_context *flctx = inode->i_flctx; |
| @@ -1214,7 +1214,7 @@ static int | |||
| 1214 | cifs_push_locks(struct cifsFileInfo *cfile) | 1214 | cifs_push_locks(struct cifsFileInfo *cfile) |
| 1215 | { | 1215 | { |
| 1216 | struct cifs_sb_info *cifs_sb = CIFS_SB(cfile->dentry->d_sb); | 1216 | struct cifs_sb_info *cifs_sb = CIFS_SB(cfile->dentry->d_sb); |
| 1217 | struct cifsInodeInfo *cinode = CIFS_I(cfile->dentry->d_inode); | 1217 | struct cifsInodeInfo *cinode = CIFS_I(d_inode(cfile->dentry)); |
| 1218 | struct cifs_tcon *tcon = tlink_tcon(cfile->tlink); | 1218 | struct cifs_tcon *tcon = tlink_tcon(cfile->tlink); |
| 1219 | int rc = 0; | 1219 | int rc = 0; |
| 1220 | 1220 | ||
| @@ -1382,7 +1382,7 @@ cifs_unlock_range(struct cifsFileInfo *cfile, struct file_lock *flock, | |||
| 1382 | unsigned int max_num, num, max_buf; | 1382 | unsigned int max_num, num, max_buf; |
| 1383 | LOCKING_ANDX_RANGE *buf, *cur; | 1383 | LOCKING_ANDX_RANGE *buf, *cur; |
| 1384 | struct cifs_tcon *tcon = tlink_tcon(cfile->tlink); | 1384 | struct cifs_tcon *tcon = tlink_tcon(cfile->tlink); |
| 1385 | struct cifsInodeInfo *cinode = CIFS_I(cfile->dentry->d_inode); | 1385 | struct cifsInodeInfo *cinode = CIFS_I(d_inode(cfile->dentry)); |
| 1386 | struct cifsLockInfo *li, *tmp; | 1386 | struct cifsLockInfo *li, *tmp; |
| 1387 | __u64 length = 1 + flock->fl_end - flock->fl_start; | 1387 | __u64 length = 1 + flock->fl_end - flock->fl_start; |
| 1388 | struct list_head tmp_llist; | 1388 | struct list_head tmp_llist; |
| @@ -1488,7 +1488,7 @@ cifs_setlk(struct file *file, struct file_lock *flock, __u32 type, | |||
| 1488 | struct cifsFileInfo *cfile = (struct cifsFileInfo *)file->private_data; | 1488 | struct cifsFileInfo *cfile = (struct cifsFileInfo *)file->private_data; |
| 1489 | struct cifs_tcon *tcon = tlink_tcon(cfile->tlink); | 1489 | struct cifs_tcon *tcon = tlink_tcon(cfile->tlink); |
| 1490 | struct TCP_Server_Info *server = tcon->ses->server; | 1490 | struct TCP_Server_Info *server = tcon->ses->server; |
| 1491 | struct inode *inode = cfile->dentry->d_inode; | 1491 | struct inode *inode = d_inode(cfile->dentry); |
| 1492 | 1492 | ||
| 1493 | if (posix_lck) { | 1493 | if (posix_lck) { |
| 1494 | int posix_lock_type; | 1494 | int posix_lock_type; |
| @@ -1643,7 +1643,7 @@ cifs_write(struct cifsFileInfo *open_file, __u32 pid, const char *write_data, | |||
| 1643 | struct TCP_Server_Info *server; | 1643 | struct TCP_Server_Info *server; |
| 1644 | unsigned int xid; | 1644 | unsigned int xid; |
| 1645 | struct dentry *dentry = open_file->dentry; | 1645 | struct dentry *dentry = open_file->dentry; |
| 1646 | struct cifsInodeInfo *cifsi = CIFS_I(dentry->d_inode); | 1646 | struct cifsInodeInfo *cifsi = CIFS_I(d_inode(dentry)); |
| 1647 | struct cifs_io_parms io_parms; | 1647 | struct cifs_io_parms io_parms; |
| 1648 | 1648 | ||
| 1649 | cifs_sb = CIFS_SB(dentry->d_sb); | 1649 | cifs_sb = CIFS_SB(dentry->d_sb); |
| @@ -1676,7 +1676,7 @@ cifs_write(struct cifsFileInfo *open_file, __u32 pid, const char *write_data, | |||
| 1676 | break; | 1676 | break; |
| 1677 | } | 1677 | } |
| 1678 | 1678 | ||
| 1679 | len = min(server->ops->wp_retry_size(dentry->d_inode), | 1679 | len = min(server->ops->wp_retry_size(d_inode(dentry)), |
| 1680 | (unsigned int)write_size - total_written); | 1680 | (unsigned int)write_size - total_written); |
| 1681 | /* iov[0] is reserved for smb header */ | 1681 | /* iov[0] is reserved for smb header */ |
| 1682 | iov[1].iov_base = (char *)write_data + total_written; | 1682 | iov[1].iov_base = (char *)write_data + total_written; |
| @@ -1696,9 +1696,9 @@ cifs_write(struct cifsFileInfo *open_file, __u32 pid, const char *write_data, | |||
| 1696 | return rc; | 1696 | return rc; |
| 1697 | } | 1697 | } |
| 1698 | } else { | 1698 | } else { |
| 1699 | spin_lock(&dentry->d_inode->i_lock); | 1699 | spin_lock(&d_inode(dentry)->i_lock); |
| 1700 | cifs_update_eof(cifsi, *offset, bytes_written); | 1700 | cifs_update_eof(cifsi, *offset, bytes_written); |
| 1701 | spin_unlock(&dentry->d_inode->i_lock); | 1701 | spin_unlock(&d_inode(dentry)->i_lock); |
| 1702 | *offset += bytes_written; | 1702 | *offset += bytes_written; |
| 1703 | } | 1703 | } |
| 1704 | } | 1704 | } |
| @@ -1706,12 +1706,12 @@ cifs_write(struct cifsFileInfo *open_file, __u32 pid, const char *write_data, | |||
| 1706 | cifs_stats_bytes_written(tcon, total_written); | 1706 | cifs_stats_bytes_written(tcon, total_written); |
| 1707 | 1707 | ||
| 1708 | if (total_written > 0) { | 1708 | if (total_written > 0) { |
| 1709 | spin_lock(&dentry->d_inode->i_lock); | 1709 | spin_lock(&d_inode(dentry)->i_lock); |
| 1710 | if (*offset > dentry->d_inode->i_size) | 1710 | if (*offset > d_inode(dentry)->i_size) |
| 1711 | i_size_write(dentry->d_inode, *offset); | 1711 | i_size_write(d_inode(dentry), *offset); |
| 1712 | spin_unlock(&dentry->d_inode->i_lock); | 1712 | spin_unlock(&d_inode(dentry)->i_lock); |
| 1713 | } | 1713 | } |
| 1714 | mark_inode_dirty_sync(dentry->d_inode); | 1714 | mark_inode_dirty_sync(d_inode(dentry)); |
| 1715 | free_xid(xid); | 1715 | free_xid(xid); |
| 1716 | return total_written; | 1716 | return total_written; |
| 1717 | } | 1717 | } |
| @@ -2406,7 +2406,7 @@ cifs_uncached_writev_complete(struct work_struct *work) | |||
| 2406 | { | 2406 | { |
| 2407 | struct cifs_writedata *wdata = container_of(work, | 2407 | struct cifs_writedata *wdata = container_of(work, |
| 2408 | struct cifs_writedata, work); | 2408 | struct cifs_writedata, work); |
| 2409 | struct inode *inode = wdata->cfile->dentry->d_inode; | 2409 | struct inode *inode = d_inode(wdata->cfile->dentry); |
| 2410 | struct cifsInodeInfo *cifsi = CIFS_I(inode); | 2410 | struct cifsInodeInfo *cifsi = CIFS_I(inode); |
| 2411 | 2411 | ||
| 2412 | spin_lock(&inode->i_lock); | 2412 | spin_lock(&inode->i_lock); |
| @@ -3794,7 +3794,7 @@ void cifs_oplock_break(struct work_struct *work) | |||
| 3794 | { | 3794 | { |
| 3795 | struct cifsFileInfo *cfile = container_of(work, struct cifsFileInfo, | 3795 | struct cifsFileInfo *cfile = container_of(work, struct cifsFileInfo, |
| 3796 | oplock_break); | 3796 | oplock_break); |
| 3797 | struct inode *inode = cfile->dentry->d_inode; | 3797 | struct inode *inode = d_inode(cfile->dentry); |
| 3798 | struct cifsInodeInfo *cinode = CIFS_I(inode); | 3798 | struct cifsInodeInfo *cinode = CIFS_I(inode); |
| 3799 | struct cifs_tcon *tcon = tlink_tcon(cfile->tlink); | 3799 | struct cifs_tcon *tcon = tlink_tcon(cfile->tlink); |
| 3800 | struct TCP_Server_Info *server = tcon->ses->server; | 3800 | struct TCP_Server_Info *server = tcon->ses->server; |
diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c index 3e126d7bb2ea..55b58112d122 100644 --- a/fs/cifs/inode.c +++ b/fs/cifs/inode.c | |||
| @@ -1067,7 +1067,7 @@ cifs_rename_pending_delete(const char *full_path, struct dentry *dentry, | |||
| 1067 | int rc; | 1067 | int rc; |
| 1068 | struct cifs_fid fid; | 1068 | struct cifs_fid fid; |
| 1069 | struct cifs_open_parms oparms; | 1069 | struct cifs_open_parms oparms; |
| 1070 | struct inode *inode = dentry->d_inode; | 1070 | struct inode *inode = d_inode(dentry); |
| 1071 | struct cifsInodeInfo *cifsInode = CIFS_I(inode); | 1071 | struct cifsInodeInfo *cifsInode = CIFS_I(inode); |
| 1072 | struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb); | 1072 | struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb); |
| 1073 | struct tcon_link *tlink; | 1073 | struct tcon_link *tlink; |
| @@ -1196,7 +1196,7 @@ cifs_drop_nlink(struct inode *inode) | |||
| 1196 | } | 1196 | } |
| 1197 | 1197 | ||
| 1198 | /* | 1198 | /* |
| 1199 | * If dentry->d_inode is null (usually meaning the cached dentry | 1199 | * If d_inode(dentry) is null (usually meaning the cached dentry |
| 1200 | * is a negative dentry) then we would attempt a standard SMB delete, but | 1200 | * is a negative dentry) then we would attempt a standard SMB delete, but |
| 1201 | * if that fails we can not attempt the fall back mechanisms on EACCESS | 1201 | * if that fails we can not attempt the fall back mechanisms on EACCESS |
| 1202 | * but will return the EACCESS to the caller. Note that the VFS does not call | 1202 | * but will return the EACCESS to the caller. Note that the VFS does not call |
| @@ -1207,7 +1207,7 @@ int cifs_unlink(struct inode *dir, struct dentry *dentry) | |||
| 1207 | int rc = 0; | 1207 | int rc = 0; |
| 1208 | unsigned int xid; | 1208 | unsigned int xid; |
| 1209 | char *full_path = NULL; | 1209 | char *full_path = NULL; |
| 1210 | struct inode *inode = dentry->d_inode; | 1210 | struct inode *inode = d_inode(dentry); |
| 1211 | struct cifsInodeInfo *cifs_inode; | 1211 | struct cifsInodeInfo *cifs_inode; |
| 1212 | struct super_block *sb = dir->i_sb; | 1212 | struct super_block *sb = dir->i_sb; |
| 1213 | struct cifs_sb_info *cifs_sb = CIFS_SB(sb); | 1213 | struct cifs_sb_info *cifs_sb = CIFS_SB(sb); |
| @@ -1551,13 +1551,13 @@ int cifs_rmdir(struct inode *inode, struct dentry *direntry) | |||
| 1551 | cifs_put_tlink(tlink); | 1551 | cifs_put_tlink(tlink); |
| 1552 | 1552 | ||
| 1553 | if (!rc) { | 1553 | if (!rc) { |
| 1554 | spin_lock(&direntry->d_inode->i_lock); | 1554 | spin_lock(&d_inode(direntry)->i_lock); |
| 1555 | i_size_write(direntry->d_inode, 0); | 1555 | i_size_write(d_inode(direntry), 0); |
| 1556 | clear_nlink(direntry->d_inode); | 1556 | clear_nlink(d_inode(direntry)); |
| 1557 | spin_unlock(&direntry->d_inode->i_lock); | 1557 | spin_unlock(&d_inode(direntry)->i_lock); |
| 1558 | } | 1558 | } |
| 1559 | 1559 | ||
| 1560 | cifsInode = CIFS_I(direntry->d_inode); | 1560 | cifsInode = CIFS_I(d_inode(direntry)); |
| 1561 | /* force revalidate to go get info when needed */ | 1561 | /* force revalidate to go get info when needed */ |
| 1562 | cifsInode->time = 0; | 1562 | cifsInode->time = 0; |
| 1563 | 1563 | ||
| @@ -1568,7 +1568,7 @@ int cifs_rmdir(struct inode *inode, struct dentry *direntry) | |||
| 1568 | */ | 1568 | */ |
| 1569 | cifsInode->time = 0; | 1569 | cifsInode->time = 0; |
| 1570 | 1570 | ||
| 1571 | direntry->d_inode->i_ctime = inode->i_ctime = inode->i_mtime = | 1571 | d_inode(direntry)->i_ctime = inode->i_ctime = inode->i_mtime = |
| 1572 | current_fs_time(inode->i_sb); | 1572 | current_fs_time(inode->i_sb); |
| 1573 | 1573 | ||
| 1574 | rmdir_exit: | 1574 | rmdir_exit: |
| @@ -1727,7 +1727,7 @@ cifs_rename2(struct inode *source_dir, struct dentry *source_dentry, | |||
| 1727 | 1727 | ||
| 1728 | unlink_target: | 1728 | unlink_target: |
| 1729 | /* Try unlinking the target dentry if it's not negative */ | 1729 | /* Try unlinking the target dentry if it's not negative */ |
| 1730 | if (target_dentry->d_inode && (rc == -EACCES || rc == -EEXIST)) { | 1730 | if (d_really_is_positive(target_dentry) && (rc == -EACCES || rc == -EEXIST)) { |
| 1731 | if (d_is_dir(target_dentry)) | 1731 | if (d_is_dir(target_dentry)) |
| 1732 | tmprc = cifs_rmdir(target_dir, target_dentry); | 1732 | tmprc = cifs_rmdir(target_dir, target_dentry); |
| 1733 | else | 1733 | else |
| @@ -1867,7 +1867,7 @@ int cifs_revalidate_dentry_attr(struct dentry *dentry) | |||
| 1867 | { | 1867 | { |
| 1868 | unsigned int xid; | 1868 | unsigned int xid; |
| 1869 | int rc = 0; | 1869 | int rc = 0; |
| 1870 | struct inode *inode = dentry->d_inode; | 1870 | struct inode *inode = d_inode(dentry); |
| 1871 | struct super_block *sb = dentry->d_sb; | 1871 | struct super_block *sb = dentry->d_sb; |
| 1872 | char *full_path = NULL; | 1872 | char *full_path = NULL; |
| 1873 | 1873 | ||
| @@ -1919,7 +1919,7 @@ int cifs_revalidate_file(struct file *filp) | |||
| 1919 | int cifs_revalidate_dentry(struct dentry *dentry) | 1919 | int cifs_revalidate_dentry(struct dentry *dentry) |
| 1920 | { | 1920 | { |
| 1921 | int rc; | 1921 | int rc; |
| 1922 | struct inode *inode = dentry->d_inode; | 1922 | struct inode *inode = d_inode(dentry); |
| 1923 | 1923 | ||
| 1924 | rc = cifs_revalidate_dentry_attr(dentry); | 1924 | rc = cifs_revalidate_dentry_attr(dentry); |
| 1925 | if (rc) | 1925 | if (rc) |
| @@ -1933,7 +1933,7 @@ int cifs_getattr(struct vfsmount *mnt, struct dentry *dentry, | |||
| 1933 | { | 1933 | { |
| 1934 | struct cifs_sb_info *cifs_sb = CIFS_SB(dentry->d_sb); | 1934 | struct cifs_sb_info *cifs_sb = CIFS_SB(dentry->d_sb); |
| 1935 | struct cifs_tcon *tcon = cifs_sb_master_tcon(cifs_sb); | 1935 | struct cifs_tcon *tcon = cifs_sb_master_tcon(cifs_sb); |
| 1936 | struct inode *inode = dentry->d_inode; | 1936 | struct inode *inode = d_inode(dentry); |
| 1937 | int rc; | 1937 | int rc; |
| 1938 | 1938 | ||
| 1939 | /* | 1939 | /* |
| @@ -2110,7 +2110,7 @@ cifs_setattr_unix(struct dentry *direntry, struct iattr *attrs) | |||
| 2110 | int rc; | 2110 | int rc; |
| 2111 | unsigned int xid; | 2111 | unsigned int xid; |
| 2112 | char *full_path = NULL; | 2112 | char *full_path = NULL; |
| 2113 | struct inode *inode = direntry->d_inode; | 2113 | struct inode *inode = d_inode(direntry); |
| 2114 | struct cifsInodeInfo *cifsInode = CIFS_I(inode); | 2114 | struct cifsInodeInfo *cifsInode = CIFS_I(inode); |
| 2115 | struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb); | 2115 | struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb); |
| 2116 | struct tcon_link *tlink; | 2116 | struct tcon_link *tlink; |
| @@ -2251,7 +2251,7 @@ cifs_setattr_nounix(struct dentry *direntry, struct iattr *attrs) | |||
| 2251 | unsigned int xid; | 2251 | unsigned int xid; |
| 2252 | kuid_t uid = INVALID_UID; | 2252 | kuid_t uid = INVALID_UID; |
| 2253 | kgid_t gid = INVALID_GID; | 2253 | kgid_t gid = INVALID_GID; |
| 2254 | struct inode *inode = direntry->d_inode; | 2254 | struct inode *inode = d_inode(direntry); |
| 2255 | struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb); | 2255 | struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb); |
| 2256 | struct cifsInodeInfo *cifsInode = CIFS_I(inode); | 2256 | struct cifsInodeInfo *cifsInode = CIFS_I(inode); |
| 2257 | char *full_path = NULL; | 2257 | char *full_path = NULL; |
| @@ -2409,7 +2409,7 @@ cifs_setattr_exit: | |||
| 2409 | int | 2409 | int |
| 2410 | cifs_setattr(struct dentry *direntry, struct iattr *attrs) | 2410 | cifs_setattr(struct dentry *direntry, struct iattr *attrs) |
| 2411 | { | 2411 | { |
| 2412 | struct inode *inode = direntry->d_inode; | 2412 | struct inode *inode = d_inode(direntry); |
| 2413 | struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb); | 2413 | struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb); |
| 2414 | struct cifs_tcon *pTcon = cifs_sb_master_tcon(cifs_sb); | 2414 | struct cifs_tcon *pTcon = cifs_sb_master_tcon(cifs_sb); |
| 2415 | 2415 | ||
diff --git a/fs/cifs/link.c b/fs/cifs/link.c index 2ec6037f61c7..252e672d5604 100644 --- a/fs/cifs/link.c +++ b/fs/cifs/link.c | |||
| @@ -586,12 +586,12 @@ cifs_hardlink(struct dentry *old_file, struct inode *inode, | |||
| 586 | * if source file is cached (oplocked) revalidate will not go to server | 586 | * if source file is cached (oplocked) revalidate will not go to server |
| 587 | * until the file is closed or oplock broken so update nlinks locally | 587 | * until the file is closed or oplock broken so update nlinks locally |
| 588 | */ | 588 | */ |
| 589 | if (old_file->d_inode) { | 589 | if (d_really_is_positive(old_file)) { |
| 590 | cifsInode = CIFS_I(old_file->d_inode); | 590 | cifsInode = CIFS_I(d_inode(old_file)); |
| 591 | if (rc == 0) { | 591 | if (rc == 0) { |
| 592 | spin_lock(&old_file->d_inode->i_lock); | 592 | spin_lock(&d_inode(old_file)->i_lock); |
| 593 | inc_nlink(old_file->d_inode); | 593 | inc_nlink(d_inode(old_file)); |
| 594 | spin_unlock(&old_file->d_inode->i_lock); | 594 | spin_unlock(&d_inode(old_file)->i_lock); |
| 595 | 595 | ||
| 596 | /* | 596 | /* |
| 597 | * parent dir timestamps will update from srv within a | 597 | * parent dir timestamps will update from srv within a |
| @@ -629,7 +629,7 @@ cifs_hl_exit: | |||
| 629 | void * | 629 | void * |
| 630 | cifs_follow_link(struct dentry *direntry, struct nameidata *nd) | 630 | cifs_follow_link(struct dentry *direntry, struct nameidata *nd) |
| 631 | { | 631 | { |
| 632 | struct inode *inode = direntry->d_inode; | 632 | struct inode *inode = d_inode(direntry); |
| 633 | int rc = -ENOMEM; | 633 | int rc = -ENOMEM; |
| 634 | unsigned int xid; | 634 | unsigned int xid; |
| 635 | char *full_path = NULL; | 635 | char *full_path = NULL; |
diff --git a/fs/cifs/misc.c b/fs/cifs/misc.c index 337946355b29..8442b8b8e0be 100644 --- a/fs/cifs/misc.c +++ b/fs/cifs/misc.c | |||
| @@ -473,7 +473,7 @@ is_valid_oplock_break(char *buffer, struct TCP_Server_Info *srv) | |||
| 473 | continue; | 473 | continue; |
| 474 | 474 | ||
| 475 | cifs_dbg(FYI, "file id match, oplock break\n"); | 475 | cifs_dbg(FYI, "file id match, oplock break\n"); |
| 476 | pCifsInode = CIFS_I(netfile->dentry->d_inode); | 476 | pCifsInode = CIFS_I(d_inode(netfile->dentry)); |
| 477 | 477 | ||
| 478 | set_bit(CIFS_INODE_PENDING_OPLOCK_BREAK, | 478 | set_bit(CIFS_INODE_PENDING_OPLOCK_BREAK, |
| 479 | &pCifsInode->flags); | 479 | &pCifsInode->flags); |
diff --git a/fs/cifs/readdir.c b/fs/cifs/readdir.c index c295338e0a98..b4a47237486b 100644 --- a/fs/cifs/readdir.c +++ b/fs/cifs/readdir.c | |||
| @@ -78,7 +78,7 @@ cifs_prime_dcache(struct dentry *parent, struct qstr *name, | |||
| 78 | { | 78 | { |
| 79 | struct dentry *dentry, *alias; | 79 | struct dentry *dentry, *alias; |
| 80 | struct inode *inode; | 80 | struct inode *inode; |
| 81 | struct super_block *sb = parent->d_inode->i_sb; | 81 | struct super_block *sb = d_inode(parent)->i_sb; |
| 82 | struct cifs_sb_info *cifs_sb = CIFS_SB(sb); | 82 | struct cifs_sb_info *cifs_sb = CIFS_SB(sb); |
| 83 | 83 | ||
| 84 | cifs_dbg(FYI, "%s: for %s\n", __func__, name->name); | 84 | cifs_dbg(FYI, "%s: for %s\n", __func__, name->name); |
| @@ -88,7 +88,7 @@ cifs_prime_dcache(struct dentry *parent, struct qstr *name, | |||
| 88 | return; | 88 | return; |
| 89 | 89 | ||
| 90 | if (dentry) { | 90 | if (dentry) { |
| 91 | inode = dentry->d_inode; | 91 | inode = d_inode(dentry); |
| 92 | if (inode) { | 92 | if (inode) { |
| 93 | /* | 93 | /* |
| 94 | * If we're generating inode numbers, then we don't | 94 | * If we're generating inode numbers, then we don't |
diff --git a/fs/cifs/smb1ops.c b/fs/cifs/smb1ops.c index d2979036a4c7..7bfdd6066276 100644 --- a/fs/cifs/smb1ops.c +++ b/fs/cifs/smb1ops.c | |||
| @@ -722,7 +722,7 @@ cifs_open_file(const unsigned int xid, struct cifs_open_parms *oparms, | |||
| 722 | static void | 722 | static void |
| 723 | cifs_set_fid(struct cifsFileInfo *cfile, struct cifs_fid *fid, __u32 oplock) | 723 | cifs_set_fid(struct cifsFileInfo *cfile, struct cifs_fid *fid, __u32 oplock) |
| 724 | { | 724 | { |
| 725 | struct cifsInodeInfo *cinode = CIFS_I(cfile->dentry->d_inode); | 725 | struct cifsInodeInfo *cinode = CIFS_I(d_inode(cfile->dentry)); |
| 726 | cfile->fid.netfid = fid->netfid; | 726 | cfile->fid.netfid = fid->netfid; |
| 727 | cifs_set_oplock_level(cinode, oplock); | 727 | cifs_set_oplock_level(cinode, oplock); |
| 728 | cinode->can_cache_brlcks = CIFS_CACHE_WRITE(cinode); | 728 | cinode->can_cache_brlcks = CIFS_CACHE_WRITE(cinode); |
diff --git a/fs/cifs/smb2file.c b/fs/cifs/smb2file.c index 7198eac5dddd..2ab297dae5a7 100644 --- a/fs/cifs/smb2file.c +++ b/fs/cifs/smb2file.c | |||
| @@ -95,7 +95,7 @@ smb2_unlock_range(struct cifsFileInfo *cfile, struct file_lock *flock, | |||
| 95 | unsigned int max_num, num = 0, max_buf; | 95 | unsigned int max_num, num = 0, max_buf; |
| 96 | struct smb2_lock_element *buf, *cur; | 96 | struct smb2_lock_element *buf, *cur; |
| 97 | struct cifs_tcon *tcon = tlink_tcon(cfile->tlink); | 97 | struct cifs_tcon *tcon = tlink_tcon(cfile->tlink); |
| 98 | struct cifsInodeInfo *cinode = CIFS_I(cfile->dentry->d_inode); | 98 | struct cifsInodeInfo *cinode = CIFS_I(d_inode(cfile->dentry)); |
| 99 | struct cifsLockInfo *li, *tmp; | 99 | struct cifsLockInfo *li, *tmp; |
| 100 | __u64 length = 1 + flock->fl_end - flock->fl_start; | 100 | __u64 length = 1 + flock->fl_end - flock->fl_start; |
| 101 | struct list_head tmp_llist; | 101 | struct list_head tmp_llist; |
| @@ -231,7 +231,7 @@ smb2_push_mandatory_locks(struct cifsFileInfo *cfile) | |||
| 231 | unsigned int xid; | 231 | unsigned int xid; |
| 232 | unsigned int max_num, max_buf; | 232 | unsigned int max_num, max_buf; |
| 233 | struct smb2_lock_element *buf; | 233 | struct smb2_lock_element *buf; |
| 234 | struct cifsInodeInfo *cinode = CIFS_I(cfile->dentry->d_inode); | 234 | struct cifsInodeInfo *cinode = CIFS_I(d_inode(cfile->dentry)); |
| 235 | struct cifs_fid_locks *fdlocks; | 235 | struct cifs_fid_locks *fdlocks; |
| 236 | 236 | ||
| 237 | xid = get_xid(); | 237 | xid = get_xid(); |
diff --git a/fs/cifs/smb2misc.c b/fs/cifs/smb2misc.c index 22dfdf17d065..1c5907019045 100644 --- a/fs/cifs/smb2misc.c +++ b/fs/cifs/smb2misc.c | |||
| @@ -453,7 +453,7 @@ smb2_tcon_has_lease(struct cifs_tcon *tcon, struct smb2_lease_break *rsp, | |||
| 453 | 453 | ||
| 454 | list_for_each(tmp, &tcon->openFileList) { | 454 | list_for_each(tmp, &tcon->openFileList) { |
| 455 | cfile = list_entry(tmp, struct cifsFileInfo, tlist); | 455 | cfile = list_entry(tmp, struct cifsFileInfo, tlist); |
| 456 | cinode = CIFS_I(cfile->dentry->d_inode); | 456 | cinode = CIFS_I(d_inode(cfile->dentry)); |
| 457 | 457 | ||
| 458 | if (memcmp(cinode->lease_key, rsp->LeaseKey, | 458 | if (memcmp(cinode->lease_key, rsp->LeaseKey, |
| 459 | SMB2_LEASE_KEY_SIZE)) | 459 | SMB2_LEASE_KEY_SIZE)) |
| @@ -590,7 +590,7 @@ smb2_is_valid_oplock_break(char *buffer, struct TCP_Server_Info *server) | |||
| 590 | continue; | 590 | continue; |
| 591 | 591 | ||
| 592 | cifs_dbg(FYI, "file id match, oplock break\n"); | 592 | cifs_dbg(FYI, "file id match, oplock break\n"); |
| 593 | cinode = CIFS_I(cfile->dentry->d_inode); | 593 | cinode = CIFS_I(d_inode(cfile->dentry)); |
| 594 | 594 | ||
| 595 | if (!CIFS_CACHE_WRITE(cinode) && | 595 | if (!CIFS_CACHE_WRITE(cinode) && |
| 596 | rsp->OplockLevel == SMB2_OPLOCK_LEVEL_NONE) | 596 | rsp->OplockLevel == SMB2_OPLOCK_LEVEL_NONE) |
diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c index eab05e1aa587..54daee5ad4c1 100644 --- a/fs/cifs/smb2ops.c +++ b/fs/cifs/smb2ops.c | |||
| @@ -524,7 +524,7 @@ smb2_print_stats(struct seq_file *m, struct cifs_tcon *tcon) | |||
| 524 | static void | 524 | static void |
| 525 | smb2_set_fid(struct cifsFileInfo *cfile, struct cifs_fid *fid, __u32 oplock) | 525 | smb2_set_fid(struct cifsFileInfo *cfile, struct cifs_fid *fid, __u32 oplock) |
| 526 | { | 526 | { |
| 527 | struct cifsInodeInfo *cinode = CIFS_I(cfile->dentry->d_inode); | 527 | struct cifsInodeInfo *cinode = CIFS_I(d_inode(cfile->dentry)); |
| 528 | struct TCP_Server_Info *server = tlink_tcon(cfile->tlink)->ses->server; | 528 | struct TCP_Server_Info *server = tlink_tcon(cfile->tlink)->ses->server; |
| 529 | 529 | ||
| 530 | cfile->fid.persistent_fid = fid->persistent_fid; | 530 | cfile->fid.persistent_fid = fid->persistent_fid; |
| @@ -793,7 +793,7 @@ smb2_set_file_size(const unsigned int xid, struct cifs_tcon *tcon, | |||
| 793 | * If extending file more than one page make sparse. Many Linux fs | 793 | * If extending file more than one page make sparse. Many Linux fs |
| 794 | * make files sparse by default when extending via ftruncate | 794 | * make files sparse by default when extending via ftruncate |
| 795 | */ | 795 | */ |
| 796 | inode = cfile->dentry->d_inode; | 796 | inode = d_inode(cfile->dentry); |
| 797 | 797 | ||
| 798 | if (!set_alloc && (size > inode->i_size + 8192)) { | 798 | if (!set_alloc && (size > inode->i_size + 8192)) { |
| 799 | __u8 set_sparse = 1; | 799 | __u8 set_sparse = 1; |
| @@ -1032,7 +1032,7 @@ static long smb3_zero_range(struct file *file, struct cifs_tcon *tcon, | |||
| 1032 | 1032 | ||
| 1033 | xid = get_xid(); | 1033 | xid = get_xid(); |
| 1034 | 1034 | ||
| 1035 | inode = cfile->dentry->d_inode; | 1035 | inode = d_inode(cfile->dentry); |
| 1036 | cifsi = CIFS_I(inode); | 1036 | cifsi = CIFS_I(inode); |
| 1037 | 1037 | ||
| 1038 | /* if file not oplocked can't be sure whether asking to extend size */ | 1038 | /* if file not oplocked can't be sure whether asking to extend size */ |
| @@ -1083,7 +1083,7 @@ static long smb3_punch_hole(struct file *file, struct cifs_tcon *tcon, | |||
| 1083 | 1083 | ||
| 1084 | xid = get_xid(); | 1084 | xid = get_xid(); |
| 1085 | 1085 | ||
| 1086 | inode = cfile->dentry->d_inode; | 1086 | inode = d_inode(cfile->dentry); |
| 1087 | cifsi = CIFS_I(inode); | 1087 | cifsi = CIFS_I(inode); |
| 1088 | 1088 | ||
| 1089 | /* Need to make file sparse, if not already, before freeing range. */ | 1089 | /* Need to make file sparse, if not already, before freeing range. */ |
| @@ -1115,7 +1115,7 @@ static long smb3_simple_falloc(struct file *file, struct cifs_tcon *tcon, | |||
| 1115 | 1115 | ||
| 1116 | xid = get_xid(); | 1116 | xid = get_xid(); |
| 1117 | 1117 | ||
| 1118 | inode = cfile->dentry->d_inode; | 1118 | inode = d_inode(cfile->dentry); |
| 1119 | cifsi = CIFS_I(inode); | 1119 | cifsi = CIFS_I(inode); |
| 1120 | 1120 | ||
| 1121 | /* if file not oplocked can't be sure whether asking to extend size */ | 1121 | /* if file not oplocked can't be sure whether asking to extend size */ |
diff --git a/fs/cifs/xattr.c b/fs/cifs/xattr.c index 72a4d10653d6..ff9e1f8b16a4 100644 --- a/fs/cifs/xattr.c +++ b/fs/cifs/xattr.c | |||
| @@ -50,9 +50,9 @@ int cifs_removexattr(struct dentry *direntry, const char *ea_name) | |||
| 50 | 50 | ||
| 51 | if (direntry == NULL) | 51 | if (direntry == NULL) |
| 52 | return -EIO; | 52 | return -EIO; |
| 53 | if (direntry->d_inode == NULL) | 53 | if (d_really_is_negative(direntry)) |
| 54 | return -EIO; | 54 | return -EIO; |
| 55 | sb = direntry->d_inode->i_sb; | 55 | sb = d_inode(direntry)->i_sb; |
| 56 | if (sb == NULL) | 56 | if (sb == NULL) |
| 57 | return -EIO; | 57 | return -EIO; |
| 58 | 58 | ||
| @@ -111,9 +111,9 @@ int cifs_setxattr(struct dentry *direntry, const char *ea_name, | |||
| 111 | 111 | ||
| 112 | if (direntry == NULL) | 112 | if (direntry == NULL) |
| 113 | return -EIO; | 113 | return -EIO; |
| 114 | if (direntry->d_inode == NULL) | 114 | if (d_really_is_negative(direntry)) |
| 115 | return -EIO; | 115 | return -EIO; |
| 116 | sb = direntry->d_inode->i_sb; | 116 | sb = d_inode(direntry)->i_sb; |
| 117 | if (sb == NULL) | 117 | if (sb == NULL) |
| 118 | return -EIO; | 118 | return -EIO; |
| 119 | 119 | ||
| @@ -177,12 +177,12 @@ int cifs_setxattr(struct dentry *direntry, const char *ea_name, | |||
| 177 | memcpy(pacl, ea_value, value_size); | 177 | memcpy(pacl, ea_value, value_size); |
| 178 | if (pTcon->ses->server->ops->set_acl) | 178 | if (pTcon->ses->server->ops->set_acl) |
| 179 | rc = pTcon->ses->server->ops->set_acl(pacl, | 179 | rc = pTcon->ses->server->ops->set_acl(pacl, |
| 180 | value_size, direntry->d_inode, | 180 | value_size, d_inode(direntry), |
| 181 | full_path, CIFS_ACL_DACL); | 181 | full_path, CIFS_ACL_DACL); |
| 182 | else | 182 | else |
| 183 | rc = -EOPNOTSUPP; | 183 | rc = -EOPNOTSUPP; |
| 184 | if (rc == 0) /* force revalidate of the inode */ | 184 | if (rc == 0) /* force revalidate of the inode */ |
| 185 | CIFS_I(direntry->d_inode)->time = 0; | 185 | CIFS_I(d_inode(direntry))->time = 0; |
| 186 | kfree(pacl); | 186 | kfree(pacl); |
| 187 | } | 187 | } |
| 188 | #else | 188 | #else |
| @@ -246,9 +246,9 @@ ssize_t cifs_getxattr(struct dentry *direntry, const char *ea_name, | |||
| 246 | 246 | ||
| 247 | if (direntry == NULL) | 247 | if (direntry == NULL) |
| 248 | return -EIO; | 248 | return -EIO; |
| 249 | if (direntry->d_inode == NULL) | 249 | if (d_really_is_negative(direntry)) |
| 250 | return -EIO; | 250 | return -EIO; |
| 251 | sb = direntry->d_inode->i_sb; | 251 | sb = d_inode(direntry)->i_sb; |
| 252 | if (sb == NULL) | 252 | if (sb == NULL) |
| 253 | return -EIO; | 253 | return -EIO; |
| 254 | 254 | ||
| @@ -324,7 +324,7 @@ ssize_t cifs_getxattr(struct dentry *direntry, const char *ea_name, | |||
| 324 | goto get_ea_exit; /* rc already EOPNOTSUPP */ | 324 | goto get_ea_exit; /* rc already EOPNOTSUPP */ |
| 325 | 325 | ||
| 326 | pacl = pTcon->ses->server->ops->get_acl(cifs_sb, | 326 | pacl = pTcon->ses->server->ops->get_acl(cifs_sb, |
| 327 | direntry->d_inode, full_path, &acllen); | 327 | d_inode(direntry), full_path, &acllen); |
| 328 | if (IS_ERR(pacl)) { | 328 | if (IS_ERR(pacl)) { |
| 329 | rc = PTR_ERR(pacl); | 329 | rc = PTR_ERR(pacl); |
| 330 | cifs_dbg(VFS, "%s: error %zd getting sec desc\n", | 330 | cifs_dbg(VFS, "%s: error %zd getting sec desc\n", |
| @@ -382,9 +382,9 @@ ssize_t cifs_listxattr(struct dentry *direntry, char *data, size_t buf_size) | |||
| 382 | 382 | ||
| 383 | if (direntry == NULL) | 383 | if (direntry == NULL) |
| 384 | return -EIO; | 384 | return -EIO; |
| 385 | if (direntry->d_inode == NULL) | 385 | if (d_really_is_negative(direntry)) |
| 386 | return -EIO; | 386 | return -EIO; |
| 387 | sb = direntry->d_inode->i_sb; | 387 | sb = d_inode(direntry)->i_sb; |
| 388 | if (sb == NULL) | 388 | if (sb == NULL) |
| 389 | return -EIO; | 389 | return -EIO; |
| 390 | 390 | ||
diff --git a/fs/coda/cache.c b/fs/coda/cache.c index 46ee6f238985..5bb630a769e0 100644 --- a/fs/coda/cache.c +++ b/fs/coda/cache.c | |||
| @@ -94,8 +94,8 @@ static void coda_flag_children(struct dentry *parent, int flag) | |||
| 94 | spin_lock(&parent->d_lock); | 94 | spin_lock(&parent->d_lock); |
| 95 | list_for_each_entry(de, &parent->d_subdirs, 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 (d_inode(de) ) |
| 98 | coda_flag_inode(de->d_inode, flag); | 98 | coda_flag_inode(d_inode(de), flag); |
| 99 | } | 99 | } |
| 100 | spin_unlock(&parent->d_lock); | 100 | spin_unlock(&parent->d_lock); |
| 101 | return; | 101 | return; |
diff --git a/fs/coda/dir.c b/fs/coda/dir.c index 60cb88c1dd2b..fda9f4311212 100644 --- a/fs/coda/dir.c +++ b/fs/coda/dir.c | |||
| @@ -201,7 +201,7 @@ err_out: | |||
| 201 | static int coda_link(struct dentry *source_de, struct inode *dir_inode, | 201 | static int coda_link(struct dentry *source_de, struct inode *dir_inode, |
| 202 | struct dentry *de) | 202 | struct dentry *de) |
| 203 | { | 203 | { |
| 204 | struct inode *inode = source_de->d_inode; | 204 | struct inode *inode = d_inode(source_de); |
| 205 | const char * name = de->d_name.name; | 205 | const char * name = de->d_name.name; |
| 206 | int len = de->d_name.len; | 206 | int len = de->d_name.len; |
| 207 | int error; | 207 | int error; |
| @@ -266,7 +266,7 @@ static int coda_unlink(struct inode *dir, struct dentry *de) | |||
| 266 | return error; | 266 | return error; |
| 267 | 267 | ||
| 268 | coda_dir_update_mtime(dir); | 268 | coda_dir_update_mtime(dir); |
| 269 | drop_nlink(de->d_inode); | 269 | drop_nlink(d_inode(de)); |
| 270 | return 0; | 270 | return 0; |
| 271 | } | 271 | } |
| 272 | 272 | ||
| @@ -279,8 +279,8 @@ static int coda_rmdir(struct inode *dir, struct dentry *de) | |||
| 279 | error = venus_rmdir(dir->i_sb, coda_i2f(dir), name, len); | 279 | error = venus_rmdir(dir->i_sb, coda_i2f(dir), name, len); |
| 280 | if (!error) { | 280 | if (!error) { |
| 281 | /* VFS may delete the child */ | 281 | /* VFS may delete the child */ |
| 282 | if (de->d_inode) | 282 | if (d_really_is_positive(de)) |
| 283 | clear_nlink(de->d_inode); | 283 | clear_nlink(d_inode(de)); |
| 284 | 284 | ||
| 285 | /* fix the link count of the parent */ | 285 | /* fix the link count of the parent */ |
| 286 | coda_dir_drop_nlink(dir); | 286 | coda_dir_drop_nlink(dir); |
| @@ -303,14 +303,14 @@ static int coda_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
| 303 | coda_i2f(new_dir), old_length, new_length, | 303 | coda_i2f(new_dir), old_length, new_length, |
| 304 | (const char *) old_name, (const char *)new_name); | 304 | (const char *) old_name, (const char *)new_name); |
| 305 | if (!error) { | 305 | if (!error) { |
| 306 | if (new_dentry->d_inode) { | 306 | if (d_really_is_positive(new_dentry)) { |
| 307 | if (d_is_dir(new_dentry)) { | 307 | if (d_is_dir(new_dentry)) { |
| 308 | coda_dir_drop_nlink(old_dir); | 308 | coda_dir_drop_nlink(old_dir); |
| 309 | coda_dir_inc_nlink(new_dir); | 309 | coda_dir_inc_nlink(new_dir); |
| 310 | } | 310 | } |
| 311 | coda_dir_update_mtime(old_dir); | 311 | coda_dir_update_mtime(old_dir); |
| 312 | coda_dir_update_mtime(new_dir); | 312 | coda_dir_update_mtime(new_dir); |
| 313 | coda_flag_inode(new_dentry->d_inode, C_VATTR); | 313 | coda_flag_inode(d_inode(new_dentry), C_VATTR); |
| 314 | } else { | 314 | } else { |
| 315 | coda_flag_inode(old_dir, C_VATTR); | 315 | coda_flag_inode(old_dir, C_VATTR); |
| 316 | coda_flag_inode(new_dir, C_VATTR); | 316 | coda_flag_inode(new_dir, C_VATTR); |
| @@ -449,13 +449,13 @@ static int coda_dentry_revalidate(struct dentry *de, unsigned int flags) | |||
| 449 | if (flags & LOOKUP_RCU) | 449 | if (flags & LOOKUP_RCU) |
| 450 | return -ECHILD; | 450 | return -ECHILD; |
| 451 | 451 | ||
| 452 | inode = de->d_inode; | 452 | inode = d_inode(de); |
| 453 | if (!inode || is_root_inode(inode)) | 453 | if (!inode || is_root_inode(inode)) |
| 454 | goto out; | 454 | goto out; |
| 455 | if (is_bad_inode(inode)) | 455 | if (is_bad_inode(inode)) |
| 456 | goto bad; | 456 | goto bad; |
| 457 | 457 | ||
| 458 | cii = ITOC(de->d_inode); | 458 | cii = ITOC(d_inode(de)); |
| 459 | if (!(cii->c_flags & (C_PURGE | C_FLUSH))) | 459 | if (!(cii->c_flags & (C_PURGE | C_FLUSH))) |
| 460 | goto out; | 460 | goto out; |
| 461 | 461 | ||
| @@ -487,11 +487,11 @@ static int coda_dentry_delete(const struct dentry * dentry) | |||
| 487 | { | 487 | { |
| 488 | int flags; | 488 | int flags; |
| 489 | 489 | ||
| 490 | if (!dentry->d_inode) | 490 | if (d_really_is_negative(dentry)) |
| 491 | return 0; | 491 | return 0; |
| 492 | 492 | ||
| 493 | flags = (ITOC(dentry->d_inode)->c_flags) & C_PURGE; | 493 | flags = (ITOC(d_inode(dentry))->c_flags) & C_PURGE; |
| 494 | if (is_bad_inode(dentry->d_inode) || flags) { | 494 | if (is_bad_inode(d_inode(dentry)) || flags) { |
| 495 | return 1; | 495 | return 1; |
| 496 | } | 496 | } |
| 497 | return 0; | 497 | return 0; |
diff --git a/fs/coda/inode.c b/fs/coda/inode.c index 82ec68b59208..cac1390b87a3 100644 --- a/fs/coda/inode.c +++ b/fs/coda/inode.c | |||
| @@ -257,15 +257,15 @@ static void coda_evict_inode(struct inode *inode) | |||
| 257 | 257 | ||
| 258 | int coda_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat) | 258 | int coda_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat) |
| 259 | { | 259 | { |
| 260 | int err = coda_revalidate_inode(dentry->d_inode); | 260 | int err = coda_revalidate_inode(d_inode(dentry)); |
| 261 | if (!err) | 261 | if (!err) |
| 262 | generic_fillattr(dentry->d_inode, stat); | 262 | generic_fillattr(d_inode(dentry), stat); |
| 263 | return err; | 263 | return err; |
| 264 | } | 264 | } |
| 265 | 265 | ||
| 266 | int coda_setattr(struct dentry *de, struct iattr *iattr) | 266 | int coda_setattr(struct dentry *de, struct iattr *iattr) |
| 267 | { | 267 | { |
| 268 | struct inode *inode = de->d_inode; | 268 | struct inode *inode = d_inode(de); |
| 269 | struct coda_vattr vattr; | 269 | struct coda_vattr vattr; |
| 270 | int error; | 270 | int error; |
| 271 | 271 | ||
diff --git a/fs/coda/pioctl.c b/fs/coda/pioctl.c index 4326d172fc27..f36a4040afb8 100644 --- a/fs/coda/pioctl.c +++ b/fs/coda/pioctl.c | |||
| @@ -72,7 +72,7 @@ static long coda_pioctl(struct file *filp, unsigned int cmd, | |||
| 72 | if (error) | 72 | if (error) |
| 73 | return error; | 73 | return error; |
| 74 | 74 | ||
| 75 | target_inode = path.dentry->d_inode; | 75 | target_inode = d_inode(path.dentry); |
| 76 | 76 | ||
| 77 | /* return if it is not a Coda inode */ | 77 | /* return if it is not a Coda inode */ |
| 78 | if (target_inode->i_sb != inode->i_sb) { | 78 | if (target_inode->i_sb != inode->i_sb) { |
diff --git a/fs/coda/upcall.c b/fs/coda/upcall.c index 5bb6e27298a4..9b1ffaa0572e 100644 --- a/fs/coda/upcall.c +++ b/fs/coda/upcall.c | |||
| @@ -820,8 +820,8 @@ int coda_downcall(struct venus_comm *vcp, int opcode, union outputArgs *out) | |||
| 820 | case CODA_FLUSH: | 820 | case CODA_FLUSH: |
| 821 | coda_cache_clear_all(sb); | 821 | coda_cache_clear_all(sb); |
| 822 | shrink_dcache_sb(sb); | 822 | shrink_dcache_sb(sb); |
| 823 | if (sb->s_root->d_inode) | 823 | if (d_really_is_positive(sb->s_root)) |
| 824 | coda_flag_inode(sb->s_root->d_inode, C_FLUSH); | 824 | coda_flag_inode(d_inode(sb->s_root), C_FLUSH); |
| 825 | break; | 825 | break; |
| 826 | 826 | ||
| 827 | case CODA_PURGEUSER: | 827 | case CODA_PURGEUSER: |
diff --git a/fs/configfs/dir.c b/fs/configfs/dir.c index acb3d63bc9dc..c81ce7f200a6 100644 --- a/fs/configfs/dir.c +++ b/fs/configfs/dir.c | |||
| @@ -289,7 +289,7 @@ static int configfs_create_dir(struct config_item *item, struct dentry *dentry) | |||
| 289 | configfs_set_dir_dirent_depth(p->d_fsdata, dentry->d_fsdata); | 289 | configfs_set_dir_dirent_depth(p->d_fsdata, dentry->d_fsdata); |
| 290 | error = configfs_create(dentry, mode, init_dir); | 290 | error = configfs_create(dentry, mode, init_dir); |
| 291 | if (!error) { | 291 | if (!error) { |
| 292 | inc_nlink(p->d_inode); | 292 | inc_nlink(d_inode(p)); |
| 293 | item->ci_dentry = dentry; | 293 | item->ci_dentry = dentry; |
| 294 | } else { | 294 | } else { |
| 295 | struct configfs_dirent *sd = dentry->d_fsdata; | 295 | struct configfs_dirent *sd = dentry->d_fsdata; |
| @@ -375,8 +375,8 @@ static void remove_dir(struct dentry * d) | |||
| 375 | list_del_init(&sd->s_sibling); | 375 | list_del_init(&sd->s_sibling); |
| 376 | spin_unlock(&configfs_dirent_lock); | 376 | spin_unlock(&configfs_dirent_lock); |
| 377 | configfs_put(sd); | 377 | configfs_put(sd); |
| 378 | if (d->d_inode) | 378 | if (d_really_is_positive(d)) |
| 379 | simple_rmdir(parent->d_inode,d); | 379 | simple_rmdir(d_inode(parent),d); |
| 380 | 380 | ||
| 381 | pr_debug(" o %pd removing done (%d)\n", d, d_count(d)); | 381 | pr_debug(" o %pd removing done (%d)\n", d, d_count(d)); |
| 382 | 382 | ||
| @@ -513,7 +513,7 @@ static int configfs_detach_prep(struct dentry *dentry, struct mutex **wait_mutex | |||
| 513 | /* Abort if racing with mkdir() */ | 513 | /* Abort if racing with mkdir() */ |
| 514 | if (sd->s_type & CONFIGFS_USET_IN_MKDIR) { | 514 | if (sd->s_type & CONFIGFS_USET_IN_MKDIR) { |
| 515 | if (wait_mutex) | 515 | if (wait_mutex) |
| 516 | *wait_mutex = &sd->s_dentry->d_inode->i_mutex; | 516 | *wait_mutex = &d_inode(sd->s_dentry)->i_mutex; |
| 517 | return -EAGAIN; | 517 | return -EAGAIN; |
| 518 | } | 518 | } |
| 519 | 519 | ||
| @@ -624,13 +624,13 @@ static void detach_groups(struct config_group *group) | |||
| 624 | 624 | ||
| 625 | child = sd->s_dentry; | 625 | child = sd->s_dentry; |
| 626 | 626 | ||
| 627 | mutex_lock(&child->d_inode->i_mutex); | 627 | mutex_lock(&d_inode(child)->i_mutex); |
| 628 | 628 | ||
| 629 | configfs_detach_group(sd->s_element); | 629 | configfs_detach_group(sd->s_element); |
| 630 | child->d_inode->i_flags |= S_DEAD; | 630 | d_inode(child)->i_flags |= S_DEAD; |
| 631 | dont_mount(child); | 631 | dont_mount(child); |
| 632 | 632 | ||
| 633 | mutex_unlock(&child->d_inode->i_mutex); | 633 | mutex_unlock(&d_inode(child)->i_mutex); |
| 634 | 634 | ||
| 635 | d_delete(child); | 635 | d_delete(child); |
| 636 | dput(child); | 636 | dput(child); |
| @@ -672,7 +672,7 @@ static int create_default_group(struct config_group *parent_group, | |||
| 672 | sd = child->d_fsdata; | 672 | sd = child->d_fsdata; |
| 673 | sd->s_type |= CONFIGFS_USET_DEFAULT; | 673 | sd->s_type |= CONFIGFS_USET_DEFAULT; |
| 674 | } else { | 674 | } else { |
| 675 | BUG_ON(child->d_inode); | 675 | BUG_ON(d_inode(child)); |
| 676 | d_drop(child); | 676 | d_drop(child); |
| 677 | dput(child); | 677 | dput(child); |
| 678 | } | 678 | } |
| @@ -818,11 +818,11 @@ static int configfs_attach_item(struct config_item *parent_item, | |||
| 818 | * the VFS may already have hit and used them. Thus, | 818 | * the VFS may already have hit and used them. Thus, |
| 819 | * we must lock them as rmdir() would. | 819 | * we must lock them as rmdir() would. |
| 820 | */ | 820 | */ |
| 821 | mutex_lock(&dentry->d_inode->i_mutex); | 821 | mutex_lock(&d_inode(dentry)->i_mutex); |
| 822 | configfs_remove_dir(item); | 822 | configfs_remove_dir(item); |
| 823 | dentry->d_inode->i_flags |= S_DEAD; | 823 | d_inode(dentry)->i_flags |= S_DEAD; |
| 824 | dont_mount(dentry); | 824 | dont_mount(dentry); |
| 825 | mutex_unlock(&dentry->d_inode->i_mutex); | 825 | mutex_unlock(&d_inode(dentry)->i_mutex); |
| 826 | d_delete(dentry); | 826 | d_delete(dentry); |
| 827 | } | 827 | } |
| 828 | } | 828 | } |
| @@ -858,16 +858,16 @@ static int configfs_attach_group(struct config_item *parent_item, | |||
| 858 | * We must also lock the inode to remove it safely in case of | 858 | * We must also lock the inode to remove it safely in case of |
| 859 | * error, as rmdir() would. | 859 | * error, as rmdir() would. |
| 860 | */ | 860 | */ |
| 861 | mutex_lock_nested(&dentry->d_inode->i_mutex, I_MUTEX_CHILD); | 861 | mutex_lock_nested(&d_inode(dentry)->i_mutex, I_MUTEX_CHILD); |
| 862 | configfs_adjust_dir_dirent_depth_before_populate(sd); | 862 | configfs_adjust_dir_dirent_depth_before_populate(sd); |
| 863 | ret = populate_groups(to_config_group(item)); | 863 | ret = populate_groups(to_config_group(item)); |
| 864 | if (ret) { | 864 | if (ret) { |
| 865 | configfs_detach_item(item); | 865 | configfs_detach_item(item); |
| 866 | dentry->d_inode->i_flags |= S_DEAD; | 866 | d_inode(dentry)->i_flags |= S_DEAD; |
| 867 | dont_mount(dentry); | 867 | dont_mount(dentry); |
| 868 | } | 868 | } |
| 869 | configfs_adjust_dir_dirent_depth_after_populate(sd); | 869 | configfs_adjust_dir_dirent_depth_after_populate(sd); |
| 870 | mutex_unlock(&dentry->d_inode->i_mutex); | 870 | mutex_unlock(&d_inode(dentry)->i_mutex); |
| 871 | if (ret) | 871 | if (ret) |
| 872 | d_delete(dentry); | 872 | d_delete(dentry); |
| 873 | } | 873 | } |
| @@ -1075,7 +1075,7 @@ int configfs_depend_item(struct configfs_subsystem *subsys, | |||
| 1075 | * subsystem is really registered, and so we need to lock out | 1075 | * subsystem is really registered, and so we need to lock out |
| 1076 | * configfs_[un]register_subsystem(). | 1076 | * configfs_[un]register_subsystem(). |
| 1077 | */ | 1077 | */ |
| 1078 | mutex_lock(&root->d_inode->i_mutex); | 1078 | mutex_lock(&d_inode(root)->i_mutex); |
| 1079 | 1079 | ||
| 1080 | root_sd = root->d_fsdata; | 1080 | root_sd = root->d_fsdata; |
| 1081 | 1081 | ||
| @@ -1111,7 +1111,7 @@ int configfs_depend_item(struct configfs_subsystem *subsys, | |||
| 1111 | out_unlock_dirent_lock: | 1111 | out_unlock_dirent_lock: |
| 1112 | spin_unlock(&configfs_dirent_lock); | 1112 | spin_unlock(&configfs_dirent_lock); |
| 1113 | out_unlock_fs: | 1113 | out_unlock_fs: |
| 1114 | mutex_unlock(&root->d_inode->i_mutex); | 1114 | mutex_unlock(&d_inode(root)->i_mutex); |
| 1115 | 1115 | ||
| 1116 | /* | 1116 | /* |
| 1117 | * If we succeeded, the fs is pinned via other methods. If not, | 1117 | * If we succeeded, the fs is pinned via other methods. If not, |
| @@ -1453,11 +1453,11 @@ int configfs_rename_dir(struct config_item * item, const char *new_name) | |||
| 1453 | down_write(&configfs_rename_sem); | 1453 | down_write(&configfs_rename_sem); |
| 1454 | parent = item->parent->dentry; | 1454 | parent = item->parent->dentry; |
| 1455 | 1455 | ||
| 1456 | mutex_lock(&parent->d_inode->i_mutex); | 1456 | mutex_lock(&d_inode(parent)->i_mutex); |
| 1457 | 1457 | ||
| 1458 | new_dentry = lookup_one_len(new_name, parent, strlen(new_name)); | 1458 | new_dentry = lookup_one_len(new_name, parent, strlen(new_name)); |
| 1459 | if (!IS_ERR(new_dentry)) { | 1459 | if (!IS_ERR(new_dentry)) { |
| 1460 | if (!new_dentry->d_inode) { | 1460 | if (d_really_is_negative(new_dentry)) { |
| 1461 | error = config_item_set_name(item, "%s", new_name); | 1461 | error = config_item_set_name(item, "%s", new_name); |
| 1462 | if (!error) { | 1462 | if (!error) { |
| 1463 | d_add(new_dentry, NULL); | 1463 | d_add(new_dentry, NULL); |
| @@ -1469,7 +1469,7 @@ int configfs_rename_dir(struct config_item * item, const char *new_name) | |||
| 1469 | error = -EEXIST; | 1469 | error = -EEXIST; |
| 1470 | dput(new_dentry); | 1470 | dput(new_dentry); |
| 1471 | } | 1471 | } |
| 1472 | mutex_unlock(&parent->d_inode->i_mutex); | 1472 | mutex_unlock(&d_inode(parent)->i_mutex); |
| 1473 | up_write(&configfs_rename_sem); | 1473 | up_write(&configfs_rename_sem); |
| 1474 | 1474 | ||
| 1475 | return error; | 1475 | return error; |
| @@ -1482,7 +1482,7 @@ static int configfs_dir_open(struct inode *inode, struct file *file) | |||
| 1482 | struct configfs_dirent * parent_sd = dentry->d_fsdata; | 1482 | struct configfs_dirent * parent_sd = dentry->d_fsdata; |
| 1483 | int err; | 1483 | int err; |
| 1484 | 1484 | ||
| 1485 | mutex_lock(&dentry->d_inode->i_mutex); | 1485 | mutex_lock(&d_inode(dentry)->i_mutex); |
| 1486 | /* | 1486 | /* |
| 1487 | * Fake invisibility if dir belongs to a group/default groups hierarchy | 1487 | * Fake invisibility if dir belongs to a group/default groups hierarchy |
| 1488 | * being attached | 1488 | * being attached |
| @@ -1495,7 +1495,7 @@ static int configfs_dir_open(struct inode *inode, struct file *file) | |||
| 1495 | else | 1495 | else |
| 1496 | err = 0; | 1496 | err = 0; |
| 1497 | } | 1497 | } |
| 1498 | mutex_unlock(&dentry->d_inode->i_mutex); | 1498 | mutex_unlock(&d_inode(dentry)->i_mutex); |
| 1499 | 1499 | ||
| 1500 | return err; | 1500 | return err; |
| 1501 | } | 1501 | } |
| @@ -1505,11 +1505,11 @@ static int configfs_dir_close(struct inode *inode, struct file *file) | |||
| 1505 | struct dentry * dentry = file->f_path.dentry; | 1505 | struct dentry * dentry = file->f_path.dentry; |
| 1506 | struct configfs_dirent * cursor = file->private_data; | 1506 | struct configfs_dirent * cursor = file->private_data; |
| 1507 | 1507 | ||
| 1508 | mutex_lock(&dentry->d_inode->i_mutex); | 1508 | mutex_lock(&d_inode(dentry)->i_mutex); |
| 1509 | spin_lock(&configfs_dirent_lock); | 1509 | spin_lock(&configfs_dirent_lock); |
| 1510 | list_del_init(&cursor->s_sibling); | 1510 | list_del_init(&cursor->s_sibling); |
| 1511 | spin_unlock(&configfs_dirent_lock); | 1511 | spin_unlock(&configfs_dirent_lock); |
| 1512 | mutex_unlock(&dentry->d_inode->i_mutex); | 1512 | mutex_unlock(&d_inode(dentry)->i_mutex); |
| 1513 | 1513 | ||
| 1514 | release_configfs_dirent(cursor); | 1514 | release_configfs_dirent(cursor); |
| 1515 | 1515 | ||
| @@ -1567,7 +1567,7 @@ static int configfs_readdir(struct file *file, struct dir_context *ctx) | |||
| 1567 | spin_lock(&configfs_dirent_lock); | 1567 | spin_lock(&configfs_dirent_lock); |
| 1568 | dentry = next->s_dentry; | 1568 | dentry = next->s_dentry; |
| 1569 | if (dentry) | 1569 | if (dentry) |
| 1570 | inode = dentry->d_inode; | 1570 | inode = d_inode(dentry); |
| 1571 | if (inode) | 1571 | if (inode) |
| 1572 | ino = inode->i_ino; | 1572 | ino = inode->i_ino; |
| 1573 | spin_unlock(&configfs_dirent_lock); | 1573 | spin_unlock(&configfs_dirent_lock); |
| @@ -1590,7 +1590,7 @@ static loff_t configfs_dir_lseek(struct file *file, loff_t offset, int whence) | |||
| 1590 | { | 1590 | { |
| 1591 | struct dentry * dentry = file->f_path.dentry; | 1591 | struct dentry * dentry = file->f_path.dentry; |
| 1592 | 1592 | ||
| 1593 | mutex_lock(&dentry->d_inode->i_mutex); | 1593 | mutex_lock(&d_inode(dentry)->i_mutex); |
| 1594 | switch (whence) { | 1594 | switch (whence) { |
| 1595 | case 1: | 1595 | case 1: |
| 1596 | offset += file->f_pos; | 1596 | offset += file->f_pos; |
| @@ -1598,7 +1598,7 @@ static loff_t configfs_dir_lseek(struct file *file, loff_t offset, int whence) | |||
| 1598 | if (offset >= 0) | 1598 | if (offset >= 0) |
| 1599 | break; | 1599 | break; |
| 1600 | default: | 1600 | default: |
| 1601 | mutex_unlock(&dentry->d_inode->i_mutex); | 1601 | mutex_unlock(&d_inode(dentry)->i_mutex); |
| 1602 | return -EINVAL; | 1602 | return -EINVAL; |
| 1603 | } | 1603 | } |
| 1604 | if (offset != file->f_pos) { | 1604 | if (offset != file->f_pos) { |
| @@ -1624,7 +1624,7 @@ static loff_t configfs_dir_lseek(struct file *file, loff_t offset, int whence) | |||
| 1624 | spin_unlock(&configfs_dirent_lock); | 1624 | spin_unlock(&configfs_dirent_lock); |
| 1625 | } | 1625 | } |
| 1626 | } | 1626 | } |
| 1627 | mutex_unlock(&dentry->d_inode->i_mutex); | 1627 | mutex_unlock(&d_inode(dentry)->i_mutex); |
| 1628 | return offset; | 1628 | return offset; |
| 1629 | } | 1629 | } |
| 1630 | 1630 | ||
| @@ -1654,7 +1654,7 @@ int configfs_register_subsystem(struct configfs_subsystem *subsys) | |||
| 1654 | sd = root->d_fsdata; | 1654 | sd = root->d_fsdata; |
| 1655 | link_group(to_config_group(sd->s_element), group); | 1655 | link_group(to_config_group(sd->s_element), group); |
| 1656 | 1656 | ||
| 1657 | mutex_lock_nested(&root->d_inode->i_mutex, I_MUTEX_PARENT); | 1657 | mutex_lock_nested(&d_inode(root)->i_mutex, I_MUTEX_PARENT); |
| 1658 | 1658 | ||
| 1659 | err = -ENOMEM; | 1659 | err = -ENOMEM; |
| 1660 | dentry = d_alloc_name(root, group->cg_item.ci_name); | 1660 | dentry = d_alloc_name(root, group->cg_item.ci_name); |
| @@ -1664,7 +1664,7 @@ int configfs_register_subsystem(struct configfs_subsystem *subsys) | |||
| 1664 | err = configfs_attach_group(sd->s_element, &group->cg_item, | 1664 | err = configfs_attach_group(sd->s_element, &group->cg_item, |
| 1665 | dentry); | 1665 | dentry); |
| 1666 | if (err) { | 1666 | if (err) { |
| 1667 | BUG_ON(dentry->d_inode); | 1667 | BUG_ON(d_inode(dentry)); |
| 1668 | d_drop(dentry); | 1668 | d_drop(dentry); |
| 1669 | dput(dentry); | 1669 | dput(dentry); |
| 1670 | } else { | 1670 | } else { |
| @@ -1674,7 +1674,7 @@ int configfs_register_subsystem(struct configfs_subsystem *subsys) | |||
| 1674 | } | 1674 | } |
| 1675 | } | 1675 | } |
| 1676 | 1676 | ||
| 1677 | mutex_unlock(&root->d_inode->i_mutex); | 1677 | mutex_unlock(&d_inode(root)->i_mutex); |
| 1678 | 1678 | ||
| 1679 | if (err) { | 1679 | if (err) { |
| 1680 | unlink_group(group); | 1680 | unlink_group(group); |
| @@ -1695,9 +1695,9 @@ void configfs_unregister_subsystem(struct configfs_subsystem *subsys) | |||
| 1695 | return; | 1695 | return; |
| 1696 | } | 1696 | } |
| 1697 | 1697 | ||
| 1698 | mutex_lock_nested(&root->d_inode->i_mutex, | 1698 | mutex_lock_nested(&d_inode(root)->i_mutex, |
| 1699 | I_MUTEX_PARENT); | 1699 | I_MUTEX_PARENT); |
| 1700 | mutex_lock_nested(&dentry->d_inode->i_mutex, I_MUTEX_CHILD); | 1700 | mutex_lock_nested(&d_inode(dentry)->i_mutex, I_MUTEX_CHILD); |
| 1701 | mutex_lock(&configfs_symlink_mutex); | 1701 | mutex_lock(&configfs_symlink_mutex); |
| 1702 | spin_lock(&configfs_dirent_lock); | 1702 | spin_lock(&configfs_dirent_lock); |
| 1703 | if (configfs_detach_prep(dentry, NULL)) { | 1703 | if (configfs_detach_prep(dentry, NULL)) { |
| @@ -1706,13 +1706,13 @@ void configfs_unregister_subsystem(struct configfs_subsystem *subsys) | |||
| 1706 | spin_unlock(&configfs_dirent_lock); | 1706 | spin_unlock(&configfs_dirent_lock); |
| 1707 | mutex_unlock(&configfs_symlink_mutex); | 1707 | mutex_unlock(&configfs_symlink_mutex); |
| 1708 | configfs_detach_group(&group->cg_item); | 1708 | configfs_detach_group(&group->cg_item); |
| 1709 | dentry->d_inode->i_flags |= S_DEAD; | 1709 | d_inode(dentry)->i_flags |= S_DEAD; |
| 1710 | dont_mount(dentry); | 1710 | dont_mount(dentry); |
| 1711 | mutex_unlock(&dentry->d_inode->i_mutex); | 1711 | mutex_unlock(&d_inode(dentry)->i_mutex); |
| 1712 | 1712 | ||
| 1713 | d_delete(dentry); | 1713 | d_delete(dentry); |
| 1714 | 1714 | ||
| 1715 | mutex_unlock(&root->d_inode->i_mutex); | 1715 | mutex_unlock(&d_inode(root)->i_mutex); |
| 1716 | 1716 | ||
| 1717 | dput(dentry); | 1717 | dput(dentry); |
| 1718 | 1718 | ||
diff --git a/fs/configfs/file.c b/fs/configfs/file.c index 56d2cdc9ae0a..403269ffcdf3 100644 --- a/fs/configfs/file.c +++ b/fs/configfs/file.c | |||
| @@ -326,10 +326,10 @@ int configfs_create_file(struct config_item * item, const struct configfs_attrib | |||
| 326 | umode_t mode = (attr->ca_mode & S_IALLUGO) | S_IFREG; | 326 | umode_t mode = (attr->ca_mode & S_IALLUGO) | S_IFREG; |
| 327 | int error = 0; | 327 | int error = 0; |
| 328 | 328 | ||
| 329 | mutex_lock_nested(&dir->d_inode->i_mutex, I_MUTEX_NORMAL); | 329 | mutex_lock_nested(&d_inode(dir)->i_mutex, I_MUTEX_NORMAL); |
| 330 | error = configfs_make_dirent(parent_sd, NULL, (void *) attr, mode, | 330 | error = configfs_make_dirent(parent_sd, NULL, (void *) attr, mode, |
| 331 | CONFIGFS_ITEM_ATTR); | 331 | CONFIGFS_ITEM_ATTR); |
| 332 | mutex_unlock(&dir->d_inode->i_mutex); | 332 | mutex_unlock(&d_inode(dir)->i_mutex); |
| 333 | 333 | ||
| 334 | return error; | 334 | return error; |
| 335 | } | 335 | } |
diff --git a/fs/configfs/inode.c b/fs/configfs/inode.c index 5423a6a6ecc8..8d89f5fd0331 100644 --- a/fs/configfs/inode.c +++ b/fs/configfs/inode.c | |||
| @@ -56,7 +56,7 @@ static const struct inode_operations configfs_inode_operations ={ | |||
| 56 | 56 | ||
| 57 | int configfs_setattr(struct dentry * dentry, struct iattr * iattr) | 57 | int configfs_setattr(struct dentry * dentry, struct iattr * iattr) |
| 58 | { | 58 | { |
| 59 | struct inode * inode = dentry->d_inode; | 59 | struct inode * inode = d_inode(dentry); |
| 60 | struct configfs_dirent * sd = dentry->d_fsdata; | 60 | struct configfs_dirent * sd = dentry->d_fsdata; |
| 61 | struct iattr * sd_iattr; | 61 | struct iattr * sd_iattr; |
| 62 | unsigned int ia_valid = iattr->ia_valid; | 62 | unsigned int ia_valid = iattr->ia_valid; |
| @@ -186,7 +186,7 @@ int configfs_create(struct dentry * dentry, umode_t mode, void (*init)(struct in | |||
| 186 | if (!dentry) | 186 | if (!dentry) |
| 187 | return -ENOENT; | 187 | return -ENOENT; |
| 188 | 188 | ||
| 189 | if (dentry->d_inode) | 189 | if (d_really_is_positive(dentry)) |
| 190 | return -EEXIST; | 190 | return -EEXIST; |
| 191 | 191 | ||
| 192 | sd = dentry->d_fsdata; | 192 | sd = dentry->d_fsdata; |
| @@ -194,7 +194,7 @@ int configfs_create(struct dentry * dentry, umode_t mode, void (*init)(struct in | |||
| 194 | if (!inode) | 194 | if (!inode) |
| 195 | return -ENOMEM; | 195 | return -ENOMEM; |
| 196 | 196 | ||
| 197 | p_inode = dentry->d_parent->d_inode; | 197 | p_inode = d_inode(dentry->d_parent); |
| 198 | p_inode->i_mtime = p_inode->i_ctime = CURRENT_TIME; | 198 | p_inode->i_mtime = p_inode->i_ctime = CURRENT_TIME; |
| 199 | configfs_set_inode_lock_class(sd, inode); | 199 | configfs_set_inode_lock_class(sd, inode); |
| 200 | 200 | ||
| @@ -236,11 +236,11 @@ void configfs_drop_dentry(struct configfs_dirent * sd, struct dentry * parent) | |||
| 236 | 236 | ||
| 237 | if (dentry) { | 237 | if (dentry) { |
| 238 | spin_lock(&dentry->d_lock); | 238 | spin_lock(&dentry->d_lock); |
| 239 | if (!d_unhashed(dentry) && dentry->d_inode) { | 239 | if (!d_unhashed(dentry) && d_really_is_positive(dentry)) { |
| 240 | dget_dlock(dentry); | 240 | dget_dlock(dentry); |
| 241 | __d_drop(dentry); | 241 | __d_drop(dentry); |
| 242 | spin_unlock(&dentry->d_lock); | 242 | spin_unlock(&dentry->d_lock); |
| 243 | simple_unlink(parent->d_inode, dentry); | 243 | simple_unlink(d_inode(parent), dentry); |
| 244 | } else | 244 | } else |
| 245 | spin_unlock(&dentry->d_lock); | 245 | spin_unlock(&dentry->d_lock); |
| 246 | } | 246 | } |
| @@ -251,11 +251,11 @@ void configfs_hash_and_remove(struct dentry * dir, const char * name) | |||
| 251 | struct configfs_dirent * sd; | 251 | struct configfs_dirent * sd; |
| 252 | struct configfs_dirent * parent_sd = dir->d_fsdata; | 252 | struct configfs_dirent * parent_sd = dir->d_fsdata; |
| 253 | 253 | ||
| 254 | if (dir->d_inode == NULL) | 254 | if (d_really_is_negative(dir)) |
| 255 | /* no inode means this hasn't been made visible yet */ | 255 | /* no inode means this hasn't been made visible yet */ |
| 256 | return; | 256 | return; |
| 257 | 257 | ||
| 258 | mutex_lock(&dir->d_inode->i_mutex); | 258 | mutex_lock(&d_inode(dir)->i_mutex); |
| 259 | list_for_each_entry(sd, &parent_sd->s_children, s_sibling) { | 259 | list_for_each_entry(sd, &parent_sd->s_children, s_sibling) { |
| 260 | if (!sd->s_element) | 260 | if (!sd->s_element) |
| 261 | continue; | 261 | continue; |
| @@ -268,5 +268,5 @@ void configfs_hash_and_remove(struct dentry * dir, const char * name) | |||
| 268 | break; | 268 | break; |
| 269 | } | 269 | } |
| 270 | } | 270 | } |
| 271 | mutex_unlock(&dir->d_inode->i_mutex); | 271 | mutex_unlock(&d_inode(dir)->i_mutex); |
| 272 | } | 272 | } |
| @@ -209,7 +209,7 @@ ssize_t dax_do_io(struct kiocb *iocb, struct inode *inode, | |||
| 209 | } | 209 | } |
| 210 | 210 | ||
| 211 | /* Protects against truncate */ | 211 | /* Protects against truncate */ |
| 212 | atomic_inc(&inode->i_dio_count); | 212 | inode_dio_begin(inode); |
| 213 | 213 | ||
| 214 | retval = dax_io(inode, iter, pos, end, get_block, &bh); | 214 | retval = dax_io(inode, iter, pos, end, get_block, &bh); |
| 215 | 215 | ||
| @@ -219,7 +219,7 @@ ssize_t dax_do_io(struct kiocb *iocb, struct inode *inode, | |||
| 219 | if ((retval > 0) && end_io) | 219 | if ((retval > 0) && end_io) |
| 220 | end_io(iocb, pos, retval, bh.b_private); | 220 | end_io(iocb, pos, retval, bh.b_private); |
| 221 | 221 | ||
| 222 | inode_dio_done(inode); | 222 | inode_dio_end(inode); |
| 223 | out: | 223 | out: |
| 224 | return retval; | 224 | return retval; |
| 225 | } | 225 | } |
diff --git a/fs/debugfs/file.c b/fs/debugfs/file.c index 517e64938438..830a7e76f5c6 100644 --- a/fs/debugfs/file.c +++ b/fs/debugfs/file.c | |||
| @@ -45,7 +45,7 @@ const struct file_operations debugfs_file_operations = { | |||
| 45 | 45 | ||
| 46 | static void *debugfs_follow_link(struct dentry *dentry, struct nameidata *nd) | 46 | static void *debugfs_follow_link(struct dentry *dentry, struct nameidata *nd) |
| 47 | { | 47 | { |
| 48 | nd_set_link(nd, dentry->d_inode->i_private); | 48 | nd_set_link(nd, d_inode(dentry)->i_private); |
| 49 | return NULL; | 49 | return NULL; |
| 50 | } | 50 | } |
| 51 | 51 | ||
diff --git a/fs/debugfs/inode.c b/fs/debugfs/inode.c index c9ee0dfe90b5..c1e7ffb0dab6 100644 --- a/fs/debugfs/inode.c +++ b/fs/debugfs/inode.c | |||
| @@ -46,7 +46,7 @@ static struct inode *debugfs_get_inode(struct super_block *sb) | |||
| 46 | 46 | ||
| 47 | static inline int debugfs_positive(struct dentry *dentry) | 47 | static inline int debugfs_positive(struct dentry *dentry) |
| 48 | { | 48 | { |
| 49 | return dentry->d_inode && !d_unhashed(dentry); | 49 | return d_really_is_positive(dentry) && !d_unhashed(dentry); |
| 50 | } | 50 | } |
| 51 | 51 | ||
| 52 | struct debugfs_mount_opts { | 52 | struct debugfs_mount_opts { |
| @@ -124,7 +124,7 @@ static int debugfs_parse_options(char *data, struct debugfs_mount_opts *opts) | |||
| 124 | static int debugfs_apply_options(struct super_block *sb) | 124 | static int debugfs_apply_options(struct super_block *sb) |
| 125 | { | 125 | { |
| 126 | struct debugfs_fs_info *fsi = sb->s_fs_info; | 126 | struct debugfs_fs_info *fsi = sb->s_fs_info; |
| 127 | struct inode *inode = sb->s_root->d_inode; | 127 | struct inode *inode = d_inode(sb->s_root); |
| 128 | struct debugfs_mount_opts *opts = &fsi->mount_opts; | 128 | struct debugfs_mount_opts *opts = &fsi->mount_opts; |
| 129 | 129 | ||
| 130 | inode->i_mode &= ~S_IALLUGO; | 130 | inode->i_mode &= ~S_IALLUGO; |
| @@ -188,7 +188,7 @@ static struct vfsmount *debugfs_automount(struct path *path) | |||
| 188 | { | 188 | { |
| 189 | struct vfsmount *(*f)(void *); | 189 | struct vfsmount *(*f)(void *); |
| 190 | f = (struct vfsmount *(*)(void *))path->dentry->d_fsdata; | 190 | f = (struct vfsmount *(*)(void *))path->dentry->d_fsdata; |
| 191 | return f(path->dentry->d_inode->i_private); | 191 | return f(d_inode(path->dentry)->i_private); |
| 192 | } | 192 | } |
| 193 | 193 | ||
| 194 | static const struct dentry_operations debugfs_dops = { | 194 | static const struct dentry_operations debugfs_dops = { |
| @@ -270,20 +270,20 @@ static struct dentry *start_creating(const char *name, struct dentry *parent) | |||
| 270 | if (!parent) | 270 | if (!parent) |
| 271 | parent = debugfs_mount->mnt_root; | 271 | parent = debugfs_mount->mnt_root; |
| 272 | 272 | ||
| 273 | mutex_lock(&parent->d_inode->i_mutex); | 273 | mutex_lock(&d_inode(parent)->i_mutex); |
| 274 | dentry = lookup_one_len(name, parent, strlen(name)); | 274 | dentry = lookup_one_len(name, parent, strlen(name)); |
| 275 | if (!IS_ERR(dentry) && dentry->d_inode) { | 275 | if (!IS_ERR(dentry) && d_really_is_positive(dentry)) { |
| 276 | dput(dentry); | 276 | dput(dentry); |
| 277 | dentry = ERR_PTR(-EEXIST); | 277 | dentry = ERR_PTR(-EEXIST); |
| 278 | } | 278 | } |
| 279 | if (IS_ERR(dentry)) | 279 | if (IS_ERR(dentry)) |
| 280 | mutex_unlock(&parent->d_inode->i_mutex); | 280 | mutex_unlock(&d_inode(parent)->i_mutex); |
| 281 | return dentry; | 281 | return dentry; |
| 282 | } | 282 | } |
| 283 | 283 | ||
| 284 | static struct dentry *failed_creating(struct dentry *dentry) | 284 | static struct dentry *failed_creating(struct dentry *dentry) |
| 285 | { | 285 | { |
| 286 | mutex_unlock(&dentry->d_parent->d_inode->i_mutex); | 286 | mutex_unlock(&d_inode(dentry->d_parent)->i_mutex); |
| 287 | dput(dentry); | 287 | dput(dentry); |
| 288 | simple_release_fs(&debugfs_mount, &debugfs_mount_count); | 288 | simple_release_fs(&debugfs_mount, &debugfs_mount_count); |
| 289 | return NULL; | 289 | return NULL; |
| @@ -291,7 +291,7 @@ static struct dentry *failed_creating(struct dentry *dentry) | |||
| 291 | 291 | ||
| 292 | static struct dentry *end_creating(struct dentry *dentry) | 292 | static struct dentry *end_creating(struct dentry *dentry) |
| 293 | { | 293 | { |
| 294 | mutex_unlock(&dentry->d_parent->d_inode->i_mutex); | 294 | mutex_unlock(&d_inode(dentry->d_parent)->i_mutex); |
| 295 | return dentry; | 295 | return dentry; |
| 296 | } | 296 | } |
| 297 | 297 | ||
| @@ -344,7 +344,7 @@ struct dentry *debugfs_create_file(const char *name, umode_t mode, | |||
| 344 | inode->i_fop = fops ? fops : &debugfs_file_operations; | 344 | inode->i_fop = fops ? fops : &debugfs_file_operations; |
| 345 | inode->i_private = data; | 345 | inode->i_private = data; |
| 346 | d_instantiate(dentry, inode); | 346 | d_instantiate(dentry, inode); |
| 347 | fsnotify_create(dentry->d_parent->d_inode, dentry); | 347 | fsnotify_create(d_inode(dentry->d_parent), dentry); |
| 348 | return end_creating(dentry); | 348 | return end_creating(dentry); |
| 349 | } | 349 | } |
| 350 | EXPORT_SYMBOL_GPL(debugfs_create_file); | 350 | EXPORT_SYMBOL_GPL(debugfs_create_file); |
| @@ -384,7 +384,7 @@ struct dentry *debugfs_create_file_size(const char *name, umode_t mode, | |||
| 384 | struct dentry *de = debugfs_create_file(name, mode, parent, data, fops); | 384 | struct dentry *de = debugfs_create_file(name, mode, parent, data, fops); |
| 385 | 385 | ||
| 386 | if (de) | 386 | if (de) |
| 387 | de->d_inode->i_size = file_size; | 387 | d_inode(de)->i_size = file_size; |
| 388 | return de; | 388 | return de; |
| 389 | } | 389 | } |
| 390 | EXPORT_SYMBOL_GPL(debugfs_create_file_size); | 390 | EXPORT_SYMBOL_GPL(debugfs_create_file_size); |
| @@ -426,8 +426,8 @@ struct dentry *debugfs_create_dir(const char *name, struct dentry *parent) | |||
| 426 | /* directory inodes start off with i_nlink == 2 (for "." entry) */ | 426 | /* directory inodes start off with i_nlink == 2 (for "." entry) */ |
| 427 | inc_nlink(inode); | 427 | inc_nlink(inode); |
| 428 | d_instantiate(dentry, inode); | 428 | d_instantiate(dentry, inode); |
| 429 | inc_nlink(dentry->d_parent->d_inode); | 429 | inc_nlink(d_inode(dentry->d_parent)); |
| 430 | fsnotify_mkdir(dentry->d_parent->d_inode, dentry); | 430 | fsnotify_mkdir(d_inode(dentry->d_parent), dentry); |
| 431 | return end_creating(dentry); | 431 | return end_creating(dentry); |
| 432 | } | 432 | } |
| 433 | EXPORT_SYMBOL_GPL(debugfs_create_dir); | 433 | EXPORT_SYMBOL_GPL(debugfs_create_dir); |
| @@ -525,9 +525,9 @@ static int __debugfs_remove(struct dentry *dentry, struct dentry *parent) | |||
| 525 | if (debugfs_positive(dentry)) { | 525 | if (debugfs_positive(dentry)) { |
| 526 | dget(dentry); | 526 | dget(dentry); |
| 527 | if (d_is_dir(dentry)) | 527 | if (d_is_dir(dentry)) |
| 528 | ret = simple_rmdir(parent->d_inode, dentry); | 528 | ret = simple_rmdir(d_inode(parent), dentry); |
| 529 | else | 529 | else |
| 530 | simple_unlink(parent->d_inode, dentry); | 530 | simple_unlink(d_inode(parent), dentry); |
| 531 | if (!ret) | 531 | if (!ret) |
| 532 | d_delete(dentry); | 532 | d_delete(dentry); |
| 533 | dput(dentry); | 533 | dput(dentry); |
| @@ -557,12 +557,12 @@ void debugfs_remove(struct dentry *dentry) | |||
| 557 | return; | 557 | return; |
| 558 | 558 | ||
| 559 | parent = dentry->d_parent; | 559 | parent = dentry->d_parent; |
| 560 | if (!parent || !parent->d_inode) | 560 | if (!parent || d_really_is_negative(parent)) |
| 561 | return; | 561 | return; |
| 562 | 562 | ||
| 563 | mutex_lock(&parent->d_inode->i_mutex); | 563 | mutex_lock(&d_inode(parent)->i_mutex); |
| 564 | ret = __debugfs_remove(dentry, parent); | 564 | ret = __debugfs_remove(dentry, parent); |
| 565 | mutex_unlock(&parent->d_inode->i_mutex); | 565 | mutex_unlock(&d_inode(parent)->i_mutex); |
| 566 | if (!ret) | 566 | if (!ret) |
| 567 | simple_release_fs(&debugfs_mount, &debugfs_mount_count); | 567 | simple_release_fs(&debugfs_mount, &debugfs_mount_count); |
| 568 | } | 568 | } |
| @@ -588,12 +588,12 @@ void debugfs_remove_recursive(struct dentry *dentry) | |||
| 588 | return; | 588 | return; |
| 589 | 589 | ||
| 590 | parent = dentry->d_parent; | 590 | parent = dentry->d_parent; |
| 591 | if (!parent || !parent->d_inode) | 591 | if (!parent || d_really_is_negative(parent)) |
| 592 | return; | 592 | return; |
| 593 | 593 | ||
| 594 | parent = dentry; | 594 | parent = dentry; |
| 595 | down: | 595 | down: |
| 596 | mutex_lock(&parent->d_inode->i_mutex); | 596 | mutex_lock(&d_inode(parent)->i_mutex); |
| 597 | loop: | 597 | loop: |
| 598 | /* | 598 | /* |
| 599 | * The parent->d_subdirs is protected by the d_lock. Outside that | 599 | * The parent->d_subdirs is protected by the d_lock. Outside that |
| @@ -608,7 +608,7 @@ void debugfs_remove_recursive(struct dentry *dentry) | |||
| 608 | /* perhaps simple_empty(child) makes more sense */ | 608 | /* perhaps simple_empty(child) makes more sense */ |
| 609 | if (!list_empty(&child->d_subdirs)) { | 609 | if (!list_empty(&child->d_subdirs)) { |
| 610 | spin_unlock(&parent->d_lock); | 610 | spin_unlock(&parent->d_lock); |
| 611 | mutex_unlock(&parent->d_inode->i_mutex); | 611 | mutex_unlock(&d_inode(parent)->i_mutex); |
| 612 | parent = child; | 612 | parent = child; |
| 613 | goto down; | 613 | goto down; |
| 614 | } | 614 | } |
| @@ -629,10 +629,10 @@ void debugfs_remove_recursive(struct dentry *dentry) | |||
| 629 | } | 629 | } |
| 630 | spin_unlock(&parent->d_lock); | 630 | spin_unlock(&parent->d_lock); |
| 631 | 631 | ||
| 632 | mutex_unlock(&parent->d_inode->i_mutex); | 632 | mutex_unlock(&d_inode(parent)->i_mutex); |
| 633 | child = parent; | 633 | child = parent; |
| 634 | parent = parent->d_parent; | 634 | parent = parent->d_parent; |
| 635 | mutex_lock(&parent->d_inode->i_mutex); | 635 | mutex_lock(&d_inode(parent)->i_mutex); |
| 636 | 636 | ||
| 637 | if (child != dentry) | 637 | if (child != dentry) |
| 638 | /* go up */ | 638 | /* go up */ |
| @@ -640,7 +640,7 @@ void debugfs_remove_recursive(struct dentry *dentry) | |||
| 640 | 640 | ||
| 641 | if (!__debugfs_remove(child, parent)) | 641 | if (!__debugfs_remove(child, parent)) |
| 642 | simple_release_fs(&debugfs_mount, &debugfs_mount_count); | 642 | simple_release_fs(&debugfs_mount, &debugfs_mount_count); |
| 643 | mutex_unlock(&parent->d_inode->i_mutex); | 643 | mutex_unlock(&d_inode(parent)->i_mutex); |
| 644 | } | 644 | } |
| 645 | EXPORT_SYMBOL_GPL(debugfs_remove_recursive); | 645 | EXPORT_SYMBOL_GPL(debugfs_remove_recursive); |
| 646 | 646 | ||
| @@ -672,27 +672,27 @@ struct dentry *debugfs_rename(struct dentry *old_dir, struct dentry *old_dentry, | |||
| 672 | 672 | ||
| 673 | trap = lock_rename(new_dir, old_dir); | 673 | trap = lock_rename(new_dir, old_dir); |
| 674 | /* Source or destination directories don't exist? */ | 674 | /* Source or destination directories don't exist? */ |
| 675 | if (!old_dir->d_inode || !new_dir->d_inode) | 675 | if (d_really_is_negative(old_dir) || d_really_is_negative(new_dir)) |
| 676 | goto exit; | 676 | goto exit; |
| 677 | /* Source does not exist, cyclic rename, or mountpoint? */ | 677 | /* Source does not exist, cyclic rename, or mountpoint? */ |
| 678 | if (!old_dentry->d_inode || old_dentry == trap || | 678 | if (d_really_is_negative(old_dentry) || old_dentry == trap || |
| 679 | d_mountpoint(old_dentry)) | 679 | d_mountpoint(old_dentry)) |
| 680 | goto exit; | 680 | goto exit; |
| 681 | dentry = lookup_one_len(new_name, new_dir, strlen(new_name)); | 681 | dentry = lookup_one_len(new_name, new_dir, strlen(new_name)); |
| 682 | /* Lookup failed, cyclic rename or target exists? */ | 682 | /* Lookup failed, cyclic rename or target exists? */ |
| 683 | if (IS_ERR(dentry) || dentry == trap || dentry->d_inode) | 683 | if (IS_ERR(dentry) || dentry == trap || d_really_is_positive(dentry)) |
| 684 | goto exit; | 684 | goto exit; |
| 685 | 685 | ||
| 686 | old_name = fsnotify_oldname_init(old_dentry->d_name.name); | 686 | old_name = fsnotify_oldname_init(old_dentry->d_name.name); |
| 687 | 687 | ||
| 688 | error = simple_rename(old_dir->d_inode, old_dentry, new_dir->d_inode, | 688 | error = simple_rename(d_inode(old_dir), old_dentry, d_inode(new_dir), |
| 689 | dentry); | 689 | dentry); |
| 690 | if (error) { | 690 | if (error) { |
| 691 | fsnotify_oldname_free(old_name); | 691 | fsnotify_oldname_free(old_name); |
| 692 | goto exit; | 692 | goto exit; |
| 693 | } | 693 | } |
| 694 | d_move(old_dentry, dentry); | 694 | d_move(old_dentry, dentry); |
| 695 | fsnotify_move(old_dir->d_inode, new_dir->d_inode, old_name, | 695 | fsnotify_move(d_inode(old_dir), d_inode(new_dir), old_name, |
| 696 | d_is_dir(old_dentry), | 696 | d_is_dir(old_dentry), |
| 697 | NULL, old_dentry); | 697 | NULL, old_dentry); |
| 698 | fsnotify_oldname_free(old_name); | 698 | fsnotify_oldname_free(old_name); |
diff --git a/fs/devpts/inode.c b/fs/devpts/inode.c index cfe8466f7fef..add566303c68 100644 --- a/fs/devpts/inode.c +++ b/fs/devpts/inode.c | |||
| @@ -253,7 +253,7 @@ static int mknod_ptmx(struct super_block *sb) | |||
| 253 | if (!uid_valid(root_uid) || !gid_valid(root_gid)) | 253 | if (!uid_valid(root_uid) || !gid_valid(root_gid)) |
| 254 | return -EINVAL; | 254 | return -EINVAL; |
| 255 | 255 | ||
| 256 | mutex_lock(&root->d_inode->i_mutex); | 256 | mutex_lock(&d_inode(root)->i_mutex); |
| 257 | 257 | ||
| 258 | /* If we have already created ptmx node, return */ | 258 | /* If we have already created ptmx node, return */ |
| 259 | if (fsi->ptmx_dentry) { | 259 | if (fsi->ptmx_dentry) { |
| @@ -290,7 +290,7 @@ static int mknod_ptmx(struct super_block *sb) | |||
| 290 | fsi->ptmx_dentry = dentry; | 290 | fsi->ptmx_dentry = dentry; |
| 291 | rc = 0; | 291 | rc = 0; |
| 292 | out: | 292 | out: |
| 293 | mutex_unlock(&root->d_inode->i_mutex); | 293 | mutex_unlock(&d_inode(root)->i_mutex); |
| 294 | return rc; | 294 | return rc; |
| 295 | } | 295 | } |
| 296 | 296 | ||
| @@ -298,7 +298,7 @@ static void update_ptmx_mode(struct pts_fs_info *fsi) | |||
| 298 | { | 298 | { |
| 299 | struct inode *inode; | 299 | struct inode *inode; |
| 300 | if (fsi->ptmx_dentry) { | 300 | if (fsi->ptmx_dentry) { |
| 301 | inode = fsi->ptmx_dentry->d_inode; | 301 | inode = d_inode(fsi->ptmx_dentry); |
| 302 | inode->i_mode = S_IFCHR|fsi->mount_opts.ptmxmode; | 302 | inode->i_mode = S_IFCHR|fsi->mount_opts.ptmxmode; |
| 303 | } | 303 | } |
| 304 | } | 304 | } |
| @@ -602,18 +602,18 @@ struct inode *devpts_pty_new(struct inode *ptmx_inode, dev_t device, int index, | |||
| 602 | 602 | ||
| 603 | sprintf(s, "%d", index); | 603 | sprintf(s, "%d", index); |
| 604 | 604 | ||
| 605 | mutex_lock(&root->d_inode->i_mutex); | 605 | mutex_lock(&d_inode(root)->i_mutex); |
| 606 | 606 | ||
| 607 | dentry = d_alloc_name(root, s); | 607 | dentry = d_alloc_name(root, s); |
| 608 | if (dentry) { | 608 | if (dentry) { |
| 609 | d_add(dentry, inode); | 609 | d_add(dentry, inode); |
| 610 | fsnotify_create(root->d_inode, dentry); | 610 | fsnotify_create(d_inode(root), dentry); |
| 611 | } else { | 611 | } else { |
| 612 | iput(inode); | 612 | iput(inode); |
| 613 | inode = ERR_PTR(-ENOMEM); | 613 | inode = ERR_PTR(-ENOMEM); |
| 614 | } | 614 | } |
| 615 | 615 | ||
| 616 | mutex_unlock(&root->d_inode->i_mutex); | 616 | mutex_unlock(&d_inode(root)->i_mutex); |
| 617 | 617 | ||
| 618 | return inode; | 618 | return inode; |
| 619 | } | 619 | } |
| @@ -658,7 +658,7 @@ void devpts_pty_kill(struct inode *inode) | |||
| 658 | 658 | ||
| 659 | BUG_ON(inode->i_rdev == MKDEV(TTYAUX_MAJOR, PTMX_MINOR)); | 659 | BUG_ON(inode->i_rdev == MKDEV(TTYAUX_MAJOR, PTMX_MINOR)); |
| 660 | 660 | ||
| 661 | mutex_lock(&root->d_inode->i_mutex); | 661 | mutex_lock(&d_inode(root)->i_mutex); |
| 662 | 662 | ||
| 663 | dentry = d_find_alias(inode); | 663 | dentry = d_find_alias(inode); |
| 664 | 664 | ||
| @@ -667,7 +667,7 @@ void devpts_pty_kill(struct inode *inode) | |||
| 667 | dput(dentry); /* d_alloc_name() in devpts_pty_new() */ | 667 | dput(dentry); /* d_alloc_name() in devpts_pty_new() */ |
| 668 | dput(dentry); /* d_find_alias above */ | 668 | dput(dentry); /* d_find_alias above */ |
| 669 | 669 | ||
| 670 | mutex_unlock(&root->d_inode->i_mutex); | 670 | mutex_unlock(&d_inode(root)->i_mutex); |
| 671 | } | 671 | } |
| 672 | 672 | ||
| 673 | static int __init init_devpts_fs(void) | 673 | static int __init init_devpts_fs(void) |
diff --git a/fs/direct-io.c b/fs/direct-io.c index c3b560b24a46..745d2342651a 100644 --- a/fs/direct-io.c +++ b/fs/direct-io.c | |||
| @@ -253,7 +253,9 @@ static ssize_t dio_complete(struct dio *dio, loff_t offset, ssize_t ret, | |||
| 253 | if (dio->end_io && dio->result) | 253 | if (dio->end_io && dio->result) |
| 254 | dio->end_io(dio->iocb, offset, transferred, dio->private); | 254 | dio->end_io(dio->iocb, offset, transferred, dio->private); |
| 255 | 255 | ||
| 256 | inode_dio_done(dio->inode); | 256 | if (!(dio->flags & DIO_SKIP_DIO_COUNT)) |
| 257 | inode_dio_end(dio->inode); | ||
| 258 | |||
| 257 | if (is_async) { | 259 | if (is_async) { |
| 258 | if (dio->rw & WRITE) { | 260 | if (dio->rw & WRITE) { |
| 259 | int err; | 261 | int err; |
| @@ -1195,7 +1197,8 @@ do_blockdev_direct_IO(struct kiocb *iocb, struct inode *inode, | |||
| 1195 | /* | 1197 | /* |
| 1196 | * Will be decremented at I/O completion time. | 1198 | * Will be decremented at I/O completion time. |
| 1197 | */ | 1199 | */ |
| 1198 | atomic_inc(&inode->i_dio_count); | 1200 | if (!(dio->flags & DIO_SKIP_DIO_COUNT)) |
| 1201 | inode_dio_begin(inode); | ||
| 1199 | 1202 | ||
| 1200 | retval = 0; | 1203 | retval = 0; |
| 1201 | sdio.blkbits = blkbits; | 1204 | sdio.blkbits = blkbits; |
diff --git a/fs/ecryptfs/crypto.c b/fs/ecryptfs/crypto.c index 719e1ce1c609..97315f2f6816 100644 --- a/fs/ecryptfs/crypto.c +++ b/fs/ecryptfs/crypto.c | |||
| @@ -1326,7 +1326,7 @@ static int ecryptfs_read_headers_virt(char *page_virt, | |||
| 1326 | if (rc) | 1326 | if (rc) |
| 1327 | goto out; | 1327 | goto out; |
| 1328 | if (!(crypt_stat->flags & ECRYPTFS_I_SIZE_INITIALIZED)) | 1328 | if (!(crypt_stat->flags & ECRYPTFS_I_SIZE_INITIALIZED)) |
| 1329 | ecryptfs_i_size_init(page_virt, ecryptfs_dentry->d_inode); | 1329 | ecryptfs_i_size_init(page_virt, d_inode(ecryptfs_dentry)); |
| 1330 | offset += MAGIC_ECRYPTFS_MARKER_SIZE_BYTES; | 1330 | offset += MAGIC_ECRYPTFS_MARKER_SIZE_BYTES; |
| 1331 | rc = ecryptfs_process_flags(crypt_stat, (page_virt + offset), | 1331 | rc = ecryptfs_process_flags(crypt_stat, (page_virt + offset), |
| 1332 | &bytes_read); | 1332 | &bytes_read); |
| @@ -1425,7 +1425,7 @@ int ecryptfs_read_metadata(struct dentry *ecryptfs_dentry) | |||
| 1425 | { | 1425 | { |
| 1426 | int rc; | 1426 | int rc; |
| 1427 | char *page_virt; | 1427 | char *page_virt; |
| 1428 | struct inode *ecryptfs_inode = ecryptfs_dentry->d_inode; | 1428 | struct inode *ecryptfs_inode = d_inode(ecryptfs_dentry); |
| 1429 | struct ecryptfs_crypt_stat *crypt_stat = | 1429 | struct ecryptfs_crypt_stat *crypt_stat = |
| 1430 | &ecryptfs_inode_to_private(ecryptfs_inode)->crypt_stat; | 1430 | &ecryptfs_inode_to_private(ecryptfs_inode)->crypt_stat; |
| 1431 | struct ecryptfs_mount_crypt_stat *mount_crypt_stat = | 1431 | struct ecryptfs_mount_crypt_stat *mount_crypt_stat = |
diff --git a/fs/ecryptfs/dentry.c b/fs/ecryptfs/dentry.c index 4000f6b3a750..8db0b464483f 100644 --- a/fs/ecryptfs/dentry.c +++ b/fs/ecryptfs/dentry.c | |||
| @@ -54,11 +54,11 @@ static int ecryptfs_d_revalidate(struct dentry *dentry, unsigned int flags) | |||
| 54 | return -ECHILD; | 54 | return -ECHILD; |
| 55 | 55 | ||
| 56 | rc = lower_dentry->d_op->d_revalidate(lower_dentry, flags); | 56 | rc = lower_dentry->d_op->d_revalidate(lower_dentry, flags); |
| 57 | if (dentry->d_inode) { | 57 | if (d_really_is_positive(dentry)) { |
| 58 | struct inode *lower_inode = | 58 | struct inode *lower_inode = |
| 59 | ecryptfs_inode_to_lower(dentry->d_inode); | 59 | ecryptfs_inode_to_lower(d_inode(dentry)); |
| 60 | 60 | ||
| 61 | fsstack_copy_attr_all(dentry->d_inode, lower_inode); | 61 | fsstack_copy_attr_all(d_inode(dentry), lower_inode); |
| 62 | } | 62 | } |
| 63 | return rc; | 63 | return rc; |
| 64 | } | 64 | } |
diff --git a/fs/ecryptfs/file.c b/fs/ecryptfs/file.c index a65786e26b05..72afcc629d7b 100644 --- a/fs/ecryptfs/file.c +++ b/fs/ecryptfs/file.c | |||
| @@ -130,7 +130,7 @@ struct kmem_cache *ecryptfs_file_info_cache; | |||
| 130 | 130 | ||
| 131 | static int read_or_initialize_metadata(struct dentry *dentry) | 131 | static int read_or_initialize_metadata(struct dentry *dentry) |
| 132 | { | 132 | { |
| 133 | struct inode *inode = dentry->d_inode; | 133 | struct inode *inode = d_inode(dentry); |
| 134 | struct ecryptfs_mount_crypt_stat *mount_crypt_stat; | 134 | struct ecryptfs_mount_crypt_stat *mount_crypt_stat; |
| 135 | struct ecryptfs_crypt_stat *crypt_stat; | 135 | struct ecryptfs_crypt_stat *crypt_stat; |
| 136 | int rc; | 136 | int rc; |
diff --git a/fs/ecryptfs/inode.c b/fs/ecryptfs/inode.c index b08b5187f662..fc850b55db67 100644 --- a/fs/ecryptfs/inode.c +++ b/fs/ecryptfs/inode.c | |||
| @@ -41,13 +41,13 @@ static struct dentry *lock_parent(struct dentry *dentry) | |||
| 41 | struct dentry *dir; | 41 | struct dentry *dir; |
| 42 | 42 | ||
| 43 | dir = dget_parent(dentry); | 43 | dir = dget_parent(dentry); |
| 44 | mutex_lock_nested(&(dir->d_inode->i_mutex), I_MUTEX_PARENT); | 44 | mutex_lock_nested(&(d_inode(dir)->i_mutex), I_MUTEX_PARENT); |
| 45 | return dir; | 45 | return dir; |
| 46 | } | 46 | } |
| 47 | 47 | ||
| 48 | static void unlock_dir(struct dentry *dir) | 48 | static void unlock_dir(struct dentry *dir) |
| 49 | { | 49 | { |
| 50 | mutex_unlock(&dir->d_inode->i_mutex); | 50 | mutex_unlock(&d_inode(dir)->i_mutex); |
| 51 | dput(dir); | 51 | dput(dir); |
| 52 | } | 52 | } |
| 53 | 53 | ||
| @@ -131,7 +131,7 @@ struct inode *ecryptfs_get_inode(struct inode *lower_inode, | |||
| 131 | static int ecryptfs_interpose(struct dentry *lower_dentry, | 131 | static int ecryptfs_interpose(struct dentry *lower_dentry, |
| 132 | struct dentry *dentry, struct super_block *sb) | 132 | struct dentry *dentry, struct super_block *sb) |
| 133 | { | 133 | { |
| 134 | struct inode *inode = ecryptfs_get_inode(lower_dentry->d_inode, sb); | 134 | struct inode *inode = ecryptfs_get_inode(d_inode(lower_dentry), sb); |
| 135 | 135 | ||
| 136 | if (IS_ERR(inode)) | 136 | if (IS_ERR(inode)) |
| 137 | return PTR_ERR(inode); | 137 | return PTR_ERR(inode); |
| @@ -189,21 +189,21 @@ ecryptfs_do_create(struct inode *directory_inode, | |||
| 189 | 189 | ||
| 190 | lower_dentry = ecryptfs_dentry_to_lower(ecryptfs_dentry); | 190 | lower_dentry = ecryptfs_dentry_to_lower(ecryptfs_dentry); |
| 191 | lower_dir_dentry = lock_parent(lower_dentry); | 191 | lower_dir_dentry = lock_parent(lower_dentry); |
| 192 | rc = vfs_create(lower_dir_dentry->d_inode, lower_dentry, mode, true); | 192 | rc = vfs_create(d_inode(lower_dir_dentry), lower_dentry, mode, true); |
| 193 | if (rc) { | 193 | if (rc) { |
| 194 | printk(KERN_ERR "%s: Failure to create dentry in lower fs; " | 194 | printk(KERN_ERR "%s: Failure to create dentry in lower fs; " |
| 195 | "rc = [%d]\n", __func__, rc); | 195 | "rc = [%d]\n", __func__, rc); |
| 196 | inode = ERR_PTR(rc); | 196 | inode = ERR_PTR(rc); |
| 197 | goto out_lock; | 197 | goto out_lock; |
| 198 | } | 198 | } |
| 199 | inode = __ecryptfs_get_inode(lower_dentry->d_inode, | 199 | inode = __ecryptfs_get_inode(d_inode(lower_dentry), |
| 200 | directory_inode->i_sb); | 200 | directory_inode->i_sb); |
| 201 | if (IS_ERR(inode)) { | 201 | if (IS_ERR(inode)) { |
| 202 | vfs_unlink(lower_dir_dentry->d_inode, lower_dentry, NULL); | 202 | vfs_unlink(d_inode(lower_dir_dentry), lower_dentry, NULL); |
| 203 | goto out_lock; | 203 | goto out_lock; |
| 204 | } | 204 | } |
| 205 | fsstack_copy_attr_times(directory_inode, lower_dir_dentry->d_inode); | 205 | fsstack_copy_attr_times(directory_inode, d_inode(lower_dir_dentry)); |
| 206 | fsstack_copy_inode_size(directory_inode, lower_dir_dentry->d_inode); | 206 | fsstack_copy_inode_size(directory_inode, d_inode(lower_dir_dentry)); |
| 207 | out_lock: | 207 | out_lock: |
| 208 | unlock_dir(lower_dir_dentry); | 208 | unlock_dir(lower_dir_dentry); |
| 209 | return inode; | 209 | return inode; |
| @@ -332,7 +332,7 @@ static int ecryptfs_lookup_interpose(struct dentry *dentry, | |||
| 332 | struct dentry *lower_dentry, | 332 | struct dentry *lower_dentry, |
| 333 | struct inode *dir_inode) | 333 | struct inode *dir_inode) |
| 334 | { | 334 | { |
| 335 | struct inode *inode, *lower_inode = lower_dentry->d_inode; | 335 | struct inode *inode, *lower_inode = d_inode(lower_dentry); |
| 336 | struct ecryptfs_dentry_info *dentry_info; | 336 | struct ecryptfs_dentry_info *dentry_info; |
| 337 | struct vfsmount *lower_mnt; | 337 | struct vfsmount *lower_mnt; |
| 338 | int rc = 0; | 338 | int rc = 0; |
| @@ -347,14 +347,14 @@ static int ecryptfs_lookup_interpose(struct dentry *dentry, | |||
| 347 | } | 347 | } |
| 348 | 348 | ||
| 349 | lower_mnt = mntget(ecryptfs_dentry_to_lower_mnt(dentry->d_parent)); | 349 | lower_mnt = mntget(ecryptfs_dentry_to_lower_mnt(dentry->d_parent)); |
| 350 | fsstack_copy_attr_atime(dir_inode, lower_dentry->d_parent->d_inode); | 350 | fsstack_copy_attr_atime(dir_inode, d_inode(lower_dentry->d_parent)); |
| 351 | BUG_ON(!d_count(lower_dentry)); | 351 | BUG_ON(!d_count(lower_dentry)); |
| 352 | 352 | ||
| 353 | ecryptfs_set_dentry_private(dentry, dentry_info); | 353 | ecryptfs_set_dentry_private(dentry, dentry_info); |
| 354 | dentry_info->lower_path.mnt = lower_mnt; | 354 | dentry_info->lower_path.mnt = lower_mnt; |
| 355 | dentry_info->lower_path.dentry = lower_dentry; | 355 | dentry_info->lower_path.dentry = lower_dentry; |
| 356 | 356 | ||
| 357 | if (!lower_dentry->d_inode) { | 357 | if (d_really_is_negative(lower_dentry)) { |
| 358 | /* We want to add because we couldn't find in lower */ | 358 | /* We want to add because we couldn't find in lower */ |
| 359 | d_add(dentry, NULL); | 359 | d_add(dentry, NULL); |
| 360 | return 0; | 360 | return 0; |
| @@ -400,11 +400,11 @@ static struct dentry *ecryptfs_lookup(struct inode *ecryptfs_dir_inode, | |||
| 400 | int rc = 0; | 400 | int rc = 0; |
| 401 | 401 | ||
| 402 | lower_dir_dentry = ecryptfs_dentry_to_lower(ecryptfs_dentry->d_parent); | 402 | lower_dir_dentry = ecryptfs_dentry_to_lower(ecryptfs_dentry->d_parent); |
| 403 | mutex_lock(&lower_dir_dentry->d_inode->i_mutex); | 403 | mutex_lock(&d_inode(lower_dir_dentry)->i_mutex); |
| 404 | lower_dentry = lookup_one_len(ecryptfs_dentry->d_name.name, | 404 | lower_dentry = lookup_one_len(ecryptfs_dentry->d_name.name, |
| 405 | lower_dir_dentry, | 405 | lower_dir_dentry, |
| 406 | ecryptfs_dentry->d_name.len); | 406 | ecryptfs_dentry->d_name.len); |
| 407 | mutex_unlock(&lower_dir_dentry->d_inode->i_mutex); | 407 | mutex_unlock(&d_inode(lower_dir_dentry)->i_mutex); |
| 408 | if (IS_ERR(lower_dentry)) { | 408 | if (IS_ERR(lower_dentry)) { |
| 409 | rc = PTR_ERR(lower_dentry); | 409 | rc = PTR_ERR(lower_dentry); |
| 410 | ecryptfs_printk(KERN_DEBUG, "%s: lookup_one_len() returned " | 410 | ecryptfs_printk(KERN_DEBUG, "%s: lookup_one_len() returned " |
| @@ -412,7 +412,7 @@ static struct dentry *ecryptfs_lookup(struct inode *ecryptfs_dir_inode, | |||
| 412 | ecryptfs_dentry); | 412 | ecryptfs_dentry); |
| 413 | goto out; | 413 | goto out; |
| 414 | } | 414 | } |
| 415 | if (lower_dentry->d_inode) | 415 | if (d_really_is_positive(lower_dentry)) |
| 416 | goto interpose; | 416 | goto interpose; |
| 417 | mount_crypt_stat = &ecryptfs_superblock_to_private( | 417 | mount_crypt_stat = &ecryptfs_superblock_to_private( |
| 418 | ecryptfs_dentry->d_sb)->mount_crypt_stat; | 418 | ecryptfs_dentry->d_sb)->mount_crypt_stat; |
| @@ -429,11 +429,11 @@ static struct dentry *ecryptfs_lookup(struct inode *ecryptfs_dir_inode, | |||
| 429 | "filename; rc = [%d]\n", __func__, rc); | 429 | "filename; rc = [%d]\n", __func__, rc); |
| 430 | goto out; | 430 | goto out; |
| 431 | } | 431 | } |
| 432 | mutex_lock(&lower_dir_dentry->d_inode->i_mutex); | 432 | mutex_lock(&d_inode(lower_dir_dentry)->i_mutex); |
| 433 | lower_dentry = lookup_one_len(encrypted_and_encoded_name, | 433 | lower_dentry = lookup_one_len(encrypted_and_encoded_name, |
| 434 | lower_dir_dentry, | 434 | lower_dir_dentry, |
| 435 | encrypted_and_encoded_name_size); | 435 | encrypted_and_encoded_name_size); |
| 436 | mutex_unlock(&lower_dir_dentry->d_inode->i_mutex); | 436 | mutex_unlock(&d_inode(lower_dir_dentry)->i_mutex); |
| 437 | if (IS_ERR(lower_dentry)) { | 437 | if (IS_ERR(lower_dentry)) { |
| 438 | rc = PTR_ERR(lower_dentry); | 438 | rc = PTR_ERR(lower_dentry); |
| 439 | ecryptfs_printk(KERN_DEBUG, "%s: lookup_one_len() returned " | 439 | ecryptfs_printk(KERN_DEBUG, "%s: lookup_one_len() returned " |
| @@ -458,24 +458,24 @@ static int ecryptfs_link(struct dentry *old_dentry, struct inode *dir, | |||
| 458 | u64 file_size_save; | 458 | u64 file_size_save; |
| 459 | int rc; | 459 | int rc; |
| 460 | 460 | ||
| 461 | file_size_save = i_size_read(old_dentry->d_inode); | 461 | file_size_save = i_size_read(d_inode(old_dentry)); |
| 462 | lower_old_dentry = ecryptfs_dentry_to_lower(old_dentry); | 462 | lower_old_dentry = ecryptfs_dentry_to_lower(old_dentry); |
| 463 | lower_new_dentry = ecryptfs_dentry_to_lower(new_dentry); | 463 | lower_new_dentry = ecryptfs_dentry_to_lower(new_dentry); |
| 464 | dget(lower_old_dentry); | 464 | dget(lower_old_dentry); |
| 465 | dget(lower_new_dentry); | 465 | dget(lower_new_dentry); |
| 466 | lower_dir_dentry = lock_parent(lower_new_dentry); | 466 | lower_dir_dentry = lock_parent(lower_new_dentry); |
| 467 | rc = vfs_link(lower_old_dentry, lower_dir_dentry->d_inode, | 467 | rc = vfs_link(lower_old_dentry, d_inode(lower_dir_dentry), |
| 468 | lower_new_dentry, NULL); | 468 | lower_new_dentry, NULL); |
| 469 | if (rc || !lower_new_dentry->d_inode) | 469 | if (rc || d_really_is_negative(lower_new_dentry)) |
| 470 | goto out_lock; | 470 | goto out_lock; |
| 471 | rc = ecryptfs_interpose(lower_new_dentry, new_dentry, dir->i_sb); | 471 | rc = ecryptfs_interpose(lower_new_dentry, new_dentry, dir->i_sb); |
| 472 | if (rc) | 472 | if (rc) |
| 473 | goto out_lock; | 473 | goto out_lock; |
| 474 | fsstack_copy_attr_times(dir, lower_dir_dentry->d_inode); | 474 | fsstack_copy_attr_times(dir, d_inode(lower_dir_dentry)); |
| 475 | fsstack_copy_inode_size(dir, lower_dir_dentry->d_inode); | 475 | fsstack_copy_inode_size(dir, d_inode(lower_dir_dentry)); |
| 476 | set_nlink(old_dentry->d_inode, | 476 | set_nlink(d_inode(old_dentry), |
| 477 | ecryptfs_inode_to_lower(old_dentry->d_inode)->i_nlink); | 477 | ecryptfs_inode_to_lower(d_inode(old_dentry))->i_nlink); |
| 478 | i_size_write(new_dentry->d_inode, file_size_save); | 478 | i_size_write(d_inode(new_dentry), file_size_save); |
| 479 | out_lock: | 479 | out_lock: |
| 480 | unlock_dir(lower_dir_dentry); | 480 | unlock_dir(lower_dir_dentry); |
| 481 | dput(lower_new_dentry); | 481 | dput(lower_new_dentry); |
| @@ -485,7 +485,7 @@ out_lock: | |||
| 485 | 485 | ||
| 486 | static int ecryptfs_unlink(struct inode *dir, struct dentry *dentry) | 486 | static int ecryptfs_unlink(struct inode *dir, struct dentry *dentry) |
| 487 | { | 487 | { |
| 488 | return ecryptfs_do_unlink(dir, dentry, dentry->d_inode); | 488 | return ecryptfs_do_unlink(dir, dentry, d_inode(dentry)); |
| 489 | } | 489 | } |
| 490 | 490 | ||
| 491 | static int ecryptfs_symlink(struct inode *dir, struct dentry *dentry, | 491 | static int ecryptfs_symlink(struct inode *dir, struct dentry *dentry, |
| @@ -510,20 +510,20 @@ static int ecryptfs_symlink(struct inode *dir, struct dentry *dentry, | |||
| 510 | strlen(symname)); | 510 | strlen(symname)); |
| 511 | if (rc) | 511 | if (rc) |
| 512 | goto out_lock; | 512 | goto out_lock; |
| 513 | rc = vfs_symlink(lower_dir_dentry->d_inode, lower_dentry, | 513 | rc = vfs_symlink(d_inode(lower_dir_dentry), lower_dentry, |
| 514 | encoded_symname); | 514 | encoded_symname); |
| 515 | kfree(encoded_symname); | 515 | kfree(encoded_symname); |
| 516 | if (rc || !lower_dentry->d_inode) | 516 | if (rc || d_really_is_negative(lower_dentry)) |
| 517 | goto out_lock; | 517 | goto out_lock; |
| 518 | rc = ecryptfs_interpose(lower_dentry, dentry, dir->i_sb); | 518 | rc = ecryptfs_interpose(lower_dentry, dentry, dir->i_sb); |
| 519 | if (rc) | 519 | if (rc) |
| 520 | goto out_lock; | 520 | goto out_lock; |
| 521 | fsstack_copy_attr_times(dir, lower_dir_dentry->d_inode); | 521 | fsstack_copy_attr_times(dir, d_inode(lower_dir_dentry)); |
| 522 | fsstack_copy_inode_size(dir, lower_dir_dentry->d_inode); | 522 | fsstack_copy_inode_size(dir, d_inode(lower_dir_dentry)); |
| 523 | out_lock: | 523 | out_lock: |
| 524 | unlock_dir(lower_dir_dentry); | 524 | unlock_dir(lower_dir_dentry); |
| 525 | dput(lower_dentry); | 525 | dput(lower_dentry); |
| 526 | if (!dentry->d_inode) | 526 | if (d_really_is_negative(dentry)) |
| 527 | d_drop(dentry); | 527 | d_drop(dentry); |
| 528 | return rc; | 528 | return rc; |
| 529 | } | 529 | } |
| @@ -536,18 +536,18 @@ static int ecryptfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode | |||
| 536 | 536 | ||
| 537 | lower_dentry = ecryptfs_dentry_to_lower(dentry); | 537 | lower_dentry = ecryptfs_dentry_to_lower(dentry); |
| 538 | lower_dir_dentry = lock_parent(lower_dentry); | 538 | lower_dir_dentry = lock_parent(lower_dentry); |
| 539 | rc = vfs_mkdir(lower_dir_dentry->d_inode, lower_dentry, mode); | 539 | rc = vfs_mkdir(d_inode(lower_dir_dentry), lower_dentry, mode); |
| 540 | if (rc || !lower_dentry->d_inode) | 540 | if (rc || d_really_is_negative(lower_dentry)) |
| 541 | goto out; | 541 | goto out; |
| 542 | rc = ecryptfs_interpose(lower_dentry, dentry, dir->i_sb); | 542 | rc = ecryptfs_interpose(lower_dentry, dentry, dir->i_sb); |
| 543 | if (rc) | 543 | if (rc) |
| 544 | goto out; | 544 | goto out; |
| 545 | fsstack_copy_attr_times(dir, lower_dir_dentry->d_inode); | 545 | fsstack_copy_attr_times(dir, d_inode(lower_dir_dentry)); |
| 546 | fsstack_copy_inode_size(dir, lower_dir_dentry->d_inode); | 546 | fsstack_copy_inode_size(dir, d_inode(lower_dir_dentry)); |
| 547 | set_nlink(dir, lower_dir_dentry->d_inode->i_nlink); | 547 | set_nlink(dir, d_inode(lower_dir_dentry)->i_nlink); |
| 548 | out: | 548 | out: |
| 549 | unlock_dir(lower_dir_dentry); | 549 | unlock_dir(lower_dir_dentry); |
| 550 | if (!dentry->d_inode) | 550 | if (d_really_is_negative(dentry)) |
| 551 | d_drop(dentry); | 551 | d_drop(dentry); |
| 552 | return rc; | 552 | return rc; |
| 553 | } | 553 | } |
| @@ -562,12 +562,12 @@ static int ecryptfs_rmdir(struct inode *dir, struct dentry *dentry) | |||
| 562 | dget(dentry); | 562 | dget(dentry); |
| 563 | lower_dir_dentry = lock_parent(lower_dentry); | 563 | lower_dir_dentry = lock_parent(lower_dentry); |
| 564 | dget(lower_dentry); | 564 | dget(lower_dentry); |
| 565 | rc = vfs_rmdir(lower_dir_dentry->d_inode, lower_dentry); | 565 | rc = vfs_rmdir(d_inode(lower_dir_dentry), lower_dentry); |
| 566 | dput(lower_dentry); | 566 | dput(lower_dentry); |
| 567 | if (!rc && dentry->d_inode) | 567 | if (!rc && d_really_is_positive(dentry)) |
| 568 | clear_nlink(dentry->d_inode); | 568 | clear_nlink(d_inode(dentry)); |
| 569 | fsstack_copy_attr_times(dir, lower_dir_dentry->d_inode); | 569 | fsstack_copy_attr_times(dir, d_inode(lower_dir_dentry)); |
| 570 | set_nlink(dir, lower_dir_dentry->d_inode->i_nlink); | 570 | set_nlink(dir, d_inode(lower_dir_dentry)->i_nlink); |
| 571 | unlock_dir(lower_dir_dentry); | 571 | unlock_dir(lower_dir_dentry); |
| 572 | if (!rc) | 572 | if (!rc) |
| 573 | d_drop(dentry); | 573 | d_drop(dentry); |
| @@ -584,17 +584,17 @@ ecryptfs_mknod(struct inode *dir, struct dentry *dentry, umode_t mode, dev_t dev | |||
| 584 | 584 | ||
| 585 | lower_dentry = ecryptfs_dentry_to_lower(dentry); | 585 | lower_dentry = ecryptfs_dentry_to_lower(dentry); |
| 586 | lower_dir_dentry = lock_parent(lower_dentry); | 586 | lower_dir_dentry = lock_parent(lower_dentry); |
| 587 | rc = vfs_mknod(lower_dir_dentry->d_inode, lower_dentry, mode, dev); | 587 | rc = vfs_mknod(d_inode(lower_dir_dentry), lower_dentry, mode, dev); |
| 588 | if (rc || !lower_dentry->d_inode) | 588 | if (rc || d_really_is_negative(lower_dentry)) |
| 589 | goto out; | 589 | goto out; |
| 590 | rc = ecryptfs_interpose(lower_dentry, dentry, dir->i_sb); | 590 | rc = ecryptfs_interpose(lower_dentry, dentry, dir->i_sb); |
| 591 | if (rc) | 591 | if (rc) |
| 592 | goto out; | 592 | goto out; |
| 593 | fsstack_copy_attr_times(dir, lower_dir_dentry->d_inode); | 593 | fsstack_copy_attr_times(dir, d_inode(lower_dir_dentry)); |
| 594 | fsstack_copy_inode_size(dir, lower_dir_dentry->d_inode); | 594 | fsstack_copy_inode_size(dir, d_inode(lower_dir_dentry)); |
| 595 | out: | 595 | out: |
| 596 | unlock_dir(lower_dir_dentry); | 596 | unlock_dir(lower_dir_dentry); |
| 597 | if (!dentry->d_inode) | 597 | if (d_really_is_negative(dentry)) |
| 598 | d_drop(dentry); | 598 | d_drop(dentry); |
| 599 | return rc; | 599 | return rc; |
| 600 | } | 600 | } |
| @@ -617,7 +617,7 @@ ecryptfs_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
| 617 | dget(lower_new_dentry); | 617 | dget(lower_new_dentry); |
| 618 | lower_old_dir_dentry = dget_parent(lower_old_dentry); | 618 | lower_old_dir_dentry = dget_parent(lower_old_dentry); |
| 619 | lower_new_dir_dentry = dget_parent(lower_new_dentry); | 619 | lower_new_dir_dentry = dget_parent(lower_new_dentry); |
| 620 | target_inode = new_dentry->d_inode; | 620 | target_inode = d_inode(new_dentry); |
| 621 | trap = lock_rename(lower_old_dir_dentry, lower_new_dir_dentry); | 621 | trap = lock_rename(lower_old_dir_dentry, lower_new_dir_dentry); |
| 622 | /* source should not be ancestor of target */ | 622 | /* source should not be ancestor of target */ |
| 623 | if (trap == lower_old_dentry) { | 623 | if (trap == lower_old_dentry) { |
| @@ -629,17 +629,17 @@ ecryptfs_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
| 629 | rc = -ENOTEMPTY; | 629 | rc = -ENOTEMPTY; |
| 630 | goto out_lock; | 630 | goto out_lock; |
| 631 | } | 631 | } |
| 632 | rc = vfs_rename(lower_old_dir_dentry->d_inode, lower_old_dentry, | 632 | rc = vfs_rename(d_inode(lower_old_dir_dentry), lower_old_dentry, |
| 633 | lower_new_dir_dentry->d_inode, lower_new_dentry, | 633 | d_inode(lower_new_dir_dentry), lower_new_dentry, |
| 634 | NULL, 0); | 634 | NULL, 0); |
| 635 | if (rc) | 635 | if (rc) |
| 636 | goto out_lock; | 636 | goto out_lock; |
| 637 | if (target_inode) | 637 | if (target_inode) |
| 638 | fsstack_copy_attr_all(target_inode, | 638 | fsstack_copy_attr_all(target_inode, |
| 639 | ecryptfs_inode_to_lower(target_inode)); | 639 | ecryptfs_inode_to_lower(target_inode)); |
| 640 | fsstack_copy_attr_all(new_dir, lower_new_dir_dentry->d_inode); | 640 | fsstack_copy_attr_all(new_dir, d_inode(lower_new_dir_dentry)); |
| 641 | if (new_dir != old_dir) | 641 | if (new_dir != old_dir) |
| 642 | fsstack_copy_attr_all(old_dir, lower_old_dir_dentry->d_inode); | 642 | fsstack_copy_attr_all(old_dir, d_inode(lower_old_dir_dentry)); |
| 643 | out_lock: | 643 | out_lock: |
| 644 | unlock_rename(lower_old_dir_dentry, lower_new_dir_dentry); | 644 | unlock_rename(lower_old_dir_dentry, lower_new_dir_dentry); |
| 645 | dput(lower_new_dir_dentry); | 645 | dput(lower_new_dir_dentry); |
| @@ -662,7 +662,7 @@ static char *ecryptfs_readlink_lower(struct dentry *dentry, size_t *bufsiz) | |||
| 662 | return ERR_PTR(-ENOMEM); | 662 | return ERR_PTR(-ENOMEM); |
| 663 | old_fs = get_fs(); | 663 | old_fs = get_fs(); |
| 664 | set_fs(get_ds()); | 664 | set_fs(get_ds()); |
| 665 | rc = lower_dentry->d_inode->i_op->readlink(lower_dentry, | 665 | rc = d_inode(lower_dentry)->i_op->readlink(lower_dentry, |
| 666 | (char __user *)lower_buf, | 666 | (char __user *)lower_buf, |
| 667 | PATH_MAX); | 667 | PATH_MAX); |
| 668 | set_fs(old_fs); | 668 | set_fs(old_fs); |
| @@ -681,8 +681,8 @@ static void *ecryptfs_follow_link(struct dentry *dentry, struct nameidata *nd) | |||
| 681 | char *buf = ecryptfs_readlink_lower(dentry, &len); | 681 | char *buf = ecryptfs_readlink_lower(dentry, &len); |
| 682 | if (IS_ERR(buf)) | 682 | if (IS_ERR(buf)) |
| 683 | goto out; | 683 | goto out; |
| 684 | fsstack_copy_attr_atime(dentry->d_inode, | 684 | fsstack_copy_attr_atime(d_inode(dentry), |
| 685 | ecryptfs_dentry_to_lower(dentry)->d_inode); | 685 | d_inode(ecryptfs_dentry_to_lower(dentry))); |
| 686 | buf[len] = '\0'; | 686 | buf[len] = '\0'; |
| 687 | out: | 687 | out: |
| 688 | nd_set_link(nd, buf); | 688 | nd_set_link(nd, buf); |
| @@ -738,7 +738,7 @@ static int truncate_upper(struct dentry *dentry, struct iattr *ia, | |||
| 738 | struct iattr *lower_ia) | 738 | struct iattr *lower_ia) |
| 739 | { | 739 | { |
| 740 | int rc = 0; | 740 | int rc = 0; |
| 741 | struct inode *inode = dentry->d_inode; | 741 | struct inode *inode = d_inode(dentry); |
| 742 | struct ecryptfs_crypt_stat *crypt_stat; | 742 | struct ecryptfs_crypt_stat *crypt_stat; |
| 743 | loff_t i_size = i_size_read(inode); | 743 | loff_t i_size = i_size_read(inode); |
| 744 | loff_t lower_size_before_truncate; | 744 | loff_t lower_size_before_truncate; |
| @@ -751,7 +751,7 @@ static int truncate_upper(struct dentry *dentry, struct iattr *ia, | |||
| 751 | rc = ecryptfs_get_lower_file(dentry, inode); | 751 | rc = ecryptfs_get_lower_file(dentry, inode); |
| 752 | if (rc) | 752 | if (rc) |
| 753 | return rc; | 753 | return rc; |
| 754 | crypt_stat = &ecryptfs_inode_to_private(dentry->d_inode)->crypt_stat; | 754 | crypt_stat = &ecryptfs_inode_to_private(d_inode(dentry))->crypt_stat; |
| 755 | /* Switch on growing or shrinking file */ | 755 | /* Switch on growing or shrinking file */ |
| 756 | if (ia->ia_size > i_size) { | 756 | if (ia->ia_size > i_size) { |
| 757 | char zero[] = { 0x00 }; | 757 | char zero[] = { 0x00 }; |
| @@ -858,7 +858,7 @@ int ecryptfs_truncate(struct dentry *dentry, loff_t new_length) | |||
| 858 | struct iattr lower_ia = { .ia_valid = 0 }; | 858 | struct iattr lower_ia = { .ia_valid = 0 }; |
| 859 | int rc; | 859 | int rc; |
| 860 | 860 | ||
| 861 | rc = ecryptfs_inode_newsize_ok(dentry->d_inode, new_length); | 861 | rc = ecryptfs_inode_newsize_ok(d_inode(dentry), new_length); |
| 862 | if (rc) | 862 | if (rc) |
| 863 | return rc; | 863 | return rc; |
| 864 | 864 | ||
| @@ -866,9 +866,9 @@ int ecryptfs_truncate(struct dentry *dentry, loff_t new_length) | |||
| 866 | if (!rc && lower_ia.ia_valid & ATTR_SIZE) { | 866 | if (!rc && lower_ia.ia_valid & ATTR_SIZE) { |
| 867 | struct dentry *lower_dentry = ecryptfs_dentry_to_lower(dentry); | 867 | struct dentry *lower_dentry = ecryptfs_dentry_to_lower(dentry); |
| 868 | 868 | ||
| 869 | mutex_lock(&lower_dentry->d_inode->i_mutex); | 869 | mutex_lock(&d_inode(lower_dentry)->i_mutex); |
| 870 | rc = notify_change(lower_dentry, &lower_ia, NULL); | 870 | rc = notify_change(lower_dentry, &lower_ia, NULL); |
| 871 | mutex_unlock(&lower_dentry->d_inode->i_mutex); | 871 | mutex_unlock(&d_inode(lower_dentry)->i_mutex); |
| 872 | } | 872 | } |
| 873 | return rc; | 873 | return rc; |
| 874 | } | 874 | } |
| @@ -900,10 +900,10 @@ static int ecryptfs_setattr(struct dentry *dentry, struct iattr *ia) | |||
| 900 | struct inode *lower_inode; | 900 | struct inode *lower_inode; |
| 901 | struct ecryptfs_crypt_stat *crypt_stat; | 901 | struct ecryptfs_crypt_stat *crypt_stat; |
| 902 | 902 | ||
| 903 | crypt_stat = &ecryptfs_inode_to_private(dentry->d_inode)->crypt_stat; | 903 | crypt_stat = &ecryptfs_inode_to_private(d_inode(dentry))->crypt_stat; |
| 904 | if (!(crypt_stat->flags & ECRYPTFS_STRUCT_INITIALIZED)) | 904 | if (!(crypt_stat->flags & ECRYPTFS_STRUCT_INITIALIZED)) |
| 905 | ecryptfs_init_crypt_stat(crypt_stat); | 905 | ecryptfs_init_crypt_stat(crypt_stat); |
| 906 | inode = dentry->d_inode; | 906 | inode = d_inode(dentry); |
| 907 | lower_inode = ecryptfs_inode_to_lower(inode); | 907 | lower_inode = ecryptfs_inode_to_lower(inode); |
| 908 | lower_dentry = ecryptfs_dentry_to_lower(dentry); | 908 | lower_dentry = ecryptfs_dentry_to_lower(dentry); |
| 909 | mutex_lock(&crypt_stat->cs_mutex); | 909 | mutex_lock(&crypt_stat->cs_mutex); |
| @@ -967,9 +967,9 @@ static int ecryptfs_setattr(struct dentry *dentry, struct iattr *ia) | |||
| 967 | if (lower_ia.ia_valid & (ATTR_KILL_SUID | ATTR_KILL_SGID)) | 967 | if (lower_ia.ia_valid & (ATTR_KILL_SUID | ATTR_KILL_SGID)) |
| 968 | lower_ia.ia_valid &= ~ATTR_MODE; | 968 | lower_ia.ia_valid &= ~ATTR_MODE; |
| 969 | 969 | ||
| 970 | mutex_lock(&lower_dentry->d_inode->i_mutex); | 970 | mutex_lock(&d_inode(lower_dentry)->i_mutex); |
| 971 | rc = notify_change(lower_dentry, &lower_ia, NULL); | 971 | rc = notify_change(lower_dentry, &lower_ia, NULL); |
| 972 | mutex_unlock(&lower_dentry->d_inode->i_mutex); | 972 | mutex_unlock(&d_inode(lower_dentry)->i_mutex); |
| 973 | out: | 973 | out: |
| 974 | fsstack_copy_attr_all(inode, lower_inode); | 974 | fsstack_copy_attr_all(inode, lower_inode); |
| 975 | return rc; | 975 | return rc; |
| @@ -983,7 +983,7 @@ static int ecryptfs_getattr_link(struct vfsmount *mnt, struct dentry *dentry, | |||
| 983 | 983 | ||
| 984 | mount_crypt_stat = &ecryptfs_superblock_to_private( | 984 | mount_crypt_stat = &ecryptfs_superblock_to_private( |
| 985 | dentry->d_sb)->mount_crypt_stat; | 985 | dentry->d_sb)->mount_crypt_stat; |
| 986 | generic_fillattr(dentry->d_inode, stat); | 986 | generic_fillattr(d_inode(dentry), stat); |
| 987 | if (mount_crypt_stat->flags & ECRYPTFS_GLOBAL_ENCRYPT_FILENAMES) { | 987 | if (mount_crypt_stat->flags & ECRYPTFS_GLOBAL_ENCRYPT_FILENAMES) { |
| 988 | char *target; | 988 | char *target; |
| 989 | size_t targetsiz; | 989 | size_t targetsiz; |
| @@ -1007,9 +1007,9 @@ static int ecryptfs_getattr(struct vfsmount *mnt, struct dentry *dentry, | |||
| 1007 | 1007 | ||
| 1008 | rc = vfs_getattr(ecryptfs_dentry_to_lower_path(dentry), &lower_stat); | 1008 | rc = vfs_getattr(ecryptfs_dentry_to_lower_path(dentry), &lower_stat); |
| 1009 | if (!rc) { | 1009 | if (!rc) { |
| 1010 | fsstack_copy_attr_all(dentry->d_inode, | 1010 | fsstack_copy_attr_all(d_inode(dentry), |
| 1011 | ecryptfs_inode_to_lower(dentry->d_inode)); | 1011 | ecryptfs_inode_to_lower(d_inode(dentry))); |
| 1012 | generic_fillattr(dentry->d_inode, stat); | 1012 | generic_fillattr(d_inode(dentry), stat); |
| 1013 | stat->blocks = lower_stat.blocks; | 1013 | stat->blocks = lower_stat.blocks; |
| 1014 | } | 1014 | } |
| 1015 | return rc; | 1015 | return rc; |
| @@ -1023,14 +1023,14 @@ ecryptfs_setxattr(struct dentry *dentry, const char *name, const void *value, | |||
| 1023 | struct dentry *lower_dentry; | 1023 | struct dentry *lower_dentry; |
| 1024 | 1024 | ||
| 1025 | lower_dentry = ecryptfs_dentry_to_lower(dentry); | 1025 | lower_dentry = ecryptfs_dentry_to_lower(dentry); |
| 1026 | if (!lower_dentry->d_inode->i_op->setxattr) { | 1026 | if (!d_inode(lower_dentry)->i_op->setxattr) { |
| 1027 | rc = -EOPNOTSUPP; | 1027 | rc = -EOPNOTSUPP; |
| 1028 | goto out; | 1028 | goto out; |
| 1029 | } | 1029 | } |
| 1030 | 1030 | ||
| 1031 | rc = vfs_setxattr(lower_dentry, name, value, size, flags); | 1031 | rc = vfs_setxattr(lower_dentry, name, value, size, flags); |
| 1032 | if (!rc && dentry->d_inode) | 1032 | if (!rc && d_really_is_positive(dentry)) |
| 1033 | fsstack_copy_attr_all(dentry->d_inode, lower_dentry->d_inode); | 1033 | fsstack_copy_attr_all(d_inode(dentry), d_inode(lower_dentry)); |
| 1034 | out: | 1034 | out: |
| 1035 | return rc; | 1035 | return rc; |
| 1036 | } | 1036 | } |
| @@ -1041,14 +1041,14 @@ ecryptfs_getxattr_lower(struct dentry *lower_dentry, const char *name, | |||
| 1041 | { | 1041 | { |
| 1042 | int rc = 0; | 1042 | int rc = 0; |
| 1043 | 1043 | ||
| 1044 | if (!lower_dentry->d_inode->i_op->getxattr) { | 1044 | if (!d_inode(lower_dentry)->i_op->getxattr) { |
| 1045 | rc = -EOPNOTSUPP; | 1045 | rc = -EOPNOTSUPP; |
| 1046 | goto out; | 1046 | goto out; |
| 1047 | } | 1047 | } |
| 1048 | mutex_lock(&lower_dentry->d_inode->i_mutex); | 1048 | mutex_lock(&d_inode(lower_dentry)->i_mutex); |
| 1049 | rc = lower_dentry->d_inode->i_op->getxattr(lower_dentry, name, value, | 1049 | rc = d_inode(lower_dentry)->i_op->getxattr(lower_dentry, name, value, |
| 1050 | size); | 1050 | size); |
| 1051 | mutex_unlock(&lower_dentry->d_inode->i_mutex); | 1051 | mutex_unlock(&d_inode(lower_dentry)->i_mutex); |
| 1052 | out: | 1052 | out: |
| 1053 | return rc; | 1053 | return rc; |
| 1054 | } | 1054 | } |
| @@ -1068,13 +1068,13 @@ ecryptfs_listxattr(struct dentry *dentry, char *list, size_t size) | |||
| 1068 | struct dentry *lower_dentry; | 1068 | struct dentry *lower_dentry; |
| 1069 | 1069 | ||
| 1070 | lower_dentry = ecryptfs_dentry_to_lower(dentry); | 1070 | lower_dentry = ecryptfs_dentry_to_lower(dentry); |
| 1071 | if (!lower_dentry->d_inode->i_op->listxattr) { | 1071 | if (!d_inode(lower_dentry)->i_op->listxattr) { |
| 1072 | rc = -EOPNOTSUPP; | 1072 | rc = -EOPNOTSUPP; |
| 1073 | goto out; | 1073 | goto out; |
| 1074 | } | 1074 | } |
| 1075 | mutex_lock(&lower_dentry->d_inode->i_mutex); | 1075 | mutex_lock(&d_inode(lower_dentry)->i_mutex); |
| 1076 | rc = lower_dentry->d_inode->i_op->listxattr(lower_dentry, list, size); | 1076 | rc = d_inode(lower_dentry)->i_op->listxattr(lower_dentry, list, size); |
| 1077 | mutex_unlock(&lower_dentry->d_inode->i_mutex); | 1077 | mutex_unlock(&d_inode(lower_dentry)->i_mutex); |
| 1078 | out: | 1078 | out: |
| 1079 | return rc; | 1079 | return rc; |
| 1080 | } | 1080 | } |
| @@ -1085,13 +1085,13 @@ static int ecryptfs_removexattr(struct dentry *dentry, const char *name) | |||
| 1085 | struct dentry *lower_dentry; | 1085 | struct dentry *lower_dentry; |
| 1086 | 1086 | ||
| 1087 | lower_dentry = ecryptfs_dentry_to_lower(dentry); | 1087 | lower_dentry = ecryptfs_dentry_to_lower(dentry); |
| 1088 | if (!lower_dentry->d_inode->i_op->removexattr) { | 1088 | if (!d_inode(lower_dentry)->i_op->removexattr) { |
| 1089 | rc = -EOPNOTSUPP; | 1089 | rc = -EOPNOTSUPP; |
| 1090 | goto out; | 1090 | goto out; |
| 1091 | } | 1091 | } |
| 1092 | mutex_lock(&lower_dentry->d_inode->i_mutex); | 1092 | mutex_lock(&d_inode(lower_dentry)->i_mutex); |
| 1093 | rc = lower_dentry->d_inode->i_op->removexattr(lower_dentry, name); | 1093 | rc = d_inode(lower_dentry)->i_op->removexattr(lower_dentry, name); |
| 1094 | mutex_unlock(&lower_dentry->d_inode->i_mutex); | 1094 | mutex_unlock(&d_inode(lower_dentry)->i_mutex); |
| 1095 | out: | 1095 | out: |
| 1096 | return rc; | 1096 | return rc; |
| 1097 | } | 1097 | } |
diff --git a/fs/ecryptfs/kthread.c b/fs/ecryptfs/kthread.c index f1ea610362c6..866bb18efefe 100644 --- a/fs/ecryptfs/kthread.c +++ b/fs/ecryptfs/kthread.c | |||
| @@ -144,7 +144,7 @@ int ecryptfs_privileged_open(struct file **lower_file, | |||
| 144 | /* Corresponding dput() and mntput() are done when the | 144 | /* Corresponding dput() and mntput() are done when the |
| 145 | * lower file is fput() when all eCryptfs files for the inode are | 145 | * lower file is fput() when all eCryptfs files for the inode are |
| 146 | * released. */ | 146 | * released. */ |
| 147 | flags |= IS_RDONLY(lower_dentry->d_inode) ? O_RDONLY : O_RDWR; | 147 | flags |= IS_RDONLY(d_inode(lower_dentry)) ? O_RDONLY : O_RDWR; |
| 148 | (*lower_file) = dentry_open(&req.path, flags, cred); | 148 | (*lower_file) = dentry_open(&req.path, flags, cred); |
| 149 | if (!IS_ERR(*lower_file)) | 149 | if (!IS_ERR(*lower_file)) |
| 150 | goto out; | 150 | goto out; |
diff --git a/fs/ecryptfs/main.c b/fs/ecryptfs/main.c index c095d3264259..4f4d0474bee9 100644 --- a/fs/ecryptfs/main.c +++ b/fs/ecryptfs/main.c | |||
| @@ -546,11 +546,11 @@ static struct dentry *ecryptfs_mount(struct file_system_type *fs_type, int flags | |||
| 546 | goto out_free; | 546 | goto out_free; |
| 547 | } | 547 | } |
| 548 | 548 | ||
| 549 | if (check_ruid && !uid_eq(path.dentry->d_inode->i_uid, current_uid())) { | 549 | if (check_ruid && !uid_eq(d_inode(path.dentry)->i_uid, current_uid())) { |
| 550 | rc = -EPERM; | 550 | rc = -EPERM; |
| 551 | printk(KERN_ERR "Mount of device (uid: %d) not owned by " | 551 | printk(KERN_ERR "Mount of device (uid: %d) not owned by " |
| 552 | "requested user (uid: %d)\n", | 552 | "requested user (uid: %d)\n", |
| 553 | i_uid_read(path.dentry->d_inode), | 553 | i_uid_read(d_inode(path.dentry)), |
| 554 | from_kuid(&init_user_ns, current_uid())); | 554 | from_kuid(&init_user_ns, current_uid())); |
| 555 | goto out_free; | 555 | goto out_free; |
| 556 | } | 556 | } |
| @@ -584,7 +584,7 @@ static struct dentry *ecryptfs_mount(struct file_system_type *fs_type, int flags | |||
| 584 | goto out_free; | 584 | goto out_free; |
| 585 | } | 585 | } |
| 586 | 586 | ||
| 587 | inode = ecryptfs_get_inode(path.dentry->d_inode, s); | 587 | inode = ecryptfs_get_inode(d_inode(path.dentry), s); |
| 588 | rc = PTR_ERR(inode); | 588 | rc = PTR_ERR(inode); |
| 589 | if (IS_ERR(inode)) | 589 | if (IS_ERR(inode)) |
| 590 | goto out_free; | 590 | goto out_free; |
diff --git a/fs/ecryptfs/mmap.c b/fs/ecryptfs/mmap.c index 4626976794e7..cf208522998e 100644 --- a/fs/ecryptfs/mmap.c +++ b/fs/ecryptfs/mmap.c | |||
| @@ -420,7 +420,7 @@ static int ecryptfs_write_inode_size_to_xattr(struct inode *ecryptfs_inode) | |||
| 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_path.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 = d_inode(lower_dentry); |
| 424 | int rc; | 424 | int rc; |
| 425 | 425 | ||
| 426 | if (!lower_inode->i_op->getxattr || !lower_inode->i_op->setxattr) { | 426 | if (!lower_inode->i_op->getxattr || !lower_inode->i_op->setxattr) { |
diff --git a/fs/efivarfs/inode.c b/fs/efivarfs/inode.c index 07ab49745e31..3381b9da9ee6 100644 --- a/fs/efivarfs/inode.c +++ b/fs/efivarfs/inode.c | |||
| @@ -145,12 +145,12 @@ out: | |||
| 145 | 145 | ||
| 146 | static int efivarfs_unlink(struct inode *dir, struct dentry *dentry) | 146 | static int efivarfs_unlink(struct inode *dir, struct dentry *dentry) |
| 147 | { | 147 | { |
| 148 | struct efivar_entry *var = dentry->d_inode->i_private; | 148 | struct efivar_entry *var = d_inode(dentry)->i_private; |
| 149 | 149 | ||
| 150 | if (efivar_entry_delete(var)) | 150 | if (efivar_entry_delete(var)) |
| 151 | return -EINVAL; | 151 | return -EINVAL; |
| 152 | 152 | ||
| 153 | drop_nlink(dentry->d_inode); | 153 | drop_nlink(d_inode(dentry)); |
| 154 | dput(dentry); | 154 | dput(dentry); |
| 155 | return 0; | 155 | return 0; |
| 156 | }; | 156 | }; |
diff --git a/fs/efivarfs/super.c b/fs/efivarfs/super.c index ddbce42548c9..59fedbcf8798 100644 --- a/fs/efivarfs/super.c +++ b/fs/efivarfs/super.c | |||
| @@ -144,7 +144,7 @@ static int efivarfs_callback(efi_char16_t *name16, efi_guid_t vendor, | |||
| 144 | 144 | ||
| 145 | name[len + EFI_VARIABLE_GUID_LEN+1] = '\0'; | 145 | name[len + EFI_VARIABLE_GUID_LEN+1] = '\0'; |
| 146 | 146 | ||
| 147 | inode = efivarfs_get_inode(sb, root->d_inode, S_IFREG | 0644, 0); | 147 | inode = efivarfs_get_inode(sb, d_inode(root), S_IFREG | 0644, 0); |
| 148 | if (!inode) | 148 | if (!inode) |
| 149 | goto fail_name; | 149 | goto fail_name; |
| 150 | 150 | ||
diff --git a/fs/efs/namei.c b/fs/efs/namei.c index bbee8f063dfa..40ba9cc41bf7 100644 --- a/fs/efs/namei.c +++ b/fs/efs/namei.c | |||
| @@ -111,9 +111,9 @@ struct dentry *efs_get_parent(struct dentry *child) | |||
| 111 | struct dentry *parent = ERR_PTR(-ENOENT); | 111 | struct dentry *parent = ERR_PTR(-ENOENT); |
| 112 | efs_ino_t ino; | 112 | efs_ino_t ino; |
| 113 | 113 | ||
| 114 | ino = efs_find_entry(child->d_inode, "..", 2); | 114 | ino = efs_find_entry(d_inode(child), "..", 2); |
| 115 | if (ino) | 115 | if (ino) |
| 116 | parent = d_obtain_alias(efs_iget(child->d_inode->i_sb, ino)); | 116 | parent = d_obtain_alias(efs_iget(d_inode(child)->i_sb, ino)); |
| 117 | 117 | ||
| 118 | return parent; | 118 | return parent; |
| 119 | } | 119 | } |
diff --git a/fs/exofs/dir.c b/fs/exofs/dir.c index d7defd557601..4deb0b05b011 100644 --- a/fs/exofs/dir.c +++ b/fs/exofs/dir.c | |||
| @@ -379,7 +379,7 @@ ino_t exofs_parent_ino(struct dentry *child) | |||
| 379 | struct exofs_dir_entry *de; | 379 | struct exofs_dir_entry *de; |
| 380 | ino_t ino; | 380 | ino_t ino; |
| 381 | 381 | ||
| 382 | de = exofs_dotdot(child->d_inode, &page); | 382 | de = exofs_dotdot(d_inode(child), &page); |
| 383 | if (!de) | 383 | if (!de) |
| 384 | return 0; | 384 | return 0; |
| 385 | 385 | ||
| @@ -429,7 +429,7 @@ int exofs_set_link(struct inode *dir, struct exofs_dir_entry *de, | |||
| 429 | 429 | ||
| 430 | int exofs_add_link(struct dentry *dentry, struct inode *inode) | 430 | int exofs_add_link(struct dentry *dentry, struct inode *inode) |
| 431 | { | 431 | { |
| 432 | struct inode *dir = dentry->d_parent->d_inode; | 432 | struct inode *dir = d_inode(dentry->d_parent); |
| 433 | const unsigned char *name = dentry->d_name.name; | 433 | const unsigned char *name = dentry->d_name.name; |
| 434 | int namelen = dentry->d_name.len; | 434 | int namelen = dentry->d_name.len; |
| 435 | unsigned chunk_size = exofs_chunk_size(dir); | 435 | unsigned chunk_size = exofs_chunk_size(dir); |
diff --git a/fs/exofs/inode.c b/fs/exofs/inode.c index 35073aaec6e0..786e4cc8c889 100644 --- a/fs/exofs/inode.c +++ b/fs/exofs/inode.c | |||
| @@ -1028,7 +1028,7 @@ static int _do_truncate(struct inode *inode, loff_t newsize) | |||
| 1028 | */ | 1028 | */ |
| 1029 | int exofs_setattr(struct dentry *dentry, struct iattr *iattr) | 1029 | int exofs_setattr(struct dentry *dentry, struct iattr *iattr) |
| 1030 | { | 1030 | { |
| 1031 | struct inode *inode = dentry->d_inode; | 1031 | struct inode *inode = d_inode(dentry); |
| 1032 | int error; | 1032 | int error; |
| 1033 | 1033 | ||
| 1034 | /* if we are about to modify an object, and it hasn't been | 1034 | /* if we are about to modify an object, and it hasn't been |
diff --git a/fs/exofs/namei.c b/fs/exofs/namei.c index 28907460e8fa..5ae25e431191 100644 --- a/fs/exofs/namei.c +++ b/fs/exofs/namei.c | |||
| @@ -141,7 +141,7 @@ out_fail: | |||
| 141 | static int exofs_link(struct dentry *old_dentry, struct inode *dir, | 141 | static int exofs_link(struct dentry *old_dentry, struct inode *dir, |
| 142 | struct dentry *dentry) | 142 | struct dentry *dentry) |
| 143 | { | 143 | { |
| 144 | struct inode *inode = old_dentry->d_inode; | 144 | struct inode *inode = d_inode(old_dentry); |
| 145 | 145 | ||
| 146 | inode->i_ctime = CURRENT_TIME; | 146 | inode->i_ctime = CURRENT_TIME; |
| 147 | inode_inc_link_count(inode); | 147 | inode_inc_link_count(inode); |
| @@ -191,7 +191,7 @@ out_dir: | |||
| 191 | 191 | ||
| 192 | static int exofs_unlink(struct inode *dir, struct dentry *dentry) | 192 | static int exofs_unlink(struct inode *dir, struct dentry *dentry) |
| 193 | { | 193 | { |
| 194 | struct inode *inode = dentry->d_inode; | 194 | struct inode *inode = d_inode(dentry); |
| 195 | struct exofs_dir_entry *de; | 195 | struct exofs_dir_entry *de; |
| 196 | struct page *page; | 196 | struct page *page; |
| 197 | int err = -ENOENT; | 197 | int err = -ENOENT; |
| @@ -213,7 +213,7 @@ out: | |||
| 213 | 213 | ||
| 214 | static int exofs_rmdir(struct inode *dir, struct dentry *dentry) | 214 | static int exofs_rmdir(struct inode *dir, struct dentry *dentry) |
| 215 | { | 215 | { |
| 216 | struct inode *inode = dentry->d_inode; | 216 | struct inode *inode = d_inode(dentry); |
| 217 | int err = -ENOTEMPTY; | 217 | int err = -ENOTEMPTY; |
| 218 | 218 | ||
| 219 | if (exofs_empty_dir(inode)) { | 219 | if (exofs_empty_dir(inode)) { |
| @@ -230,8 +230,8 @@ static int exofs_rmdir(struct inode *dir, struct dentry *dentry) | |||
| 230 | static int exofs_rename(struct inode *old_dir, struct dentry *old_dentry, | 230 | static int exofs_rename(struct inode *old_dir, struct dentry *old_dentry, |
| 231 | struct inode *new_dir, struct dentry *new_dentry) | 231 | struct inode *new_dir, struct dentry *new_dentry) |
| 232 | { | 232 | { |
| 233 | struct inode *old_inode = old_dentry->d_inode; | 233 | struct inode *old_inode = d_inode(old_dentry); |
| 234 | struct inode *new_inode = new_dentry->d_inode; | 234 | struct inode *new_inode = d_inode(new_dentry); |
| 235 | struct page *dir_page = NULL; | 235 | struct page *dir_page = NULL; |
| 236 | struct exofs_dir_entry *dir_de = NULL; | 236 | struct exofs_dir_entry *dir_de = NULL; |
| 237 | struct page *old_page; | 237 | struct page *old_page; |
diff --git a/fs/exofs/super.c b/fs/exofs/super.c index fcc2e565f540..b795c567b5e1 100644 --- a/fs/exofs/super.c +++ b/fs/exofs/super.c | |||
| @@ -958,7 +958,7 @@ static struct dentry *exofs_get_parent(struct dentry *child) | |||
| 958 | if (!ino) | 958 | if (!ino) |
| 959 | return ERR_PTR(-ESTALE); | 959 | return ERR_PTR(-ESTALE); |
| 960 | 960 | ||
| 961 | return d_obtain_alias(exofs_iget(child->d_inode->i_sb, ino)); | 961 | return d_obtain_alias(exofs_iget(d_inode(child)->i_sb, ino)); |
| 962 | } | 962 | } |
| 963 | 963 | ||
| 964 | static struct inode *exofs_nfs_get_inode(struct super_block *sb, | 964 | static struct inode *exofs_nfs_get_inode(struct super_block *sb, |
diff --git a/fs/exofs/symlink.c b/fs/exofs/symlink.c index 832e2624b80b..6f6f3a4c1365 100644 --- a/fs/exofs/symlink.c +++ b/fs/exofs/symlink.c | |||
| @@ -37,7 +37,7 @@ | |||
| 37 | 37 | ||
| 38 | static void *exofs_follow_link(struct dentry *dentry, struct nameidata *nd) | 38 | static void *exofs_follow_link(struct dentry *dentry, struct nameidata *nd) |
| 39 | { | 39 | { |
| 40 | struct exofs_i_info *oi = exofs_i(dentry->d_inode); | 40 | struct exofs_i_info *oi = exofs_i(d_inode(dentry)); |
| 41 | 41 | ||
| 42 | nd_set_link(nd, (char *)oi->i_data); | 42 | nd_set_link(nd, (char *)oi->i_data); |
| 43 | return NULL; | 43 | return NULL; |
diff --git a/fs/ext2/dir.c b/fs/ext2/dir.c index 6e1d4ab09d72..796b491e6978 100644 --- a/fs/ext2/dir.c +++ b/fs/ext2/dir.c | |||
| @@ -486,7 +486,7 @@ void ext2_set_link(struct inode *dir, struct ext2_dir_entry_2 *de, | |||
| 486 | */ | 486 | */ |
| 487 | int ext2_add_link (struct dentry *dentry, struct inode *inode) | 487 | int ext2_add_link (struct dentry *dentry, struct inode *inode) |
| 488 | { | 488 | { |
| 489 | struct inode *dir = dentry->d_parent->d_inode; | 489 | struct inode *dir = d_inode(dentry->d_parent); |
| 490 | const char *name = dentry->d_name.name; | 490 | const char *name = dentry->d_name.name; |
| 491 | int namelen = dentry->d_name.len; | 491 | int namelen = dentry->d_name.len; |
| 492 | unsigned chunk_size = ext2_chunk_size(dir); | 492 | unsigned chunk_size = ext2_chunk_size(dir); |
diff --git a/fs/ext2/ialloc.c b/fs/ext2/ialloc.c index 6c14bb8322fa..5c04a0ddea80 100644 --- a/fs/ext2/ialloc.c +++ b/fs/ext2/ialloc.c | |||
| @@ -278,7 +278,7 @@ static int find_group_orlov(struct super_block *sb, struct inode *parent) | |||
| 278 | avefreeb = free_blocks / ngroups; | 278 | avefreeb = free_blocks / ngroups; |
| 279 | ndirs = percpu_counter_read_positive(&sbi->s_dirs_counter); | 279 | ndirs = percpu_counter_read_positive(&sbi->s_dirs_counter); |
| 280 | 280 | ||
| 281 | if ((parent == sb->s_root->d_inode) || | 281 | if ((parent == d_inode(sb->s_root)) || |
| 282 | (EXT2_I(parent)->i_flags & EXT2_TOPDIR_FL)) { | 282 | (EXT2_I(parent)->i_flags & EXT2_TOPDIR_FL)) { |
| 283 | struct ext2_group_desc *best_desc = NULL; | 283 | struct ext2_group_desc *best_desc = NULL; |
| 284 | int best_ndir = inodes_per_group; | 284 | int best_ndir = inodes_per_group; |
diff --git a/fs/ext2/inode.c b/fs/ext2/inode.c index 5d9213963fae..f460ae36d5b7 100644 --- a/fs/ext2/inode.c +++ b/fs/ext2/inode.c | |||
| @@ -1544,7 +1544,7 @@ int ext2_write_inode(struct inode *inode, struct writeback_control *wbc) | |||
| 1544 | 1544 | ||
| 1545 | int ext2_setattr(struct dentry *dentry, struct iattr *iattr) | 1545 | int ext2_setattr(struct dentry *dentry, struct iattr *iattr) |
| 1546 | { | 1546 | { |
| 1547 | struct inode *inode = dentry->d_inode; | 1547 | struct inode *inode = d_inode(dentry); |
| 1548 | int error; | 1548 | int error; |
| 1549 | 1549 | ||
| 1550 | error = inode_change_ok(inode, iattr); | 1550 | error = inode_change_ok(inode, iattr); |
diff --git a/fs/ext2/namei.c b/fs/ext2/namei.c index ce422931f411..3e074a9ccbe6 100644 --- a/fs/ext2/namei.c +++ b/fs/ext2/namei.c | |||
| @@ -79,10 +79,10 @@ static struct dentry *ext2_lookup(struct inode * dir, struct dentry *dentry, uns | |||
| 79 | struct dentry *ext2_get_parent(struct dentry *child) | 79 | struct dentry *ext2_get_parent(struct dentry *child) |
| 80 | { | 80 | { |
| 81 | struct qstr dotdot = QSTR_INIT("..", 2); | 81 | struct qstr dotdot = QSTR_INIT("..", 2); |
| 82 | unsigned long ino = ext2_inode_by_name(child->d_inode, &dotdot); | 82 | unsigned long ino = ext2_inode_by_name(d_inode(child), &dotdot); |
| 83 | if (!ino) | 83 | if (!ino) |
| 84 | return ERR_PTR(-ENOENT); | 84 | return ERR_PTR(-ENOENT); |
| 85 | return d_obtain_alias(ext2_iget(child->d_inode->i_sb, ino)); | 85 | return d_obtain_alias(ext2_iget(d_inode(child)->i_sb, ino)); |
| 86 | } | 86 | } |
| 87 | 87 | ||
| 88 | /* | 88 | /* |
| @@ -208,7 +208,7 @@ out_fail: | |||
| 208 | static int ext2_link (struct dentry * old_dentry, struct inode * dir, | 208 | static int ext2_link (struct dentry * old_dentry, struct inode * dir, |
| 209 | struct dentry *dentry) | 209 | struct dentry *dentry) |
| 210 | { | 210 | { |
| 211 | struct inode *inode = old_dentry->d_inode; | 211 | struct inode *inode = d_inode(old_dentry); |
| 212 | int err; | 212 | int err; |
| 213 | 213 | ||
| 214 | dquot_initialize(dir); | 214 | dquot_initialize(dir); |
| @@ -275,7 +275,7 @@ out_dir: | |||
| 275 | 275 | ||
| 276 | static int ext2_unlink(struct inode * dir, struct dentry *dentry) | 276 | static int ext2_unlink(struct inode * dir, struct dentry *dentry) |
| 277 | { | 277 | { |
| 278 | struct inode * inode = dentry->d_inode; | 278 | struct inode * inode = d_inode(dentry); |
| 279 | struct ext2_dir_entry_2 * de; | 279 | struct ext2_dir_entry_2 * de; |
| 280 | struct page * page; | 280 | struct page * page; |
| 281 | int err = -ENOENT; | 281 | int err = -ENOENT; |
| @@ -299,7 +299,7 @@ out: | |||
| 299 | 299 | ||
| 300 | static int ext2_rmdir (struct inode * dir, struct dentry *dentry) | 300 | static int ext2_rmdir (struct inode * dir, struct dentry *dentry) |
| 301 | { | 301 | { |
| 302 | struct inode * inode = dentry->d_inode; | 302 | struct inode * inode = d_inode(dentry); |
| 303 | int err = -ENOTEMPTY; | 303 | int err = -ENOTEMPTY; |
| 304 | 304 | ||
| 305 | if (ext2_empty_dir(inode)) { | 305 | if (ext2_empty_dir(inode)) { |
| @@ -316,8 +316,8 @@ static int ext2_rmdir (struct inode * dir, struct dentry *dentry) | |||
| 316 | static int ext2_rename (struct inode * old_dir, struct dentry * old_dentry, | 316 | static int ext2_rename (struct inode * old_dir, struct dentry * old_dentry, |
| 317 | struct inode * new_dir, struct dentry * new_dentry ) | 317 | struct inode * new_dir, struct dentry * new_dentry ) |
| 318 | { | 318 | { |
| 319 | struct inode * old_inode = old_dentry->d_inode; | 319 | struct inode * old_inode = d_inode(old_dentry); |
| 320 | struct inode * new_inode = new_dentry->d_inode; | 320 | struct inode * new_inode = d_inode(new_dentry); |
| 321 | struct page * dir_page = NULL; | 321 | struct page * dir_page = NULL; |
| 322 | struct ext2_dir_entry_2 * dir_de = NULL; | 322 | struct ext2_dir_entry_2 * dir_de = NULL; |
| 323 | struct page * old_page; | 323 | struct page * old_page; |
diff --git a/fs/ext2/symlink.c b/fs/ext2/symlink.c index 565cf817bbf1..20608f17c2e5 100644 --- a/fs/ext2/symlink.c +++ b/fs/ext2/symlink.c | |||
| @@ -23,7 +23,7 @@ | |||
| 23 | 23 | ||
| 24 | static void *ext2_follow_link(struct dentry *dentry, struct nameidata *nd) | 24 | static void *ext2_follow_link(struct dentry *dentry, struct nameidata *nd) |
| 25 | { | 25 | { |
| 26 | struct ext2_inode_info *ei = EXT2_I(dentry->d_inode); | 26 | struct ext2_inode_info *ei = EXT2_I(d_inode(dentry)); |
| 27 | nd_set_link(nd, (char *)ei->i_data); | 27 | nd_set_link(nd, (char *)ei->i_data); |
| 28 | return NULL; | 28 | return NULL; |
| 29 | } | 29 | } |
diff --git a/fs/ext2/xattr.c b/fs/ext2/xattr.c index 91426141c33a..0b6bfd3a398b 100644 --- a/fs/ext2/xattr.c +++ b/fs/ext2/xattr.c | |||
| @@ -243,7 +243,7 @@ cleanup: | |||
| 243 | static int | 243 | static int |
| 244 | ext2_xattr_list(struct dentry *dentry, char *buffer, size_t buffer_size) | 244 | ext2_xattr_list(struct dentry *dentry, char *buffer, size_t buffer_size) |
| 245 | { | 245 | { |
| 246 | struct inode *inode = dentry->d_inode; | 246 | struct inode *inode = d_inode(dentry); |
| 247 | struct buffer_head *bh = NULL; | 247 | struct buffer_head *bh = NULL; |
| 248 | struct ext2_xattr_entry *entry; | 248 | struct ext2_xattr_entry *entry; |
| 249 | char *end; | 249 | char *end; |
| @@ -319,7 +319,7 @@ cleanup: | |||
| 319 | /* | 319 | /* |
| 320 | * Inode operation listxattr() | 320 | * Inode operation listxattr() |
| 321 | * | 321 | * |
| 322 | * dentry->d_inode->i_mutex: don't care | 322 | * d_inode(dentry)->i_mutex: don't care |
| 323 | */ | 323 | */ |
| 324 | ssize_t | 324 | ssize_t |
| 325 | ext2_listxattr(struct dentry *dentry, char *buffer, size_t size) | 325 | ext2_listxattr(struct dentry *dentry, char *buffer, size_t size) |
diff --git a/fs/ext2/xattr_security.c b/fs/ext2/xattr_security.c index c0ebc4db8849..702fc6840246 100644 --- a/fs/ext2/xattr_security.c +++ b/fs/ext2/xattr_security.c | |||
| @@ -28,7 +28,7 @@ ext2_xattr_security_get(struct dentry *dentry, const char *name, | |||
| 28 | { | 28 | { |
| 29 | if (strcmp(name, "") == 0) | 29 | if (strcmp(name, "") == 0) |
| 30 | return -EINVAL; | 30 | return -EINVAL; |
| 31 | return ext2_xattr_get(dentry->d_inode, EXT2_XATTR_INDEX_SECURITY, name, | 31 | return ext2_xattr_get(d_inode(dentry), EXT2_XATTR_INDEX_SECURITY, name, |
| 32 | buffer, size); | 32 | buffer, size); |
| 33 | } | 33 | } |
| 34 | 34 | ||
| @@ -38,7 +38,7 @@ ext2_xattr_security_set(struct dentry *dentry, const char *name, | |||
| 38 | { | 38 | { |
| 39 | if (strcmp(name, "") == 0) | 39 | if (strcmp(name, "") == 0) |
| 40 | return -EINVAL; | 40 | return -EINVAL; |
| 41 | return ext2_xattr_set(dentry->d_inode, EXT2_XATTR_INDEX_SECURITY, name, | 41 | return ext2_xattr_set(d_inode(dentry), EXT2_XATTR_INDEX_SECURITY, name, |
| 42 | value, size, flags); | 42 | value, size, flags); |
| 43 | } | 43 | } |
| 44 | 44 | ||
diff --git a/fs/ext2/xattr_trusted.c b/fs/ext2/xattr_trusted.c index 7e192574c001..42b6e9874bcc 100644 --- a/fs/ext2/xattr_trusted.c +++ b/fs/ext2/xattr_trusted.c | |||
| @@ -32,7 +32,7 @@ ext2_xattr_trusted_get(struct dentry *dentry, const char *name, | |||
| 32 | { | 32 | { |
| 33 | if (strcmp(name, "") == 0) | 33 | if (strcmp(name, "") == 0) |
| 34 | return -EINVAL; | 34 | return -EINVAL; |
| 35 | return ext2_xattr_get(dentry->d_inode, EXT2_XATTR_INDEX_TRUSTED, name, | 35 | return ext2_xattr_get(d_inode(dentry), EXT2_XATTR_INDEX_TRUSTED, name, |
| 36 | buffer, size); | 36 | buffer, size); |
| 37 | } | 37 | } |
| 38 | 38 | ||
| @@ -42,7 +42,7 @@ ext2_xattr_trusted_set(struct dentry *dentry, const char *name, | |||
| 42 | { | 42 | { |
| 43 | if (strcmp(name, "") == 0) | 43 | if (strcmp(name, "") == 0) |
| 44 | return -EINVAL; | 44 | return -EINVAL; |
| 45 | return ext2_xattr_set(dentry->d_inode, EXT2_XATTR_INDEX_TRUSTED, name, | 45 | return ext2_xattr_set(d_inode(dentry), EXT2_XATTR_INDEX_TRUSTED, name, |
| 46 | value, size, flags); | 46 | value, size, flags); |
| 47 | } | 47 | } |
| 48 | 48 | ||
diff --git a/fs/ext2/xattr_user.c b/fs/ext2/xattr_user.c index f470e44c4b8d..ecdc4605192c 100644 --- a/fs/ext2/xattr_user.c +++ b/fs/ext2/xattr_user.c | |||
| @@ -36,7 +36,7 @@ ext2_xattr_user_get(struct dentry *dentry, const char *name, | |||
| 36 | return -EINVAL; | 36 | return -EINVAL; |
| 37 | if (!test_opt(dentry->d_sb, XATTR_USER)) | 37 | if (!test_opt(dentry->d_sb, XATTR_USER)) |
| 38 | return -EOPNOTSUPP; | 38 | return -EOPNOTSUPP; |
| 39 | return ext2_xattr_get(dentry->d_inode, EXT2_XATTR_INDEX_USER, | 39 | return ext2_xattr_get(d_inode(dentry), EXT2_XATTR_INDEX_USER, |
| 40 | name, buffer, size); | 40 | name, buffer, size); |
| 41 | } | 41 | } |
| 42 | 42 | ||
| @@ -49,7 +49,7 @@ ext2_xattr_user_set(struct dentry *dentry, const char *name, | |||
| 49 | if (!test_opt(dentry->d_sb, XATTR_USER)) | 49 | if (!test_opt(dentry->d_sb, XATTR_USER)) |
| 50 | return -EOPNOTSUPP; | 50 | return -EOPNOTSUPP; |
| 51 | 51 | ||
| 52 | return ext2_xattr_set(dentry->d_inode, EXT2_XATTR_INDEX_USER, | 52 | return ext2_xattr_set(d_inode(dentry), EXT2_XATTR_INDEX_USER, |
| 53 | name, value, size, flags); | 53 | name, value, size, flags); |
| 54 | } | 54 | } |
| 55 | 55 | ||
diff --git a/fs/ext3/ialloc.c b/fs/ext3/ialloc.c index a1b810230cc5..3ad242e5840e 100644 --- a/fs/ext3/ialloc.c +++ b/fs/ext3/ialloc.c | |||
| @@ -210,7 +210,7 @@ static int find_group_orlov(struct super_block *sb, struct inode *parent) | |||
| 210 | avefreeb = freeb / ngroups; | 210 | avefreeb = freeb / ngroups; |
| 211 | ndirs = percpu_counter_read_positive(&sbi->s_dirs_counter); | 211 | ndirs = percpu_counter_read_positive(&sbi->s_dirs_counter); |
| 212 | 212 | ||
| 213 | if ((parent == sb->s_root->d_inode) || | 213 | if ((parent == d_inode(sb->s_root)) || |
| 214 | (EXT3_I(parent)->i_flags & EXT3_TOPDIR_FL)) { | 214 | (EXT3_I(parent)->i_flags & EXT3_TOPDIR_FL)) { |
| 215 | int best_ndir = inodes_per_group; | 215 | int best_ndir = inodes_per_group; |
| 216 | int best_group = -1; | 216 | int best_group = -1; |
diff --git a/fs/ext3/inode.c b/fs/ext3/inode.c index 13c0868c7160..2ee2dc4351d1 100644 --- a/fs/ext3/inode.c +++ b/fs/ext3/inode.c | |||
| @@ -3240,7 +3240,7 @@ int ext3_write_inode(struct inode *inode, struct writeback_control *wbc) | |||
| 3240 | */ | 3240 | */ |
| 3241 | int ext3_setattr(struct dentry *dentry, struct iattr *attr) | 3241 | int ext3_setattr(struct dentry *dentry, struct iattr *attr) |
| 3242 | { | 3242 | { |
| 3243 | struct inode *inode = dentry->d_inode; | 3243 | struct inode *inode = d_inode(dentry); |
| 3244 | int error, rc = 0; | 3244 | int error, rc = 0; |
| 3245 | const unsigned int ia_valid = attr->ia_valid; | 3245 | const unsigned int ia_valid = attr->ia_valid; |
| 3246 | 3246 | ||
diff --git a/fs/ext3/namei.c b/fs/ext3/namei.c index f197736dccfa..4264b9bd0002 100644 --- a/fs/ext3/namei.c +++ b/fs/ext3/namei.c | |||
| @@ -1049,19 +1049,19 @@ struct dentry *ext3_get_parent(struct dentry *child) | |||
| 1049 | struct ext3_dir_entry_2 * de; | 1049 | struct ext3_dir_entry_2 * de; |
| 1050 | struct buffer_head *bh; | 1050 | struct buffer_head *bh; |
| 1051 | 1051 | ||
| 1052 | bh = ext3_find_entry(child->d_inode, &dotdot, &de); | 1052 | bh = ext3_find_entry(d_inode(child), &dotdot, &de); |
| 1053 | if (!bh) | 1053 | if (!bh) |
| 1054 | return ERR_PTR(-ENOENT); | 1054 | return ERR_PTR(-ENOENT); |
| 1055 | ino = le32_to_cpu(de->inode); | 1055 | ino = le32_to_cpu(de->inode); |
| 1056 | brelse(bh); | 1056 | brelse(bh); |
| 1057 | 1057 | ||
| 1058 | if (!ext3_valid_inum(child->d_inode->i_sb, ino)) { | 1058 | if (!ext3_valid_inum(d_inode(child)->i_sb, ino)) { |
| 1059 | ext3_error(child->d_inode->i_sb, "ext3_get_parent", | 1059 | ext3_error(d_inode(child)->i_sb, "ext3_get_parent", |
| 1060 | "bad inode number: %lu", ino); | 1060 | "bad inode number: %lu", ino); |
| 1061 | return ERR_PTR(-EIO); | 1061 | return ERR_PTR(-EIO); |
| 1062 | } | 1062 | } |
| 1063 | 1063 | ||
| 1064 | return d_obtain_alias(ext3_iget(child->d_inode->i_sb, ino)); | 1064 | return d_obtain_alias(ext3_iget(d_inode(child)->i_sb, ino)); |
| 1065 | } | 1065 | } |
| 1066 | 1066 | ||
| 1067 | #define S_SHIFT 12 | 1067 | #define S_SHIFT 12 |
| @@ -1243,7 +1243,7 @@ static int add_dirent_to_buf(handle_t *handle, struct dentry *dentry, | |||
| 1243 | struct inode *inode, struct ext3_dir_entry_2 *de, | 1243 | struct inode *inode, struct ext3_dir_entry_2 *de, |
| 1244 | struct buffer_head * bh) | 1244 | struct buffer_head * bh) |
| 1245 | { | 1245 | { |
| 1246 | struct inode *dir = dentry->d_parent->d_inode; | 1246 | struct inode *dir = d_inode(dentry->d_parent); |
| 1247 | const char *name = dentry->d_name.name; | 1247 | const char *name = dentry->d_name.name; |
| 1248 | int namelen = dentry->d_name.len; | 1248 | int namelen = dentry->d_name.len; |
| 1249 | unsigned long offset = 0; | 1249 | unsigned long offset = 0; |
| @@ -1330,7 +1330,7 @@ static int add_dirent_to_buf(handle_t *handle, struct dentry *dentry, | |||
| 1330 | static int make_indexed_dir(handle_t *handle, struct dentry *dentry, | 1330 | static int make_indexed_dir(handle_t *handle, struct dentry *dentry, |
| 1331 | struct inode *inode, struct buffer_head *bh) | 1331 | struct inode *inode, struct buffer_head *bh) |
| 1332 | { | 1332 | { |
| 1333 | struct inode *dir = dentry->d_parent->d_inode; | 1333 | struct inode *dir = d_inode(dentry->d_parent); |
| 1334 | const char *name = dentry->d_name.name; | 1334 | const char *name = dentry->d_name.name; |
| 1335 | int namelen = dentry->d_name.len; | 1335 | int namelen = dentry->d_name.len; |
| 1336 | struct buffer_head *bh2; | 1336 | struct buffer_head *bh2; |
| @@ -1435,7 +1435,7 @@ static int make_indexed_dir(handle_t *handle, struct dentry *dentry, | |||
| 1435 | static int ext3_add_entry (handle_t *handle, struct dentry *dentry, | 1435 | static int ext3_add_entry (handle_t *handle, struct dentry *dentry, |
| 1436 | struct inode *inode) | 1436 | struct inode *inode) |
| 1437 | { | 1437 | { |
| 1438 | struct inode *dir = dentry->d_parent->d_inode; | 1438 | struct inode *dir = d_inode(dentry->d_parent); |
| 1439 | struct buffer_head * bh; | 1439 | struct buffer_head * bh; |
| 1440 | struct ext3_dir_entry_2 *de; | 1440 | struct ext3_dir_entry_2 *de; |
| 1441 | struct super_block * sb; | 1441 | struct super_block * sb; |
| @@ -1489,7 +1489,7 @@ static int ext3_dx_add_entry(handle_t *handle, struct dentry *dentry, | |||
| 1489 | struct dx_entry *entries, *at; | 1489 | struct dx_entry *entries, *at; |
| 1490 | struct dx_hash_info hinfo; | 1490 | struct dx_hash_info hinfo; |
| 1491 | struct buffer_head * bh; | 1491 | struct buffer_head * bh; |
| 1492 | struct inode *dir = dentry->d_parent->d_inode; | 1492 | struct inode *dir = d_inode(dentry->d_parent); |
| 1493 | struct super_block * sb = dir->i_sb; | 1493 | struct super_block * sb = dir->i_sb; |
| 1494 | struct ext3_dir_entry_2 *de; | 1494 | struct ext3_dir_entry_2 *de; |
| 1495 | int err; | 1495 | int err; |
| @@ -2111,7 +2111,7 @@ static int ext3_rmdir (struct inode * dir, struct dentry *dentry) | |||
| 2111 | /* Initialize quotas before so that eventual writes go in | 2111 | /* Initialize quotas before so that eventual writes go in |
| 2112 | * separate transaction */ | 2112 | * separate transaction */ |
| 2113 | dquot_initialize(dir); | 2113 | dquot_initialize(dir); |
| 2114 | dquot_initialize(dentry->d_inode); | 2114 | dquot_initialize(d_inode(dentry)); |
| 2115 | 2115 | ||
| 2116 | handle = ext3_journal_start(dir, EXT3_DELETE_TRANS_BLOCKS(dir->i_sb)); | 2116 | handle = ext3_journal_start(dir, EXT3_DELETE_TRANS_BLOCKS(dir->i_sb)); |
| 2117 | if (IS_ERR(handle)) | 2117 | if (IS_ERR(handle)) |
| @@ -2125,7 +2125,7 @@ static int ext3_rmdir (struct inode * dir, struct dentry *dentry) | |||
| 2125 | if (IS_DIRSYNC(dir)) | 2125 | if (IS_DIRSYNC(dir)) |
| 2126 | handle->h_sync = 1; | 2126 | handle->h_sync = 1; |
| 2127 | 2127 | ||
| 2128 | inode = dentry->d_inode; | 2128 | inode = d_inode(dentry); |
| 2129 | 2129 | ||
| 2130 | retval = -EIO; | 2130 | retval = -EIO; |
| 2131 | if (le32_to_cpu(de->inode) != inode->i_ino) | 2131 | if (le32_to_cpu(de->inode) != inode->i_ino) |
| @@ -2173,7 +2173,7 @@ static int ext3_unlink(struct inode * dir, struct dentry *dentry) | |||
| 2173 | /* Initialize quotas before so that eventual writes go | 2173 | /* Initialize quotas before so that eventual writes go |
| 2174 | * in separate transaction */ | 2174 | * in separate transaction */ |
| 2175 | dquot_initialize(dir); | 2175 | dquot_initialize(dir); |
| 2176 | dquot_initialize(dentry->d_inode); | 2176 | dquot_initialize(d_inode(dentry)); |
| 2177 | 2177 | ||
| 2178 | handle = ext3_journal_start(dir, EXT3_DELETE_TRANS_BLOCKS(dir->i_sb)); | 2178 | handle = ext3_journal_start(dir, EXT3_DELETE_TRANS_BLOCKS(dir->i_sb)); |
| 2179 | if (IS_ERR(handle)) | 2179 | if (IS_ERR(handle)) |
| @@ -2187,7 +2187,7 @@ static int ext3_unlink(struct inode * dir, struct dentry *dentry) | |||
| 2187 | if (!bh) | 2187 | if (!bh) |
| 2188 | goto end_unlink; | 2188 | goto end_unlink; |
| 2189 | 2189 | ||
| 2190 | inode = dentry->d_inode; | 2190 | inode = d_inode(dentry); |
| 2191 | 2191 | ||
| 2192 | retval = -EIO; | 2192 | retval = -EIO; |
| 2193 | if (le32_to_cpu(de->inode) != inode->i_ino) | 2193 | if (le32_to_cpu(de->inode) != inode->i_ino) |
| @@ -2328,7 +2328,7 @@ static int ext3_link (struct dentry * old_dentry, | |||
| 2328 | struct inode * dir, struct dentry *dentry) | 2328 | struct inode * dir, struct dentry *dentry) |
| 2329 | { | 2329 | { |
| 2330 | handle_t *handle; | 2330 | handle_t *handle; |
| 2331 | struct inode *inode = old_dentry->d_inode; | 2331 | struct inode *inode = d_inode(old_dentry); |
| 2332 | int err, retries = 0; | 2332 | int err, retries = 0; |
| 2333 | 2333 | ||
| 2334 | if (inode->i_nlink >= EXT3_LINK_MAX) | 2334 | if (inode->i_nlink >= EXT3_LINK_MAX) |
| @@ -2391,8 +2391,8 @@ static int ext3_rename (struct inode * old_dir, struct dentry *old_dentry, | |||
| 2391 | 2391 | ||
| 2392 | /* Initialize quotas before so that eventual writes go | 2392 | /* Initialize quotas before so that eventual writes go |
| 2393 | * in separate transaction */ | 2393 | * in separate transaction */ |
| 2394 | if (new_dentry->d_inode) | 2394 | if (d_really_is_positive(new_dentry)) |
| 2395 | dquot_initialize(new_dentry->d_inode); | 2395 | dquot_initialize(d_inode(new_dentry)); |
| 2396 | handle = ext3_journal_start(old_dir, 2 * | 2396 | handle = ext3_journal_start(old_dir, 2 * |
| 2397 | EXT3_DATA_TRANS_BLOCKS(old_dir->i_sb) + | 2397 | EXT3_DATA_TRANS_BLOCKS(old_dir->i_sb) + |
| 2398 | EXT3_INDEX_EXTRA_TRANS_BLOCKS + 2); | 2398 | EXT3_INDEX_EXTRA_TRANS_BLOCKS + 2); |
| @@ -2409,12 +2409,12 @@ static int ext3_rename (struct inode * old_dir, struct dentry *old_dentry, | |||
| 2409 | * and merrily kill the link to whatever was created under the | 2409 | * and merrily kill the link to whatever was created under the |
| 2410 | * same name. Goodbye sticky bit ;-< | 2410 | * same name. Goodbye sticky bit ;-< |
| 2411 | */ | 2411 | */ |
| 2412 | old_inode = old_dentry->d_inode; | 2412 | old_inode = d_inode(old_dentry); |
| 2413 | retval = -ENOENT; | 2413 | retval = -ENOENT; |
| 2414 | if (!old_bh || le32_to_cpu(old_de->inode) != old_inode->i_ino) | 2414 | if (!old_bh || le32_to_cpu(old_de->inode) != old_inode->i_ino) |
| 2415 | goto end_rename; | 2415 | goto end_rename; |
| 2416 | 2416 | ||
| 2417 | new_inode = new_dentry->d_inode; | 2417 | new_inode = d_inode(new_dentry); |
| 2418 | new_bh = ext3_find_entry(new_dir, &new_dentry->d_name, &new_de); | 2418 | new_bh = ext3_find_entry(new_dir, &new_dentry->d_name, &new_de); |
| 2419 | if (new_bh) { | 2419 | if (new_bh) { |
| 2420 | if (!new_inode) { | 2420 | if (!new_inode) { |
diff --git a/fs/ext3/super.c b/fs/ext3/super.c index f037b4b27300..a9312f0a54e5 100644 --- a/fs/ext3/super.c +++ b/fs/ext3/super.c | |||
| @@ -1170,7 +1170,7 @@ static int parse_options (char *options, struct super_block *sb, | |||
| 1170 | return 0; | 1170 | return 0; |
| 1171 | } | 1171 | } |
| 1172 | 1172 | ||
| 1173 | journal_inode = path.dentry->d_inode; | 1173 | journal_inode = d_inode(path.dentry); |
| 1174 | if (!S_ISBLK(journal_inode->i_mode)) { | 1174 | if (!S_ISBLK(journal_inode->i_mode)) { |
| 1175 | ext3_msg(sb, KERN_ERR, "error: journal path %s " | 1175 | ext3_msg(sb, KERN_ERR, "error: journal path %s " |
| 1176 | "is not a block device", journal_path); | 1176 | "is not a block device", journal_path); |
| @@ -2947,7 +2947,7 @@ static int ext3_write_info(struct super_block *sb, int type) | |||
| 2947 | handle_t *handle; | 2947 | handle_t *handle; |
| 2948 | 2948 | ||
| 2949 | /* Data block + inode block */ | 2949 | /* Data block + inode block */ |
| 2950 | handle = ext3_journal_start(sb->s_root->d_inode, 2); | 2950 | handle = ext3_journal_start(d_inode(sb->s_root), 2); |
| 2951 | if (IS_ERR(handle)) | 2951 | if (IS_ERR(handle)) |
| 2952 | return PTR_ERR(handle); | 2952 | return PTR_ERR(handle); |
| 2953 | ret = dquot_commit_info(sb, type); | 2953 | ret = dquot_commit_info(sb, type); |
| @@ -2994,7 +2994,7 @@ static int ext3_quota_on(struct super_block *sb, int type, int format_id, | |||
| 2994 | * When we journal data on quota file, we have to flush journal to see | 2994 | * When we journal data on quota file, we have to flush journal to see |
| 2995 | * all updates to the file when we bypass pagecache... | 2995 | * all updates to the file when we bypass pagecache... |
| 2996 | */ | 2996 | */ |
| 2997 | if (ext3_should_journal_data(path->dentry->d_inode)) { | 2997 | if (ext3_should_journal_data(d_inode(path->dentry))) { |
| 2998 | /* | 2998 | /* |
| 2999 | * We don't need to lock updates but journal_flush() could | 2999 | * We don't need to lock updates but journal_flush() could |
| 3000 | * otherwise be livelocked... | 3000 | * otherwise be livelocked... |
diff --git a/fs/ext3/symlink.c b/fs/ext3/symlink.c index 6b01c3eab1f3..ea96df3c58db 100644 --- a/fs/ext3/symlink.c +++ b/fs/ext3/symlink.c | |||
| @@ -23,7 +23,7 @@ | |||
| 23 | 23 | ||
| 24 | static void * ext3_follow_link(struct dentry *dentry, struct nameidata *nd) | 24 | static void * ext3_follow_link(struct dentry *dentry, struct nameidata *nd) |
| 25 | { | 25 | { |
| 26 | struct ext3_inode_info *ei = EXT3_I(dentry->d_inode); | 26 | struct ext3_inode_info *ei = EXT3_I(d_inode(dentry)); |
| 27 | nd_set_link(nd, (char*)ei->i_data); | 27 | nd_set_link(nd, (char*)ei->i_data); |
| 28 | return NULL; | 28 | return NULL; |
| 29 | } | 29 | } |
diff --git a/fs/ext3/xattr.c b/fs/ext3/xattr.c index 24215dc09a18..7cf36501ccf4 100644 --- a/fs/ext3/xattr.c +++ b/fs/ext3/xattr.c | |||
| @@ -137,7 +137,7 @@ ext3_xattr_handler(int name_index) | |||
| 137 | /* | 137 | /* |
| 138 | * Inode operation listxattr() | 138 | * Inode operation listxattr() |
| 139 | * | 139 | * |
| 140 | * dentry->d_inode->i_mutex: don't care | 140 | * d_inode(dentry)->i_mutex: don't care |
| 141 | */ | 141 | */ |
| 142 | ssize_t | 142 | ssize_t |
| 143 | ext3_listxattr(struct dentry *dentry, char *buffer, size_t size) | 143 | ext3_listxattr(struct dentry *dentry, char *buffer, size_t size) |
| @@ -355,7 +355,7 @@ ext3_xattr_list_entries(struct dentry *dentry, struct ext3_xattr_entry *entry, | |||
| 355 | static int | 355 | static int |
| 356 | ext3_xattr_block_list(struct dentry *dentry, char *buffer, size_t buffer_size) | 356 | ext3_xattr_block_list(struct dentry *dentry, char *buffer, size_t buffer_size) |
| 357 | { | 357 | { |
| 358 | struct inode *inode = dentry->d_inode; | 358 | struct inode *inode = d_inode(dentry); |
| 359 | struct buffer_head *bh = NULL; | 359 | struct buffer_head *bh = NULL; |
| 360 | int error; | 360 | int error; |
| 361 | 361 | ||
| @@ -391,7 +391,7 @@ cleanup: | |||
| 391 | static int | 391 | static int |
| 392 | ext3_xattr_ibody_list(struct dentry *dentry, char *buffer, size_t buffer_size) | 392 | ext3_xattr_ibody_list(struct dentry *dentry, char *buffer, size_t buffer_size) |
| 393 | { | 393 | { |
| 394 | struct inode *inode = dentry->d_inode; | 394 | struct inode *inode = d_inode(dentry); |
| 395 | struct ext3_xattr_ibody_header *header; | 395 | struct ext3_xattr_ibody_header *header; |
| 396 | struct ext3_inode *raw_inode; | 396 | struct ext3_inode *raw_inode; |
| 397 | struct ext3_iloc iloc; | 397 | struct ext3_iloc iloc; |
| @@ -432,7 +432,7 @@ ext3_xattr_list(struct dentry *dentry, char *buffer, size_t buffer_size) | |||
| 432 | { | 432 | { |
| 433 | int i_error, b_error; | 433 | int i_error, b_error; |
| 434 | 434 | ||
| 435 | down_read(&EXT3_I(dentry->d_inode)->xattr_sem); | 435 | down_read(&EXT3_I(d_inode(dentry))->xattr_sem); |
| 436 | i_error = ext3_xattr_ibody_list(dentry, buffer, buffer_size); | 436 | i_error = ext3_xattr_ibody_list(dentry, buffer, buffer_size); |
| 437 | if (i_error < 0) { | 437 | if (i_error < 0) { |
| 438 | b_error = 0; | 438 | b_error = 0; |
| @@ -445,7 +445,7 @@ ext3_xattr_list(struct dentry *dentry, char *buffer, size_t buffer_size) | |||
| 445 | if (b_error < 0) | 445 | if (b_error < 0) |
| 446 | i_error = 0; | 446 | i_error = 0; |
| 447 | } | 447 | } |
| 448 | up_read(&EXT3_I(dentry->d_inode)->xattr_sem); | 448 | up_read(&EXT3_I(d_inode(dentry))->xattr_sem); |
| 449 | return i_error + b_error; | 449 | return i_error + b_error; |
| 450 | } | 450 | } |
| 451 | 451 | ||
diff --git a/fs/ext3/xattr_security.c b/fs/ext3/xattr_security.c index 722c2bf9645d..c9506d5e3b13 100644 --- a/fs/ext3/xattr_security.c +++ b/fs/ext3/xattr_security.c | |||
| @@ -29,7 +29,7 @@ ext3_xattr_security_get(struct dentry *dentry, const char *name, | |||
| 29 | { | 29 | { |
| 30 | if (strcmp(name, "") == 0) | 30 | if (strcmp(name, "") == 0) |
| 31 | return -EINVAL; | 31 | return -EINVAL; |
| 32 | return ext3_xattr_get(dentry->d_inode, EXT3_XATTR_INDEX_SECURITY, | 32 | return ext3_xattr_get(d_inode(dentry), EXT3_XATTR_INDEX_SECURITY, |
| 33 | name, buffer, size); | 33 | name, buffer, size); |
| 34 | } | 34 | } |
| 35 | 35 | ||
| @@ -39,7 +39,7 @@ ext3_xattr_security_set(struct dentry *dentry, const char *name, | |||
| 39 | { | 39 | { |
| 40 | if (strcmp(name, "") == 0) | 40 | if (strcmp(name, "") == 0) |
| 41 | return -EINVAL; | 41 | return -EINVAL; |
| 42 | return ext3_xattr_set(dentry->d_inode, EXT3_XATTR_INDEX_SECURITY, | 42 | return ext3_xattr_set(d_inode(dentry), EXT3_XATTR_INDEX_SECURITY, |
| 43 | name, value, size, flags); | 43 | name, value, size, flags); |
| 44 | } | 44 | } |
| 45 | 45 | ||
diff --git a/fs/ext3/xattr_trusted.c b/fs/ext3/xattr_trusted.c index d75727cc67fa..206cc66dc285 100644 --- a/fs/ext3/xattr_trusted.c +++ b/fs/ext3/xattr_trusted.c | |||
| @@ -32,7 +32,7 @@ ext3_xattr_trusted_get(struct dentry *dentry, const char *name, | |||
| 32 | { | 32 | { |
| 33 | if (strcmp(name, "") == 0) | 33 | if (strcmp(name, "") == 0) |
| 34 | return -EINVAL; | 34 | return -EINVAL; |
| 35 | return ext3_xattr_get(dentry->d_inode, EXT3_XATTR_INDEX_TRUSTED, | 35 | return ext3_xattr_get(d_inode(dentry), EXT3_XATTR_INDEX_TRUSTED, |
| 36 | name, buffer, size); | 36 | name, buffer, size); |
| 37 | } | 37 | } |
| 38 | 38 | ||
| @@ -42,7 +42,7 @@ ext3_xattr_trusted_set(struct dentry *dentry, const char *name, | |||
| 42 | { | 42 | { |
| 43 | if (strcmp(name, "") == 0) | 43 | if (strcmp(name, "") == 0) |
| 44 | return -EINVAL; | 44 | return -EINVAL; |
| 45 | return ext3_xattr_set(dentry->d_inode, EXT3_XATTR_INDEX_TRUSTED, name, | 45 | return ext3_xattr_set(d_inode(dentry), EXT3_XATTR_INDEX_TRUSTED, name, |
| 46 | value, size, flags); | 46 | value, size, flags); |
| 47 | } | 47 | } |
| 48 | 48 | ||
diff --git a/fs/ext3/xattr_user.c b/fs/ext3/xattr_user.c index 5612af3567e0..021508ad1616 100644 --- a/fs/ext3/xattr_user.c +++ b/fs/ext3/xattr_user.c | |||
| @@ -34,7 +34,7 @@ ext3_xattr_user_get(struct dentry *dentry, const char *name, void *buffer, | |||
| 34 | return -EINVAL; | 34 | return -EINVAL; |
| 35 | if (!test_opt(dentry->d_sb, XATTR_USER)) | 35 | if (!test_opt(dentry->d_sb, XATTR_USER)) |
| 36 | return -EOPNOTSUPP; | 36 | return -EOPNOTSUPP; |
| 37 | return ext3_xattr_get(dentry->d_inode, EXT3_XATTR_INDEX_USER, | 37 | return ext3_xattr_get(d_inode(dentry), EXT3_XATTR_INDEX_USER, |
| 38 | name, buffer, size); | 38 | name, buffer, size); |
| 39 | } | 39 | } |
| 40 | 40 | ||
| @@ -46,7 +46,7 @@ ext3_xattr_user_set(struct dentry *dentry, const char *name, | |||
| 46 | return -EINVAL; | 46 | return -EINVAL; |
| 47 | if (!test_opt(dentry->d_sb, XATTR_USER)) | 47 | if (!test_opt(dentry->d_sb, XATTR_USER)) |
| 48 | return -EOPNOTSUPP; | 48 | return -EOPNOTSUPP; |
| 49 | return ext3_xattr_set(dentry->d_inode, EXT3_XATTR_INDEX_USER, | 49 | return ext3_xattr_set(d_inode(dentry), EXT3_XATTR_INDEX_USER, |
| 50 | name, value, size, flags); | 50 | name, value, size, flags); |
| 51 | } | 51 | } |
| 52 | 52 | ||
diff --git a/fs/ext4/fsync.c b/fs/ext4/fsync.c index e9d632e9aa4b..8850254136ae 100644 --- a/fs/ext4/fsync.c +++ b/fs/ext4/fsync.c | |||
| @@ -55,7 +55,7 @@ static int ext4_sync_parent(struct inode *inode) | |||
| 55 | dentry = d_find_any_alias(inode); | 55 | dentry = d_find_any_alias(inode); |
| 56 | if (!dentry) | 56 | if (!dentry) |
| 57 | break; | 57 | break; |
| 58 | next = igrab(dentry->d_parent->d_inode); | 58 | next = igrab(d_inode(dentry->d_parent)); |
| 59 | dput(dentry); | 59 | dput(dentry); |
| 60 | if (!next) | 60 | if (!next) |
| 61 | break; | 61 | break; |
diff --git a/fs/ext4/ialloc.c b/fs/ext4/ialloc.c index 2cf18a2d5c72..1eaa6cb96cd0 100644 --- a/fs/ext4/ialloc.c +++ b/fs/ext4/ialloc.c | |||
| @@ -443,7 +443,7 @@ static int find_group_orlov(struct super_block *sb, struct inode *parent, | |||
| 443 | ndirs = percpu_counter_read_positive(&sbi->s_dirs_counter); | 443 | ndirs = percpu_counter_read_positive(&sbi->s_dirs_counter); |
| 444 | 444 | ||
| 445 | if (S_ISDIR(mode) && | 445 | if (S_ISDIR(mode) && |
| 446 | ((parent == sb->s_root->d_inode) || | 446 | ((parent == d_inode(sb->s_root)) || |
| 447 | (ext4_test_inode_flag(parent, EXT4_INODE_TOPDIR)))) { | 447 | (ext4_test_inode_flag(parent, EXT4_INODE_TOPDIR)))) { |
| 448 | int best_ndir = inodes_per_group; | 448 | int best_ndir = inodes_per_group; |
| 449 | int ret = -1; | 449 | int ret = -1; |
diff --git a/fs/ext4/indirect.c b/fs/ext4/indirect.c index 3580629e42d3..958824019509 100644 --- a/fs/ext4/indirect.c +++ b/fs/ext4/indirect.c | |||
| @@ -682,11 +682,11 @@ retry: | |||
| 682 | * via ext4_inode_block_unlocked_dio(). Check inode's state | 682 | * via ext4_inode_block_unlocked_dio(). Check inode's state |
| 683 | * while holding extra i_dio_count ref. | 683 | * while holding extra i_dio_count ref. |
| 684 | */ | 684 | */ |
| 685 | atomic_inc(&inode->i_dio_count); | 685 | inode_dio_begin(inode); |
| 686 | smp_mb(); | 686 | smp_mb(); |
| 687 | if (unlikely(ext4_test_inode_state(inode, | 687 | if (unlikely(ext4_test_inode_state(inode, |
| 688 | EXT4_STATE_DIOREAD_LOCK))) { | 688 | EXT4_STATE_DIOREAD_LOCK))) { |
| 689 | inode_dio_done(inode); | 689 | inode_dio_end(inode); |
| 690 | goto locked; | 690 | goto locked; |
| 691 | } | 691 | } |
| 692 | if (IS_DAX(inode)) | 692 | if (IS_DAX(inode)) |
| @@ -697,7 +697,7 @@ retry: | |||
| 697 | inode->i_sb->s_bdev, iter, | 697 | inode->i_sb->s_bdev, iter, |
| 698 | offset, ext4_get_block, NULL, | 698 | offset, ext4_get_block, NULL, |
| 699 | NULL, 0); | 699 | NULL, 0); |
| 700 | inode_dio_done(inode); | 700 | inode_dio_end(inode); |
| 701 | } else { | 701 | } else { |
| 702 | locked: | 702 | locked: |
| 703 | if (IS_DAX(inode)) | 703 | if (IS_DAX(inode)) |
diff --git a/fs/ext4/inline.c b/fs/ext4/inline.c index feb2cafbeace..095c7a258d97 100644 --- a/fs/ext4/inline.c +++ b/fs/ext4/inline.c | |||
| @@ -1000,7 +1000,7 @@ static int ext4_add_dirent_to_inline(handle_t *handle, | |||
| 1000 | struct ext4_iloc *iloc, | 1000 | struct ext4_iloc *iloc, |
| 1001 | void *inline_start, int inline_size) | 1001 | void *inline_start, int inline_size) |
| 1002 | { | 1002 | { |
| 1003 | struct inode *dir = dentry->d_parent->d_inode; | 1003 | struct inode *dir = d_inode(dentry->d_parent); |
| 1004 | const char *name = dentry->d_name.name; | 1004 | const char *name = dentry->d_name.name; |
| 1005 | int namelen = dentry->d_name.len; | 1005 | int namelen = dentry->d_name.len; |
| 1006 | int err; | 1006 | int err; |
| @@ -1254,7 +1254,7 @@ int ext4_try_add_inline_entry(handle_t *handle, struct dentry *dentry, | |||
| 1254 | int ret, inline_size; | 1254 | int ret, inline_size; |
| 1255 | void *inline_start; | 1255 | void *inline_start; |
| 1256 | struct ext4_iloc iloc; | 1256 | struct ext4_iloc iloc; |
| 1257 | struct inode *dir = dentry->d_parent->d_inode; | 1257 | struct inode *dir = d_inode(dentry->d_parent); |
| 1258 | 1258 | ||
| 1259 | ret = ext4_get_inode_loc(dir, &iloc); | 1259 | ret = ext4_get_inode_loc(dir, &iloc); |
| 1260 | if (ret) | 1260 | if (ret) |
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index 366476e71e10..cbd0654a2675 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c | |||
| @@ -3077,7 +3077,7 @@ static ssize_t ext4_ext_direct_IO(struct kiocb *iocb, struct iov_iter *iter, | |||
| 3077 | * overwrite DIO as i_dio_count needs to be incremented under i_mutex. | 3077 | * overwrite DIO as i_dio_count needs to be incremented under i_mutex. |
| 3078 | */ | 3078 | */ |
| 3079 | if (iov_iter_rw(iter) == WRITE) | 3079 | if (iov_iter_rw(iter) == WRITE) |
| 3080 | atomic_inc(&inode->i_dio_count); | 3080 | inode_dio_begin(inode); |
| 3081 | 3081 | ||
| 3082 | /* If we do a overwrite dio, i_mutex locking can be released */ | 3082 | /* If we do a overwrite dio, i_mutex locking can be released */ |
| 3083 | overwrite = *((int *)iocb->private); | 3083 | overwrite = *((int *)iocb->private); |
| @@ -3182,7 +3182,7 @@ static ssize_t ext4_ext_direct_IO(struct kiocb *iocb, struct iov_iter *iter, | |||
| 3182 | 3182 | ||
| 3183 | retake_lock: | 3183 | retake_lock: |
| 3184 | if (iov_iter_rw(iter) == WRITE) | 3184 | if (iov_iter_rw(iter) == WRITE) |
| 3185 | inode_dio_done(inode); | 3185 | inode_dio_end(inode); |
| 3186 | /* take i_mutex locking again if we do a ovewrite dio */ | 3186 | /* take i_mutex locking again if we do a ovewrite dio */ |
| 3187 | if (overwrite) { | 3187 | if (overwrite) { |
| 3188 | up_read(&EXT4_I(inode)->i_data_sem); | 3188 | up_read(&EXT4_I(inode)->i_data_sem); |
| @@ -4637,7 +4637,7 @@ static void ext4_wait_for_tail_page_commit(struct inode *inode) | |||
| 4637 | */ | 4637 | */ |
| 4638 | int ext4_setattr(struct dentry *dentry, struct iattr *attr) | 4638 | int ext4_setattr(struct dentry *dentry, struct iattr *attr) |
| 4639 | { | 4639 | { |
| 4640 | struct inode *inode = dentry->d_inode; | 4640 | struct inode *inode = d_inode(dentry); |
| 4641 | int error, rc = 0; | 4641 | int error, rc = 0; |
| 4642 | int orphan = 0; | 4642 | int orphan = 0; |
| 4643 | const unsigned int ia_valid = attr->ia_valid; | 4643 | const unsigned int ia_valid = attr->ia_valid; |
| @@ -4785,7 +4785,7 @@ int ext4_getattr(struct vfsmount *mnt, struct dentry *dentry, | |||
| 4785 | struct inode *inode; | 4785 | struct inode *inode; |
| 4786 | unsigned long long delalloc_blocks; | 4786 | unsigned long long delalloc_blocks; |
| 4787 | 4787 | ||
| 4788 | inode = dentry->d_inode; | 4788 | inode = d_inode(dentry); |
| 4789 | generic_fillattr(inode, stat); | 4789 | generic_fillattr(inode, stat); |
| 4790 | 4790 | ||
| 4791 | /* | 4791 | /* |
diff --git a/fs/ext4/migrate.c b/fs/ext4/migrate.c index 3cb267aee802..b52374e42102 100644 --- a/fs/ext4/migrate.c +++ b/fs/ext4/migrate.c | |||
| @@ -475,7 +475,7 @@ int ext4_ext_migrate(struct inode *inode) | |||
| 475 | EXT4_INODES_PER_GROUP(inode->i_sb)) + 1; | 475 | EXT4_INODES_PER_GROUP(inode->i_sb)) + 1; |
| 476 | owner[0] = i_uid_read(inode); | 476 | owner[0] = i_uid_read(inode); |
| 477 | owner[1] = i_gid_read(inode); | 477 | owner[1] = i_gid_read(inode); |
| 478 | tmp_inode = ext4_new_inode(handle, inode->i_sb->s_root->d_inode, | 478 | tmp_inode = ext4_new_inode(handle, d_inode(inode->i_sb->s_root), |
| 479 | S_IFREG, NULL, goal, owner); | 479 | S_IFREG, NULL, goal, owner); |
| 480 | if (IS_ERR(tmp_inode)) { | 480 | if (IS_ERR(tmp_inode)) { |
| 481 | retval = PTR_ERR(tmp_inode); | 481 | retval = PTR_ERR(tmp_inode); |
diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c index ef22cd951c0c..7223b0b4bc38 100644 --- a/fs/ext4/namei.c +++ b/fs/ext4/namei.c | |||
| @@ -1664,7 +1664,7 @@ struct dentry *ext4_get_parent(struct dentry *child) | |||
| 1664 | struct ext4_dir_entry_2 * de; | 1664 | struct ext4_dir_entry_2 * de; |
| 1665 | struct buffer_head *bh; | 1665 | struct buffer_head *bh; |
| 1666 | 1666 | ||
| 1667 | bh = ext4_find_entry(child->d_inode, &dotdot, &de, NULL); | 1667 | bh = ext4_find_entry(d_inode(child), &dotdot, &de, NULL); |
| 1668 | if (IS_ERR(bh)) | 1668 | if (IS_ERR(bh)) |
| 1669 | return (struct dentry *) bh; | 1669 | return (struct dentry *) bh; |
| 1670 | if (!bh) | 1670 | if (!bh) |
| @@ -1672,13 +1672,13 @@ struct dentry *ext4_get_parent(struct dentry *child) | |||
| 1672 | ino = le32_to_cpu(de->inode); | 1672 | ino = le32_to_cpu(de->inode); |
| 1673 | brelse(bh); | 1673 | brelse(bh); |
| 1674 | 1674 | ||
| 1675 | if (!ext4_valid_inum(child->d_inode->i_sb, ino)) { | 1675 | if (!ext4_valid_inum(d_inode(child)->i_sb, ino)) { |
| 1676 | EXT4_ERROR_INODE(child->d_inode, | 1676 | EXT4_ERROR_INODE(d_inode(child), |
| 1677 | "bad parent inode number: %u", ino); | 1677 | "bad parent inode number: %u", ino); |
| 1678 | return ERR_PTR(-EIO); | 1678 | return ERR_PTR(-EIO); |
| 1679 | } | 1679 | } |
| 1680 | 1680 | ||
| 1681 | return d_obtain_alias(ext4_iget_normal(child->d_inode->i_sb, ino)); | 1681 | return d_obtain_alias(ext4_iget_normal(d_inode(child)->i_sb, ino)); |
| 1682 | } | 1682 | } |
| 1683 | 1683 | ||
| 1684 | /* | 1684 | /* |
| @@ -1988,7 +1988,7 @@ static int add_dirent_to_buf(handle_t *handle, struct dentry *dentry, | |||
| 1988 | struct inode *inode, struct ext4_dir_entry_2 *de, | 1988 | struct inode *inode, struct ext4_dir_entry_2 *de, |
| 1989 | struct buffer_head *bh) | 1989 | struct buffer_head *bh) |
| 1990 | { | 1990 | { |
| 1991 | struct inode *dir = dentry->d_parent->d_inode; | 1991 | struct inode *dir = d_inode(dentry->d_parent); |
| 1992 | const char *name = dentry->d_name.name; | 1992 | const char *name = dentry->d_name.name; |
| 1993 | int namelen = dentry->d_name.len; | 1993 | int namelen = dentry->d_name.len; |
| 1994 | unsigned int blocksize = dir->i_sb->s_blocksize; | 1994 | unsigned int blocksize = dir->i_sb->s_blocksize; |
| @@ -2048,7 +2048,7 @@ static int add_dirent_to_buf(handle_t *handle, struct dentry *dentry, | |||
| 2048 | static int make_indexed_dir(handle_t *handle, struct dentry *dentry, | 2048 | static int make_indexed_dir(handle_t *handle, struct dentry *dentry, |
| 2049 | struct inode *inode, struct buffer_head *bh) | 2049 | struct inode *inode, struct buffer_head *bh) |
| 2050 | { | 2050 | { |
| 2051 | struct inode *dir = dentry->d_parent->d_inode; | 2051 | struct inode *dir = d_inode(dentry->d_parent); |
| 2052 | #ifdef CONFIG_EXT4_FS_ENCRYPTION | 2052 | #ifdef CONFIG_EXT4_FS_ENCRYPTION |
| 2053 | struct ext4_fname_crypto_ctx *ctx = NULL; | 2053 | struct ext4_fname_crypto_ctx *ctx = NULL; |
| 2054 | int res; | 2054 | int res; |
| @@ -2202,7 +2202,7 @@ out_frames: | |||
| 2202 | static int ext4_add_entry(handle_t *handle, struct dentry *dentry, | 2202 | static int ext4_add_entry(handle_t *handle, struct dentry *dentry, |
| 2203 | struct inode *inode) | 2203 | struct inode *inode) |
| 2204 | { | 2204 | { |
| 2205 | struct inode *dir = dentry->d_parent->d_inode; | 2205 | struct inode *dir = d_inode(dentry->d_parent); |
| 2206 | struct buffer_head *bh = NULL; | 2206 | struct buffer_head *bh = NULL; |
| 2207 | struct ext4_dir_entry_2 *de; | 2207 | struct ext4_dir_entry_2 *de; |
| 2208 | struct ext4_dir_entry_tail *t; | 2208 | struct ext4_dir_entry_tail *t; |
| @@ -2287,7 +2287,7 @@ static int ext4_dx_add_entry(handle_t *handle, struct dentry *dentry, | |||
| 2287 | struct dx_entry *entries, *at; | 2287 | struct dx_entry *entries, *at; |
| 2288 | struct dx_hash_info hinfo; | 2288 | struct dx_hash_info hinfo; |
| 2289 | struct buffer_head *bh; | 2289 | struct buffer_head *bh; |
| 2290 | struct inode *dir = dentry->d_parent->d_inode; | 2290 | struct inode *dir = d_inode(dentry->d_parent); |
| 2291 | struct super_block *sb = dir->i_sb; | 2291 | struct super_block *sb = dir->i_sb; |
| 2292 | struct ext4_dir_entry_2 *de; | 2292 | struct ext4_dir_entry_2 *de; |
| 2293 | int err; | 2293 | int err; |
| @@ -3063,7 +3063,7 @@ static int ext4_rmdir(struct inode *dir, struct dentry *dentry) | |||
| 3063 | /* Initialize quotas before so that eventual writes go in | 3063 | /* Initialize quotas before so that eventual writes go in |
| 3064 | * separate transaction */ | 3064 | * separate transaction */ |
| 3065 | dquot_initialize(dir); | 3065 | dquot_initialize(dir); |
| 3066 | dquot_initialize(dentry->d_inode); | 3066 | dquot_initialize(d_inode(dentry)); |
| 3067 | 3067 | ||
| 3068 | retval = -ENOENT; | 3068 | retval = -ENOENT; |
| 3069 | bh = ext4_find_entry(dir, &dentry->d_name, &de, NULL); | 3069 | bh = ext4_find_entry(dir, &dentry->d_name, &de, NULL); |
| @@ -3072,7 +3072,7 @@ static int ext4_rmdir(struct inode *dir, struct dentry *dentry) | |||
| 3072 | if (!bh) | 3072 | if (!bh) |
| 3073 | goto end_rmdir; | 3073 | goto end_rmdir; |
| 3074 | 3074 | ||
| 3075 | inode = dentry->d_inode; | 3075 | inode = d_inode(dentry); |
| 3076 | 3076 | ||
| 3077 | retval = -EIO; | 3077 | retval = -EIO; |
| 3078 | if (le32_to_cpu(de->inode) != inode->i_ino) | 3078 | if (le32_to_cpu(de->inode) != inode->i_ino) |
| @@ -3132,7 +3132,7 @@ static int ext4_unlink(struct inode *dir, struct dentry *dentry) | |||
| 3132 | /* Initialize quotas before so that eventual writes go | 3132 | /* Initialize quotas before so that eventual writes go |
| 3133 | * in separate transaction */ | 3133 | * in separate transaction */ |
| 3134 | dquot_initialize(dir); | 3134 | dquot_initialize(dir); |
| 3135 | dquot_initialize(dentry->d_inode); | 3135 | dquot_initialize(d_inode(dentry)); |
| 3136 | 3136 | ||
| 3137 | retval = -ENOENT; | 3137 | retval = -ENOENT; |
| 3138 | bh = ext4_find_entry(dir, &dentry->d_name, &de, NULL); | 3138 | bh = ext4_find_entry(dir, &dentry->d_name, &de, NULL); |
| @@ -3141,7 +3141,7 @@ static int ext4_unlink(struct inode *dir, struct dentry *dentry) | |||
| 3141 | if (!bh) | 3141 | if (!bh) |
| 3142 | goto end_unlink; | 3142 | goto end_unlink; |
| 3143 | 3143 | ||
| 3144 | inode = dentry->d_inode; | 3144 | inode = d_inode(dentry); |
| 3145 | 3145 | ||
| 3146 | retval = -EIO; | 3146 | retval = -EIO; |
| 3147 | if (le32_to_cpu(de->inode) != inode->i_ino) | 3147 | if (le32_to_cpu(de->inode) != inode->i_ino) |
| @@ -3339,7 +3339,7 @@ static int ext4_link(struct dentry *old_dentry, | |||
| 3339 | struct inode *dir, struct dentry *dentry) | 3339 | struct inode *dir, struct dentry *dentry) |
| 3340 | { | 3340 | { |
| 3341 | handle_t *handle; | 3341 | handle_t *handle; |
| 3342 | struct inode *inode = old_dentry->d_inode; | 3342 | struct inode *inode = d_inode(old_dentry); |
| 3343 | int err, retries = 0; | 3343 | int err, retries = 0; |
| 3344 | 3344 | ||
| 3345 | if (inode->i_nlink >= EXT4_LINK_MAX) | 3345 | if (inode->i_nlink >= EXT4_LINK_MAX) |
| @@ -3613,12 +3613,12 @@ static int ext4_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
| 3613 | struct ext4_renament old = { | 3613 | struct ext4_renament old = { |
| 3614 | .dir = old_dir, | 3614 | .dir = old_dir, |
| 3615 | .dentry = old_dentry, | 3615 | .dentry = old_dentry, |
| 3616 | .inode = old_dentry->d_inode, | 3616 | .inode = d_inode(old_dentry), |
| 3617 | }; | 3617 | }; |
| 3618 | struct ext4_renament new = { | 3618 | struct ext4_renament new = { |
| 3619 | .dir = new_dir, | 3619 | .dir = new_dir, |
| 3620 | .dentry = new_dentry, | 3620 | .dentry = new_dentry, |
| 3621 | .inode = new_dentry->d_inode, | 3621 | .inode = d_inode(new_dentry), |
| 3622 | }; | 3622 | }; |
| 3623 | int force_reread; | 3623 | int force_reread; |
| 3624 | int retval; | 3624 | int retval; |
| @@ -3809,12 +3809,12 @@ static int ext4_cross_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
| 3809 | struct ext4_renament old = { | 3809 | struct ext4_renament old = { |
| 3810 | .dir = old_dir, | 3810 | .dir = old_dir, |
| 3811 | .dentry = old_dentry, | 3811 | .dentry = old_dentry, |
| 3812 | .inode = old_dentry->d_inode, | 3812 | .inode = d_inode(old_dentry), |
| 3813 | }; | 3813 | }; |
| 3814 | struct ext4_renament new = { | 3814 | struct ext4_renament new = { |
| 3815 | .dir = new_dir, | 3815 | .dir = new_dir, |
| 3816 | .dentry = new_dentry, | 3816 | .dentry = new_dentry, |
| 3817 | .inode = new_dentry->d_inode, | 3817 | .inode = d_inode(new_dentry), |
| 3818 | }; | 3818 | }; |
| 3819 | u8 new_file_type; | 3819 | u8 new_file_type; |
| 3820 | int retval; | 3820 | int retval; |
diff --git a/fs/ext4/super.c b/fs/ext4/super.c index 821f22dbe825..f06d0589ddba 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c | |||
| @@ -1556,7 +1556,7 @@ static int handle_mount_opt(struct super_block *sb, char *opt, int token, | |||
| 1556 | return -1; | 1556 | return -1; |
| 1557 | } | 1557 | } |
| 1558 | 1558 | ||
| 1559 | journal_inode = path.dentry->d_inode; | 1559 | journal_inode = d_inode(path.dentry); |
| 1560 | if (!S_ISBLK(journal_inode->i_mode)) { | 1560 | if (!S_ISBLK(journal_inode->i_mode)) { |
| 1561 | ext4_msg(sb, KERN_ERR, "error: journal path %s " | 1561 | ext4_msg(sb, KERN_ERR, "error: journal path %s " |
| 1562 | "is not a block device", journal_path); | 1562 | "is not a block device", journal_path); |
| @@ -5217,7 +5217,7 @@ static int ext4_write_info(struct super_block *sb, int type) | |||
| 5217 | handle_t *handle; | 5217 | handle_t *handle; |
| 5218 | 5218 | ||
| 5219 | /* Data block + inode block */ | 5219 | /* Data block + inode block */ |
| 5220 | handle = ext4_journal_start(sb->s_root->d_inode, EXT4_HT_QUOTA, 2); | 5220 | handle = ext4_journal_start(d_inode(sb->s_root), EXT4_HT_QUOTA, 2); |
| 5221 | if (IS_ERR(handle)) | 5221 | if (IS_ERR(handle)) |
| 5222 | return PTR_ERR(handle); | 5222 | return PTR_ERR(handle); |
| 5223 | ret = dquot_commit_info(sb, type); | 5223 | ret = dquot_commit_info(sb, type); |
| @@ -5265,7 +5265,7 @@ static int ext4_quota_on(struct super_block *sb, int type, int format_id, | |||
| 5265 | * all updates to the file when we bypass pagecache... | 5265 | * all updates to the file when we bypass pagecache... |
| 5266 | */ | 5266 | */ |
| 5267 | if (EXT4_SB(sb)->s_journal && | 5267 | if (EXT4_SB(sb)->s_journal && |
| 5268 | ext4_should_journal_data(path->dentry->d_inode)) { | 5268 | ext4_should_journal_data(d_inode(path->dentry))) { |
| 5269 | /* | 5269 | /* |
| 5270 | * We don't need to lock updates but journal_flush() could | 5270 | * We don't need to lock updates but journal_flush() could |
| 5271 | * otherwise be livelocked... | 5271 | * otherwise be livelocked... |
diff --git a/fs/ext4/symlink.c b/fs/ext4/symlink.c index 136ca0e911fd..19f78f20975e 100644 --- a/fs/ext4/symlink.c +++ b/fs/ext4/symlink.c | |||
| @@ -28,7 +28,7 @@ static void *ext4_follow_link(struct dentry *dentry, struct nameidata *nd) | |||
| 28 | struct page *cpage = NULL; | 28 | struct page *cpage = NULL; |
| 29 | char *caddr, *paddr = NULL; | 29 | char *caddr, *paddr = NULL; |
| 30 | struct ext4_str cstr, pstr; | 30 | struct ext4_str cstr, pstr; |
| 31 | struct inode *inode = dentry->d_inode; | 31 | struct inode *inode = d_inode(dentry); |
| 32 | struct ext4_fname_crypto_ctx *ctx = NULL; | 32 | struct ext4_fname_crypto_ctx *ctx = NULL; |
| 33 | struct ext4_encrypted_symlink_data *sd; | 33 | struct ext4_encrypted_symlink_data *sd; |
| 34 | loff_t size = min_t(loff_t, i_size_read(inode), PAGE_SIZE - 1); | 34 | loff_t size = min_t(loff_t, i_size_read(inode), PAGE_SIZE - 1); |
| @@ -43,8 +43,8 @@ static void *ext4_follow_link(struct dentry *dentry, struct nameidata *nd) | |||
| 43 | return ctx; | 43 | return ctx; |
| 44 | 44 | ||
| 45 | if (ext4_inode_is_fast_symlink(inode)) { | 45 | if (ext4_inode_is_fast_symlink(inode)) { |
| 46 | caddr = (char *) EXT4_I(dentry->d_inode)->i_data; | 46 | caddr = (char *) EXT4_I(inode)->i_data; |
| 47 | max_size = sizeof(EXT4_I(dentry->d_inode)->i_data); | 47 | max_size = sizeof(EXT4_I(inode)->i_data); |
| 48 | } else { | 48 | } else { |
| 49 | cpage = read_mapping_page(inode->i_mapping, 0, NULL); | 49 | cpage = read_mapping_page(inode->i_mapping, 0, NULL); |
| 50 | if (IS_ERR(cpage)) { | 50 | if (IS_ERR(cpage)) { |
| @@ -113,7 +113,7 @@ static void ext4_put_link(struct dentry *dentry, struct nameidata *nd, | |||
| 113 | 113 | ||
| 114 | static void *ext4_follow_fast_link(struct dentry *dentry, struct nameidata *nd) | 114 | static void *ext4_follow_fast_link(struct dentry *dentry, struct nameidata *nd) |
| 115 | { | 115 | { |
| 116 | struct ext4_inode_info *ei = EXT4_I(dentry->d_inode); | 116 | struct ext4_inode_info *ei = EXT4_I(d_inode(dentry)); |
| 117 | nd_set_link(nd, (char *) ei->i_data); | 117 | nd_set_link(nd, (char *) ei->i_data); |
| 118 | return NULL; | 118 | return NULL; |
| 119 | } | 119 | } |
diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c index 759842ff8af0..16e28c08d1e8 100644 --- a/fs/ext4/xattr.c +++ b/fs/ext4/xattr.c | |||
| @@ -178,7 +178,7 @@ ext4_xattr_handler(int name_index) | |||
| 178 | /* | 178 | /* |
| 179 | * Inode operation listxattr() | 179 | * Inode operation listxattr() |
| 180 | * | 180 | * |
| 181 | * dentry->d_inode->i_mutex: don't care | 181 | * d_inode(dentry)->i_mutex: don't care |
| 182 | */ | 182 | */ |
| 183 | ssize_t | 183 | ssize_t |
| 184 | ext4_listxattr(struct dentry *dentry, char *buffer, size_t size) | 184 | ext4_listxattr(struct dentry *dentry, char *buffer, size_t size) |
| @@ -423,7 +423,7 @@ ext4_xattr_list_entries(struct dentry *dentry, struct ext4_xattr_entry *entry, | |||
| 423 | static int | 423 | static int |
| 424 | ext4_xattr_block_list(struct dentry *dentry, char *buffer, size_t buffer_size) | 424 | ext4_xattr_block_list(struct dentry *dentry, char *buffer, size_t buffer_size) |
| 425 | { | 425 | { |
| 426 | struct inode *inode = dentry->d_inode; | 426 | struct inode *inode = d_inode(dentry); |
| 427 | struct buffer_head *bh = NULL; | 427 | struct buffer_head *bh = NULL; |
| 428 | int error; | 428 | int error; |
| 429 | struct mb_cache *ext4_mb_cache = EXT4_GET_MB_CACHE(inode); | 429 | struct mb_cache *ext4_mb_cache = EXT4_GET_MB_CACHE(inode); |
| @@ -460,7 +460,7 @@ cleanup: | |||
| 460 | static int | 460 | static int |
| 461 | ext4_xattr_ibody_list(struct dentry *dentry, char *buffer, size_t buffer_size) | 461 | ext4_xattr_ibody_list(struct dentry *dentry, char *buffer, size_t buffer_size) |
| 462 | { | 462 | { |
| 463 | struct inode *inode = dentry->d_inode; | 463 | struct inode *inode = d_inode(dentry); |
| 464 | struct ext4_xattr_ibody_header *header; | 464 | struct ext4_xattr_ibody_header *header; |
| 465 | struct ext4_inode *raw_inode; | 465 | struct ext4_inode *raw_inode; |
| 466 | struct ext4_iloc iloc; | 466 | struct ext4_iloc iloc; |
| @@ -501,7 +501,7 @@ ext4_xattr_list(struct dentry *dentry, char *buffer, size_t buffer_size) | |||
| 501 | { | 501 | { |
| 502 | int ret, ret2; | 502 | int ret, ret2; |
| 503 | 503 | ||
| 504 | down_read(&EXT4_I(dentry->d_inode)->xattr_sem); | 504 | down_read(&EXT4_I(d_inode(dentry))->xattr_sem); |
| 505 | ret = ret2 = ext4_xattr_ibody_list(dentry, buffer, buffer_size); | 505 | ret = ret2 = ext4_xattr_ibody_list(dentry, buffer, buffer_size); |
| 506 | if (ret < 0) | 506 | if (ret < 0) |
| 507 | goto errout; | 507 | goto errout; |
| @@ -514,7 +514,7 @@ ext4_xattr_list(struct dentry *dentry, char *buffer, size_t buffer_size) | |||
| 514 | goto errout; | 514 | goto errout; |
| 515 | ret += ret2; | 515 | ret += ret2; |
| 516 | errout: | 516 | errout: |
| 517 | up_read(&EXT4_I(dentry->d_inode)->xattr_sem); | 517 | up_read(&EXT4_I(d_inode(dentry))->xattr_sem); |
| 518 | return ret; | 518 | return ret; |
| 519 | } | 519 | } |
| 520 | 520 | ||
diff --git a/fs/ext4/xattr_security.c b/fs/ext4/xattr_security.c index d2a200624af5..95d90e0560f0 100644 --- a/fs/ext4/xattr_security.c +++ b/fs/ext4/xattr_security.c | |||
| @@ -33,7 +33,7 @@ ext4_xattr_security_get(struct dentry *dentry, const char *name, | |||
| 33 | { | 33 | { |
| 34 | if (strcmp(name, "") == 0) | 34 | if (strcmp(name, "") == 0) |
| 35 | return -EINVAL; | 35 | return -EINVAL; |
| 36 | return ext4_xattr_get(dentry->d_inode, EXT4_XATTR_INDEX_SECURITY, | 36 | return ext4_xattr_get(d_inode(dentry), EXT4_XATTR_INDEX_SECURITY, |
| 37 | name, buffer, size); | 37 | name, buffer, size); |
| 38 | } | 38 | } |
| 39 | 39 | ||
| @@ -43,7 +43,7 @@ ext4_xattr_security_set(struct dentry *dentry, const char *name, | |||
| 43 | { | 43 | { |
| 44 | if (strcmp(name, "") == 0) | 44 | if (strcmp(name, "") == 0) |
| 45 | return -EINVAL; | 45 | return -EINVAL; |
| 46 | return ext4_xattr_set(dentry->d_inode, EXT4_XATTR_INDEX_SECURITY, | 46 | return ext4_xattr_set(d_inode(dentry), EXT4_XATTR_INDEX_SECURITY, |
| 47 | name, value, size, flags); | 47 | name, value, size, flags); |
| 48 | } | 48 | } |
| 49 | 49 | ||
diff --git a/fs/ext4/xattr_trusted.c b/fs/ext4/xattr_trusted.c index 95f1f4ab59a4..891ee2ddfbd6 100644 --- a/fs/ext4/xattr_trusted.c +++ b/fs/ext4/xattr_trusted.c | |||
| @@ -36,7 +36,7 @@ ext4_xattr_trusted_get(struct dentry *dentry, const char *name, void *buffer, | |||
| 36 | { | 36 | { |
| 37 | if (strcmp(name, "") == 0) | 37 | if (strcmp(name, "") == 0) |
| 38 | return -EINVAL; | 38 | return -EINVAL; |
| 39 | return ext4_xattr_get(dentry->d_inode, EXT4_XATTR_INDEX_TRUSTED, | 39 | return ext4_xattr_get(d_inode(dentry), EXT4_XATTR_INDEX_TRUSTED, |
| 40 | name, buffer, size); | 40 | name, buffer, size); |
| 41 | } | 41 | } |
| 42 | 42 | ||
| @@ -46,7 +46,7 @@ ext4_xattr_trusted_set(struct dentry *dentry, const char *name, | |||
| 46 | { | 46 | { |
| 47 | if (strcmp(name, "") == 0) | 47 | if (strcmp(name, "") == 0) |
| 48 | return -EINVAL; | 48 | return -EINVAL; |
| 49 | return ext4_xattr_set(dentry->d_inode, EXT4_XATTR_INDEX_TRUSTED, | 49 | return ext4_xattr_set(d_inode(dentry), EXT4_XATTR_INDEX_TRUSTED, |
| 50 | name, value, size, flags); | 50 | name, value, size, flags); |
| 51 | } | 51 | } |
| 52 | 52 | ||
diff --git a/fs/ext4/xattr_user.c b/fs/ext4/xattr_user.c index 0edb7611ffbe..6ed932b3c043 100644 --- a/fs/ext4/xattr_user.c +++ b/fs/ext4/xattr_user.c | |||
| @@ -37,7 +37,7 @@ ext4_xattr_user_get(struct dentry *dentry, const char *name, | |||
| 37 | return -EINVAL; | 37 | return -EINVAL; |
| 38 | if (!test_opt(dentry->d_sb, XATTR_USER)) | 38 | if (!test_opt(dentry->d_sb, XATTR_USER)) |
| 39 | return -EOPNOTSUPP; | 39 | return -EOPNOTSUPP; |
| 40 | return ext4_xattr_get(dentry->d_inode, EXT4_XATTR_INDEX_USER, | 40 | return ext4_xattr_get(d_inode(dentry), EXT4_XATTR_INDEX_USER, |
| 41 | name, buffer, size); | 41 | name, buffer, size); |
| 42 | } | 42 | } |
| 43 | 43 | ||
| @@ -49,7 +49,7 @@ ext4_xattr_user_set(struct dentry *dentry, const char *name, | |||
| 49 | return -EINVAL; | 49 | return -EINVAL; |
| 50 | if (!test_opt(dentry->d_sb, XATTR_USER)) | 50 | if (!test_opt(dentry->d_sb, XATTR_USER)) |
| 51 | return -EOPNOTSUPP; | 51 | return -EOPNOTSUPP; |
| 52 | return ext4_xattr_set(dentry->d_inode, EXT4_XATTR_INDEX_USER, | 52 | return ext4_xattr_set(d_inode(dentry), EXT4_XATTR_INDEX_USER, |
| 53 | name, value, size, flags); | 53 | name, value, size, flags); |
| 54 | } | 54 | } |
| 55 | 55 | ||
diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h index c06a25e5cec3..d8921cf2ba9a 100644 --- a/fs/f2fs/f2fs.h +++ b/fs/f2fs/f2fs.h | |||
| @@ -1482,7 +1482,7 @@ bool f2fs_empty_dir(struct inode *); | |||
| 1482 | 1482 | ||
| 1483 | static inline int f2fs_add_link(struct dentry *dentry, struct inode *inode) | 1483 | static inline int f2fs_add_link(struct dentry *dentry, struct inode *inode) |
| 1484 | { | 1484 | { |
| 1485 | return __f2fs_add_link(dentry->d_parent->d_inode, &dentry->d_name, | 1485 | return __f2fs_add_link(d_inode(dentry->d_parent), &dentry->d_name, |
| 1486 | inode, inode->i_ino, inode->i_mode); | 1486 | inode, inode->i_ino, inode->i_mode); |
| 1487 | } | 1487 | } |
| 1488 | 1488 | ||
diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index a6f3f6186588..2b52e48d7482 100644 --- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c | |||
| @@ -574,7 +574,7 @@ void f2fs_truncate(struct inode *inode) | |||
| 574 | int f2fs_getattr(struct vfsmount *mnt, | 574 | int f2fs_getattr(struct vfsmount *mnt, |
| 575 | struct dentry *dentry, struct kstat *stat) | 575 | struct dentry *dentry, struct kstat *stat) |
| 576 | { | 576 | { |
| 577 | struct inode *inode = dentry->d_inode; | 577 | struct inode *inode = d_inode(dentry); |
| 578 | generic_fillattr(inode, stat); | 578 | generic_fillattr(inode, stat); |
| 579 | stat->blocks <<= 3; | 579 | stat->blocks <<= 3; |
| 580 | return 0; | 580 | return 0; |
| @@ -613,7 +613,7 @@ static void __setattr_copy(struct inode *inode, const struct iattr *attr) | |||
| 613 | 613 | ||
| 614 | int f2fs_setattr(struct dentry *dentry, struct iattr *attr) | 614 | int f2fs_setattr(struct dentry *dentry, struct iattr *attr) |
| 615 | { | 615 | { |
| 616 | struct inode *inode = dentry->d_inode; | 616 | struct inode *inode = d_inode(dentry); |
| 617 | struct f2fs_inode_info *fi = F2FS_I(inode); | 617 | struct f2fs_inode_info *fi = F2FS_I(inode); |
| 618 | int err; | 618 | int err; |
| 619 | 619 | ||
diff --git a/fs/f2fs/namei.c b/fs/f2fs/namei.c index 407dde3d7a92..7e3794edae42 100644 --- a/fs/f2fs/namei.c +++ b/fs/f2fs/namei.c | |||
| @@ -151,7 +151,7 @@ out: | |||
| 151 | static int f2fs_link(struct dentry *old_dentry, struct inode *dir, | 151 | static int f2fs_link(struct dentry *old_dentry, struct inode *dir, |
| 152 | struct dentry *dentry) | 152 | struct dentry *dentry) |
| 153 | { | 153 | { |
| 154 | struct inode *inode = old_dentry->d_inode; | 154 | struct inode *inode = d_inode(old_dentry); |
| 155 | struct f2fs_sb_info *sbi = F2FS_I_SB(dir); | 155 | struct f2fs_sb_info *sbi = F2FS_I_SB(dir); |
| 156 | int err; | 156 | int err; |
| 157 | 157 | ||
| @@ -182,10 +182,10 @@ out: | |||
| 182 | struct dentry *f2fs_get_parent(struct dentry *child) | 182 | struct dentry *f2fs_get_parent(struct dentry *child) |
| 183 | { | 183 | { |
| 184 | struct qstr dotdot = QSTR_INIT("..", 2); | 184 | struct qstr dotdot = QSTR_INIT("..", 2); |
| 185 | unsigned long ino = f2fs_inode_by_name(child->d_inode, &dotdot); | 185 | unsigned long ino = f2fs_inode_by_name(d_inode(child), &dotdot); |
| 186 | if (!ino) | 186 | if (!ino) |
| 187 | return ERR_PTR(-ENOENT); | 187 | return ERR_PTR(-ENOENT); |
| 188 | return d_obtain_alias(f2fs_iget(child->d_inode->i_sb, ino)); | 188 | return d_obtain_alias(f2fs_iget(d_inode(child)->i_sb, ino)); |
| 189 | } | 189 | } |
| 190 | 190 | ||
| 191 | static int __recover_dot_dentries(struct inode *dir, nid_t pino) | 191 | static int __recover_dot_dentries(struct inode *dir, nid_t pino) |
| @@ -263,7 +263,7 @@ static struct dentry *f2fs_lookup(struct inode *dir, struct dentry *dentry, | |||
| 263 | static int f2fs_unlink(struct inode *dir, struct dentry *dentry) | 263 | static int f2fs_unlink(struct inode *dir, struct dentry *dentry) |
| 264 | { | 264 | { |
| 265 | struct f2fs_sb_info *sbi = F2FS_I_SB(dir); | 265 | struct f2fs_sb_info *sbi = F2FS_I_SB(dir); |
| 266 | struct inode *inode = dentry->d_inode; | 266 | struct inode *inode = d_inode(dentry); |
| 267 | struct f2fs_dir_entry *de; | 267 | struct f2fs_dir_entry *de; |
| 268 | struct page *page; | 268 | struct page *page; |
| 269 | int err = -ENOENT; | 269 | int err = -ENOENT; |
| @@ -403,7 +403,7 @@ out_fail: | |||
| 403 | 403 | ||
| 404 | static int f2fs_rmdir(struct inode *dir, struct dentry *dentry) | 404 | static int f2fs_rmdir(struct inode *dir, struct dentry *dentry) |
| 405 | { | 405 | { |
| 406 | struct inode *inode = dentry->d_inode; | 406 | struct inode *inode = d_inode(dentry); |
| 407 | if (f2fs_empty_dir(inode)) | 407 | if (f2fs_empty_dir(inode)) |
| 408 | return f2fs_unlink(dir, dentry); | 408 | return f2fs_unlink(dir, dentry); |
| 409 | return -ENOTEMPTY; | 409 | return -ENOTEMPTY; |
| @@ -451,8 +451,8 @@ static int f2fs_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
| 451 | struct inode *new_dir, struct dentry *new_dentry) | 451 | struct inode *new_dir, struct dentry *new_dentry) |
| 452 | { | 452 | { |
| 453 | struct f2fs_sb_info *sbi = F2FS_I_SB(old_dir); | 453 | struct f2fs_sb_info *sbi = F2FS_I_SB(old_dir); |
| 454 | struct inode *old_inode = old_dentry->d_inode; | 454 | struct inode *old_inode = d_inode(old_dentry); |
| 455 | struct inode *new_inode = new_dentry->d_inode; | 455 | struct inode *new_inode = d_inode(new_dentry); |
| 456 | struct page *old_dir_page; | 456 | struct page *old_dir_page; |
| 457 | struct page *old_page, *new_page; | 457 | struct page *old_page, *new_page; |
| 458 | struct f2fs_dir_entry *old_dir_entry = NULL; | 458 | struct f2fs_dir_entry *old_dir_entry = NULL; |
| @@ -578,8 +578,8 @@ static int f2fs_cross_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
| 578 | struct inode *new_dir, struct dentry *new_dentry) | 578 | struct inode *new_dir, struct dentry *new_dentry) |
| 579 | { | 579 | { |
| 580 | struct f2fs_sb_info *sbi = F2FS_I_SB(old_dir); | 580 | struct f2fs_sb_info *sbi = F2FS_I_SB(old_dir); |
| 581 | struct inode *old_inode = old_dentry->d_inode; | 581 | struct inode *old_inode = d_inode(old_dentry); |
| 582 | struct inode *new_inode = new_dentry->d_inode; | 582 | struct inode *new_inode = d_inode(new_dentry); |
| 583 | struct page *old_dir_page, *new_dir_page; | 583 | struct page *old_dir_page, *new_dir_page; |
| 584 | struct page *old_page, *new_page; | 584 | struct page *old_page, *new_page; |
| 585 | struct f2fs_dir_entry *old_dir_entry = NULL, *new_dir_entry = NULL; | 585 | struct f2fs_dir_entry *old_dir_entry = NULL, *new_dir_entry = NULL; |
diff --git a/fs/f2fs/xattr.c b/fs/f2fs/xattr.c index b0fd2f2d0716..9757f65a05bc 100644 --- a/fs/f2fs/xattr.c +++ b/fs/f2fs/xattr.c | |||
| @@ -83,7 +83,7 @@ static int f2fs_xattr_generic_get(struct dentry *dentry, const char *name, | |||
| 83 | } | 83 | } |
| 84 | if (strcmp(name, "") == 0) | 84 | if (strcmp(name, "") == 0) |
| 85 | return -EINVAL; | 85 | return -EINVAL; |
| 86 | return f2fs_getxattr(dentry->d_inode, type, name, buffer, size, NULL); | 86 | return f2fs_getxattr(d_inode(dentry), type, name, buffer, size, NULL); |
| 87 | } | 87 | } |
| 88 | 88 | ||
| 89 | static int f2fs_xattr_generic_set(struct dentry *dentry, const char *name, | 89 | static int f2fs_xattr_generic_set(struct dentry *dentry, const char *name, |
| @@ -108,7 +108,7 @@ static int f2fs_xattr_generic_set(struct dentry *dentry, const char *name, | |||
| 108 | if (strcmp(name, "") == 0) | 108 | if (strcmp(name, "") == 0) |
| 109 | return -EINVAL; | 109 | return -EINVAL; |
| 110 | 110 | ||
| 111 | return f2fs_setxattr(dentry->d_inode, type, name, | 111 | return f2fs_setxattr(d_inode(dentry), type, name, |
| 112 | value, size, NULL, flags); | 112 | value, size, NULL, flags); |
| 113 | } | 113 | } |
| 114 | 114 | ||
| @@ -130,7 +130,7 @@ static size_t f2fs_xattr_advise_list(struct dentry *dentry, char *list, | |||
| 130 | static int f2fs_xattr_advise_get(struct dentry *dentry, const char *name, | 130 | static int f2fs_xattr_advise_get(struct dentry *dentry, const char *name, |
| 131 | void *buffer, size_t size, int type) | 131 | void *buffer, size_t size, int type) |
| 132 | { | 132 | { |
| 133 | struct inode *inode = dentry->d_inode; | 133 | struct inode *inode = d_inode(dentry); |
| 134 | 134 | ||
| 135 | if (strcmp(name, "") != 0) | 135 | if (strcmp(name, "") != 0) |
| 136 | return -EINVAL; | 136 | return -EINVAL; |
| @@ -143,7 +143,7 @@ static int f2fs_xattr_advise_get(struct dentry *dentry, const char *name, | |||
| 143 | static int f2fs_xattr_advise_set(struct dentry *dentry, const char *name, | 143 | static int f2fs_xattr_advise_set(struct dentry *dentry, const char *name, |
| 144 | const void *value, size_t size, int flags, int type) | 144 | const void *value, size_t size, int flags, int type) |
| 145 | { | 145 | { |
| 146 | struct inode *inode = dentry->d_inode; | 146 | struct inode *inode = d_inode(dentry); |
| 147 | 147 | ||
| 148 | if (strcmp(name, "") != 0) | 148 | if (strcmp(name, "") != 0) |
| 149 | return -EINVAL; | 149 | return -EINVAL; |
| @@ -444,7 +444,7 @@ cleanup: | |||
| 444 | 444 | ||
| 445 | ssize_t f2fs_listxattr(struct dentry *dentry, char *buffer, size_t buffer_size) | 445 | ssize_t f2fs_listxattr(struct dentry *dentry, char *buffer, size_t buffer_size) |
| 446 | { | 446 | { |
| 447 | struct inode *inode = dentry->d_inode; | 447 | struct inode *inode = d_inode(dentry); |
| 448 | struct f2fs_xattr_entry *entry; | 448 | struct f2fs_xattr_entry *entry; |
| 449 | void *base_addr; | 449 | void *base_addr; |
| 450 | int error = 0; | 450 | int error = 0; |
diff --git a/fs/fat/file.c b/fs/fat/file.c index cf50d93565a2..442d50a0e33e 100644 --- a/fs/fat/file.c +++ b/fs/fat/file.c | |||
| @@ -305,7 +305,7 @@ void fat_truncate_blocks(struct inode *inode, loff_t offset) | |||
| 305 | 305 | ||
| 306 | int fat_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat) | 306 | int fat_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat) |
| 307 | { | 307 | { |
| 308 | struct inode *inode = dentry->d_inode; | 308 | struct inode *inode = d_inode(dentry); |
| 309 | generic_fillattr(inode, stat); | 309 | generic_fillattr(inode, stat); |
| 310 | stat->blksize = MSDOS_SB(inode->i_sb)->cluster_size; | 310 | stat->blksize = MSDOS_SB(inode->i_sb)->cluster_size; |
| 311 | 311 | ||
| @@ -377,7 +377,7 @@ static int fat_allow_set_time(struct msdos_sb_info *sbi, struct inode *inode) | |||
| 377 | int fat_setattr(struct dentry *dentry, struct iattr *attr) | 377 | int fat_setattr(struct dentry *dentry, struct iattr *attr) |
| 378 | { | 378 | { |
| 379 | struct msdos_sb_info *sbi = MSDOS_SB(dentry->d_sb); | 379 | struct msdos_sb_info *sbi = MSDOS_SB(dentry->d_sb); |
| 380 | struct inode *inode = dentry->d_inode; | 380 | struct inode *inode = d_inode(dentry); |
| 381 | unsigned int ia_valid; | 381 | unsigned int ia_valid; |
| 382 | int error; | 382 | int error; |
| 383 | 383 | ||
diff --git a/fs/fat/namei_msdos.c b/fs/fat/namei_msdos.c index cc6a8541b668..b7e2b33aa793 100644 --- a/fs/fat/namei_msdos.c +++ b/fs/fat/namei_msdos.c | |||
| @@ -308,7 +308,7 @@ out: | |||
| 308 | static int msdos_rmdir(struct inode *dir, struct dentry *dentry) | 308 | static int msdos_rmdir(struct inode *dir, struct dentry *dentry) |
| 309 | { | 309 | { |
| 310 | struct super_block *sb = dir->i_sb; | 310 | struct super_block *sb = dir->i_sb; |
| 311 | struct inode *inode = dentry->d_inode; | 311 | struct inode *inode = d_inode(dentry); |
| 312 | struct fat_slot_info sinfo; | 312 | struct fat_slot_info sinfo; |
| 313 | int err; | 313 | int err; |
| 314 | 314 | ||
| @@ -402,7 +402,7 @@ out: | |||
| 402 | /***** Unlink a file */ | 402 | /***** Unlink a file */ |
| 403 | static int msdos_unlink(struct inode *dir, struct dentry *dentry) | 403 | static int msdos_unlink(struct inode *dir, struct dentry *dentry) |
| 404 | { | 404 | { |
| 405 | struct inode *inode = dentry->d_inode; | 405 | struct inode *inode = d_inode(dentry); |
| 406 | struct super_block *sb = inode->i_sb; | 406 | struct super_block *sb = inode->i_sb; |
| 407 | struct fat_slot_info sinfo; | 407 | struct fat_slot_info sinfo; |
| 408 | int err; | 408 | int err; |
| @@ -440,8 +440,8 @@ static int do_msdos_rename(struct inode *old_dir, unsigned char *old_name, | |||
| 440 | int err, old_attrs, is_dir, update_dotdot, corrupt = 0; | 440 | int err, old_attrs, is_dir, update_dotdot, corrupt = 0; |
| 441 | 441 | ||
| 442 | old_sinfo.bh = sinfo.bh = dotdot_bh = NULL; | 442 | old_sinfo.bh = sinfo.bh = dotdot_bh = NULL; |
| 443 | old_inode = old_dentry->d_inode; | 443 | old_inode = d_inode(old_dentry); |
| 444 | new_inode = new_dentry->d_inode; | 444 | new_inode = d_inode(new_dentry); |
| 445 | 445 | ||
| 446 | err = fat_scan(old_dir, old_name, &old_sinfo); | 446 | err = fat_scan(old_dir, old_name, &old_sinfo); |
| 447 | if (err) { | 447 | if (err) { |
diff --git a/fs/fat/namei_vfat.c b/fs/fat/namei_vfat.c index 7e0974eebd8e..7092584f424a 100644 --- a/fs/fat/namei_vfat.c +++ b/fs/fat/namei_vfat.c | |||
| @@ -33,7 +33,7 @@ static int vfat_revalidate_shortname(struct dentry *dentry) | |||
| 33 | { | 33 | { |
| 34 | int ret = 1; | 34 | int ret = 1; |
| 35 | spin_lock(&dentry->d_lock); | 35 | spin_lock(&dentry->d_lock); |
| 36 | if (dentry->d_time != dentry->d_parent->d_inode->i_version) | 36 | if (dentry->d_time != d_inode(dentry->d_parent)->i_version) |
| 37 | ret = 0; | 37 | ret = 0; |
| 38 | spin_unlock(&dentry->d_lock); | 38 | spin_unlock(&dentry->d_lock); |
| 39 | return ret; | 39 | return ret; |
| @@ -45,7 +45,7 @@ static int vfat_revalidate(struct dentry *dentry, unsigned int flags) | |||
| 45 | return -ECHILD; | 45 | return -ECHILD; |
| 46 | 46 | ||
| 47 | /* This is not negative dentry. Always valid. */ | 47 | /* This is not negative dentry. Always valid. */ |
| 48 | if (dentry->d_inode) | 48 | if (d_really_is_positive(dentry)) |
| 49 | return 1; | 49 | return 1; |
| 50 | return vfat_revalidate_shortname(dentry); | 50 | return vfat_revalidate_shortname(dentry); |
| 51 | } | 51 | } |
| @@ -65,7 +65,7 @@ static int vfat_revalidate_ci(struct dentry *dentry, unsigned int flags) | |||
| 65 | * positive dentry isn't good idea. So it's unsupported like | 65 | * positive dentry isn't good idea. So it's unsupported like |
| 66 | * rename("filename", "FILENAME") for now. | 66 | * rename("filename", "FILENAME") for now. |
| 67 | */ | 67 | */ |
| 68 | if (dentry->d_inode) | 68 | if (d_really_is_positive(dentry)) |
| 69 | return 1; | 69 | return 1; |
| 70 | 70 | ||
| 71 | /* | 71 | /* |
| @@ -801,7 +801,7 @@ out: | |||
| 801 | 801 | ||
| 802 | static int vfat_rmdir(struct inode *dir, struct dentry *dentry) | 802 | static int vfat_rmdir(struct inode *dir, struct dentry *dentry) |
| 803 | { | 803 | { |
| 804 | struct inode *inode = dentry->d_inode; | 804 | struct inode *inode = d_inode(dentry); |
| 805 | struct super_block *sb = dir->i_sb; | 805 | struct super_block *sb = dir->i_sb; |
| 806 | struct fat_slot_info sinfo; | 806 | struct fat_slot_info sinfo; |
| 807 | int err; | 807 | int err; |
| @@ -832,7 +832,7 @@ out: | |||
| 832 | 832 | ||
| 833 | static int vfat_unlink(struct inode *dir, struct dentry *dentry) | 833 | static int vfat_unlink(struct inode *dir, struct dentry *dentry) |
| 834 | { | 834 | { |
| 835 | struct inode *inode = dentry->d_inode; | 835 | struct inode *inode = d_inode(dentry); |
| 836 | struct super_block *sb = dir->i_sb; | 836 | struct super_block *sb = dir->i_sb; |
| 837 | struct fat_slot_info sinfo; | 837 | struct fat_slot_info sinfo; |
| 838 | int err; | 838 | int err; |
| @@ -915,8 +915,8 @@ static int vfat_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
| 915 | struct super_block *sb = old_dir->i_sb; | 915 | struct super_block *sb = old_dir->i_sb; |
| 916 | 916 | ||
| 917 | old_sinfo.bh = sinfo.bh = dotdot_bh = NULL; | 917 | old_sinfo.bh = sinfo.bh = dotdot_bh = NULL; |
| 918 | old_inode = old_dentry->d_inode; | 918 | old_inode = d_inode(old_dentry); |
| 919 | new_inode = new_dentry->d_inode; | 919 | new_inode = d_inode(new_dentry); |
| 920 | mutex_lock(&MSDOS_SB(sb)->s_lock); | 920 | mutex_lock(&MSDOS_SB(sb)->s_lock); |
| 921 | err = vfat_find(old_dir, &old_dentry->d_name, &old_sinfo); | 921 | err = vfat_find(old_dir, &old_dentry->d_name, &old_sinfo); |
| 922 | if (err) | 922 | if (err) |
diff --git a/fs/fat/nfs.c b/fs/fat/nfs.c index 93e14933dcb6..eb192656fba2 100644 --- a/fs/fat/nfs.c +++ b/fs/fat/nfs.c | |||
| @@ -266,7 +266,7 @@ struct inode *fat_rebuild_parent(struct super_block *sb, int parent_logstart) | |||
| 266 | * Find the parent for a directory that is not currently connected to | 266 | * Find the parent for a directory that is not currently connected to |
| 267 | * the filesystem root. | 267 | * the filesystem root. |
| 268 | * | 268 | * |
| 269 | * On entry, the caller holds child_dir->d_inode->i_mutex. | 269 | * On entry, the caller holds d_inode(child_dir)->i_mutex. |
| 270 | */ | 270 | */ |
| 271 | static struct dentry *fat_get_parent(struct dentry *child_dir) | 271 | static struct dentry *fat_get_parent(struct dentry *child_dir) |
| 272 | { | 272 | { |
| @@ -276,7 +276,7 @@ static struct dentry *fat_get_parent(struct dentry *child_dir) | |||
| 276 | struct inode *parent_inode = NULL; | 276 | struct inode *parent_inode = NULL; |
| 277 | struct msdos_sb_info *sbi = MSDOS_SB(sb); | 277 | struct msdos_sb_info *sbi = MSDOS_SB(sb); |
| 278 | 278 | ||
| 279 | if (!fat_get_dotdot_entry(child_dir->d_inode, &bh, &de)) { | 279 | if (!fat_get_dotdot_entry(d_inode(child_dir), &bh, &de)) { |
| 280 | int parent_logstart = fat_get_start(sbi, de); | 280 | int parent_logstart = fat_get_start(sbi, de); |
| 281 | parent_inode = fat_dget(sb, parent_logstart); | 281 | parent_inode = fat_dget(sb, parent_logstart); |
| 282 | if (!parent_inode && sbi->options.nfs == FAT_NFS_NOSTALE_RO) | 282 | if (!parent_inode && sbi->options.nfs == FAT_NFS_NOSTALE_RO) |
diff --git a/fs/freevxfs/vxfs_immed.c b/fs/freevxfs/vxfs_immed.c index c36aeaf92e41..8b9229e2ca5c 100644 --- a/fs/freevxfs/vxfs_immed.c +++ b/fs/freevxfs/vxfs_immed.c | |||
| @@ -76,7 +76,7 @@ const struct address_space_operations vxfs_immed_aops = { | |||
| 76 | static void * | 76 | static void * |
| 77 | vxfs_immed_follow_link(struct dentry *dp, struct nameidata *np) | 77 | vxfs_immed_follow_link(struct dentry *dp, struct nameidata *np) |
| 78 | { | 78 | { |
| 79 | struct vxfs_inode_info *vip = VXFS_INO(dp->d_inode); | 79 | struct vxfs_inode_info *vip = VXFS_INO(d_inode(dp)); |
| 80 | nd_set_link(np, vip->vii_immed.vi_immed); | 80 | nd_set_link(np, vip->vii_immed.vi_immed); |
| 81 | return NULL; | 81 | return NULL; |
| 82 | } | 82 | } |
diff --git a/fs/fuse/control.c b/fs/fuse/control.c index 205e0d5d5307..f863ac6647ac 100644 --- a/fs/fuse/control.c +++ b/fs/fuse/control.c | |||
| @@ -244,7 +244,7 @@ int fuse_ctl_add_conn(struct fuse_conn *fc) | |||
| 244 | return 0; | 244 | return 0; |
| 245 | 245 | ||
| 246 | parent = fuse_control_sb->s_root; | 246 | parent = fuse_control_sb->s_root; |
| 247 | inc_nlink(parent->d_inode); | 247 | inc_nlink(d_inode(parent)); |
| 248 | sprintf(name, "%u", fc->dev); | 248 | sprintf(name, "%u", fc->dev); |
| 249 | parent = fuse_ctl_add_dentry(parent, fc, name, S_IFDIR | 0500, 2, | 249 | parent = fuse_ctl_add_dentry(parent, fc, name, S_IFDIR | 0500, 2, |
| 250 | &simple_dir_inode_operations, | 250 | &simple_dir_inode_operations, |
| @@ -283,11 +283,11 @@ void fuse_ctl_remove_conn(struct fuse_conn *fc) | |||
| 283 | 283 | ||
| 284 | for (i = fc->ctl_ndents - 1; i >= 0; i--) { | 284 | for (i = fc->ctl_ndents - 1; i >= 0; i--) { |
| 285 | struct dentry *dentry = fc->ctl_dentry[i]; | 285 | struct dentry *dentry = fc->ctl_dentry[i]; |
| 286 | dentry->d_inode->i_private = NULL; | 286 | d_inode(dentry)->i_private = NULL; |
| 287 | d_drop(dentry); | 287 | d_drop(dentry); |
| 288 | dput(dentry); | 288 | dput(dentry); |
| 289 | } | 289 | } |
| 290 | drop_nlink(fuse_control_sb->s_root->d_inode); | 290 | drop_nlink(d_inode(fuse_control_sb->s_root)); |
| 291 | } | 291 | } |
| 292 | 292 | ||
| 293 | static int fuse_ctl_fill_super(struct super_block *sb, void *data, int silent) | 293 | static int fuse_ctl_fill_super(struct super_block *sb, void *data, int silent) |
diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c index 1545b711ddcf..0572bca49f15 100644 --- a/fs/fuse/dir.c +++ b/fs/fuse/dir.c | |||
| @@ -192,7 +192,7 @@ static int fuse_dentry_revalidate(struct dentry *entry, unsigned int flags) | |||
| 192 | struct fuse_inode *fi; | 192 | struct fuse_inode *fi; |
| 193 | int ret; | 193 | int ret; |
| 194 | 194 | ||
| 195 | inode = ACCESS_ONCE(entry->d_inode); | 195 | inode = d_inode_rcu(entry); |
| 196 | if (inode && is_bad_inode(inode)) | 196 | if (inode && is_bad_inode(inode)) |
| 197 | goto invalid; | 197 | goto invalid; |
| 198 | else if (time_before64(fuse_dentry_time(entry), get_jiffies_64()) || | 198 | else if (time_before64(fuse_dentry_time(entry), get_jiffies_64()) || |
| @@ -220,7 +220,7 @@ static int fuse_dentry_revalidate(struct dentry *entry, unsigned int flags) | |||
| 220 | attr_version = fuse_get_attr_version(fc); | 220 | attr_version = fuse_get_attr_version(fc); |
| 221 | 221 | ||
| 222 | parent = dget_parent(entry); | 222 | parent = dget_parent(entry); |
| 223 | fuse_lookup_init(fc, &args, get_node_id(parent->d_inode), | 223 | fuse_lookup_init(fc, &args, get_node_id(d_inode(parent)), |
| 224 | &entry->d_name, &outarg); | 224 | &entry->d_name, &outarg); |
| 225 | ret = fuse_simple_request(fc, &args); | 225 | ret = fuse_simple_request(fc, &args); |
| 226 | dput(parent); | 226 | dput(parent); |
| @@ -254,7 +254,7 @@ static int fuse_dentry_revalidate(struct dentry *entry, unsigned int flags) | |||
| 254 | return -ECHILD; | 254 | return -ECHILD; |
| 255 | } else if (test_and_clear_bit(FUSE_I_INIT_RDPLUS, &fi->state)) { | 255 | } else if (test_and_clear_bit(FUSE_I_INIT_RDPLUS, &fi->state)) { |
| 256 | parent = dget_parent(entry); | 256 | parent = dget_parent(entry); |
| 257 | fuse_advise_use_readdirplus(parent->d_inode); | 257 | fuse_advise_use_readdirplus(d_inode(parent)); |
| 258 | dput(parent); | 258 | dput(parent); |
| 259 | } | 259 | } |
| 260 | } | 260 | } |
| @@ -487,7 +487,7 @@ static int fuse_atomic_open(struct inode *dir, struct dentry *entry, | |||
| 487 | entry = res; | 487 | entry = res; |
| 488 | } | 488 | } |
| 489 | 489 | ||
| 490 | if (!(flags & O_CREAT) || entry->d_inode) | 490 | if (!(flags & O_CREAT) || d_really_is_positive(entry)) |
| 491 | goto no_open; | 491 | goto no_open; |
| 492 | 492 | ||
| 493 | /* Only creates */ | 493 | /* Only creates */ |
| @@ -653,7 +653,7 @@ static int fuse_unlink(struct inode *dir, struct dentry *entry) | |||
| 653 | args.in.args[0].value = entry->d_name.name; | 653 | args.in.args[0].value = entry->d_name.name; |
| 654 | err = fuse_simple_request(fc, &args); | 654 | err = fuse_simple_request(fc, &args); |
| 655 | if (!err) { | 655 | if (!err) { |
| 656 | struct inode *inode = entry->d_inode; | 656 | struct inode *inode = d_inode(entry); |
| 657 | struct fuse_inode *fi = get_fuse_inode(inode); | 657 | struct fuse_inode *fi = get_fuse_inode(inode); |
| 658 | 658 | ||
| 659 | spin_lock(&fc->lock); | 659 | spin_lock(&fc->lock); |
| @@ -689,7 +689,7 @@ static int fuse_rmdir(struct inode *dir, struct dentry *entry) | |||
| 689 | args.in.args[0].value = entry->d_name.name; | 689 | args.in.args[0].value = entry->d_name.name; |
| 690 | err = fuse_simple_request(fc, &args); | 690 | err = fuse_simple_request(fc, &args); |
| 691 | if (!err) { | 691 | if (!err) { |
| 692 | clear_nlink(entry->d_inode); | 692 | clear_nlink(d_inode(entry)); |
| 693 | fuse_invalidate_attr(dir); | 693 | fuse_invalidate_attr(dir); |
| 694 | fuse_invalidate_entry_cache(entry); | 694 | fuse_invalidate_entry_cache(entry); |
| 695 | } else if (err == -EINTR) | 695 | } else if (err == -EINTR) |
| @@ -721,12 +721,12 @@ static int fuse_rename_common(struct inode *olddir, struct dentry *oldent, | |||
| 721 | err = fuse_simple_request(fc, &args); | 721 | err = fuse_simple_request(fc, &args); |
| 722 | if (!err) { | 722 | if (!err) { |
| 723 | /* ctime changes */ | 723 | /* ctime changes */ |
| 724 | fuse_invalidate_attr(oldent->d_inode); | 724 | fuse_invalidate_attr(d_inode(oldent)); |
| 725 | fuse_update_ctime(oldent->d_inode); | 725 | fuse_update_ctime(d_inode(oldent)); |
| 726 | 726 | ||
| 727 | if (flags & RENAME_EXCHANGE) { | 727 | if (flags & RENAME_EXCHANGE) { |
| 728 | fuse_invalidate_attr(newent->d_inode); | 728 | fuse_invalidate_attr(d_inode(newent)); |
| 729 | fuse_update_ctime(newent->d_inode); | 729 | fuse_update_ctime(d_inode(newent)); |
| 730 | } | 730 | } |
| 731 | 731 | ||
| 732 | fuse_invalidate_attr(olddir); | 732 | fuse_invalidate_attr(olddir); |
| @@ -734,10 +734,10 @@ static int fuse_rename_common(struct inode *olddir, struct dentry *oldent, | |||
| 734 | fuse_invalidate_attr(newdir); | 734 | fuse_invalidate_attr(newdir); |
| 735 | 735 | ||
| 736 | /* newent will end up negative */ | 736 | /* newent will end up negative */ |
| 737 | if (!(flags & RENAME_EXCHANGE) && newent->d_inode) { | 737 | if (!(flags & RENAME_EXCHANGE) && d_really_is_positive(newent)) { |
| 738 | fuse_invalidate_attr(newent->d_inode); | 738 | fuse_invalidate_attr(d_inode(newent)); |
| 739 | fuse_invalidate_entry_cache(newent); | 739 | fuse_invalidate_entry_cache(newent); |
| 740 | fuse_update_ctime(newent->d_inode); | 740 | fuse_update_ctime(d_inode(newent)); |
| 741 | } | 741 | } |
| 742 | } else if (err == -EINTR) { | 742 | } else if (err == -EINTR) { |
| 743 | /* If request was interrupted, DEITY only knows if the | 743 | /* If request was interrupted, DEITY only knows if the |
| @@ -746,7 +746,7 @@ static int fuse_rename_common(struct inode *olddir, struct dentry *oldent, | |||
| 746 | directory), then there can be inconsistency between | 746 | directory), then there can be inconsistency between |
| 747 | the dcache and the real filesystem. Tough luck. */ | 747 | the dcache and the real filesystem. Tough luck. */ |
| 748 | fuse_invalidate_entry(oldent); | 748 | fuse_invalidate_entry(oldent); |
| 749 | if (newent->d_inode) | 749 | if (d_really_is_positive(newent)) |
| 750 | fuse_invalidate_entry(newent); | 750 | fuse_invalidate_entry(newent); |
| 751 | } | 751 | } |
| 752 | 752 | ||
| @@ -788,7 +788,7 @@ static int fuse_link(struct dentry *entry, struct inode *newdir, | |||
| 788 | { | 788 | { |
| 789 | int err; | 789 | int err; |
| 790 | struct fuse_link_in inarg; | 790 | struct fuse_link_in inarg; |
| 791 | struct inode *inode = entry->d_inode; | 791 | struct inode *inode = d_inode(entry); |
| 792 | struct fuse_conn *fc = get_fuse_conn(inode); | 792 | struct fuse_conn *fc = get_fuse_conn(inode); |
| 793 | FUSE_ARGS(args); | 793 | FUSE_ARGS(args); |
| 794 | 794 | ||
| @@ -961,9 +961,9 @@ int fuse_reverse_inval_entry(struct super_block *sb, u64 parent_nodeid, | |||
| 961 | fuse_invalidate_attr(parent); | 961 | fuse_invalidate_attr(parent); |
| 962 | fuse_invalidate_entry(entry); | 962 | fuse_invalidate_entry(entry); |
| 963 | 963 | ||
| 964 | if (child_nodeid != 0 && entry->d_inode) { | 964 | if (child_nodeid != 0 && d_really_is_positive(entry)) { |
| 965 | mutex_lock(&entry->d_inode->i_mutex); | 965 | mutex_lock(&d_inode(entry)->i_mutex); |
| 966 | if (get_node_id(entry->d_inode) != child_nodeid) { | 966 | if (get_node_id(d_inode(entry)) != child_nodeid) { |
| 967 | err = -ENOENT; | 967 | err = -ENOENT; |
| 968 | goto badentry; | 968 | goto badentry; |
| 969 | } | 969 | } |
| @@ -977,13 +977,13 @@ int fuse_reverse_inval_entry(struct super_block *sb, u64 parent_nodeid, | |||
| 977 | err = -ENOTEMPTY; | 977 | err = -ENOTEMPTY; |
| 978 | goto badentry; | 978 | goto badentry; |
| 979 | } | 979 | } |
| 980 | entry->d_inode->i_flags |= S_DEAD; | 980 | d_inode(entry)->i_flags |= S_DEAD; |
| 981 | } | 981 | } |
| 982 | dont_mount(entry); | 982 | dont_mount(entry); |
| 983 | clear_nlink(entry->d_inode); | 983 | clear_nlink(d_inode(entry)); |
| 984 | err = 0; | 984 | err = 0; |
| 985 | badentry: | 985 | badentry: |
| 986 | mutex_unlock(&entry->d_inode->i_mutex); | 986 | mutex_unlock(&d_inode(entry)->i_mutex); |
| 987 | if (!err) | 987 | if (!err) |
| 988 | d_delete(entry); | 988 | d_delete(entry); |
| 989 | } else { | 989 | } else { |
| @@ -1169,7 +1169,7 @@ static int fuse_direntplus_link(struct file *file, | |||
| 1169 | struct qstr name = QSTR_INIT(dirent->name, dirent->namelen); | 1169 | struct qstr name = QSTR_INIT(dirent->name, dirent->namelen); |
| 1170 | struct dentry *dentry; | 1170 | struct dentry *dentry; |
| 1171 | struct dentry *alias; | 1171 | struct dentry *alias; |
| 1172 | struct inode *dir = parent->d_inode; | 1172 | struct inode *dir = d_inode(parent); |
| 1173 | struct fuse_conn *fc; | 1173 | struct fuse_conn *fc; |
| 1174 | struct inode *inode; | 1174 | struct inode *inode; |
| 1175 | 1175 | ||
| @@ -1205,7 +1205,7 @@ static int fuse_direntplus_link(struct file *file, | |||
| 1205 | name.hash = full_name_hash(name.name, name.len); | 1205 | name.hash = full_name_hash(name.name, name.len); |
| 1206 | dentry = d_lookup(parent, &name); | 1206 | dentry = d_lookup(parent, &name); |
| 1207 | if (dentry) { | 1207 | if (dentry) { |
| 1208 | inode = dentry->d_inode; | 1208 | inode = d_inode(dentry); |
| 1209 | if (!inode) { | 1209 | if (!inode) { |
| 1210 | d_drop(dentry); | 1210 | d_drop(dentry); |
| 1211 | } else if (get_node_id(inode) != o->nodeid || | 1211 | } else if (get_node_id(inode) != o->nodeid || |
| @@ -1367,7 +1367,7 @@ static int fuse_readdir(struct file *file, struct dir_context *ctx) | |||
| 1367 | 1367 | ||
| 1368 | static char *read_link(struct dentry *dentry) | 1368 | static char *read_link(struct dentry *dentry) |
| 1369 | { | 1369 | { |
| 1370 | struct inode *inode = dentry->d_inode; | 1370 | struct inode *inode = d_inode(dentry); |
| 1371 | struct fuse_conn *fc = get_fuse_conn(inode); | 1371 | struct fuse_conn *fc = get_fuse_conn(inode); |
| 1372 | FUSE_ARGS(args); | 1372 | FUSE_ARGS(args); |
| 1373 | char *link; | 1373 | char *link; |
| @@ -1712,7 +1712,7 @@ error: | |||
| 1712 | 1712 | ||
| 1713 | static int fuse_setattr(struct dentry *entry, struct iattr *attr) | 1713 | static int fuse_setattr(struct dentry *entry, struct iattr *attr) |
| 1714 | { | 1714 | { |
| 1715 | struct inode *inode = entry->d_inode; | 1715 | struct inode *inode = d_inode(entry); |
| 1716 | 1716 | ||
| 1717 | if (!fuse_allow_current_process(get_fuse_conn(inode))) | 1717 | if (!fuse_allow_current_process(get_fuse_conn(inode))) |
| 1718 | return -EACCES; | 1718 | return -EACCES; |
| @@ -1726,7 +1726,7 @@ static int fuse_setattr(struct dentry *entry, struct iattr *attr) | |||
| 1726 | static int fuse_getattr(struct vfsmount *mnt, struct dentry *entry, | 1726 | static int fuse_getattr(struct vfsmount *mnt, struct dentry *entry, |
| 1727 | struct kstat *stat) | 1727 | struct kstat *stat) |
| 1728 | { | 1728 | { |
| 1729 | struct inode *inode = entry->d_inode; | 1729 | struct inode *inode = d_inode(entry); |
| 1730 | struct fuse_conn *fc = get_fuse_conn(inode); | 1730 | struct fuse_conn *fc = get_fuse_conn(inode); |
| 1731 | 1731 | ||
| 1732 | if (!fuse_allow_current_process(fc)) | 1732 | if (!fuse_allow_current_process(fc)) |
| @@ -1738,7 +1738,7 @@ static int fuse_getattr(struct vfsmount *mnt, struct dentry *entry, | |||
| 1738 | static int fuse_setxattr(struct dentry *entry, const char *name, | 1738 | static int fuse_setxattr(struct dentry *entry, const char *name, |
| 1739 | const void *value, size_t size, int flags) | 1739 | const void *value, size_t size, int flags) |
| 1740 | { | 1740 | { |
| 1741 | struct inode *inode = entry->d_inode; | 1741 | struct inode *inode = d_inode(entry); |
| 1742 | struct fuse_conn *fc = get_fuse_conn(inode); | 1742 | struct fuse_conn *fc = get_fuse_conn(inode); |
| 1743 | FUSE_ARGS(args); | 1743 | FUSE_ARGS(args); |
| 1744 | struct fuse_setxattr_in inarg; | 1744 | struct fuse_setxattr_in inarg; |
| @@ -1774,7 +1774,7 @@ static int fuse_setxattr(struct dentry *entry, const char *name, | |||
| 1774 | static ssize_t fuse_getxattr(struct dentry *entry, const char *name, | 1774 | static ssize_t fuse_getxattr(struct dentry *entry, const char *name, |
| 1775 | void *value, size_t size) | 1775 | void *value, size_t size) |
| 1776 | { | 1776 | { |
| 1777 | struct inode *inode = entry->d_inode; | 1777 | struct inode *inode = d_inode(entry); |
| 1778 | struct fuse_conn *fc = get_fuse_conn(inode); | 1778 | struct fuse_conn *fc = get_fuse_conn(inode); |
| 1779 | FUSE_ARGS(args); | 1779 | FUSE_ARGS(args); |
| 1780 | struct fuse_getxattr_in inarg; | 1780 | struct fuse_getxattr_in inarg; |
| @@ -1815,7 +1815,7 @@ static ssize_t fuse_getxattr(struct dentry *entry, const char *name, | |||
| 1815 | 1815 | ||
| 1816 | static ssize_t fuse_listxattr(struct dentry *entry, char *list, size_t size) | 1816 | static ssize_t fuse_listxattr(struct dentry *entry, char *list, size_t size) |
| 1817 | { | 1817 | { |
| 1818 | struct inode *inode = entry->d_inode; | 1818 | struct inode *inode = d_inode(entry); |
| 1819 | struct fuse_conn *fc = get_fuse_conn(inode); | 1819 | struct fuse_conn *fc = get_fuse_conn(inode); |
| 1820 | FUSE_ARGS(args); | 1820 | FUSE_ARGS(args); |
| 1821 | struct fuse_getxattr_in inarg; | 1821 | struct fuse_getxattr_in inarg; |
| @@ -1857,7 +1857,7 @@ static ssize_t fuse_listxattr(struct dentry *entry, char *list, size_t size) | |||
| 1857 | 1857 | ||
| 1858 | static int fuse_removexattr(struct dentry *entry, const char *name) | 1858 | static int fuse_removexattr(struct dentry *entry, const char *name) |
| 1859 | { | 1859 | { |
| 1860 | struct inode *inode = entry->d_inode; | 1860 | struct inode *inode = d_inode(entry); |
| 1861 | struct fuse_conn *fc = get_fuse_conn(inode); | 1861 | struct fuse_conn *fc = get_fuse_conn(inode); |
| 1862 | FUSE_ARGS(args); | 1862 | FUSE_ARGS(args); |
| 1863 | int err; | 1863 | int err; |
diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c index e8799c11424b..082ac1c97f39 100644 --- a/fs/fuse/inode.c +++ b/fs/fuse/inode.c | |||
| @@ -421,7 +421,7 @@ static int fuse_statfs(struct dentry *dentry, struct kstatfs *buf) | |||
| 421 | memset(&outarg, 0, sizeof(outarg)); | 421 | memset(&outarg, 0, sizeof(outarg)); |
| 422 | args.in.numargs = 0; | 422 | args.in.numargs = 0; |
| 423 | args.in.h.opcode = FUSE_STATFS; | 423 | args.in.h.opcode = FUSE_STATFS; |
| 424 | args.in.h.nodeid = get_node_id(dentry->d_inode); | 424 | args.in.h.nodeid = get_node_id(d_inode(dentry)); |
| 425 | args.out.numargs = 1; | 425 | args.out.numargs = 1; |
| 426 | args.out.args[0].size = sizeof(outarg); | 426 | args.out.args[0].size = sizeof(outarg); |
| 427 | args.out.args[0].value = &outarg; | 427 | args.out.args[0].value = &outarg; |
| @@ -740,7 +740,7 @@ static struct dentry *fuse_fh_to_parent(struct super_block *sb, | |||
| 740 | 740 | ||
| 741 | static struct dentry *fuse_get_parent(struct dentry *child) | 741 | static struct dentry *fuse_get_parent(struct dentry *child) |
| 742 | { | 742 | { |
| 743 | struct inode *child_inode = child->d_inode; | 743 | struct inode *child_inode = d_inode(child); |
| 744 | struct fuse_conn *fc = get_fuse_conn(child_inode); | 744 | struct fuse_conn *fc = get_fuse_conn(child_inode); |
| 745 | struct inode *inode; | 745 | struct inode *inode; |
| 746 | struct dentry *parent; | 746 | struct dentry *parent; |
diff --git a/fs/gfs2/dentry.c b/fs/gfs2/dentry.c index 589f4ea9381c..30822b148f3e 100644 --- a/fs/gfs2/dentry.c +++ b/fs/gfs2/dentry.c | |||
| @@ -48,9 +48,9 @@ static int gfs2_drevalidate(struct dentry *dentry, unsigned int flags) | |||
| 48 | return -ECHILD; | 48 | return -ECHILD; |
| 49 | 49 | ||
| 50 | parent = dget_parent(dentry); | 50 | parent = dget_parent(dentry); |
| 51 | sdp = GFS2_SB(parent->d_inode); | 51 | sdp = GFS2_SB(d_inode(parent)); |
| 52 | dip = GFS2_I(parent->d_inode); | 52 | dip = GFS2_I(d_inode(parent)); |
| 53 | inode = dentry->d_inode; | 53 | inode = d_inode(dentry); |
| 54 | 54 | ||
| 55 | if (inode) { | 55 | if (inode) { |
| 56 | if (is_bad_inode(inode)) | 56 | if (is_bad_inode(inode)) |
| @@ -68,7 +68,7 @@ static int gfs2_drevalidate(struct dentry *dentry, unsigned int flags) | |||
| 68 | goto fail; | 68 | goto fail; |
| 69 | } | 69 | } |
| 70 | 70 | ||
| 71 | error = gfs2_dir_check(parent->d_inode, &dentry->d_name, ip); | 71 | error = gfs2_dir_check(d_inode(parent), &dentry->d_name, ip); |
| 72 | switch (error) { | 72 | switch (error) { |
| 73 | case 0: | 73 | case 0: |
| 74 | if (!inode) | 74 | if (!inode) |
| @@ -113,10 +113,10 @@ static int gfs2_dentry_delete(const struct dentry *dentry) | |||
| 113 | { | 113 | { |
| 114 | struct gfs2_inode *ginode; | 114 | struct gfs2_inode *ginode; |
| 115 | 115 | ||
| 116 | if (!dentry->d_inode) | 116 | if (d_really_is_negative(dentry)) |
| 117 | return 0; | 117 | return 0; |
| 118 | 118 | ||
| 119 | ginode = GFS2_I(dentry->d_inode); | 119 | ginode = GFS2_I(d_inode(dentry)); |
| 120 | if (!ginode->i_iopen_gh.gh_gl) | 120 | if (!ginode->i_iopen_gh.gh_gl) |
| 121 | return 0; | 121 | return 0; |
| 122 | 122 | ||
diff --git a/fs/gfs2/export.c b/fs/gfs2/export.c index c41d255b6a7b..5d15e9498b48 100644 --- a/fs/gfs2/export.c +++ b/fs/gfs2/export.c | |||
| @@ -49,7 +49,7 @@ static int gfs2_encode_fh(struct inode *inode, __u32 *p, int *len, | |||
| 49 | fh[3] = cpu_to_be32(ip->i_no_addr & 0xFFFFFFFF); | 49 | fh[3] = cpu_to_be32(ip->i_no_addr & 0xFFFFFFFF); |
| 50 | *len = GFS2_SMALL_FH_SIZE; | 50 | *len = GFS2_SMALL_FH_SIZE; |
| 51 | 51 | ||
| 52 | if (!parent || inode == sb->s_root->d_inode) | 52 | if (!parent || inode == d_inode(sb->s_root)) |
| 53 | return *len; | 53 | return *len; |
| 54 | 54 | ||
| 55 | ip = GFS2_I(parent); | 55 | ip = GFS2_I(parent); |
| @@ -88,8 +88,8 @@ static int get_name_filldir(struct dir_context *ctx, const char *name, | |||
| 88 | static int gfs2_get_name(struct dentry *parent, char *name, | 88 | static int gfs2_get_name(struct dentry *parent, char *name, |
| 89 | struct dentry *child) | 89 | struct dentry *child) |
| 90 | { | 90 | { |
| 91 | struct inode *dir = parent->d_inode; | 91 | struct inode *dir = d_inode(parent); |
| 92 | struct inode *inode = child->d_inode; | 92 | struct inode *inode = d_inode(child); |
| 93 | struct gfs2_inode *dip, *ip; | 93 | struct gfs2_inode *dip, *ip; |
| 94 | struct get_name_filldir gnfd = { | 94 | struct get_name_filldir gnfd = { |
| 95 | .ctx.actor = get_name_filldir, | 95 | .ctx.actor = get_name_filldir, |
| @@ -128,7 +128,7 @@ static int gfs2_get_name(struct dentry *parent, char *name, | |||
| 128 | 128 | ||
| 129 | static struct dentry *gfs2_get_parent(struct dentry *child) | 129 | static struct dentry *gfs2_get_parent(struct dentry *child) |
| 130 | { | 130 | { |
| 131 | return d_obtain_alias(gfs2_lookupi(child->d_inode, &gfs2_qdotdot, 1)); | 131 | return d_obtain_alias(gfs2_lookupi(d_inode(child), &gfs2_qdotdot, 1)); |
| 132 | } | 132 | } |
| 133 | 133 | ||
| 134 | static struct dentry *gfs2_get_dentry(struct super_block *sb, | 134 | static struct dentry *gfs2_get_dentry(struct super_block *sb, |
diff --git a/fs/gfs2/inode.c b/fs/gfs2/inode.c index 08bc84d7e768..1b3ca7a2e3fc 100644 --- a/fs/gfs2/inode.c +++ b/fs/gfs2/inode.c | |||
| @@ -295,7 +295,7 @@ struct inode *gfs2_lookupi(struct inode *dir, const struct qstr *name, | |||
| 295 | 295 | ||
| 296 | if ((name->len == 1 && memcmp(name->name, ".", 1) == 0) || | 296 | if ((name->len == 1 && memcmp(name->name, ".", 1) == 0) || |
| 297 | (name->len == 2 && memcmp(name->name, "..", 2) == 0 && | 297 | (name->len == 2 && memcmp(name->name, "..", 2) == 0 && |
| 298 | dir == sb->s_root->d_inode)) { | 298 | dir == d_inode(sb->s_root))) { |
| 299 | igrab(dir); | 299 | igrab(dir); |
| 300 | return dir; | 300 | return dir; |
| 301 | } | 301 | } |
| @@ -687,7 +687,7 @@ static int gfs2_create_inode(struct inode *dir, struct dentry *dentry, | |||
| 687 | } | 687 | } |
| 688 | gfs2_set_inode_flags(inode); | 688 | gfs2_set_inode_flags(inode); |
| 689 | 689 | ||
| 690 | if ((GFS2_I(sdp->sd_root_dir->d_inode) == dip) || | 690 | if ((GFS2_I(d_inode(sdp->sd_root_dir)) == dip) || |
| 691 | (dip->i_diskflags & GFS2_DIF_TOPDIR)) | 691 | (dip->i_diskflags & GFS2_DIF_TOPDIR)) |
| 692 | aflags |= GFS2_AF_ORLOV; | 692 | aflags |= GFS2_AF_ORLOV; |
| 693 | 693 | ||
| @@ -888,7 +888,7 @@ static int gfs2_link(struct dentry *old_dentry, struct inode *dir, | |||
| 888 | { | 888 | { |
| 889 | struct gfs2_inode *dip = GFS2_I(dir); | 889 | struct gfs2_inode *dip = GFS2_I(dir); |
| 890 | struct gfs2_sbd *sdp = GFS2_SB(dir); | 890 | struct gfs2_sbd *sdp = GFS2_SB(dir); |
| 891 | struct inode *inode = old_dentry->d_inode; | 891 | struct inode *inode = d_inode(old_dentry); |
| 892 | struct gfs2_inode *ip = GFS2_I(inode); | 892 | struct gfs2_inode *ip = GFS2_I(inode); |
| 893 | struct gfs2_holder ghs[2]; | 893 | struct gfs2_holder ghs[2]; |
| 894 | struct buffer_head *dibh; | 894 | struct buffer_head *dibh; |
| @@ -1055,7 +1055,7 @@ static int gfs2_unlink_ok(struct gfs2_inode *dip, const struct qstr *name, | |||
| 1055 | static int gfs2_unlink_inode(struct gfs2_inode *dip, | 1055 | static int gfs2_unlink_inode(struct gfs2_inode *dip, |
| 1056 | const struct dentry *dentry) | 1056 | const struct dentry *dentry) |
| 1057 | { | 1057 | { |
| 1058 | struct inode *inode = dentry->d_inode; | 1058 | struct inode *inode = d_inode(dentry); |
| 1059 | struct gfs2_inode *ip = GFS2_I(inode); | 1059 | struct gfs2_inode *ip = GFS2_I(inode); |
| 1060 | int error; | 1060 | int error; |
| 1061 | 1061 | ||
| @@ -1091,7 +1091,7 @@ static int gfs2_unlink(struct inode *dir, struct dentry *dentry) | |||
| 1091 | { | 1091 | { |
| 1092 | struct gfs2_inode *dip = GFS2_I(dir); | 1092 | struct gfs2_inode *dip = GFS2_I(dir); |
| 1093 | struct gfs2_sbd *sdp = GFS2_SB(dir); | 1093 | struct gfs2_sbd *sdp = GFS2_SB(dir); |
| 1094 | struct inode *inode = dentry->d_inode; | 1094 | struct inode *inode = d_inode(dentry); |
| 1095 | struct gfs2_inode *ip = GFS2_I(inode); | 1095 | struct gfs2_inode *ip = GFS2_I(inode); |
| 1096 | struct gfs2_holder ghs[3]; | 1096 | struct gfs2_holder ghs[3]; |
| 1097 | struct gfs2_rgrpd *rgd; | 1097 | struct gfs2_rgrpd *rgd; |
| @@ -1241,7 +1241,7 @@ static int gfs2_atomic_open(struct inode *dir, struct dentry *dentry, | |||
| 1241 | return PTR_ERR(d); | 1241 | return PTR_ERR(d); |
| 1242 | if (d != NULL) | 1242 | if (d != NULL) |
| 1243 | dentry = d; | 1243 | dentry = d; |
| 1244 | if (dentry->d_inode) { | 1244 | if (d_really_is_positive(dentry)) { |
| 1245 | if (!(*opened & FILE_OPENED)) | 1245 | if (!(*opened & FILE_OPENED)) |
| 1246 | return finish_no_open(file, d); | 1246 | return finish_no_open(file, d); |
| 1247 | dput(d); | 1247 | dput(d); |
| @@ -1282,7 +1282,7 @@ static int gfs2_ok_to_move(struct gfs2_inode *this, struct gfs2_inode *to) | |||
| 1282 | error = -EINVAL; | 1282 | error = -EINVAL; |
| 1283 | break; | 1283 | break; |
| 1284 | } | 1284 | } |
| 1285 | if (dir == sb->s_root->d_inode) { | 1285 | if (dir == d_inode(sb->s_root)) { |
| 1286 | error = 0; | 1286 | error = 0; |
| 1287 | break; | 1287 | break; |
| 1288 | } | 1288 | } |
| @@ -1321,7 +1321,7 @@ static int gfs2_rename(struct inode *odir, struct dentry *odentry, | |||
| 1321 | { | 1321 | { |
| 1322 | struct gfs2_inode *odip = GFS2_I(odir); | 1322 | struct gfs2_inode *odip = GFS2_I(odir); |
| 1323 | struct gfs2_inode *ndip = GFS2_I(ndir); | 1323 | struct gfs2_inode *ndip = GFS2_I(ndir); |
| 1324 | struct gfs2_inode *ip = GFS2_I(odentry->d_inode); | 1324 | struct gfs2_inode *ip = GFS2_I(d_inode(odentry)); |
| 1325 | struct gfs2_inode *nip = NULL; | 1325 | struct gfs2_inode *nip = NULL; |
| 1326 | struct gfs2_sbd *sdp = GFS2_SB(odir); | 1326 | struct gfs2_sbd *sdp = GFS2_SB(odir); |
| 1327 | struct gfs2_holder ghs[5], r_gh = { .gh_gl = NULL, }; | 1327 | struct gfs2_holder ghs[5], r_gh = { .gh_gl = NULL, }; |
| @@ -1332,8 +1332,8 @@ static int gfs2_rename(struct inode *odir, struct dentry *odentry, | |||
| 1332 | unsigned int x; | 1332 | unsigned int x; |
| 1333 | int error; | 1333 | int error; |
| 1334 | 1334 | ||
| 1335 | if (ndentry->d_inode) { | 1335 | if (d_really_is_positive(ndentry)) { |
| 1336 | nip = GFS2_I(ndentry->d_inode); | 1336 | nip = GFS2_I(d_inode(ndentry)); |
| 1337 | if (ip == nip) | 1337 | if (ip == nip) |
| 1338 | return 0; | 1338 | return 0; |
| 1339 | } | 1339 | } |
| @@ -1457,7 +1457,7 @@ static int gfs2_rename(struct inode *odir, struct dentry *odentry, | |||
| 1457 | /* Check out the dir to be renamed */ | 1457 | /* Check out the dir to be renamed */ |
| 1458 | 1458 | ||
| 1459 | if (dir_rename) { | 1459 | if (dir_rename) { |
| 1460 | error = gfs2_permission(odentry->d_inode, MAY_WRITE); | 1460 | error = gfs2_permission(d_inode(odentry), MAY_WRITE); |
| 1461 | if (error) | 1461 | if (error) |
| 1462 | goto out_gunlock; | 1462 | goto out_gunlock; |
| 1463 | } | 1463 | } |
| @@ -1550,7 +1550,7 @@ out: | |||
| 1550 | 1550 | ||
| 1551 | static void *gfs2_follow_link(struct dentry *dentry, struct nameidata *nd) | 1551 | static void *gfs2_follow_link(struct dentry *dentry, struct nameidata *nd) |
| 1552 | { | 1552 | { |
| 1553 | struct gfs2_inode *ip = GFS2_I(dentry->d_inode); | 1553 | struct gfs2_inode *ip = GFS2_I(d_inode(dentry)); |
| 1554 | struct gfs2_holder i_gh; | 1554 | struct gfs2_holder i_gh; |
| 1555 | struct buffer_head *dibh; | 1555 | struct buffer_head *dibh; |
| 1556 | unsigned int size; | 1556 | unsigned int size; |
| @@ -1742,7 +1742,7 @@ out: | |||
| 1742 | 1742 | ||
| 1743 | static int gfs2_setattr(struct dentry *dentry, struct iattr *attr) | 1743 | static int gfs2_setattr(struct dentry *dentry, struct iattr *attr) |
| 1744 | { | 1744 | { |
| 1745 | struct inode *inode = dentry->d_inode; | 1745 | struct inode *inode = d_inode(dentry); |
| 1746 | struct gfs2_inode *ip = GFS2_I(inode); | 1746 | struct gfs2_inode *ip = GFS2_I(inode); |
| 1747 | struct gfs2_holder i_gh; | 1747 | struct gfs2_holder i_gh; |
| 1748 | int error; | 1748 | int error; |
| @@ -1798,7 +1798,7 @@ out: | |||
| 1798 | static int gfs2_getattr(struct vfsmount *mnt, struct dentry *dentry, | 1798 | static int gfs2_getattr(struct vfsmount *mnt, struct dentry *dentry, |
| 1799 | struct kstat *stat) | 1799 | struct kstat *stat) |
| 1800 | { | 1800 | { |
| 1801 | struct inode *inode = dentry->d_inode; | 1801 | struct inode *inode = d_inode(dentry); |
| 1802 | struct gfs2_inode *ip = GFS2_I(inode); | 1802 | struct gfs2_inode *ip = GFS2_I(inode); |
| 1803 | struct gfs2_holder gh; | 1803 | struct gfs2_holder gh; |
| 1804 | int error; | 1804 | int error; |
| @@ -1821,7 +1821,7 @@ static int gfs2_getattr(struct vfsmount *mnt, struct dentry *dentry, | |||
| 1821 | static int gfs2_setxattr(struct dentry *dentry, const char *name, | 1821 | static int gfs2_setxattr(struct dentry *dentry, const char *name, |
| 1822 | const void *data, size_t size, int flags) | 1822 | const void *data, size_t size, int flags) |
| 1823 | { | 1823 | { |
| 1824 | struct inode *inode = dentry->d_inode; | 1824 | struct inode *inode = d_inode(dentry); |
| 1825 | struct gfs2_inode *ip = GFS2_I(inode); | 1825 | struct gfs2_inode *ip = GFS2_I(inode); |
| 1826 | struct gfs2_holder gh; | 1826 | struct gfs2_holder gh; |
| 1827 | int ret; | 1827 | int ret; |
| @@ -1841,7 +1841,7 @@ static int gfs2_setxattr(struct dentry *dentry, const char *name, | |||
| 1841 | static ssize_t gfs2_getxattr(struct dentry *dentry, const char *name, | 1841 | static ssize_t gfs2_getxattr(struct dentry *dentry, const char *name, |
| 1842 | void *data, size_t size) | 1842 | void *data, size_t size) |
| 1843 | { | 1843 | { |
| 1844 | struct inode *inode = dentry->d_inode; | 1844 | struct inode *inode = d_inode(dentry); |
| 1845 | struct gfs2_inode *ip = GFS2_I(inode); | 1845 | struct gfs2_inode *ip = GFS2_I(inode); |
| 1846 | struct gfs2_holder gh; | 1846 | struct gfs2_holder gh; |
| 1847 | int ret; | 1847 | int ret; |
| @@ -1862,7 +1862,7 @@ static ssize_t gfs2_getxattr(struct dentry *dentry, const char *name, | |||
| 1862 | 1862 | ||
| 1863 | static int gfs2_removexattr(struct dentry *dentry, const char *name) | 1863 | static int gfs2_removexattr(struct dentry *dentry, const char *name) |
| 1864 | { | 1864 | { |
| 1865 | struct inode *inode = dentry->d_inode; | 1865 | struct inode *inode = d_inode(dentry); |
| 1866 | struct gfs2_inode *ip = GFS2_I(inode); | 1866 | struct gfs2_inode *ip = GFS2_I(inode); |
| 1867 | struct gfs2_holder gh; | 1867 | struct gfs2_holder gh; |
| 1868 | int ret; | 1868 | int ret; |
diff --git a/fs/gfs2/ops_fstype.c b/fs/gfs2/ops_fstype.c index efc8e254787c..35b49f44c72f 100644 --- a/fs/gfs2/ops_fstype.c +++ b/fs/gfs2/ops_fstype.c | |||
| @@ -647,7 +647,7 @@ out_unlock: | |||
| 647 | 647 | ||
| 648 | static int init_journal(struct gfs2_sbd *sdp, int undo) | 648 | static int init_journal(struct gfs2_sbd *sdp, int undo) |
| 649 | { | 649 | { |
| 650 | struct inode *master = sdp->sd_master_dir->d_inode; | 650 | struct inode *master = d_inode(sdp->sd_master_dir); |
| 651 | struct gfs2_holder ji_gh; | 651 | struct gfs2_holder ji_gh; |
| 652 | struct gfs2_inode *ip; | 652 | struct gfs2_inode *ip; |
| 653 | int jindex = 1; | 653 | int jindex = 1; |
| @@ -782,7 +782,7 @@ static struct lock_class_key gfs2_quota_imutex_key; | |||
| 782 | static int init_inodes(struct gfs2_sbd *sdp, int undo) | 782 | static int init_inodes(struct gfs2_sbd *sdp, int undo) |
| 783 | { | 783 | { |
| 784 | int error = 0; | 784 | int error = 0; |
| 785 | struct inode *master = sdp->sd_master_dir->d_inode; | 785 | struct inode *master = d_inode(sdp->sd_master_dir); |
| 786 | 786 | ||
| 787 | if (undo) | 787 | if (undo) |
| 788 | goto fail_qinode; | 788 | goto fail_qinode; |
| @@ -848,7 +848,7 @@ static int init_per_node(struct gfs2_sbd *sdp, int undo) | |||
| 848 | char buf[30]; | 848 | char buf[30]; |
| 849 | int error = 0; | 849 | int error = 0; |
| 850 | struct gfs2_inode *ip; | 850 | struct gfs2_inode *ip; |
| 851 | struct inode *master = sdp->sd_master_dir->d_inode; | 851 | struct inode *master = d_inode(sdp->sd_master_dir); |
| 852 | 852 | ||
| 853 | if (sdp->sd_args.ar_spectator) | 853 | if (sdp->sd_args.ar_spectator) |
| 854 | return 0; | 854 | return 0; |
| @@ -1357,7 +1357,7 @@ static struct dentry *gfs2_mount_meta(struct file_system_type *fs_type, | |||
| 1357 | return ERR_PTR(error); | 1357 | return ERR_PTR(error); |
| 1358 | } | 1358 | } |
| 1359 | s = sget(&gfs2_fs_type, test_gfs2_super, set_meta_super, flags, | 1359 | s = sget(&gfs2_fs_type, test_gfs2_super, set_meta_super, flags, |
| 1360 | path.dentry->d_inode->i_sb->s_bdev); | 1360 | d_inode(path.dentry)->i_sb->s_bdev); |
| 1361 | path_put(&path); | 1361 | path_put(&path); |
| 1362 | if (IS_ERR(s)) { | 1362 | if (IS_ERR(s)) { |
| 1363 | pr_warn("gfs2 mount does not exist\n"); | 1363 | pr_warn("gfs2 mount does not exist\n"); |
diff --git a/fs/gfs2/super.c b/fs/gfs2/super.c index 1666382b198d..859c6edbf81a 100644 --- a/fs/gfs2/super.c +++ b/fs/gfs2/super.c | |||
| @@ -1171,7 +1171,7 @@ static int gfs2_statfs_i(struct gfs2_sbd *sdp, struct gfs2_statfs_change_host *s | |||
| 1171 | 1171 | ||
| 1172 | static int gfs2_statfs(struct dentry *dentry, struct kstatfs *buf) | 1172 | static int gfs2_statfs(struct dentry *dentry, struct kstatfs *buf) |
| 1173 | { | 1173 | { |
| 1174 | struct super_block *sb = dentry->d_inode->i_sb; | 1174 | struct super_block *sb = d_inode(dentry)->i_sb; |
| 1175 | struct gfs2_sbd *sdp = sb->s_fs_info; | 1175 | struct gfs2_sbd *sdp = sb->s_fs_info; |
| 1176 | struct gfs2_statfs_change_host sc; | 1176 | struct gfs2_statfs_change_host sc; |
| 1177 | int error; | 1177 | int error; |
diff --git a/fs/gfs2/xattr.c b/fs/gfs2/xattr.c index fd260ce8869a..4c096fa9e2a1 100644 --- a/fs/gfs2/xattr.c +++ b/fs/gfs2/xattr.c | |||
| @@ -420,7 +420,7 @@ static int ea_list_i(struct gfs2_inode *ip, struct buffer_head *bh, | |||
| 420 | 420 | ||
| 421 | ssize_t gfs2_listxattr(struct dentry *dentry, char *buffer, size_t size) | 421 | ssize_t gfs2_listxattr(struct dentry *dentry, char *buffer, size_t size) |
| 422 | { | 422 | { |
| 423 | struct gfs2_inode *ip = GFS2_I(dentry->d_inode); | 423 | struct gfs2_inode *ip = GFS2_I(d_inode(dentry)); |
| 424 | struct gfs2_ea_request er; | 424 | struct gfs2_ea_request er; |
| 425 | struct gfs2_holder i_gh; | 425 | struct gfs2_holder i_gh; |
| 426 | int error; | 426 | int error; |
| @@ -586,7 +586,7 @@ out: | |||
| 586 | static int gfs2_xattr_get(struct dentry *dentry, const char *name, | 586 | static int gfs2_xattr_get(struct dentry *dentry, const char *name, |
| 587 | void *buffer, size_t size, int type) | 587 | void *buffer, size_t size, int type) |
| 588 | { | 588 | { |
| 589 | struct gfs2_inode *ip = GFS2_I(dentry->d_inode); | 589 | struct gfs2_inode *ip = GFS2_I(d_inode(dentry)); |
| 590 | struct gfs2_ea_location el; | 590 | struct gfs2_ea_location el; |
| 591 | int error; | 591 | int error; |
| 592 | 592 | ||
| @@ -1230,7 +1230,7 @@ int __gfs2_xattr_set(struct inode *inode, const char *name, | |||
| 1230 | static int gfs2_xattr_set(struct dentry *dentry, const char *name, | 1230 | static int gfs2_xattr_set(struct dentry *dentry, const char *name, |
| 1231 | const void *value, size_t size, int flags, int type) | 1231 | const void *value, size_t size, int flags, int type) |
| 1232 | { | 1232 | { |
| 1233 | return __gfs2_xattr_set(dentry->d_inode, name, value, | 1233 | return __gfs2_xattr_set(d_inode(dentry), name, value, |
| 1234 | size, flags, type); | 1234 | size, flags, type); |
| 1235 | } | 1235 | } |
| 1236 | 1236 | ||
diff --git a/fs/hfs/attr.c b/fs/hfs/attr.c index e057ec542a6a..8d931b157bbe 100644 --- a/fs/hfs/attr.c +++ b/fs/hfs/attr.c | |||
| @@ -16,7 +16,7 @@ | |||
| 16 | int hfs_setxattr(struct dentry *dentry, const char *name, | 16 | int hfs_setxattr(struct dentry *dentry, const char *name, |
| 17 | const void *value, size_t size, int flags) | 17 | const void *value, size_t size, int flags) |
| 18 | { | 18 | { |
| 19 | struct inode *inode = dentry->d_inode; | 19 | struct inode *inode = d_inode(dentry); |
| 20 | struct hfs_find_data fd; | 20 | struct hfs_find_data fd; |
| 21 | hfs_cat_rec rec; | 21 | hfs_cat_rec rec; |
| 22 | struct hfs_cat_file *file; | 22 | struct hfs_cat_file *file; |
| @@ -59,7 +59,7 @@ out: | |||
| 59 | ssize_t hfs_getxattr(struct dentry *dentry, const char *name, | 59 | ssize_t hfs_getxattr(struct dentry *dentry, const char *name, |
| 60 | void *value, size_t size) | 60 | void *value, size_t size) |
| 61 | { | 61 | { |
| 62 | struct inode *inode = dentry->d_inode; | 62 | struct inode *inode = d_inode(dentry); |
| 63 | struct hfs_find_data fd; | 63 | struct hfs_find_data fd; |
| 64 | hfs_cat_rec rec; | 64 | hfs_cat_rec rec; |
| 65 | struct hfs_cat_file *file; | 65 | struct hfs_cat_file *file; |
| @@ -105,7 +105,7 @@ out: | |||
| 105 | 105 | ||
| 106 | ssize_t hfs_listxattr(struct dentry *dentry, char *buffer, size_t size) | 106 | ssize_t hfs_listxattr(struct dentry *dentry, char *buffer, size_t size) |
| 107 | { | 107 | { |
| 108 | struct inode *inode = dentry->d_inode; | 108 | struct inode *inode = d_inode(dentry); |
| 109 | 109 | ||
| 110 | if (!S_ISREG(inode->i_mode) || HFS_IS_RSRC(inode)) | 110 | if (!S_ISREG(inode->i_mode) || HFS_IS_RSRC(inode)) |
| 111 | return -EOPNOTSUPP; | 111 | return -EOPNOTSUPP; |
diff --git a/fs/hfs/dir.c b/fs/hfs/dir.c index 36d1a6ae7655..70788e03820a 100644 --- a/fs/hfs/dir.c +++ b/fs/hfs/dir.c | |||
| @@ -253,7 +253,7 @@ static int hfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) | |||
| 253 | */ | 253 | */ |
| 254 | static int hfs_remove(struct inode *dir, struct dentry *dentry) | 254 | static int hfs_remove(struct inode *dir, struct dentry *dentry) |
| 255 | { | 255 | { |
| 256 | struct inode *inode = dentry->d_inode; | 256 | struct inode *inode = d_inode(dentry); |
| 257 | int res; | 257 | int res; |
| 258 | 258 | ||
| 259 | if (S_ISDIR(inode->i_mode) && inode->i_size != 2) | 259 | if (S_ISDIR(inode->i_mode) && inode->i_size != 2) |
| @@ -285,18 +285,18 @@ static int hfs_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
| 285 | int res; | 285 | int res; |
| 286 | 286 | ||
| 287 | /* Unlink destination if it already exists */ | 287 | /* Unlink destination if it already exists */ |
| 288 | if (new_dentry->d_inode) { | 288 | if (d_really_is_positive(new_dentry)) { |
| 289 | res = hfs_remove(new_dir, new_dentry); | 289 | res = hfs_remove(new_dir, new_dentry); |
| 290 | if (res) | 290 | if (res) |
| 291 | return res; | 291 | return res; |
| 292 | } | 292 | } |
| 293 | 293 | ||
| 294 | res = hfs_cat_move(old_dentry->d_inode->i_ino, | 294 | res = hfs_cat_move(d_inode(old_dentry)->i_ino, |
| 295 | old_dir, &old_dentry->d_name, | 295 | old_dir, &old_dentry->d_name, |
| 296 | new_dir, &new_dentry->d_name); | 296 | new_dir, &new_dentry->d_name); |
| 297 | if (!res) | 297 | if (!res) |
| 298 | hfs_cat_build_key(old_dir->i_sb, | 298 | hfs_cat_build_key(old_dir->i_sb, |
| 299 | (btree_key *)&HFS_I(old_dentry->d_inode)->cat_key, | 299 | (btree_key *)&HFS_I(d_inode(old_dentry))->cat_key, |
| 300 | new_dir->i_ino, &new_dentry->d_name); | 300 | new_dir->i_ino, &new_dentry->d_name); |
| 301 | return res; | 301 | return res; |
| 302 | } | 302 | } |
diff --git a/fs/hfs/inode.c b/fs/hfs/inode.c index 75fd5d873c19..b99ebddb10cb 100644 --- a/fs/hfs/inode.c +++ b/fs/hfs/inode.c | |||
| @@ -600,7 +600,7 @@ static int hfs_file_release(struct inode *inode, struct file *file) | |||
| 600 | 600 | ||
| 601 | int hfs_inode_setattr(struct dentry *dentry, struct iattr * attr) | 601 | int hfs_inode_setattr(struct dentry *dentry, struct iattr * attr) |
| 602 | { | 602 | { |
| 603 | struct inode *inode = dentry->d_inode; | 603 | struct inode *inode = d_inode(dentry); |
| 604 | struct hfs_sb_info *hsb = HFS_SB(inode->i_sb); | 604 | struct hfs_sb_info *hsb = HFS_SB(inode->i_sb); |
| 605 | int error; | 605 | int error; |
| 606 | 606 | ||
diff --git a/fs/hfs/sysdep.c b/fs/hfs/sysdep.c index 91b91fd3a901..2875961fdc10 100644 --- a/fs/hfs/sysdep.c +++ b/fs/hfs/sysdep.c | |||
| @@ -21,7 +21,7 @@ static int hfs_revalidate_dentry(struct dentry *dentry, unsigned int flags) | |||
| 21 | if (flags & LOOKUP_RCU) | 21 | if (flags & LOOKUP_RCU) |
| 22 | return -ECHILD; | 22 | return -ECHILD; |
| 23 | 23 | ||
| 24 | inode = dentry->d_inode; | 24 | inode = d_inode(dentry); |
| 25 | if(!inode) | 25 | if(!inode) |
| 26 | return 1; | 26 | return 1; |
| 27 | 27 | ||
diff --git a/fs/hfsplus/dir.c b/fs/hfsplus/dir.c index 3074609befc3..d0f39dcbb58e 100644 --- a/fs/hfsplus/dir.c +++ b/fs/hfsplus/dir.c | |||
| @@ -81,7 +81,7 @@ again: | |||
| 81 | HFSPLUS_I(HFSPLUS_SB(sb)->hidden_dir)-> | 81 | HFSPLUS_I(HFSPLUS_SB(sb)->hidden_dir)-> |
| 82 | create_date || | 82 | create_date || |
| 83 | entry.file.create_date == | 83 | entry.file.create_date == |
| 84 | HFSPLUS_I(sb->s_root->d_inode)-> | 84 | HFSPLUS_I(d_inode(sb->s_root))-> |
| 85 | create_date) && | 85 | create_date) && |
| 86 | HFSPLUS_SB(sb)->hidden_dir) { | 86 | HFSPLUS_SB(sb)->hidden_dir) { |
| 87 | struct qstr str; | 87 | struct qstr str; |
| @@ -296,8 +296,8 @@ static int hfsplus_link(struct dentry *src_dentry, struct inode *dst_dir, | |||
| 296 | struct dentry *dst_dentry) | 296 | struct dentry *dst_dentry) |
| 297 | { | 297 | { |
| 298 | struct hfsplus_sb_info *sbi = HFSPLUS_SB(dst_dir->i_sb); | 298 | struct hfsplus_sb_info *sbi = HFSPLUS_SB(dst_dir->i_sb); |
| 299 | struct inode *inode = src_dentry->d_inode; | 299 | struct inode *inode = d_inode(src_dentry); |
| 300 | struct inode *src_dir = src_dentry->d_parent->d_inode; | 300 | struct inode *src_dir = d_inode(src_dentry->d_parent); |
| 301 | struct qstr str; | 301 | struct qstr str; |
| 302 | char name[32]; | 302 | char name[32]; |
| 303 | u32 cnid, id; | 303 | u32 cnid, id; |
| @@ -353,7 +353,7 @@ out: | |||
| 353 | static int hfsplus_unlink(struct inode *dir, struct dentry *dentry) | 353 | static int hfsplus_unlink(struct inode *dir, struct dentry *dentry) |
| 354 | { | 354 | { |
| 355 | struct hfsplus_sb_info *sbi = HFSPLUS_SB(dir->i_sb); | 355 | struct hfsplus_sb_info *sbi = HFSPLUS_SB(dir->i_sb); |
| 356 | struct inode *inode = dentry->d_inode; | 356 | struct inode *inode = d_inode(dentry); |
| 357 | struct qstr str; | 357 | struct qstr str; |
| 358 | char name[32]; | 358 | char name[32]; |
| 359 | u32 cnid; | 359 | u32 cnid; |
| @@ -410,7 +410,7 @@ out: | |||
| 410 | static int hfsplus_rmdir(struct inode *dir, struct dentry *dentry) | 410 | static int hfsplus_rmdir(struct inode *dir, struct dentry *dentry) |
| 411 | { | 411 | { |
| 412 | struct hfsplus_sb_info *sbi = HFSPLUS_SB(dir->i_sb); | 412 | struct hfsplus_sb_info *sbi = HFSPLUS_SB(dir->i_sb); |
| 413 | struct inode *inode = dentry->d_inode; | 413 | struct inode *inode = d_inode(dentry); |
| 414 | int res; | 414 | int res; |
| 415 | 415 | ||
| 416 | if (inode->i_size != 2) | 416 | if (inode->i_size != 2) |
| @@ -529,7 +529,7 @@ static int hfsplus_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
| 529 | int res; | 529 | int res; |
| 530 | 530 | ||
| 531 | /* Unlink destination if it already exists */ | 531 | /* Unlink destination if it already exists */ |
| 532 | if (new_dentry->d_inode) { | 532 | if (d_really_is_positive(new_dentry)) { |
| 533 | if (d_is_dir(new_dentry)) | 533 | if (d_is_dir(new_dentry)) |
| 534 | res = hfsplus_rmdir(new_dir, new_dentry); | 534 | res = hfsplus_rmdir(new_dir, new_dentry); |
| 535 | else | 535 | else |
diff --git a/fs/hfsplus/inode.c b/fs/hfsplus/inode.c index b0afedbef12b..6dd107d7421e 100644 --- a/fs/hfsplus/inode.c +++ b/fs/hfsplus/inode.c | |||
| @@ -243,7 +243,7 @@ static int hfsplus_file_release(struct inode *inode, struct file *file) | |||
| 243 | 243 | ||
| 244 | static int hfsplus_setattr(struct dentry *dentry, struct iattr *attr) | 244 | static int hfsplus_setattr(struct dentry *dentry, struct iattr *attr) |
| 245 | { | 245 | { |
| 246 | struct inode *inode = dentry->d_inode; | 246 | struct inode *inode = d_inode(dentry); |
| 247 | int error; | 247 | int error; |
| 248 | 248 | ||
| 249 | error = inode_change_ok(inode, attr); | 249 | error = inode_change_ok(inode, attr); |
diff --git a/fs/hfsplus/ioctl.c b/fs/hfsplus/ioctl.c index 8e98f5db6ad6..0624ce4e0702 100644 --- a/fs/hfsplus/ioctl.c +++ b/fs/hfsplus/ioctl.c | |||
| @@ -26,7 +26,7 @@ | |||
| 26 | static int hfsplus_ioctl_bless(struct file *file, int __user *user_flags) | 26 | static int hfsplus_ioctl_bless(struct file *file, int __user *user_flags) |
| 27 | { | 27 | { |
| 28 | struct dentry *dentry = file->f_path.dentry; | 28 | struct dentry *dentry = file->f_path.dentry; |
| 29 | struct inode *inode = dentry->d_inode; | 29 | struct inode *inode = d_inode(dentry); |
| 30 | struct hfsplus_sb_info *sbi = HFSPLUS_SB(inode->i_sb); | 30 | struct hfsplus_sb_info *sbi = HFSPLUS_SB(inode->i_sb); |
| 31 | struct hfsplus_vh *vh = sbi->s_vhdr; | 31 | struct hfsplus_vh *vh = sbi->s_vhdr; |
| 32 | struct hfsplus_vh *bvh = sbi->s_backup_vhdr; | 32 | struct hfsplus_vh *bvh = sbi->s_backup_vhdr; |
diff --git a/fs/hfsplus/xattr.c b/fs/hfsplus/xattr.c index 89f262d8fcd8..416b1dbafe51 100644 --- a/fs/hfsplus/xattr.c +++ b/fs/hfsplus/xattr.c | |||
| @@ -440,7 +440,7 @@ int hfsplus_setxattr(struct dentry *dentry, const char *name, | |||
| 440 | return -ENOMEM; | 440 | return -ENOMEM; |
| 441 | strcpy(xattr_name, prefix); | 441 | strcpy(xattr_name, prefix); |
| 442 | strcpy(xattr_name + prefixlen, name); | 442 | strcpy(xattr_name + prefixlen, name); |
| 443 | res = __hfsplus_setxattr(dentry->d_inode, xattr_name, value, size, | 443 | res = __hfsplus_setxattr(d_inode(dentry), xattr_name, value, size, |
| 444 | flags); | 444 | flags); |
| 445 | kfree(xattr_name); | 445 | kfree(xattr_name); |
| 446 | return res; | 446 | return res; |
| @@ -600,7 +600,7 @@ ssize_t hfsplus_getxattr(struct dentry *dentry, const char *name, | |||
| 600 | strcpy(xattr_name, prefix); | 600 | strcpy(xattr_name, prefix); |
| 601 | strcpy(xattr_name + prefixlen, name); | 601 | strcpy(xattr_name + prefixlen, name); |
| 602 | 602 | ||
| 603 | res = __hfsplus_getxattr(dentry->d_inode, xattr_name, value, size); | 603 | res = __hfsplus_getxattr(d_inode(dentry), xattr_name, value, size); |
| 604 | kfree(xattr_name); | 604 | kfree(xattr_name); |
| 605 | return res; | 605 | return res; |
| 606 | 606 | ||
| @@ -620,7 +620,7 @@ static ssize_t hfsplus_listxattr_finder_info(struct dentry *dentry, | |||
| 620 | char *buffer, size_t size) | 620 | char *buffer, size_t size) |
| 621 | { | 621 | { |
| 622 | ssize_t res = 0; | 622 | ssize_t res = 0; |
| 623 | struct inode *inode = dentry->d_inode; | 623 | struct inode *inode = d_inode(dentry); |
| 624 | struct hfs_find_data fd; | 624 | struct hfs_find_data fd; |
| 625 | u16 entry_type; | 625 | u16 entry_type; |
| 626 | u8 folder_finder_info[sizeof(struct DInfo) + sizeof(struct DXInfo)]; | 626 | u8 folder_finder_info[sizeof(struct DInfo) + sizeof(struct DXInfo)]; |
| @@ -688,7 +688,7 @@ ssize_t hfsplus_listxattr(struct dentry *dentry, char *buffer, size_t size) | |||
| 688 | { | 688 | { |
| 689 | ssize_t err; | 689 | ssize_t err; |
| 690 | ssize_t res = 0; | 690 | ssize_t res = 0; |
| 691 | struct inode *inode = dentry->d_inode; | 691 | struct inode *inode = d_inode(dentry); |
| 692 | struct hfs_find_data fd; | 692 | struct hfs_find_data fd; |
| 693 | u16 key_len = 0; | 693 | u16 key_len = 0; |
| 694 | struct hfsplus_attr_key attr_key; | 694 | struct hfsplus_attr_key attr_key; |
| @@ -868,7 +868,7 @@ static int hfsplus_osx_getxattr(struct dentry *dentry, const char *name, | |||
| 868 | * creates), so we pass the name through unmodified (after | 868 | * creates), so we pass the name through unmodified (after |
| 869 | * ensuring it doesn't conflict with another namespace). | 869 | * ensuring it doesn't conflict with another namespace). |
| 870 | */ | 870 | */ |
| 871 | return __hfsplus_getxattr(dentry->d_inode, name, buffer, size); | 871 | return __hfsplus_getxattr(d_inode(dentry), name, buffer, size); |
| 872 | } | 872 | } |
| 873 | 873 | ||
| 874 | static int hfsplus_osx_setxattr(struct dentry *dentry, const char *name, | 874 | static int hfsplus_osx_setxattr(struct dentry *dentry, const char *name, |
| @@ -890,7 +890,7 @@ static int hfsplus_osx_setxattr(struct dentry *dentry, const char *name, | |||
| 890 | * creates), so we pass the name through unmodified (after | 890 | * creates), so we pass the name through unmodified (after |
| 891 | * ensuring it doesn't conflict with another namespace). | 891 | * ensuring it doesn't conflict with another namespace). |
| 892 | */ | 892 | */ |
| 893 | return __hfsplus_setxattr(dentry->d_inode, name, buffer, size, flags); | 893 | return __hfsplus_setxattr(d_inode(dentry), name, buffer, size, flags); |
| 894 | } | 894 | } |
| 895 | 895 | ||
| 896 | static size_t hfsplus_osx_listxattr(struct dentry *dentry, char *list, | 896 | static size_t hfsplus_osx_listxattr(struct dentry *dentry, char *list, |
diff --git a/fs/hostfs/hostfs_kern.c b/fs/hostfs/hostfs_kern.c index b83a0343378b..ef263174acd2 100644 --- a/fs/hostfs/hostfs_kern.c +++ b/fs/hostfs/hostfs_kern.c | |||
| @@ -807,7 +807,7 @@ static int hostfs_permission(struct inode *ino, int desired) | |||
| 807 | 807 | ||
| 808 | static int hostfs_setattr(struct dentry *dentry, struct iattr *attr) | 808 | static int hostfs_setattr(struct dentry *dentry, struct iattr *attr) |
| 809 | { | 809 | { |
| 810 | struct inode *inode = dentry->d_inode; | 810 | struct inode *inode = d_inode(dentry); |
| 811 | struct hostfs_iattr attrs; | 811 | struct hostfs_iattr attrs; |
| 812 | char *name; | 812 | char *name; |
| 813 | int err; | 813 | int err; |
diff --git a/fs/hpfs/inode.c b/fs/hpfs/inode.c index 7ce4b74234a1..933c73780813 100644 --- a/fs/hpfs/inode.c +++ b/fs/hpfs/inode.c | |||
| @@ -257,7 +257,7 @@ void hpfs_write_inode_nolock(struct inode *i) | |||
| 257 | 257 | ||
| 258 | int hpfs_setattr(struct dentry *dentry, struct iattr *attr) | 258 | int hpfs_setattr(struct dentry *dentry, struct iattr *attr) |
| 259 | { | 259 | { |
| 260 | struct inode *inode = dentry->d_inode; | 260 | struct inode *inode = d_inode(dentry); |
| 261 | int error = -EINVAL; | 261 | int error = -EINVAL; |
| 262 | 262 | ||
| 263 | hpfs_lock(inode->i_sb); | 263 | hpfs_lock(inode->i_sb); |
diff --git a/fs/hpfs/namei.c b/fs/hpfs/namei.c index bdbc2c3080a4..a0872f239f04 100644 --- a/fs/hpfs/namei.c +++ b/fs/hpfs/namei.c | |||
| @@ -359,7 +359,7 @@ static int hpfs_unlink(struct inode *dir, struct dentry *dentry) | |||
| 359 | unsigned len = dentry->d_name.len; | 359 | unsigned len = dentry->d_name.len; |
| 360 | struct quad_buffer_head qbh; | 360 | struct quad_buffer_head qbh; |
| 361 | struct hpfs_dirent *de; | 361 | struct hpfs_dirent *de; |
| 362 | struct inode *inode = dentry->d_inode; | 362 | struct inode *inode = d_inode(dentry); |
| 363 | dnode_secno dno; | 363 | dnode_secno dno; |
| 364 | int r; | 364 | int r; |
| 365 | int rep = 0; | 365 | int rep = 0; |
| @@ -433,7 +433,7 @@ static int hpfs_rmdir(struct inode *dir, struct dentry *dentry) | |||
| 433 | unsigned len = dentry->d_name.len; | 433 | unsigned len = dentry->d_name.len; |
| 434 | struct quad_buffer_head qbh; | 434 | struct quad_buffer_head qbh; |
| 435 | struct hpfs_dirent *de; | 435 | struct hpfs_dirent *de; |
| 436 | struct inode *inode = dentry->d_inode; | 436 | struct inode *inode = d_inode(dentry); |
| 437 | dnode_secno dno; | 437 | dnode_secno dno; |
| 438 | int n_items = 0; | 438 | int n_items = 0; |
| 439 | int err; | 439 | int err; |
| @@ -522,8 +522,8 @@ static int hpfs_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
| 522 | unsigned old_len = old_dentry->d_name.len; | 522 | unsigned old_len = old_dentry->d_name.len; |
| 523 | const unsigned char *new_name = new_dentry->d_name.name; | 523 | const unsigned char *new_name = new_dentry->d_name.name; |
| 524 | unsigned new_len = new_dentry->d_name.len; | 524 | unsigned new_len = new_dentry->d_name.len; |
| 525 | struct inode *i = old_dentry->d_inode; | 525 | struct inode *i = d_inode(old_dentry); |
| 526 | struct inode *new_inode = new_dentry->d_inode; | 526 | struct inode *new_inode = d_inode(new_dentry); |
| 527 | struct quad_buffer_head qbh, qbh1; | 527 | struct quad_buffer_head qbh, qbh1; |
| 528 | struct hpfs_dirent *dep, *nde; | 528 | struct hpfs_dirent *dep, *nde; |
| 529 | struct hpfs_dirent de; | 529 | struct hpfs_dirent de; |
diff --git a/fs/hppfs/hppfs.c b/fs/hppfs/hppfs.c index 043ac9d77262..fa2bd5366ecf 100644 --- a/fs/hppfs/hppfs.c +++ b/fs/hppfs/hppfs.c | |||
| @@ -153,9 +153,9 @@ static struct dentry *hppfs_lookup(struct inode *ino, struct dentry *dentry, | |||
| 153 | return ERR_PTR(-ENOENT); | 153 | return ERR_PTR(-ENOENT); |
| 154 | 154 | ||
| 155 | parent = HPPFS_I(ino)->proc_dentry; | 155 | parent = HPPFS_I(ino)->proc_dentry; |
| 156 | mutex_lock(&parent->d_inode->i_mutex); | 156 | mutex_lock(&d_inode(parent)->i_mutex); |
| 157 | proc_dentry = lookup_one_len(name->name, parent, name->len); | 157 | proc_dentry = lookup_one_len(name->name, parent, name->len); |
| 158 | mutex_unlock(&parent->d_inode->i_mutex); | 158 | mutex_unlock(&d_inode(parent)->i_mutex); |
| 159 | 159 | ||
| 160 | if (IS_ERR(proc_dentry)) | 160 | if (IS_ERR(proc_dentry)) |
| 161 | return proc_dentry; | 161 | return proc_dentry; |
| @@ -637,25 +637,25 @@ static const struct super_operations hppfs_sbops = { | |||
| 637 | static int hppfs_readlink(struct dentry *dentry, char __user *buffer, | 637 | static int hppfs_readlink(struct dentry *dentry, char __user *buffer, |
| 638 | int buflen) | 638 | int buflen) |
| 639 | { | 639 | { |
| 640 | struct dentry *proc_dentry = HPPFS_I(dentry->d_inode)->proc_dentry; | 640 | struct dentry *proc_dentry = HPPFS_I(d_inode(dentry))->proc_dentry; |
| 641 | return proc_dentry->d_inode->i_op->readlink(proc_dentry, buffer, | 641 | return d_inode(proc_dentry)->i_op->readlink(proc_dentry, buffer, |
| 642 | buflen); | 642 | buflen); |
| 643 | } | 643 | } |
| 644 | 644 | ||
| 645 | static void *hppfs_follow_link(struct dentry *dentry, struct nameidata *nd) | 645 | static void *hppfs_follow_link(struct dentry *dentry, struct nameidata *nd) |
| 646 | { | 646 | { |
| 647 | struct dentry *proc_dentry = HPPFS_I(dentry->d_inode)->proc_dentry; | 647 | struct dentry *proc_dentry = HPPFS_I(d_inode(dentry))->proc_dentry; |
| 648 | 648 | ||
| 649 | return proc_dentry->d_inode->i_op->follow_link(proc_dentry, nd); | 649 | return d_inode(proc_dentry)->i_op->follow_link(proc_dentry, nd); |
| 650 | } | 650 | } |
| 651 | 651 | ||
| 652 | static void hppfs_put_link(struct dentry *dentry, struct nameidata *nd, | 652 | static void hppfs_put_link(struct dentry *dentry, struct nameidata *nd, |
| 653 | void *cookie) | 653 | void *cookie) |
| 654 | { | 654 | { |
| 655 | struct dentry *proc_dentry = HPPFS_I(dentry->d_inode)->proc_dentry; | 655 | struct dentry *proc_dentry = HPPFS_I(d_inode(dentry))->proc_dentry; |
| 656 | 656 | ||
| 657 | if (proc_dentry->d_inode->i_op->put_link) | 657 | if (d_inode(proc_dentry)->i_op->put_link) |
| 658 | proc_dentry->d_inode->i_op->put_link(proc_dentry, nd, cookie); | 658 | d_inode(proc_dentry)->i_op->put_link(proc_dentry, nd, cookie); |
| 659 | } | 659 | } |
| 660 | 660 | ||
| 661 | static const struct inode_operations hppfs_dir_iops = { | 661 | static const struct inode_operations hppfs_dir_iops = { |
| @@ -670,7 +670,7 @@ static const struct inode_operations hppfs_link_iops = { | |||
| 670 | 670 | ||
| 671 | static struct inode *get_inode(struct super_block *sb, struct dentry *dentry) | 671 | static struct inode *get_inode(struct super_block *sb, struct dentry *dentry) |
| 672 | { | 672 | { |
| 673 | struct inode *proc_ino = dentry->d_inode; | 673 | struct inode *proc_ino = d_inode(dentry); |
| 674 | struct inode *inode = new_inode(sb); | 674 | struct inode *inode = new_inode(sb); |
| 675 | 675 | ||
| 676 | if (!inode) { | 676 | if (!inode) { |
diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c index 2640d88b0e63..87724c1d7be6 100644 --- a/fs/hugetlbfs/inode.c +++ b/fs/hugetlbfs/inode.c | |||
| @@ -393,7 +393,7 @@ static int hugetlb_vmtruncate(struct inode *inode, loff_t offset) | |||
| 393 | 393 | ||
| 394 | static int hugetlbfs_setattr(struct dentry *dentry, struct iattr *attr) | 394 | static int hugetlbfs_setattr(struct dentry *dentry, struct iattr *attr) |
| 395 | { | 395 | { |
| 396 | struct inode *inode = dentry->d_inode; | 396 | struct inode *inode = d_inode(dentry); |
| 397 | struct hstate *h = hstate_inode(inode); | 397 | struct hstate *h = hstate_inode(inode); |
| 398 | int error; | 398 | int error; |
| 399 | unsigned int ia_valid = attr->ia_valid; | 399 | unsigned int ia_valid = attr->ia_valid; |
| @@ -587,7 +587,7 @@ static int hugetlbfs_migrate_page(struct address_space *mapping, | |||
| 587 | static int hugetlbfs_statfs(struct dentry *dentry, struct kstatfs *buf) | 587 | static int hugetlbfs_statfs(struct dentry *dentry, struct kstatfs *buf) |
| 588 | { | 588 | { |
| 589 | struct hugetlbfs_sb_info *sbinfo = HUGETLBFS_SB(dentry->d_sb); | 589 | struct hugetlbfs_sb_info *sbinfo = HUGETLBFS_SB(dentry->d_sb); |
| 590 | struct hstate *h = hstate_inode(dentry->d_inode); | 590 | struct hstate *h = hstate_inode(d_inode(dentry)); |
| 591 | 591 | ||
| 592 | buf->f_type = HUGETLBFS_MAGIC; | 592 | buf->f_type = HUGETLBFS_MAGIC; |
| 593 | buf->f_bsize = huge_page_size(h); | 593 | buf->f_bsize = huge_page_size(h); |
diff --git a/fs/inode.c b/fs/inode.c index f00b16f45507..ea37cd17b53f 100644 --- a/fs/inode.c +++ b/fs/inode.c | |||
| @@ -1587,7 +1587,7 @@ static int update_time(struct inode *inode, struct timespec *time, int flags) | |||
| 1587 | void touch_atime(const struct path *path) | 1587 | void touch_atime(const struct path *path) |
| 1588 | { | 1588 | { |
| 1589 | struct vfsmount *mnt = path->mnt; | 1589 | struct vfsmount *mnt = path->mnt; |
| 1590 | struct inode *inode = path->dentry->d_inode; | 1590 | struct inode *inode = d_inode(path->dentry); |
| 1591 | struct timespec now; | 1591 | struct timespec now; |
| 1592 | 1592 | ||
| 1593 | if (inode->i_flags & S_NOATIME) | 1593 | if (inode->i_flags & S_NOATIME) |
| @@ -1639,7 +1639,7 @@ EXPORT_SYMBOL(touch_atime); | |||
| 1639 | */ | 1639 | */ |
| 1640 | int should_remove_suid(struct dentry *dentry) | 1640 | int should_remove_suid(struct dentry *dentry) |
| 1641 | { | 1641 | { |
| 1642 | umode_t mode = dentry->d_inode->i_mode; | 1642 | umode_t mode = d_inode(dentry)->i_mode; |
| 1643 | int kill = 0; | 1643 | int kill = 0; |
| 1644 | 1644 | ||
| 1645 | /* suid always must be killed */ | 1645 | /* suid always must be killed */ |
| @@ -1675,7 +1675,7 @@ static int __remove_suid(struct dentry *dentry, int kill) | |||
| 1675 | int file_remove_suid(struct file *file) | 1675 | int file_remove_suid(struct file *file) |
| 1676 | { | 1676 | { |
| 1677 | struct dentry *dentry = file->f_path.dentry; | 1677 | struct dentry *dentry = file->f_path.dentry; |
| 1678 | struct inode *inode = dentry->d_inode; | 1678 | struct inode *inode = d_inode(dentry); |
| 1679 | int killsuid; | 1679 | int killsuid; |
| 1680 | int killpriv; | 1680 | int killpriv; |
| 1681 | int error = 0; | 1681 | int error = 0; |
| @@ -1946,20 +1946,6 @@ void inode_dio_wait(struct inode *inode) | |||
| 1946 | EXPORT_SYMBOL(inode_dio_wait); | 1946 | EXPORT_SYMBOL(inode_dio_wait); |
| 1947 | 1947 | ||
| 1948 | /* | 1948 | /* |
| 1949 | * inode_dio_done - signal finish of a direct I/O requests | ||
| 1950 | * @inode: inode the direct I/O happens on | ||
| 1951 | * | ||
| 1952 | * This is called once we've finished processing a direct I/O request, | ||
| 1953 | * and is used to wake up callers waiting for direct I/O to be quiesced. | ||
| 1954 | */ | ||
| 1955 | void inode_dio_done(struct inode *inode) | ||
| 1956 | { | ||
| 1957 | if (atomic_dec_and_test(&inode->i_dio_count)) | ||
| 1958 | wake_up_bit(&inode->i_state, __I_DIO_WAKEUP); | ||
| 1959 | } | ||
| 1960 | EXPORT_SYMBOL(inode_dio_done); | ||
| 1961 | |||
| 1962 | /* | ||
| 1963 | * inode_set_flags - atomically set some inode flags | 1949 | * inode_set_flags - atomically set some inode flags |
| 1964 | * | 1950 | * |
| 1965 | * Note: the caller should be holding i_mutex, or else be sure that | 1951 | * Note: the caller should be holding i_mutex, or else be sure that |
diff --git a/fs/isofs/export.c b/fs/isofs/export.c index 12088d8de3fa..0c5f721b4e91 100644 --- a/fs/isofs/export.c +++ b/fs/isofs/export.c | |||
| @@ -44,7 +44,7 @@ static struct dentry *isofs_export_get_parent(struct dentry *child) | |||
| 44 | { | 44 | { |
| 45 | unsigned long parent_block = 0; | 45 | unsigned long parent_block = 0; |
| 46 | unsigned long parent_offset = 0; | 46 | unsigned long parent_offset = 0; |
| 47 | struct inode *child_inode = child->d_inode; | 47 | struct inode *child_inode = d_inode(child); |
| 48 | struct iso_inode_info *e_child_inode = ISOFS_I(child_inode); | 48 | struct iso_inode_info *e_child_inode = ISOFS_I(child_inode); |
| 49 | struct iso_directory_record *de = NULL; | 49 | struct iso_directory_record *de = NULL; |
| 50 | struct buffer_head * bh = NULL; | 50 | struct buffer_head * bh = NULL; |
diff --git a/fs/jffs2/dir.c b/fs/jffs2/dir.c index f21b6fb5e4c4..1ba5c97943b8 100644 --- a/fs/jffs2/dir.c +++ b/fs/jffs2/dir.c | |||
| @@ -224,14 +224,14 @@ static int jffs2_unlink(struct inode *dir_i, struct dentry *dentry) | |||
| 224 | { | 224 | { |
| 225 | struct jffs2_sb_info *c = JFFS2_SB_INFO(dir_i->i_sb); | 225 | struct jffs2_sb_info *c = JFFS2_SB_INFO(dir_i->i_sb); |
| 226 | struct jffs2_inode_info *dir_f = JFFS2_INODE_INFO(dir_i); | 226 | struct jffs2_inode_info *dir_f = JFFS2_INODE_INFO(dir_i); |
| 227 | struct jffs2_inode_info *dead_f = JFFS2_INODE_INFO(dentry->d_inode); | 227 | struct jffs2_inode_info *dead_f = JFFS2_INODE_INFO(d_inode(dentry)); |
| 228 | int ret; | 228 | int ret; |
| 229 | uint32_t now = get_seconds(); | 229 | uint32_t now = get_seconds(); |
| 230 | 230 | ||
| 231 | ret = jffs2_do_unlink(c, dir_f, dentry->d_name.name, | 231 | ret = jffs2_do_unlink(c, dir_f, dentry->d_name.name, |
| 232 | dentry->d_name.len, dead_f, now); | 232 | dentry->d_name.len, dead_f, now); |
| 233 | if (dead_f->inocache) | 233 | if (dead_f->inocache) |
| 234 | set_nlink(dentry->d_inode, dead_f->inocache->pino_nlink); | 234 | set_nlink(d_inode(dentry), dead_f->inocache->pino_nlink); |
| 235 | if (!ret) | 235 | if (!ret) |
| 236 | dir_i->i_mtime = dir_i->i_ctime = ITIME(now); | 236 | dir_i->i_mtime = dir_i->i_ctime = ITIME(now); |
| 237 | return ret; | 237 | return ret; |
| @@ -241,8 +241,8 @@ static int jffs2_unlink(struct inode *dir_i, struct dentry *dentry) | |||
| 241 | 241 | ||
| 242 | static int jffs2_link (struct dentry *old_dentry, struct inode *dir_i, struct dentry *dentry) | 242 | static int jffs2_link (struct dentry *old_dentry, struct inode *dir_i, struct dentry *dentry) |
| 243 | { | 243 | { |
| 244 | struct jffs2_sb_info *c = JFFS2_SB_INFO(old_dentry->d_inode->i_sb); | 244 | struct jffs2_sb_info *c = JFFS2_SB_INFO(d_inode(old_dentry)->i_sb); |
| 245 | struct jffs2_inode_info *f = JFFS2_INODE_INFO(old_dentry->d_inode); | 245 | struct jffs2_inode_info *f = JFFS2_INODE_INFO(d_inode(old_dentry)); |
| 246 | struct jffs2_inode_info *dir_f = JFFS2_INODE_INFO(dir_i); | 246 | struct jffs2_inode_info *dir_f = JFFS2_INODE_INFO(dir_i); |
| 247 | int ret; | 247 | int ret; |
| 248 | uint8_t type; | 248 | uint8_t type; |
| @@ -256,7 +256,7 @@ static int jffs2_link (struct dentry *old_dentry, struct inode *dir_i, struct de | |||
| 256 | return -EPERM; | 256 | return -EPERM; |
| 257 | 257 | ||
| 258 | /* XXX: This is ugly */ | 258 | /* XXX: This is ugly */ |
| 259 | type = (old_dentry->d_inode->i_mode & S_IFMT) >> 12; | 259 | type = (d_inode(old_dentry)->i_mode & S_IFMT) >> 12; |
| 260 | if (!type) type = DT_REG; | 260 | if (!type) type = DT_REG; |
| 261 | 261 | ||
| 262 | now = get_seconds(); | 262 | now = get_seconds(); |
| @@ -264,11 +264,11 @@ static int jffs2_link (struct dentry *old_dentry, struct inode *dir_i, struct de | |||
| 264 | 264 | ||
| 265 | if (!ret) { | 265 | if (!ret) { |
| 266 | mutex_lock(&f->sem); | 266 | mutex_lock(&f->sem); |
| 267 | set_nlink(old_dentry->d_inode, ++f->inocache->pino_nlink); | 267 | set_nlink(d_inode(old_dentry), ++f->inocache->pino_nlink); |
| 268 | mutex_unlock(&f->sem); | 268 | mutex_unlock(&f->sem); |
| 269 | d_instantiate(dentry, old_dentry->d_inode); | 269 | d_instantiate(dentry, d_inode(old_dentry)); |
| 270 | dir_i->i_mtime = dir_i->i_ctime = ITIME(now); | 270 | dir_i->i_mtime = dir_i->i_ctime = ITIME(now); |
| 271 | ihold(old_dentry->d_inode); | 271 | ihold(d_inode(old_dentry)); |
| 272 | } | 272 | } |
| 273 | return ret; | 273 | return ret; |
| 274 | } | 274 | } |
| @@ -585,7 +585,7 @@ static int jffs2_rmdir (struct inode *dir_i, struct dentry *dentry) | |||
| 585 | { | 585 | { |
| 586 | struct jffs2_sb_info *c = JFFS2_SB_INFO(dir_i->i_sb); | 586 | struct jffs2_sb_info *c = JFFS2_SB_INFO(dir_i->i_sb); |
| 587 | struct jffs2_inode_info *dir_f = JFFS2_INODE_INFO(dir_i); | 587 | struct jffs2_inode_info *dir_f = JFFS2_INODE_INFO(dir_i); |
| 588 | struct jffs2_inode_info *f = JFFS2_INODE_INFO(dentry->d_inode); | 588 | struct jffs2_inode_info *f = JFFS2_INODE_INFO(d_inode(dentry)); |
| 589 | struct jffs2_full_dirent *fd; | 589 | struct jffs2_full_dirent *fd; |
| 590 | int ret; | 590 | int ret; |
| 591 | uint32_t now = get_seconds(); | 591 | uint32_t now = get_seconds(); |
| @@ -599,7 +599,7 @@ static int jffs2_rmdir (struct inode *dir_i, struct dentry *dentry) | |||
| 599 | dentry->d_name.len, f, now); | 599 | dentry->d_name.len, f, now); |
| 600 | if (!ret) { | 600 | if (!ret) { |
| 601 | dir_i->i_mtime = dir_i->i_ctime = ITIME(now); | 601 | dir_i->i_mtime = dir_i->i_ctime = ITIME(now); |
| 602 | clear_nlink(dentry->d_inode); | 602 | clear_nlink(d_inode(dentry)); |
| 603 | drop_nlink(dir_i); | 603 | drop_nlink(dir_i); |
| 604 | } | 604 | } |
| 605 | return ret; | 605 | return ret; |
| @@ -770,8 +770,8 @@ static int jffs2_rename (struct inode *old_dir_i, struct dentry *old_dentry, | |||
| 770 | * the VFS can't check whether the victim is empty. The filesystem | 770 | * the VFS can't check whether the victim is empty. The filesystem |
| 771 | * needs to do that for itself. | 771 | * needs to do that for itself. |
| 772 | */ | 772 | */ |
| 773 | if (new_dentry->d_inode) { | 773 | if (d_really_is_positive(new_dentry)) { |
| 774 | victim_f = JFFS2_INODE_INFO(new_dentry->d_inode); | 774 | victim_f = JFFS2_INODE_INFO(d_inode(new_dentry)); |
| 775 | if (d_is_dir(new_dentry)) { | 775 | if (d_is_dir(new_dentry)) { |
| 776 | struct jffs2_full_dirent *fd; | 776 | struct jffs2_full_dirent *fd; |
| 777 | 777 | ||
| @@ -794,12 +794,12 @@ static int jffs2_rename (struct inode *old_dir_i, struct dentry *old_dentry, | |||
| 794 | /* Make a hard link */ | 794 | /* Make a hard link */ |
| 795 | 795 | ||
| 796 | /* XXX: This is ugly */ | 796 | /* XXX: This is ugly */ |
| 797 | type = (old_dentry->d_inode->i_mode & S_IFMT) >> 12; | 797 | type = (d_inode(old_dentry)->i_mode & S_IFMT) >> 12; |
| 798 | if (!type) type = DT_REG; | 798 | if (!type) type = DT_REG; |
| 799 | 799 | ||
| 800 | now = get_seconds(); | 800 | now = get_seconds(); |
| 801 | ret = jffs2_do_link(c, JFFS2_INODE_INFO(new_dir_i), | 801 | ret = jffs2_do_link(c, JFFS2_INODE_INFO(new_dir_i), |
| 802 | old_dentry->d_inode->i_ino, type, | 802 | d_inode(old_dentry)->i_ino, type, |
| 803 | new_dentry->d_name.name, new_dentry->d_name.len, now); | 803 | new_dentry->d_name.name, new_dentry->d_name.len, now); |
| 804 | 804 | ||
| 805 | if (ret) | 805 | if (ret) |
| @@ -808,9 +808,9 @@ static int jffs2_rename (struct inode *old_dir_i, struct dentry *old_dentry, | |||
| 808 | if (victim_f) { | 808 | if (victim_f) { |
| 809 | /* There was a victim. Kill it off nicely */ | 809 | /* There was a victim. Kill it off nicely */ |
| 810 | if (d_is_dir(new_dentry)) | 810 | if (d_is_dir(new_dentry)) |
| 811 | clear_nlink(new_dentry->d_inode); | 811 | clear_nlink(d_inode(new_dentry)); |
| 812 | else | 812 | else |
| 813 | drop_nlink(new_dentry->d_inode); | 813 | drop_nlink(d_inode(new_dentry)); |
| 814 | /* Don't oops if the victim was a dirent pointing to an | 814 | /* Don't oops if the victim was a dirent pointing to an |
| 815 | inode which didn't exist. */ | 815 | inode which didn't exist. */ |
| 816 | if (victim_f->inocache) { | 816 | if (victim_f->inocache) { |
| @@ -836,9 +836,9 @@ static int jffs2_rename (struct inode *old_dir_i, struct dentry *old_dentry, | |||
| 836 | 836 | ||
| 837 | if (ret) { | 837 | if (ret) { |
| 838 | /* Oh shit. We really ought to make a single node which can do both atomically */ | 838 | /* Oh shit. We really ought to make a single node which can do both atomically */ |
| 839 | struct jffs2_inode_info *f = JFFS2_INODE_INFO(old_dentry->d_inode); | 839 | struct jffs2_inode_info *f = JFFS2_INODE_INFO(d_inode(old_dentry)); |
| 840 | mutex_lock(&f->sem); | 840 | mutex_lock(&f->sem); |
| 841 | inc_nlink(old_dentry->d_inode); | 841 | inc_nlink(d_inode(old_dentry)); |
| 842 | if (f->inocache && !d_is_dir(old_dentry)) | 842 | if (f->inocache && !d_is_dir(old_dentry)) |
| 843 | f->inocache->pino_nlink++; | 843 | f->inocache->pino_nlink++; |
| 844 | mutex_unlock(&f->sem); | 844 | mutex_unlock(&f->sem); |
| @@ -846,8 +846,8 @@ static int jffs2_rename (struct inode *old_dir_i, struct dentry *old_dentry, | |||
| 846 | pr_notice("%s(): Link succeeded, unlink failed (err %d). You now have a hard link\n", | 846 | pr_notice("%s(): Link succeeded, unlink failed (err %d). You now have a hard link\n", |
| 847 | __func__, ret); | 847 | __func__, ret); |
| 848 | /* Might as well let the VFS know */ | 848 | /* Might as well let the VFS know */ |
| 849 | d_instantiate(new_dentry, old_dentry->d_inode); | 849 | d_instantiate(new_dentry, d_inode(old_dentry)); |
| 850 | ihold(old_dentry->d_inode); | 850 | ihold(d_inode(old_dentry)); |
| 851 | new_dir_i->i_mtime = new_dir_i->i_ctime = ITIME(now); | 851 | new_dir_i->i_mtime = new_dir_i->i_ctime = ITIME(now); |
| 852 | return ret; | 852 | return ret; |
| 853 | } | 853 | } |
diff --git a/fs/jffs2/fs.c b/fs/jffs2/fs.c index 601afd1afddf..fe5ea080b4ec 100644 --- a/fs/jffs2/fs.c +++ b/fs/jffs2/fs.c | |||
| @@ -190,7 +190,7 @@ int jffs2_do_setattr (struct inode *inode, struct iattr *iattr) | |||
| 190 | 190 | ||
| 191 | int jffs2_setattr(struct dentry *dentry, struct iattr *iattr) | 191 | int jffs2_setattr(struct dentry *dentry, struct iattr *iattr) |
| 192 | { | 192 | { |
| 193 | struct inode *inode = dentry->d_inode; | 193 | struct inode *inode = d_inode(dentry); |
| 194 | int rc; | 194 | int rc; |
| 195 | 195 | ||
| 196 | rc = inode_change_ok(inode, iattr); | 196 | rc = inode_change_ok(inode, iattr); |
diff --git a/fs/jffs2/security.c b/fs/jffs2/security.c index aca97f35b292..d4b43fb7adb1 100644 --- a/fs/jffs2/security.c +++ b/fs/jffs2/security.c | |||
| @@ -54,7 +54,7 @@ static int jffs2_security_getxattr(struct dentry *dentry, const char *name, | |||
| 54 | if (!strcmp(name, "")) | 54 | if (!strcmp(name, "")) |
| 55 | return -EINVAL; | 55 | return -EINVAL; |
| 56 | 56 | ||
| 57 | return do_jffs2_getxattr(dentry->d_inode, JFFS2_XPREFIX_SECURITY, | 57 | return do_jffs2_getxattr(d_inode(dentry), JFFS2_XPREFIX_SECURITY, |
| 58 | name, buffer, size); | 58 | name, buffer, size); |
| 59 | } | 59 | } |
| 60 | 60 | ||
| @@ -64,7 +64,7 @@ static int jffs2_security_setxattr(struct dentry *dentry, const char *name, | |||
| 64 | if (!strcmp(name, "")) | 64 | if (!strcmp(name, "")) |
| 65 | return -EINVAL; | 65 | return -EINVAL; |
| 66 | 66 | ||
| 67 | return do_jffs2_setxattr(dentry->d_inode, JFFS2_XPREFIX_SECURITY, | 67 | return do_jffs2_setxattr(d_inode(dentry), JFFS2_XPREFIX_SECURITY, |
| 68 | name, buffer, size, flags); | 68 | name, buffer, size, flags); |
| 69 | } | 69 | } |
| 70 | 70 | ||
diff --git a/fs/jffs2/super.c b/fs/jffs2/super.c index 3d76f28a2ba9..d86c5e3176a1 100644 --- a/fs/jffs2/super.c +++ b/fs/jffs2/super.c | |||
| @@ -140,14 +140,14 @@ static struct dentry *jffs2_get_parent(struct dentry *child) | |||
| 140 | 140 | ||
| 141 | BUG_ON(!d_is_dir(child)); | 141 | BUG_ON(!d_is_dir(child)); |
| 142 | 142 | ||
| 143 | f = JFFS2_INODE_INFO(child->d_inode); | 143 | f = JFFS2_INODE_INFO(d_inode(child)); |
| 144 | 144 | ||
| 145 | pino = f->inocache->pino_nlink; | 145 | pino = f->inocache->pino_nlink; |
| 146 | 146 | ||
| 147 | JFFS2_DEBUG("Parent of directory ino #%u is #%u\n", | 147 | JFFS2_DEBUG("Parent of directory ino #%u is #%u\n", |
| 148 | f->inocache->ino, pino); | 148 | f->inocache->ino, pino); |
| 149 | 149 | ||
| 150 | return d_obtain_alias(jffs2_iget(child->d_inode->i_sb, pino)); | 150 | return d_obtain_alias(jffs2_iget(d_inode(child)->i_sb, pino)); |
| 151 | } | 151 | } |
| 152 | 152 | ||
| 153 | static const struct export_operations jffs2_export_ops = { | 153 | static const struct export_operations jffs2_export_ops = { |
diff --git a/fs/jffs2/symlink.c b/fs/jffs2/symlink.c index c7c77b0dfccd..1fefa25d0fa5 100644 --- a/fs/jffs2/symlink.c +++ b/fs/jffs2/symlink.c | |||
| @@ -31,7 +31,7 @@ const struct inode_operations jffs2_symlink_inode_operations = | |||
| 31 | 31 | ||
| 32 | static void *jffs2_follow_link(struct dentry *dentry, struct nameidata *nd) | 32 | static void *jffs2_follow_link(struct dentry *dentry, struct nameidata *nd) |
| 33 | { | 33 | { |
| 34 | struct jffs2_inode_info *f = JFFS2_INODE_INFO(dentry->d_inode); | 34 | struct jffs2_inode_info *f = JFFS2_INODE_INFO(d_inode(dentry)); |
| 35 | char *p = (char *)f->target; | 35 | char *p = (char *)f->target; |
| 36 | 36 | ||
| 37 | /* | 37 | /* |
diff --git a/fs/jffs2/xattr.c b/fs/jffs2/xattr.c index 2eac55379239..f092fee5be50 100644 --- a/fs/jffs2/xattr.c +++ b/fs/jffs2/xattr.c | |||
| @@ -960,7 +960,7 @@ static const struct xattr_handler *xprefix_to_handler(int xprefix) { | |||
| 960 | 960 | ||
| 961 | ssize_t jffs2_listxattr(struct dentry *dentry, char *buffer, size_t size) | 961 | ssize_t jffs2_listxattr(struct dentry *dentry, char *buffer, size_t size) |
| 962 | { | 962 | { |
| 963 | struct inode *inode = dentry->d_inode; | 963 | struct inode *inode = d_inode(dentry); |
| 964 | struct jffs2_inode_info *f = JFFS2_INODE_INFO(inode); | 964 | struct jffs2_inode_info *f = JFFS2_INODE_INFO(inode); |
| 965 | struct jffs2_sb_info *c = JFFS2_SB_INFO(inode->i_sb); | 965 | struct jffs2_sb_info *c = JFFS2_SB_INFO(inode->i_sb); |
| 966 | struct jffs2_inode_cache *ic = f->inocache; | 966 | struct jffs2_inode_cache *ic = f->inocache; |
diff --git a/fs/jffs2/xattr_trusted.c b/fs/jffs2/xattr_trusted.c index 1c868194c504..ceaf9c693225 100644 --- a/fs/jffs2/xattr_trusted.c +++ b/fs/jffs2/xattr_trusted.c | |||
| @@ -21,7 +21,7 @@ static int jffs2_trusted_getxattr(struct dentry *dentry, const char *name, | |||
| 21 | { | 21 | { |
| 22 | if (!strcmp(name, "")) | 22 | if (!strcmp(name, "")) |
| 23 | return -EINVAL; | 23 | return -EINVAL; |
| 24 | return do_jffs2_getxattr(dentry->d_inode, JFFS2_XPREFIX_TRUSTED, | 24 | return do_jffs2_getxattr(d_inode(dentry), JFFS2_XPREFIX_TRUSTED, |
| 25 | name, buffer, size); | 25 | name, buffer, size); |
| 26 | } | 26 | } |
| 27 | 27 | ||
| @@ -30,7 +30,7 @@ static int jffs2_trusted_setxattr(struct dentry *dentry, const char *name, | |||
| 30 | { | 30 | { |
| 31 | if (!strcmp(name, "")) | 31 | if (!strcmp(name, "")) |
| 32 | return -EINVAL; | 32 | return -EINVAL; |
| 33 | return do_jffs2_setxattr(dentry->d_inode, JFFS2_XPREFIX_TRUSTED, | 33 | return do_jffs2_setxattr(d_inode(dentry), JFFS2_XPREFIX_TRUSTED, |
| 34 | name, buffer, size, flags); | 34 | name, buffer, size, flags); |
| 35 | } | 35 | } |
| 36 | 36 | ||
diff --git a/fs/jffs2/xattr_user.c b/fs/jffs2/xattr_user.c index 916b5c966039..a71391eba514 100644 --- a/fs/jffs2/xattr_user.c +++ b/fs/jffs2/xattr_user.c | |||
| @@ -21,7 +21,7 @@ static int jffs2_user_getxattr(struct dentry *dentry, const char *name, | |||
| 21 | { | 21 | { |
| 22 | if (!strcmp(name, "")) | 22 | if (!strcmp(name, "")) |
| 23 | return -EINVAL; | 23 | return -EINVAL; |
| 24 | return do_jffs2_getxattr(dentry->d_inode, JFFS2_XPREFIX_USER, | 24 | return do_jffs2_getxattr(d_inode(dentry), JFFS2_XPREFIX_USER, |
| 25 | name, buffer, size); | 25 | name, buffer, size); |
| 26 | } | 26 | } |
| 27 | 27 | ||
| @@ -30,7 +30,7 @@ static int jffs2_user_setxattr(struct dentry *dentry, const char *name, | |||
| 30 | { | 30 | { |
| 31 | if (!strcmp(name, "")) | 31 | if (!strcmp(name, "")) |
| 32 | return -EINVAL; | 32 | return -EINVAL; |
| 33 | return do_jffs2_setxattr(dentry->d_inode, JFFS2_XPREFIX_USER, | 33 | return do_jffs2_setxattr(d_inode(dentry), JFFS2_XPREFIX_USER, |
| 34 | name, buffer, size, flags); | 34 | name, buffer, size, flags); |
| 35 | } | 35 | } |
| 36 | 36 | ||
diff --git a/fs/jfs/file.c b/fs/jfs/file.c index ae46788b9723..e98d39d75cf4 100644 --- a/fs/jfs/file.c +++ b/fs/jfs/file.c | |||
| @@ -100,7 +100,7 @@ static int jfs_release(struct inode *inode, struct file *file) | |||
| 100 | 100 | ||
| 101 | int jfs_setattr(struct dentry *dentry, struct iattr *iattr) | 101 | int jfs_setattr(struct dentry *dentry, struct iattr *iattr) |
| 102 | { | 102 | { |
| 103 | struct inode *inode = dentry->d_inode; | 103 | struct inode *inode = d_inode(dentry); |
| 104 | int rc; | 104 | int rc; |
| 105 | 105 | ||
| 106 | rc = inode_change_ok(inode, iattr); | 106 | rc = inode_change_ok(inode, iattr); |
diff --git a/fs/jfs/namei.c b/fs/jfs/namei.c index 38fdc533f4ec..66db7bc0ed10 100644 --- a/fs/jfs/namei.c +++ b/fs/jfs/namei.c | |||
| @@ -346,7 +346,7 @@ static int jfs_rmdir(struct inode *dip, struct dentry *dentry) | |||
| 346 | { | 346 | { |
| 347 | int rc; | 347 | int rc; |
| 348 | tid_t tid; /* transaction id */ | 348 | tid_t tid; /* transaction id */ |
| 349 | struct inode *ip = dentry->d_inode; | 349 | struct inode *ip = d_inode(dentry); |
| 350 | ino_t ino; | 350 | ino_t ino; |
| 351 | struct component_name dname; | 351 | struct component_name dname; |
| 352 | struct inode *iplist[2]; | 352 | struct inode *iplist[2]; |
| @@ -472,7 +472,7 @@ static int jfs_unlink(struct inode *dip, struct dentry *dentry) | |||
| 472 | { | 472 | { |
| 473 | int rc; | 473 | int rc; |
| 474 | tid_t tid; /* transaction id */ | 474 | tid_t tid; /* transaction id */ |
| 475 | struct inode *ip = dentry->d_inode; | 475 | struct inode *ip = d_inode(dentry); |
| 476 | ino_t ino; | 476 | ino_t ino; |
| 477 | struct component_name dname; /* object name */ | 477 | struct component_name dname; /* object name */ |
| 478 | struct inode *iplist[2]; | 478 | struct inode *iplist[2]; |
| @@ -791,7 +791,7 @@ static int jfs_link(struct dentry *old_dentry, | |||
| 791 | { | 791 | { |
| 792 | int rc; | 792 | int rc; |
| 793 | tid_t tid; | 793 | tid_t tid; |
| 794 | struct inode *ip = old_dentry->d_inode; | 794 | struct inode *ip = d_inode(old_dentry); |
| 795 | ino_t ino; | 795 | ino_t ino; |
| 796 | struct component_name dname; | 796 | struct component_name dname; |
| 797 | struct btstack btstack; | 797 | struct btstack btstack; |
| @@ -879,7 +879,7 @@ static int jfs_symlink(struct inode *dip, struct dentry *dentry, | |||
| 879 | struct component_name dname; | 879 | struct component_name dname; |
| 880 | int ssize; /* source pathname size */ | 880 | int ssize; /* source pathname size */ |
| 881 | struct btstack btstack; | 881 | struct btstack btstack; |
| 882 | struct inode *ip = dentry->d_inode; | 882 | struct inode *ip = d_inode(dentry); |
| 883 | unchar *i_fastsymlink; | 883 | unchar *i_fastsymlink; |
| 884 | s64 xlen = 0; | 884 | s64 xlen = 0; |
| 885 | int bmask = 0, xsize; | 885 | int bmask = 0, xsize; |
| @@ -1086,8 +1086,8 @@ static int jfs_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
| 1086 | dquot_initialize(old_dir); | 1086 | dquot_initialize(old_dir); |
| 1087 | dquot_initialize(new_dir); | 1087 | dquot_initialize(new_dir); |
| 1088 | 1088 | ||
| 1089 | old_ip = old_dentry->d_inode; | 1089 | old_ip = d_inode(old_dentry); |
| 1090 | new_ip = new_dentry->d_inode; | 1090 | new_ip = d_inode(new_dentry); |
| 1091 | 1091 | ||
| 1092 | if ((rc = get_UCSname(&old_dname, old_dentry))) | 1092 | if ((rc = get_UCSname(&old_dname, old_dentry))) |
| 1093 | goto out1; | 1093 | goto out1; |
| @@ -1500,9 +1500,9 @@ struct dentry *jfs_get_parent(struct dentry *dentry) | |||
| 1500 | unsigned long parent_ino; | 1500 | unsigned long parent_ino; |
| 1501 | 1501 | ||
| 1502 | parent_ino = | 1502 | parent_ino = |
| 1503 | le32_to_cpu(JFS_IP(dentry->d_inode)->i_dtroot.header.idotdot); | 1503 | le32_to_cpu(JFS_IP(d_inode(dentry))->i_dtroot.header.idotdot); |
| 1504 | 1504 | ||
| 1505 | return d_obtain_alias(jfs_iget(dentry->d_inode->i_sb, parent_ino)); | 1505 | return d_obtain_alias(jfs_iget(d_inode(dentry)->i_sb, parent_ino)); |
| 1506 | } | 1506 | } |
| 1507 | 1507 | ||
| 1508 | const struct inode_operations jfs_dir_inode_operations = { | 1508 | const struct inode_operations jfs_dir_inode_operations = { |
| @@ -1578,7 +1578,7 @@ static int jfs_ci_revalidate(struct dentry *dentry, unsigned int flags) | |||
| 1578 | * positive dentry isn't good idea. So it's unsupported like | 1578 | * positive dentry isn't good idea. So it's unsupported like |
| 1579 | * rename("filename", "FILENAME") for now. | 1579 | * rename("filename", "FILENAME") for now. |
| 1580 | */ | 1580 | */ |
| 1581 | if (dentry->d_inode) | 1581 | if (d_really_is_positive(dentry)) |
| 1582 | return 1; | 1582 | return 1; |
| 1583 | 1583 | ||
| 1584 | /* | 1584 | /* |
diff --git a/fs/jfs/symlink.c b/fs/jfs/symlink.c index 205b946d8e0d..80f42bcc4ef1 100644 --- a/fs/jfs/symlink.c +++ b/fs/jfs/symlink.c | |||
| @@ -24,7 +24,7 @@ | |||
| 24 | 24 | ||
| 25 | static void *jfs_follow_link(struct dentry *dentry, struct nameidata *nd) | 25 | static void *jfs_follow_link(struct dentry *dentry, struct nameidata *nd) |
| 26 | { | 26 | { |
| 27 | char *s = JFS_IP(dentry->d_inode)->i_inline; | 27 | char *s = JFS_IP(d_inode(dentry))->i_inline; |
| 28 | nd_set_link(nd, s); | 28 | nd_set_link(nd, s); |
| 29 | return NULL; | 29 | return NULL; |
| 30 | } | 30 | } |
diff --git a/fs/jfs/xattr.c b/fs/jfs/xattr.c index 46325d5c34fc..48b15a6e5558 100644 --- a/fs/jfs/xattr.c +++ b/fs/jfs/xattr.c | |||
| @@ -849,7 +849,7 @@ int __jfs_setxattr(tid_t tid, struct inode *inode, const char *name, | |||
| 849 | int jfs_setxattr(struct dentry *dentry, const char *name, const void *value, | 849 | int jfs_setxattr(struct dentry *dentry, const char *name, const void *value, |
| 850 | size_t value_len, int flags) | 850 | size_t value_len, int flags) |
| 851 | { | 851 | { |
| 852 | struct inode *inode = dentry->d_inode; | 852 | struct inode *inode = d_inode(dentry); |
| 853 | struct jfs_inode_info *ji = JFS_IP(inode); | 853 | struct jfs_inode_info *ji = JFS_IP(inode); |
| 854 | int rc; | 854 | int rc; |
| 855 | tid_t tid; | 855 | tid_t tid; |
| @@ -872,7 +872,7 @@ int jfs_setxattr(struct dentry *dentry, const char *name, const void *value, | |||
| 872 | 872 | ||
| 873 | tid = txBegin(inode->i_sb, 0); | 873 | tid = txBegin(inode->i_sb, 0); |
| 874 | mutex_lock(&ji->commit_mutex); | 874 | mutex_lock(&ji->commit_mutex); |
| 875 | rc = __jfs_setxattr(tid, dentry->d_inode, name, value, value_len, | 875 | rc = __jfs_setxattr(tid, d_inode(dentry), name, value, value_len, |
| 876 | flags); | 876 | flags); |
| 877 | if (!rc) | 877 | if (!rc) |
| 878 | rc = txCommit(tid, 1, &inode, 0); | 878 | rc = txCommit(tid, 1, &inode, 0); |
| @@ -959,7 +959,7 @@ ssize_t jfs_getxattr(struct dentry *dentry, const char *name, void *data, | |||
| 959 | return -EOPNOTSUPP; | 959 | return -EOPNOTSUPP; |
| 960 | } | 960 | } |
| 961 | 961 | ||
| 962 | err = __jfs_getxattr(dentry->d_inode, name, data, buf_size); | 962 | err = __jfs_getxattr(d_inode(dentry), name, data, buf_size); |
| 963 | 963 | ||
| 964 | return err; | 964 | return err; |
| 965 | } | 965 | } |
| @@ -976,7 +976,7 @@ static inline int can_list(struct jfs_ea *ea) | |||
| 976 | 976 | ||
| 977 | ssize_t jfs_listxattr(struct dentry * dentry, char *data, size_t buf_size) | 977 | ssize_t jfs_listxattr(struct dentry * dentry, char *data, size_t buf_size) |
| 978 | { | 978 | { |
| 979 | struct inode *inode = dentry->d_inode; | 979 | struct inode *inode = d_inode(dentry); |
| 980 | char *buffer; | 980 | char *buffer; |
| 981 | ssize_t size = 0; | 981 | ssize_t size = 0; |
| 982 | int xattr_size; | 982 | int xattr_size; |
| @@ -1029,7 +1029,7 @@ ssize_t jfs_listxattr(struct dentry * dentry, char *data, size_t buf_size) | |||
| 1029 | 1029 | ||
| 1030 | int jfs_removexattr(struct dentry *dentry, const char *name) | 1030 | int jfs_removexattr(struct dentry *dentry, const char *name) |
| 1031 | { | 1031 | { |
| 1032 | struct inode *inode = dentry->d_inode; | 1032 | struct inode *inode = d_inode(dentry); |
| 1033 | struct jfs_inode_info *ji = JFS_IP(inode); | 1033 | struct jfs_inode_info *ji = JFS_IP(inode); |
| 1034 | int rc; | 1034 | int rc; |
| 1035 | tid_t tid; | 1035 | tid_t tid; |
| @@ -1047,7 +1047,7 @@ int jfs_removexattr(struct dentry *dentry, const char *name) | |||
| 1047 | 1047 | ||
| 1048 | tid = txBegin(inode->i_sb, 0); | 1048 | tid = txBegin(inode->i_sb, 0); |
| 1049 | mutex_lock(&ji->commit_mutex); | 1049 | mutex_lock(&ji->commit_mutex); |
| 1050 | rc = __jfs_setxattr(tid, dentry->d_inode, name, NULL, 0, XATTR_REPLACE); | 1050 | rc = __jfs_setxattr(tid, d_inode(dentry), name, NULL, 0, XATTR_REPLACE); |
| 1051 | if (!rc) | 1051 | if (!rc) |
| 1052 | rc = txCommit(tid, 1, &inode, 0); | 1052 | rc = txCommit(tid, 1, &inode, 0); |
| 1053 | txEnd(tid); | 1053 | txEnd(tid); |
diff --git a/fs/kernfs/dir.c b/fs/kernfs/dir.c index 6acc9648f986..f131fc23ffc4 100644 --- a/fs/kernfs/dir.c +++ b/fs/kernfs/dir.c | |||
| @@ -444,7 +444,7 @@ static int kernfs_dop_revalidate(struct dentry *dentry, unsigned int flags) | |||
| 444 | return -ECHILD; | 444 | return -ECHILD; |
| 445 | 445 | ||
| 446 | /* Always perform fresh lookup for negatives */ | 446 | /* Always perform fresh lookup for negatives */ |
| 447 | if (!dentry->d_inode) | 447 | if (d_really_is_negative(dentry)) |
| 448 | goto out_bad_unlocked; | 448 | goto out_bad_unlocked; |
| 449 | 449 | ||
| 450 | kn = dentry->d_fsdata; | 450 | kn = dentry->d_fsdata; |
diff --git a/fs/kernfs/inode.c b/fs/kernfs/inode.c index 9000874a945b..2da8493a380b 100644 --- a/fs/kernfs/inode.c +++ b/fs/kernfs/inode.c | |||
| @@ -111,7 +111,7 @@ int kernfs_setattr(struct kernfs_node *kn, const struct iattr *iattr) | |||
| 111 | 111 | ||
| 112 | int kernfs_iop_setattr(struct dentry *dentry, struct iattr *iattr) | 112 | int kernfs_iop_setattr(struct dentry *dentry, struct iattr *iattr) |
| 113 | { | 113 | { |
| 114 | struct inode *inode = dentry->d_inode; | 114 | struct inode *inode = d_inode(dentry); |
| 115 | struct kernfs_node *kn = dentry->d_fsdata; | 115 | struct kernfs_node *kn = dentry->d_fsdata; |
| 116 | int error; | 116 | int error; |
| 117 | 117 | ||
| @@ -172,11 +172,11 @@ int kernfs_iop_setxattr(struct dentry *dentry, const char *name, | |||
| 172 | 172 | ||
| 173 | if (!strncmp(name, XATTR_SECURITY_PREFIX, XATTR_SECURITY_PREFIX_LEN)) { | 173 | if (!strncmp(name, XATTR_SECURITY_PREFIX, XATTR_SECURITY_PREFIX_LEN)) { |
| 174 | const char *suffix = name + XATTR_SECURITY_PREFIX_LEN; | 174 | const char *suffix = name + XATTR_SECURITY_PREFIX_LEN; |
| 175 | error = security_inode_setsecurity(dentry->d_inode, suffix, | 175 | error = security_inode_setsecurity(d_inode(dentry), suffix, |
| 176 | value, size, flags); | 176 | value, size, flags); |
| 177 | if (error) | 177 | if (error) |
| 178 | return error; | 178 | return error; |
| 179 | error = security_inode_getsecctx(dentry->d_inode, | 179 | error = security_inode_getsecctx(d_inode(dentry), |
| 180 | &secdata, &secdata_len); | 180 | &secdata, &secdata_len); |
| 181 | if (error) | 181 | if (error) |
| 182 | return error; | 182 | return error; |
| @@ -271,7 +271,7 @@ int kernfs_iop_getattr(struct vfsmount *mnt, struct dentry *dentry, | |||
| 271 | struct kstat *stat) | 271 | struct kstat *stat) |
| 272 | { | 272 | { |
| 273 | struct kernfs_node *kn = dentry->d_fsdata; | 273 | struct kernfs_node *kn = dentry->d_fsdata; |
| 274 | struct inode *inode = dentry->d_inode; | 274 | struct inode *inode = d_inode(dentry); |
| 275 | 275 | ||
| 276 | mutex_lock(&kernfs_mutex); | 276 | mutex_lock(&kernfs_mutex); |
| 277 | kernfs_refresh_inode(kn, inode); | 277 | kernfs_refresh_inode(kn, inode); |
diff --git a/fs/libfs.c b/fs/libfs.c index 0ab65122ee45..cb1fb4b9b637 100644 --- a/fs/libfs.c +++ b/fs/libfs.c | |||
| @@ -22,13 +22,13 @@ | |||
| 22 | 22 | ||
| 23 | static inline int simple_positive(struct dentry *dentry) | 23 | static inline int simple_positive(struct dentry *dentry) |
| 24 | { | 24 | { |
| 25 | return dentry->d_inode && !d_unhashed(dentry); | 25 | return d_really_is_positive(dentry) && !d_unhashed(dentry); |
| 26 | } | 26 | } |
| 27 | 27 | ||
| 28 | int simple_getattr(struct vfsmount *mnt, struct dentry *dentry, | 28 | int simple_getattr(struct vfsmount *mnt, struct dentry *dentry, |
| 29 | struct kstat *stat) | 29 | struct kstat *stat) |
| 30 | { | 30 | { |
| 31 | struct inode *inode = dentry->d_inode; | 31 | struct inode *inode = d_inode(dentry); |
| 32 | generic_fillattr(inode, stat); | 32 | generic_fillattr(inode, stat); |
| 33 | stat->blocks = inode->i_mapping->nrpages << (PAGE_CACHE_SHIFT - 9); | 33 | stat->blocks = inode->i_mapping->nrpages << (PAGE_CACHE_SHIFT - 9); |
| 34 | return 0; | 34 | return 0; |
| @@ -94,7 +94,7 @@ EXPORT_SYMBOL(dcache_dir_close); | |||
| 94 | loff_t dcache_dir_lseek(struct file *file, loff_t offset, int whence) | 94 | loff_t dcache_dir_lseek(struct file *file, loff_t offset, int whence) |
| 95 | { | 95 | { |
| 96 | struct dentry *dentry = file->f_path.dentry; | 96 | struct dentry *dentry = file->f_path.dentry; |
| 97 | mutex_lock(&dentry->d_inode->i_mutex); | 97 | mutex_lock(&d_inode(dentry)->i_mutex); |
| 98 | switch (whence) { | 98 | switch (whence) { |
| 99 | case 1: | 99 | case 1: |
| 100 | offset += file->f_pos; | 100 | offset += file->f_pos; |
| @@ -102,7 +102,7 @@ loff_t dcache_dir_lseek(struct file *file, loff_t offset, int whence) | |||
| 102 | if (offset >= 0) | 102 | if (offset >= 0) |
| 103 | break; | 103 | break; |
| 104 | default: | 104 | default: |
| 105 | mutex_unlock(&dentry->d_inode->i_mutex); | 105 | mutex_unlock(&d_inode(dentry)->i_mutex); |
| 106 | return -EINVAL; | 106 | return -EINVAL; |
| 107 | } | 107 | } |
| 108 | if (offset != file->f_pos) { | 108 | if (offset != file->f_pos) { |
| @@ -129,7 +129,7 @@ loff_t dcache_dir_lseek(struct file *file, loff_t offset, int whence) | |||
| 129 | spin_unlock(&dentry->d_lock); | 129 | spin_unlock(&dentry->d_lock); |
| 130 | } | 130 | } |
| 131 | } | 131 | } |
| 132 | mutex_unlock(&dentry->d_inode->i_mutex); | 132 | mutex_unlock(&d_inode(dentry)->i_mutex); |
| 133 | return offset; | 133 | return offset; |
| 134 | } | 134 | } |
| 135 | EXPORT_SYMBOL(dcache_dir_lseek); | 135 | EXPORT_SYMBOL(dcache_dir_lseek); |
| @@ -169,7 +169,7 @@ int dcache_readdir(struct file *file, struct dir_context *ctx) | |||
| 169 | spin_unlock(&next->d_lock); | 169 | spin_unlock(&next->d_lock); |
| 170 | spin_unlock(&dentry->d_lock); | 170 | spin_unlock(&dentry->d_lock); |
| 171 | if (!dir_emit(ctx, next->d_name.name, next->d_name.len, | 171 | if (!dir_emit(ctx, next->d_name.name, next->d_name.len, |
| 172 | next->d_inode->i_ino, dt_type(next->d_inode))) | 172 | d_inode(next)->i_ino, dt_type(d_inode(next)))) |
| 173 | return 0; | 173 | return 0; |
| 174 | spin_lock(&dentry->d_lock); | 174 | spin_lock(&dentry->d_lock); |
| 175 | spin_lock_nested(&next->d_lock, DENTRY_D_LOCK_NESTED); | 175 | spin_lock_nested(&next->d_lock, DENTRY_D_LOCK_NESTED); |
| @@ -270,7 +270,7 @@ EXPORT_SYMBOL(simple_open); | |||
| 270 | 270 | ||
| 271 | int simple_link(struct dentry *old_dentry, struct inode *dir, struct dentry *dentry) | 271 | int simple_link(struct dentry *old_dentry, struct inode *dir, struct dentry *dentry) |
| 272 | { | 272 | { |
| 273 | struct inode *inode = old_dentry->d_inode; | 273 | struct inode *inode = d_inode(old_dentry); |
| 274 | 274 | ||
| 275 | inode->i_ctime = dir->i_ctime = dir->i_mtime = CURRENT_TIME; | 275 | inode->i_ctime = dir->i_ctime = dir->i_mtime = CURRENT_TIME; |
| 276 | inc_nlink(inode); | 276 | inc_nlink(inode); |
| @@ -304,7 +304,7 @@ EXPORT_SYMBOL(simple_empty); | |||
| 304 | 304 | ||
| 305 | int simple_unlink(struct inode *dir, struct dentry *dentry) | 305 | int simple_unlink(struct inode *dir, struct dentry *dentry) |
| 306 | { | 306 | { |
| 307 | struct inode *inode = dentry->d_inode; | 307 | struct inode *inode = d_inode(dentry); |
| 308 | 308 | ||
| 309 | inode->i_ctime = dir->i_ctime = dir->i_mtime = CURRENT_TIME; | 309 | inode->i_ctime = dir->i_ctime = dir->i_mtime = CURRENT_TIME; |
| 310 | drop_nlink(inode); | 310 | drop_nlink(inode); |
| @@ -318,7 +318,7 @@ int simple_rmdir(struct inode *dir, struct dentry *dentry) | |||
| 318 | if (!simple_empty(dentry)) | 318 | if (!simple_empty(dentry)) |
| 319 | return -ENOTEMPTY; | 319 | return -ENOTEMPTY; |
| 320 | 320 | ||
| 321 | drop_nlink(dentry->d_inode); | 321 | drop_nlink(d_inode(dentry)); |
| 322 | simple_unlink(dir, dentry); | 322 | simple_unlink(dir, dentry); |
| 323 | drop_nlink(dir); | 323 | drop_nlink(dir); |
| 324 | return 0; | 324 | return 0; |
| @@ -328,16 +328,16 @@ EXPORT_SYMBOL(simple_rmdir); | |||
| 328 | int simple_rename(struct inode *old_dir, struct dentry *old_dentry, | 328 | int simple_rename(struct inode *old_dir, struct dentry *old_dentry, |
| 329 | struct inode *new_dir, struct dentry *new_dentry) | 329 | struct inode *new_dir, struct dentry *new_dentry) |
| 330 | { | 330 | { |
| 331 | struct inode *inode = old_dentry->d_inode; | 331 | struct inode *inode = d_inode(old_dentry); |
| 332 | int they_are_dirs = d_is_dir(old_dentry); | 332 | int they_are_dirs = d_is_dir(old_dentry); |
| 333 | 333 | ||
| 334 | if (!simple_empty(new_dentry)) | 334 | if (!simple_empty(new_dentry)) |
| 335 | return -ENOTEMPTY; | 335 | return -ENOTEMPTY; |
| 336 | 336 | ||
| 337 | if (new_dentry->d_inode) { | 337 | if (d_really_is_positive(new_dentry)) { |
| 338 | simple_unlink(new_dir, new_dentry); | 338 | simple_unlink(new_dir, new_dentry); |
| 339 | if (they_are_dirs) { | 339 | if (they_are_dirs) { |
| 340 | drop_nlink(new_dentry->d_inode); | 340 | drop_nlink(d_inode(new_dentry)); |
| 341 | drop_nlink(old_dir); | 341 | drop_nlink(old_dir); |
| 342 | } | 342 | } |
| 343 | } else if (they_are_dirs) { | 343 | } else if (they_are_dirs) { |
| @@ -368,7 +368,7 @@ EXPORT_SYMBOL(simple_rename); | |||
| 368 | */ | 368 | */ |
| 369 | int simple_setattr(struct dentry *dentry, struct iattr *iattr) | 369 | int simple_setattr(struct dentry *dentry, struct iattr *iattr) |
| 370 | { | 370 | { |
| 371 | struct inode *inode = dentry->d_inode; | 371 | struct inode *inode = d_inode(dentry); |
| 372 | int error; | 372 | int error; |
| 373 | 373 | ||
| 374 | error = inode_change_ok(inode, iattr); | 374 | error = inode_change_ok(inode, iattr); |
diff --git a/fs/logfs/dir.c b/fs/logfs/dir.c index 6bdc347008f5..4cf38f118549 100644 --- a/fs/logfs/dir.c +++ b/fs/logfs/dir.c | |||
| @@ -213,7 +213,7 @@ static void abort_transaction(struct inode *inode, struct logfs_transaction *ta) | |||
| 213 | static int logfs_unlink(struct inode *dir, struct dentry *dentry) | 213 | static int logfs_unlink(struct inode *dir, struct dentry *dentry) |
| 214 | { | 214 | { |
| 215 | struct logfs_super *super = logfs_super(dir->i_sb); | 215 | struct logfs_super *super = logfs_super(dir->i_sb); |
| 216 | struct inode *inode = dentry->d_inode; | 216 | struct inode *inode = d_inode(dentry); |
| 217 | struct logfs_transaction *ta; | 217 | struct logfs_transaction *ta; |
| 218 | struct page *page; | 218 | struct page *page; |
| 219 | pgoff_t index; | 219 | pgoff_t index; |
| @@ -271,7 +271,7 @@ static inline int logfs_empty_dir(struct inode *dir) | |||
| 271 | 271 | ||
| 272 | static int logfs_rmdir(struct inode *dir, struct dentry *dentry) | 272 | static int logfs_rmdir(struct inode *dir, struct dentry *dentry) |
| 273 | { | 273 | { |
| 274 | struct inode *inode = dentry->d_inode; | 274 | struct inode *inode = d_inode(dentry); |
| 275 | 275 | ||
| 276 | if (!logfs_empty_dir(inode)) | 276 | if (!logfs_empty_dir(inode)) |
| 277 | return -ENOTEMPTY; | 277 | return -ENOTEMPTY; |
| @@ -537,7 +537,7 @@ static int logfs_symlink(struct inode *dir, struct dentry *dentry, | |||
| 537 | static int logfs_link(struct dentry *old_dentry, struct inode *dir, | 537 | static int logfs_link(struct dentry *old_dentry, struct inode *dir, |
| 538 | struct dentry *dentry) | 538 | struct dentry *dentry) |
| 539 | { | 539 | { |
| 540 | struct inode *inode = old_dentry->d_inode; | 540 | struct inode *inode = d_inode(old_dentry); |
| 541 | 541 | ||
| 542 | inode->i_ctime = dir->i_ctime = dir->i_mtime = CURRENT_TIME; | 542 | inode->i_ctime = dir->i_ctime = dir->i_mtime = CURRENT_TIME; |
| 543 | ihold(inode); | 543 | ihold(inode); |
| @@ -607,7 +607,7 @@ static int logfs_rename_cross(struct inode *old_dir, struct dentry *old_dentry, | |||
| 607 | /* 2. write target dd */ | 607 | /* 2. write target dd */ |
| 608 | mutex_lock(&super->s_dirop_mutex); | 608 | mutex_lock(&super->s_dirop_mutex); |
| 609 | logfs_add_transaction(new_dir, ta); | 609 | logfs_add_transaction(new_dir, ta); |
| 610 | err = logfs_write_dir(new_dir, new_dentry, old_dentry->d_inode); | 610 | err = logfs_write_dir(new_dir, new_dentry, d_inode(old_dentry)); |
| 611 | if (!err) | 611 | if (!err) |
| 612 | err = write_inode(new_dir); | 612 | err = write_inode(new_dir); |
| 613 | 613 | ||
| @@ -658,8 +658,8 @@ static int logfs_rename_target(struct inode *old_dir, struct dentry *old_dentry, | |||
| 658 | struct inode *new_dir, struct dentry *new_dentry) | 658 | struct inode *new_dir, struct dentry *new_dentry) |
| 659 | { | 659 | { |
| 660 | struct logfs_super *super = logfs_super(old_dir->i_sb); | 660 | struct logfs_super *super = logfs_super(old_dir->i_sb); |
| 661 | struct inode *old_inode = old_dentry->d_inode; | 661 | struct inode *old_inode = d_inode(old_dentry); |
| 662 | struct inode *new_inode = new_dentry->d_inode; | 662 | struct inode *new_inode = d_inode(new_dentry); |
| 663 | int isdir = S_ISDIR(old_inode->i_mode); | 663 | int isdir = S_ISDIR(old_inode->i_mode); |
| 664 | struct logfs_disk_dentry dd; | 664 | struct logfs_disk_dentry dd; |
| 665 | struct logfs_transaction *ta; | 665 | struct logfs_transaction *ta; |
| @@ -719,7 +719,7 @@ out: | |||
| 719 | static int logfs_rename(struct inode *old_dir, struct dentry *old_dentry, | 719 | static int logfs_rename(struct inode *old_dir, struct dentry *old_dentry, |
| 720 | struct inode *new_dir, struct dentry *new_dentry) | 720 | struct inode *new_dir, struct dentry *new_dentry) |
| 721 | { | 721 | { |
| 722 | if (new_dentry->d_inode) | 722 | if (d_really_is_positive(new_dentry)) |
| 723 | return logfs_rename_target(old_dir, old_dentry, | 723 | return logfs_rename_target(old_dir, old_dentry, |
| 724 | new_dir, new_dentry); | 724 | new_dir, new_dentry); |
| 725 | return logfs_rename_cross(old_dir, old_dentry, new_dir, new_dentry); | 725 | return logfs_rename_cross(old_dir, old_dentry, new_dir, new_dentry); |
diff --git a/fs/logfs/file.c b/fs/logfs/file.c index b2c13f739ffa..1a6f0167b16a 100644 --- a/fs/logfs/file.c +++ b/fs/logfs/file.c | |||
| @@ -241,7 +241,7 @@ int logfs_fsync(struct file *file, loff_t start, loff_t end, int datasync) | |||
| 241 | 241 | ||
| 242 | static int logfs_setattr(struct dentry *dentry, struct iattr *attr) | 242 | static int logfs_setattr(struct dentry *dentry, struct iattr *attr) |
| 243 | { | 243 | { |
| 244 | struct inode *inode = dentry->d_inode; | 244 | struct inode *inode = d_inode(dentry); |
| 245 | int err = 0; | 245 | int err = 0; |
| 246 | 246 | ||
| 247 | err = inode_change_ok(inode, attr); | 247 | err = inode_change_ok(inode, attr); |
diff --git a/fs/minix/dir.c b/fs/minix/dir.c index dfaf6fa9b7b5..118e4e7bc935 100644 --- a/fs/minix/dir.c +++ b/fs/minix/dir.c | |||
| @@ -156,7 +156,7 @@ minix_dirent *minix_find_entry(struct dentry *dentry, struct page **res_page) | |||
| 156 | { | 156 | { |
| 157 | const char * name = dentry->d_name.name; | 157 | const char * name = dentry->d_name.name; |
| 158 | int namelen = dentry->d_name.len; | 158 | int namelen = dentry->d_name.len; |
| 159 | struct inode * dir = dentry->d_parent->d_inode; | 159 | struct inode * dir = d_inode(dentry->d_parent); |
| 160 | struct super_block * sb = dir->i_sb; | 160 | struct super_block * sb = dir->i_sb; |
| 161 | struct minix_sb_info * sbi = minix_sb(sb); | 161 | struct minix_sb_info * sbi = minix_sb(sb); |
| 162 | unsigned long n; | 162 | unsigned long n; |
| @@ -203,7 +203,7 @@ found: | |||
| 203 | 203 | ||
| 204 | int minix_add_link(struct dentry *dentry, struct inode *inode) | 204 | int minix_add_link(struct dentry *dentry, struct inode *inode) |
| 205 | { | 205 | { |
| 206 | struct inode *dir = dentry->d_parent->d_inode; | 206 | struct inode *dir = d_inode(dentry->d_parent); |
| 207 | const char * name = dentry->d_name.name; | 207 | const char * name = dentry->d_name.name; |
| 208 | int namelen = dentry->d_name.len; | 208 | int namelen = dentry->d_name.len; |
| 209 | struct super_block * sb = dir->i_sb; | 209 | struct super_block * sb = dir->i_sb; |
diff --git a/fs/minix/file.c b/fs/minix/file.c index 6d63e27ec961..94f0eb9a6e2c 100644 --- a/fs/minix/file.c +++ b/fs/minix/file.c | |||
| @@ -23,7 +23,7 @@ const struct file_operations minix_file_operations = { | |||
| 23 | 23 | ||
| 24 | static int minix_setattr(struct dentry *dentry, struct iattr *attr) | 24 | static int minix_setattr(struct dentry *dentry, struct iattr *attr) |
| 25 | { | 25 | { |
| 26 | struct inode *inode = dentry->d_inode; | 26 | struct inode *inode = d_inode(dentry); |
| 27 | int error; | 27 | int error; |
| 28 | 28 | ||
| 29 | error = inode_change_ok(inode, attr); | 29 | error = inode_change_ok(inode, attr); |
diff --git a/fs/minix/inode.c b/fs/minix/inode.c index 3f57af196a7d..1182d1e26a9c 100644 --- a/fs/minix/inode.c +++ b/fs/minix/inode.c | |||
| @@ -626,8 +626,8 @@ static int minix_write_inode(struct inode *inode, struct writeback_control *wbc) | |||
| 626 | int minix_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat) | 626 | int minix_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat) |
| 627 | { | 627 | { |
| 628 | struct super_block *sb = dentry->d_sb; | 628 | struct super_block *sb = dentry->d_sb; |
| 629 | generic_fillattr(dentry->d_inode, stat); | 629 | generic_fillattr(d_inode(dentry), stat); |
| 630 | if (INODE_VERSION(dentry->d_inode) == MINIX_V1) | 630 | if (INODE_VERSION(d_inode(dentry)) == MINIX_V1) |
| 631 | stat->blocks = (BLOCK_SIZE / 512) * V1_minix_blocks(stat->size, sb); | 631 | stat->blocks = (BLOCK_SIZE / 512) * V1_minix_blocks(stat->size, sb); |
| 632 | else | 632 | else |
| 633 | stat->blocks = (sb->s_blocksize / 512) * V2_minix_blocks(stat->size, sb); | 633 | stat->blocks = (sb->s_blocksize / 512) * V2_minix_blocks(stat->size, sb); |
diff --git a/fs/minix/namei.c b/fs/minix/namei.c index cd950e2331b6..a795a11e50c7 100644 --- a/fs/minix/namei.c +++ b/fs/minix/namei.c | |||
| @@ -104,7 +104,7 @@ out_fail: | |||
| 104 | static int minix_link(struct dentry * old_dentry, struct inode * dir, | 104 | static int minix_link(struct dentry * old_dentry, struct inode * dir, |
| 105 | struct dentry *dentry) | 105 | struct dentry *dentry) |
| 106 | { | 106 | { |
| 107 | struct inode *inode = old_dentry->d_inode; | 107 | struct inode *inode = d_inode(old_dentry); |
| 108 | 108 | ||
| 109 | inode->i_ctime = CURRENT_TIME_SEC; | 109 | inode->i_ctime = CURRENT_TIME_SEC; |
| 110 | inode_inc_link_count(inode); | 110 | inode_inc_link_count(inode); |
| @@ -151,7 +151,7 @@ out_dir: | |||
| 151 | static int minix_unlink(struct inode * dir, struct dentry *dentry) | 151 | static int minix_unlink(struct inode * dir, struct dentry *dentry) |
| 152 | { | 152 | { |
| 153 | int err = -ENOENT; | 153 | int err = -ENOENT; |
| 154 | struct inode * inode = dentry->d_inode; | 154 | struct inode * inode = d_inode(dentry); |
| 155 | struct page * page; | 155 | struct page * page; |
| 156 | struct minix_dir_entry * de; | 156 | struct minix_dir_entry * de; |
| 157 | 157 | ||
| @@ -171,7 +171,7 @@ end_unlink: | |||
| 171 | 171 | ||
| 172 | static int minix_rmdir(struct inode * dir, struct dentry *dentry) | 172 | static int minix_rmdir(struct inode * dir, struct dentry *dentry) |
| 173 | { | 173 | { |
| 174 | struct inode * inode = dentry->d_inode; | 174 | struct inode * inode = d_inode(dentry); |
| 175 | int err = -ENOTEMPTY; | 175 | int err = -ENOTEMPTY; |
| 176 | 176 | ||
| 177 | if (minix_empty_dir(inode)) { | 177 | if (minix_empty_dir(inode)) { |
| @@ -187,8 +187,8 @@ static int minix_rmdir(struct inode * dir, struct dentry *dentry) | |||
| 187 | static int minix_rename(struct inode * old_dir, struct dentry *old_dentry, | 187 | static int minix_rename(struct inode * old_dir, struct dentry *old_dentry, |
| 188 | struct inode * new_dir, struct dentry *new_dentry) | 188 | struct inode * new_dir, struct dentry *new_dentry) |
| 189 | { | 189 | { |
| 190 | struct inode * old_inode = old_dentry->d_inode; | 190 | struct inode * old_inode = d_inode(old_dentry); |
| 191 | struct inode * new_inode = new_dentry->d_inode; | 191 | struct inode * new_inode = d_inode(new_dentry); |
| 192 | struct page * dir_page = NULL; | 192 | struct page * dir_page = NULL; |
| 193 | struct minix_dir_entry * dir_de = NULL; | 193 | struct minix_dir_entry * dir_de = NULL; |
| 194 | struct page * old_page; | 194 | struct page * old_page; |
diff --git a/fs/namei.c b/fs/namei.c index ffab2e06e147..4a8d998b7274 100644 --- a/fs/namei.c +++ b/fs/namei.c | |||
| @@ -1590,7 +1590,8 @@ static inline int walk_component(struct nameidata *nd, struct path *path, | |||
| 1590 | 1590 | ||
| 1591 | if (should_follow_link(path->dentry, follow)) { | 1591 | if (should_follow_link(path->dentry, follow)) { |
| 1592 | if (nd->flags & LOOKUP_RCU) { | 1592 | if (nd->flags & LOOKUP_RCU) { |
| 1593 | if (unlikely(unlazy_walk(nd, path->dentry))) { | 1593 | if (unlikely(nd->path.mnt != path->mnt || |
| 1594 | unlazy_walk(nd, path->dentry))) { | ||
| 1594 | err = -ECHILD; | 1595 | err = -ECHILD; |
| 1595 | goto out_err; | 1596 | goto out_err; |
| 1596 | } | 1597 | } |
| @@ -3045,7 +3046,8 @@ finish_lookup: | |||
| 3045 | 3046 | ||
| 3046 | if (should_follow_link(path->dentry, !symlink_ok)) { | 3047 | if (should_follow_link(path->dentry, !symlink_ok)) { |
| 3047 | if (nd->flags & LOOKUP_RCU) { | 3048 | if (nd->flags & LOOKUP_RCU) { |
| 3048 | if (unlikely(unlazy_walk(nd, path->dentry))) { | 3049 | if (unlikely(nd->path.mnt != path->mnt || |
| 3050 | unlazy_walk(nd, path->dentry))) { | ||
| 3049 | error = -ECHILD; | 3051 | error = -ECHILD; |
| 3050 | goto out; | 3052 | goto out; |
| 3051 | } | 3053 | } |
diff --git a/fs/ncpfs/dir.c b/fs/ncpfs/dir.c index e7ca827d7694..80021c709af9 100644 --- a/fs/ncpfs/dir.c +++ b/fs/ncpfs/dir.c | |||
| @@ -127,7 +127,7 @@ static inline int ncp_case_sensitive(const struct inode *i) | |||
| 127 | static int | 127 | static int |
| 128 | ncp_hash_dentry(const struct dentry *dentry, struct qstr *this) | 128 | ncp_hash_dentry(const struct dentry *dentry, struct qstr *this) |
| 129 | { | 129 | { |
| 130 | struct inode *inode = ACCESS_ONCE(dentry->d_inode); | 130 | struct inode *inode = d_inode_rcu(dentry); |
| 131 | 131 | ||
| 132 | if (!inode) | 132 | if (!inode) |
| 133 | return 0; | 133 | return 0; |
| @@ -162,7 +162,7 @@ ncp_compare_dentry(const struct dentry *parent, const struct dentry *dentry, | |||
| 162 | if (len != name->len) | 162 | if (len != name->len) |
| 163 | return 1; | 163 | return 1; |
| 164 | 164 | ||
| 165 | pinode = ACCESS_ONCE(parent->d_inode); | 165 | pinode = d_inode_rcu(parent); |
| 166 | if (!pinode) | 166 | if (!pinode) |
| 167 | return 1; | 167 | return 1; |
| 168 | 168 | ||
| @@ -180,7 +180,7 @@ ncp_compare_dentry(const struct dentry *parent, const struct dentry *dentry, | |||
| 180 | static int | 180 | static int |
| 181 | ncp_delete_dentry(const struct dentry * dentry) | 181 | ncp_delete_dentry(const struct dentry * dentry) |
| 182 | { | 182 | { |
| 183 | struct inode *inode = dentry->d_inode; | 183 | struct inode *inode = d_inode(dentry); |
| 184 | 184 | ||
| 185 | if (inode) { | 185 | if (inode) { |
| 186 | if (is_bad_inode(inode)) | 186 | if (is_bad_inode(inode)) |
| @@ -224,7 +224,7 @@ ncp_force_unlink(struct inode *dir, struct dentry* dentry) | |||
| 224 | memset(&info, 0, sizeof(info)); | 224 | memset(&info, 0, sizeof(info)); |
| 225 | 225 | ||
| 226 | /* remove the Read-Only flag on the NW server */ | 226 | /* remove the Read-Only flag on the NW server */ |
| 227 | inode = dentry->d_inode; | 227 | inode = d_inode(dentry); |
| 228 | 228 | ||
| 229 | old_nwattr = NCP_FINFO(inode)->nwattr; | 229 | old_nwattr = NCP_FINFO(inode)->nwattr; |
| 230 | info.attributes = old_nwattr & ~(aRONLY|aDELETEINHIBIT|aRENAMEINHIBIT); | 230 | info.attributes = old_nwattr & ~(aRONLY|aDELETEINHIBIT|aRENAMEINHIBIT); |
| @@ -254,7 +254,7 @@ ncp_force_rename(struct inode *old_dir, struct dentry* old_dentry, char *_old_na | |||
| 254 | { | 254 | { |
| 255 | struct nw_modify_dos_info info; | 255 | struct nw_modify_dos_info info; |
| 256 | int res=0x90,res2; | 256 | int res=0x90,res2; |
| 257 | struct inode *old_inode = old_dentry->d_inode; | 257 | struct inode *old_inode = d_inode(old_dentry); |
| 258 | __le32 old_nwattr = NCP_FINFO(old_inode)->nwattr; | 258 | __le32 old_nwattr = NCP_FINFO(old_inode)->nwattr; |
| 259 | __le32 new_nwattr = 0; /* shut compiler warning */ | 259 | __le32 new_nwattr = 0; /* shut compiler warning */ |
| 260 | int old_nwattr_changed = 0; | 260 | int old_nwattr_changed = 0; |
| @@ -268,8 +268,8 @@ ncp_force_rename(struct inode *old_dir, struct dentry* old_dentry, char *_old_na | |||
| 268 | res2 = ncp_modify_file_or_subdir_dos_info_path(NCP_SERVER(old_inode), old_inode, NULL, DM_ATTRIBUTES, &info); | 268 | res2 = ncp_modify_file_or_subdir_dos_info_path(NCP_SERVER(old_inode), old_inode, NULL, DM_ATTRIBUTES, &info); |
| 269 | if (!res2) | 269 | if (!res2) |
| 270 | old_nwattr_changed = 1; | 270 | old_nwattr_changed = 1; |
| 271 | if (new_dentry && new_dentry->d_inode) { | 271 | if (new_dentry && d_really_is_positive(new_dentry)) { |
| 272 | new_nwattr = NCP_FINFO(new_dentry->d_inode)->nwattr; | 272 | new_nwattr = NCP_FINFO(d_inode(new_dentry))->nwattr; |
| 273 | info.attributes = new_nwattr & ~(aRONLY|aRENAMEINHIBIT|aDELETEINHIBIT); | 273 | info.attributes = new_nwattr & ~(aRONLY|aRENAMEINHIBIT|aDELETEINHIBIT); |
| 274 | res2 = ncp_modify_file_or_subdir_dos_info_path(NCP_SERVER(new_dir), new_dir, _new_name, DM_ATTRIBUTES, &info); | 274 | res2 = ncp_modify_file_or_subdir_dos_info_path(NCP_SERVER(new_dir), new_dir, _new_name, DM_ATTRIBUTES, &info); |
| 275 | if (!res2) | 275 | if (!res2) |
| @@ -324,9 +324,9 @@ ncp_lookup_validate(struct dentry *dentry, unsigned int flags) | |||
| 324 | return -ECHILD; | 324 | return -ECHILD; |
| 325 | 325 | ||
| 326 | parent = dget_parent(dentry); | 326 | parent = dget_parent(dentry); |
| 327 | dir = parent->d_inode; | 327 | dir = d_inode(parent); |
| 328 | 328 | ||
| 329 | if (!dentry->d_inode) | 329 | if (d_really_is_negative(dentry)) |
| 330 | goto finished; | 330 | goto finished; |
| 331 | 331 | ||
| 332 | server = NCP_SERVER(dir); | 332 | server = NCP_SERVER(dir); |
| @@ -367,7 +367,7 @@ ncp_lookup_validate(struct dentry *dentry, unsigned int flags) | |||
| 367 | * what we remember, it's not valid any more. | 367 | * what we remember, it's not valid any more. |
| 368 | */ | 368 | */ |
| 369 | if (!res) { | 369 | if (!res) { |
| 370 | struct inode *inode = dentry->d_inode; | 370 | struct inode *inode = d_inode(dentry); |
| 371 | 371 | ||
| 372 | mutex_lock(&inode->i_mutex); | 372 | mutex_lock(&inode->i_mutex); |
| 373 | if (finfo.i.dirEntNum == NCP_FINFO(inode)->dirEntNum) { | 373 | if (finfo.i.dirEntNum == NCP_FINFO(inode)->dirEntNum) { |
| @@ -388,7 +388,7 @@ finished: | |||
| 388 | 388 | ||
| 389 | static time_t ncp_obtain_mtime(struct dentry *dentry) | 389 | static time_t ncp_obtain_mtime(struct dentry *dentry) |
| 390 | { | 390 | { |
| 391 | struct inode *inode = dentry->d_inode; | 391 | struct inode *inode = d_inode(dentry); |
| 392 | struct ncp_server *server = NCP_SERVER(inode); | 392 | struct ncp_server *server = NCP_SERVER(inode); |
| 393 | struct nw_info_struct i; | 393 | struct nw_info_struct i; |
| 394 | 394 | ||
| @@ -404,7 +404,7 @@ static time_t ncp_obtain_mtime(struct dentry *dentry) | |||
| 404 | static inline void | 404 | static inline void |
| 405 | ncp_invalidate_dircache_entries(struct dentry *parent) | 405 | ncp_invalidate_dircache_entries(struct dentry *parent) |
| 406 | { | 406 | { |
| 407 | struct ncp_server *server = NCP_SERVER(parent->d_inode); | 407 | struct ncp_server *server = NCP_SERVER(d_inode(parent)); |
| 408 | struct dentry *dentry; | 408 | struct dentry *dentry; |
| 409 | 409 | ||
| 410 | spin_lock(&parent->d_lock); | 410 | spin_lock(&parent->d_lock); |
| @@ -418,7 +418,7 @@ ncp_invalidate_dircache_entries(struct dentry *parent) | |||
| 418 | static int ncp_readdir(struct file *file, struct dir_context *ctx) | 418 | static int ncp_readdir(struct file *file, struct dir_context *ctx) |
| 419 | { | 419 | { |
| 420 | struct dentry *dentry = file->f_path.dentry; | 420 | struct dentry *dentry = file->f_path.dentry; |
| 421 | struct inode *inode = dentry->d_inode; | 421 | struct inode *inode = d_inode(dentry); |
| 422 | struct page *page = NULL; | 422 | struct page *page = NULL; |
| 423 | struct ncp_server *server = NCP_SERVER(inode); | 423 | struct ncp_server *server = NCP_SERVER(inode); |
| 424 | union ncp_dir_cache *cache = NULL; | 424 | union ncp_dir_cache *cache = NULL; |
| @@ -491,13 +491,13 @@ static int ncp_readdir(struct file *file, struct dir_context *ctx) | |||
| 491 | goto invalid_cache; | 491 | goto invalid_cache; |
| 492 | } | 492 | } |
| 493 | spin_unlock(&dentry->d_lock); | 493 | spin_unlock(&dentry->d_lock); |
| 494 | if (!dent->d_inode) { | 494 | if (d_really_is_negative(dent)) { |
| 495 | dput(dent); | 495 | dput(dent); |
| 496 | goto invalid_cache; | 496 | goto invalid_cache; |
| 497 | } | 497 | } |
| 498 | over = !dir_emit(ctx, dent->d_name.name, | 498 | over = !dir_emit(ctx, dent->d_name.name, |
| 499 | dent->d_name.len, | 499 | dent->d_name.len, |
| 500 | dent->d_inode->i_ino, DT_UNKNOWN); | 500 | d_inode(dent)->i_ino, DT_UNKNOWN); |
| 501 | dput(dent); | 501 | dput(dent); |
| 502 | if (over) | 502 | if (over) |
| 503 | goto finished; | 503 | goto finished; |
| @@ -571,7 +571,7 @@ static void ncp_d_prune(struct dentry *dentry) | |||
| 571 | { | 571 | { |
| 572 | if (!dentry->d_fsdata) /* not referenced from page cache */ | 572 | if (!dentry->d_fsdata) /* not referenced from page cache */ |
| 573 | return; | 573 | return; |
| 574 | NCP_FINFO(dentry->d_parent->d_inode)->flags &= ~NCPI_DIR_CACHE; | 574 | NCP_FINFO(d_inode(dentry->d_parent))->flags &= ~NCPI_DIR_CACHE; |
| 575 | } | 575 | } |
| 576 | 576 | ||
| 577 | static int | 577 | static int |
| @@ -580,7 +580,7 @@ ncp_fill_cache(struct file *file, struct dir_context *ctx, | |||
| 580 | int inval_childs) | 580 | int inval_childs) |
| 581 | { | 581 | { |
| 582 | struct dentry *newdent, *dentry = file->f_path.dentry; | 582 | struct dentry *newdent, *dentry = file->f_path.dentry; |
| 583 | struct inode *dir = dentry->d_inode; | 583 | struct inode *dir = d_inode(dentry); |
| 584 | struct ncp_cache_control ctl = *ctrl; | 584 | struct ncp_cache_control ctl = *ctrl; |
| 585 | struct qstr qname; | 585 | struct qstr qname; |
| 586 | int valid = 0; | 586 | int valid = 0; |
| @@ -621,7 +621,7 @@ ncp_fill_cache(struct file *file, struct dir_context *ctx, | |||
| 621 | dentry_update_name_case(newdent, &qname); | 621 | dentry_update_name_case(newdent, &qname); |
| 622 | } | 622 | } |
| 623 | 623 | ||
| 624 | if (!newdent->d_inode) { | 624 | if (d_really_is_negative(newdent)) { |
| 625 | struct inode *inode; | 625 | struct inode *inode; |
| 626 | 626 | ||
| 627 | entry->opened = 0; | 627 | entry->opened = 0; |
| @@ -637,7 +637,7 @@ ncp_fill_cache(struct file *file, struct dir_context *ctx, | |||
| 637 | spin_unlock(&dentry->d_lock); | 637 | spin_unlock(&dentry->d_lock); |
| 638 | } | 638 | } |
| 639 | } else { | 639 | } else { |
| 640 | struct inode *inode = newdent->d_inode; | 640 | struct inode *inode = d_inode(newdent); |
| 641 | 641 | ||
| 642 | mutex_lock_nested(&inode->i_mutex, I_MUTEX_CHILD); | 642 | mutex_lock_nested(&inode->i_mutex, I_MUTEX_CHILD); |
| 643 | ncp_update_inode2(inode, entry); | 643 | ncp_update_inode2(inode, entry); |
| @@ -659,10 +659,10 @@ ncp_fill_cache(struct file *file, struct dir_context *ctx, | |||
| 659 | ctl.cache = kmap(ctl.page); | 659 | ctl.cache = kmap(ctl.page); |
| 660 | } | 660 | } |
| 661 | if (ctl.cache) { | 661 | if (ctl.cache) { |
| 662 | if (newdent->d_inode) { | 662 | if (d_really_is_positive(newdent)) { |
| 663 | newdent->d_fsdata = newdent; | 663 | newdent->d_fsdata = newdent; |
| 664 | ctl.cache->dentry[ctl.idx] = newdent; | 664 | ctl.cache->dentry[ctl.idx] = newdent; |
| 665 | ino = newdent->d_inode->i_ino; | 665 | ino = d_inode(newdent)->i_ino; |
| 666 | ncp_new_dentry(newdent); | 666 | ncp_new_dentry(newdent); |
| 667 | } | 667 | } |
| 668 | valid = 1; | 668 | valid = 1; |
| @@ -807,7 +807,7 @@ int ncp_conn_logged_in(struct super_block *sb) | |||
| 807 | } | 807 | } |
| 808 | dent = sb->s_root; | 808 | dent = sb->s_root; |
| 809 | if (dent) { | 809 | if (dent) { |
| 810 | struct inode* ino = dent->d_inode; | 810 | struct inode* ino = d_inode(dent); |
| 811 | if (ino) { | 811 | if (ino) { |
| 812 | ncp_update_known_namespace(server, volNumber, NULL); | 812 | ncp_update_known_namespace(server, volNumber, NULL); |
| 813 | NCP_FINFO(ino)->volNumber = volNumber; | 813 | NCP_FINFO(ino)->volNumber = volNumber; |
| @@ -815,7 +815,7 @@ int ncp_conn_logged_in(struct super_block *sb) | |||
| 815 | NCP_FINFO(ino)->DosDirNum = DosDirNum; | 815 | NCP_FINFO(ino)->DosDirNum = DosDirNum; |
| 816 | result = 0; | 816 | result = 0; |
| 817 | } else { | 817 | } else { |
| 818 | ncp_dbg(1, "sb->s_root->d_inode == NULL!\n"); | 818 | ncp_dbg(1, "d_inode(sb->s_root) == NULL!\n"); |
| 819 | } | 819 | } |
| 820 | } else { | 820 | } else { |
| 821 | ncp_dbg(1, "sb->s_root == NULL!\n"); | 821 | ncp_dbg(1, "sb->s_root == NULL!\n"); |
| @@ -1055,7 +1055,7 @@ out: | |||
| 1055 | 1055 | ||
| 1056 | static int ncp_unlink(struct inode *dir, struct dentry *dentry) | 1056 | static int ncp_unlink(struct inode *dir, struct dentry *dentry) |
| 1057 | { | 1057 | { |
| 1058 | struct inode *inode = dentry->d_inode; | 1058 | struct inode *inode = d_inode(dentry); |
| 1059 | struct ncp_server *server; | 1059 | struct ncp_server *server; |
| 1060 | int error; | 1060 | int error; |
| 1061 | 1061 | ||
diff --git a/fs/ncpfs/inode.c b/fs/ncpfs/inode.c index 01a9e16e9782..9605a2f63549 100644 --- a/fs/ncpfs/inode.c +++ b/fs/ncpfs/inode.c | |||
| @@ -812,7 +812,7 @@ static int ncp_statfs(struct dentry *dentry, struct kstatfs *buf) | |||
| 812 | if (!d) { | 812 | if (!d) { |
| 813 | goto dflt; | 813 | goto dflt; |
| 814 | } | 814 | } |
| 815 | i = d->d_inode; | 815 | i = d_inode(d); |
| 816 | if (!i) { | 816 | if (!i) { |
| 817 | goto dflt; | 817 | goto dflt; |
| 818 | } | 818 | } |
| @@ -865,7 +865,7 @@ dflt:; | |||
| 865 | 865 | ||
| 866 | int ncp_notify_change(struct dentry *dentry, struct iattr *attr) | 866 | int ncp_notify_change(struct dentry *dentry, struct iattr *attr) |
| 867 | { | 867 | { |
| 868 | struct inode *inode = dentry->d_inode; | 868 | struct inode *inode = d_inode(dentry); |
| 869 | int result = 0; | 869 | int result = 0; |
| 870 | __le32 info_mask; | 870 | __le32 info_mask; |
| 871 | struct nw_modify_dos_info info; | 871 | struct nw_modify_dos_info info; |
| @@ -878,7 +878,7 @@ int ncp_notify_change(struct dentry *dentry, struct iattr *attr) | |||
| 878 | goto out; | 878 | goto out; |
| 879 | 879 | ||
| 880 | result = -EPERM; | 880 | result = -EPERM; |
| 881 | if (IS_DEADDIR(dentry->d_inode)) | 881 | if (IS_DEADDIR(d_inode(dentry))) |
| 882 | goto out; | 882 | goto out; |
| 883 | 883 | ||
| 884 | /* ageing the dentry to force validation */ | 884 | /* ageing the dentry to force validation */ |
diff --git a/fs/ncpfs/ioctl.c b/fs/ncpfs/ioctl.c index cf7e043a9447..79b113048eac 100644 --- a/fs/ncpfs/ioctl.c +++ b/fs/ncpfs/ioctl.c | |||
| @@ -376,7 +376,7 @@ static long __ncp_ioctl(struct inode *inode, unsigned int cmd, unsigned long arg | |||
| 376 | struct dentry* dentry = inode->i_sb->s_root; | 376 | struct dentry* dentry = inode->i_sb->s_root; |
| 377 | 377 | ||
| 378 | if (dentry) { | 378 | if (dentry) { |
| 379 | struct inode* s_inode = dentry->d_inode; | 379 | struct inode* s_inode = d_inode(dentry); |
| 380 | 380 | ||
| 381 | if (s_inode) { | 381 | if (s_inode) { |
| 382 | sr.volNumber = NCP_FINFO(s_inode)->volNumber; | 382 | sr.volNumber = NCP_FINFO(s_inode)->volNumber; |
| @@ -384,7 +384,7 @@ static long __ncp_ioctl(struct inode *inode, unsigned int cmd, unsigned long arg | |||
| 384 | sr.namespace = server->name_space[sr.volNumber]; | 384 | sr.namespace = server->name_space[sr.volNumber]; |
| 385 | result = 0; | 385 | result = 0; |
| 386 | } else | 386 | } else |
| 387 | ncp_dbg(1, "s_root->d_inode==NULL\n"); | 387 | ncp_dbg(1, "d_inode(s_root)==NULL\n"); |
| 388 | } else | 388 | } else |
| 389 | ncp_dbg(1, "s_root==NULL\n"); | 389 | ncp_dbg(1, "s_root==NULL\n"); |
| 390 | } else { | 390 | } else { |
| @@ -431,7 +431,7 @@ static long __ncp_ioctl(struct inode *inode, unsigned int cmd, unsigned long arg | |||
| 431 | if (result == 0) { | 431 | if (result == 0) { |
| 432 | dentry = inode->i_sb->s_root; | 432 | dentry = inode->i_sb->s_root; |
| 433 | if (dentry) { | 433 | if (dentry) { |
| 434 | struct inode* s_inode = dentry->d_inode; | 434 | struct inode* s_inode = d_inode(dentry); |
| 435 | 435 | ||
| 436 | if (s_inode) { | 436 | if (s_inode) { |
| 437 | NCP_FINFO(s_inode)->volNumber = vnum; | 437 | NCP_FINFO(s_inode)->volNumber = vnum; |
| @@ -439,7 +439,7 @@ static long __ncp_ioctl(struct inode *inode, unsigned int cmd, unsigned long arg | |||
| 439 | NCP_FINFO(s_inode)->DosDirNum = dosde; | 439 | NCP_FINFO(s_inode)->DosDirNum = dosde; |
| 440 | server->root_setuped = 1; | 440 | server->root_setuped = 1; |
| 441 | } else { | 441 | } else { |
| 442 | ncp_dbg(1, "s_root->d_inode==NULL\n"); | 442 | ncp_dbg(1, "d_inode(s_root)==NULL\n"); |
| 443 | result = -EIO; | 443 | result = -EIO; |
| 444 | } | 444 | } |
| 445 | } else { | 445 | } else { |
diff --git a/fs/ncpfs/ncplib_kernel.c b/fs/ncpfs/ncplib_kernel.c index 2b502a0d7941..88dbbc9fcf4d 100644 --- a/fs/ncpfs/ncplib_kernel.c +++ b/fs/ncpfs/ncplib_kernel.c | |||
| @@ -727,7 +727,7 @@ int | |||
| 727 | ncp_del_file_or_subdir2(struct ncp_server *server, | 727 | ncp_del_file_or_subdir2(struct ncp_server *server, |
| 728 | struct dentry *dentry) | 728 | struct dentry *dentry) |
| 729 | { | 729 | { |
| 730 | struct inode *inode = dentry->d_inode; | 730 | struct inode *inode = d_inode(dentry); |
| 731 | __u8 volnum; | 731 | __u8 volnum; |
| 732 | __le32 dirent; | 732 | __le32 dirent; |
| 733 | 733 | ||
diff --git a/fs/ncpfs/symlink.c b/fs/ncpfs/symlink.c index 1a63bfdb4a65..421b6f91e8ec 100644 --- a/fs/ncpfs/symlink.c +++ b/fs/ncpfs/symlink.c | |||
| @@ -156,7 +156,7 @@ int ncp_symlink(struct inode *dir, struct dentry *dentry, const char *symname) { | |||
| 156 | goto failfree; | 156 | goto failfree; |
| 157 | } | 157 | } |
| 158 | 158 | ||
| 159 | inode=dentry->d_inode; | 159 | inode=d_inode(dentry); |
| 160 | 160 | ||
| 161 | if (ncp_make_open(inode, O_WRONLY)) | 161 | if (ncp_make_open(inode, O_WRONLY)) |
| 162 | goto failfree; | 162 | goto failfree; |
diff --git a/fs/nfs/Makefile b/fs/nfs/Makefile index 1e987acf20c9..8664417955a2 100644 --- a/fs/nfs/Makefile +++ b/fs/nfs/Makefile | |||
| @@ -22,7 +22,7 @@ nfsv3-$(CONFIG_NFS_V3_ACL) += nfs3acl.o | |||
| 22 | obj-$(CONFIG_NFS_V4) += nfsv4.o | 22 | obj-$(CONFIG_NFS_V4) += nfsv4.o |
| 23 | CFLAGS_nfs4trace.o += -I$(src) | 23 | CFLAGS_nfs4trace.o += -I$(src) |
| 24 | nfsv4-y := nfs4proc.o nfs4xdr.o nfs4state.o nfs4renewd.o nfs4super.o nfs4file.o \ | 24 | nfsv4-y := nfs4proc.o nfs4xdr.o nfs4state.o nfs4renewd.o nfs4super.o nfs4file.o \ |
| 25 | delegation.o idmap.o callback.o callback_xdr.o callback_proc.o \ | 25 | delegation.o nfs4idmap.o callback.o callback_xdr.o callback_proc.o \ |
| 26 | nfs4namespace.o nfs4getroot.o nfs4client.o nfs4session.o \ | 26 | nfs4namespace.o nfs4getroot.o nfs4client.o nfs4session.o \ |
| 27 | dns_resolve.o nfs4trace.o | 27 | dns_resolve.o nfs4trace.o |
| 28 | nfsv4-$(CONFIG_NFS_USE_LEGACY_DNS) += cache_lib.o | 28 | nfsv4-$(CONFIG_NFS_USE_LEGACY_DNS) += cache_lib.o |
diff --git a/fs/nfs/blocklayout/blocklayout.c b/fs/nfs/blocklayout/blocklayout.c index 1cac3c175d18..d2554fe140a3 100644 --- a/fs/nfs/blocklayout/blocklayout.c +++ b/fs/nfs/blocklayout/blocklayout.c | |||
| @@ -890,6 +890,7 @@ static struct pnfs_layoutdriver_type blocklayout_type = { | |||
| 890 | .free_deviceid_node = bl_free_deviceid_node, | 890 | .free_deviceid_node = bl_free_deviceid_node, |
| 891 | .pg_read_ops = &bl_pg_read_ops, | 891 | .pg_read_ops = &bl_pg_read_ops, |
| 892 | .pg_write_ops = &bl_pg_write_ops, | 892 | .pg_write_ops = &bl_pg_write_ops, |
| 893 | .sync = pnfs_generic_sync, | ||
| 893 | }; | 894 | }; |
| 894 | 895 | ||
| 895 | static int __init nfs4blocklayout_init(void) | 896 | static int __init nfs4blocklayout_init(void) |
diff --git a/fs/nfs/blocklayout/dev.c b/fs/nfs/blocklayout/dev.c index 5aed4f98df41..e535599a0719 100644 --- a/fs/nfs/blocklayout/dev.c +++ b/fs/nfs/blocklayout/dev.c | |||
| @@ -33,7 +33,7 @@ bl_free_deviceid_node(struct nfs4_deviceid_node *d) | |||
| 33 | container_of(d, struct pnfs_block_dev, node); | 33 | container_of(d, struct pnfs_block_dev, node); |
| 34 | 34 | ||
| 35 | bl_free_device(dev); | 35 | bl_free_device(dev); |
| 36 | kfree(dev); | 36 | kfree_rcu(dev, node.rcu); |
| 37 | } | 37 | } |
| 38 | 38 | ||
| 39 | static int | 39 | static int |
diff --git a/fs/nfs/callback.c b/fs/nfs/callback.c index 351be9205bf8..8d129bb7355a 100644 --- a/fs/nfs/callback.c +++ b/fs/nfs/callback.c | |||
| @@ -128,7 +128,7 @@ nfs41_callback_svc(void *vrqstp) | |||
| 128 | if (try_to_freeze()) | 128 | if (try_to_freeze()) |
| 129 | continue; | 129 | continue; |
| 130 | 130 | ||
| 131 | prepare_to_wait(&serv->sv_cb_waitq, &wq, TASK_UNINTERRUPTIBLE); | 131 | prepare_to_wait(&serv->sv_cb_waitq, &wq, TASK_INTERRUPTIBLE); |
| 132 | spin_lock_bh(&serv->sv_cb_lock); | 132 | spin_lock_bh(&serv->sv_cb_lock); |
| 133 | if (!list_empty(&serv->sv_cb_list)) { | 133 | if (!list_empty(&serv->sv_cb_list)) { |
| 134 | req = list_first_entry(&serv->sv_cb_list, | 134 | req = list_first_entry(&serv->sv_cb_list, |
| @@ -142,10 +142,10 @@ nfs41_callback_svc(void *vrqstp) | |||
| 142 | error); | 142 | error); |
| 143 | } else { | 143 | } else { |
| 144 | spin_unlock_bh(&serv->sv_cb_lock); | 144 | spin_unlock_bh(&serv->sv_cb_lock); |
| 145 | /* schedule_timeout to game the hung task watchdog */ | 145 | schedule(); |
| 146 | schedule_timeout(60 * HZ); | ||
| 147 | finish_wait(&serv->sv_cb_waitq, &wq); | 146 | finish_wait(&serv->sv_cb_waitq, &wq); |
| 148 | } | 147 | } |
| 148 | flush_signals(current); | ||
| 149 | } | 149 | } |
| 150 | return 0; | 150 | return 0; |
| 151 | } | 151 | } |
diff --git a/fs/nfs/client.c b/fs/nfs/client.c index 19874151e95c..892aefff3630 100644 --- a/fs/nfs/client.c +++ b/fs/nfs/client.c | |||
| @@ -31,7 +31,6 @@ | |||
| 31 | #include <linux/lockd/bind.h> | 31 | #include <linux/lockd/bind.h> |
| 32 | #include <linux/seq_file.h> | 32 | #include <linux/seq_file.h> |
| 33 | #include <linux/mount.h> | 33 | #include <linux/mount.h> |
| 34 | #include <linux/nfs_idmap.h> | ||
| 35 | #include <linux/vfs.h> | 34 | #include <linux/vfs.h> |
| 36 | #include <linux/inet.h> | 35 | #include <linux/inet.h> |
| 37 | #include <linux/in6.h> | 36 | #include <linux/in6.h> |
diff --git a/fs/nfs/delegation.c b/fs/nfs/delegation.c index a6ad68865880..029d688a969f 100644 --- a/fs/nfs/delegation.c +++ b/fs/nfs/delegation.c | |||
| @@ -378,7 +378,7 @@ int nfs_inode_set_delegation(struct inode *inode, struct rpc_cred *cred, struct | |||
| 378 | if (freeme == NULL) | 378 | if (freeme == NULL) |
| 379 | goto out; | 379 | goto out; |
| 380 | } | 380 | } |
| 381 | list_add_rcu(&delegation->super_list, &server->delegations); | 381 | list_add_tail_rcu(&delegation->super_list, &server->delegations); |
| 382 | rcu_assign_pointer(nfsi->delegation, delegation); | 382 | rcu_assign_pointer(nfsi->delegation, delegation); |
| 383 | delegation = NULL; | 383 | delegation = NULL; |
| 384 | 384 | ||
| @@ -514,7 +514,7 @@ void nfs_inode_return_delegation_noreclaim(struct inode *inode) | |||
| 514 | 514 | ||
| 515 | delegation = nfs_inode_detach_delegation(inode); | 515 | delegation = nfs_inode_detach_delegation(inode); |
| 516 | if (delegation != NULL) | 516 | if (delegation != NULL) |
| 517 | nfs_do_return_delegation(inode, delegation, 0); | 517 | nfs_do_return_delegation(inode, delegation, 1); |
| 518 | } | 518 | } |
| 519 | 519 | ||
| 520 | /** | 520 | /** |
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c index c19e16f0b2d0..b2c8b31b2be7 100644 --- a/fs/nfs/dir.c +++ b/fs/nfs/dir.c | |||
| @@ -416,15 +416,14 @@ int nfs_same_file(struct dentry *dentry, struct nfs_entry *entry) | |||
| 416 | { | 416 | { |
| 417 | struct nfs_inode *nfsi; | 417 | struct nfs_inode *nfsi; |
| 418 | 418 | ||
| 419 | if (dentry->d_inode == NULL) | 419 | if (d_really_is_negative(dentry)) |
| 420 | goto different; | 420 | return 0; |
| 421 | 421 | ||
| 422 | nfsi = NFS_I(dentry->d_inode); | 422 | nfsi = NFS_I(d_inode(dentry)); |
| 423 | if (entry->fattr->fileid == nfsi->fileid) | 423 | if (entry->fattr->fileid == nfsi->fileid) |
| 424 | return 1; | 424 | return 1; |
| 425 | if (nfs_compare_fh(entry->fh, &nfsi->fh) == 0) | 425 | if (nfs_compare_fh(entry->fh, &nfsi->fh) == 0) |
| 426 | return 1; | 426 | return 1; |
| 427 | different: | ||
| 428 | return 0; | 427 | return 0; |
| 429 | } | 428 | } |
| 430 | 429 | ||
| @@ -473,7 +472,7 @@ void nfs_prime_dcache(struct dentry *parent, struct nfs_entry *entry) | |||
| 473 | struct qstr filename = QSTR_INIT(entry->name, entry->len); | 472 | struct qstr filename = QSTR_INIT(entry->name, entry->len); |
| 474 | struct dentry *dentry; | 473 | struct dentry *dentry; |
| 475 | struct dentry *alias; | 474 | struct dentry *alias; |
| 476 | struct inode *dir = parent->d_inode; | 475 | struct inode *dir = d_inode(parent); |
| 477 | struct inode *inode; | 476 | struct inode *inode; |
| 478 | int status; | 477 | int status; |
| 479 | 478 | ||
| @@ -497,9 +496,9 @@ void nfs_prime_dcache(struct dentry *parent, struct nfs_entry *entry) | |||
| 497 | goto out; | 496 | goto out; |
| 498 | if (nfs_same_file(dentry, entry)) { | 497 | if (nfs_same_file(dentry, entry)) { |
| 499 | nfs_set_verifier(dentry, nfs_save_change_attribute(dir)); | 498 | nfs_set_verifier(dentry, nfs_save_change_attribute(dir)); |
| 500 | status = nfs_refresh_inode(dentry->d_inode, entry->fattr); | 499 | status = nfs_refresh_inode(d_inode(dentry), entry->fattr); |
| 501 | if (!status) | 500 | if (!status) |
| 502 | nfs_setsecurity(dentry->d_inode, entry->fattr, entry->label); | 501 | nfs_setsecurity(d_inode(dentry), entry->fattr, entry->label); |
| 503 | goto out; | 502 | goto out; |
| 504 | } else { | 503 | } else { |
| 505 | d_invalidate(dentry); | 504 | d_invalidate(dentry); |
| @@ -544,6 +543,9 @@ int nfs_readdir_page_filler(nfs_readdir_descriptor_t *desc, struct nfs_entry *en | |||
| 544 | if (scratch == NULL) | 543 | if (scratch == NULL) |
| 545 | return -ENOMEM; | 544 | return -ENOMEM; |
| 546 | 545 | ||
| 546 | if (buflen == 0) | ||
| 547 | goto out_nopages; | ||
| 548 | |||
| 547 | xdr_init_decode_pages(&stream, &buf, xdr_pages, buflen); | 549 | xdr_init_decode_pages(&stream, &buf, xdr_pages, buflen); |
| 548 | xdr_set_scratch_buffer(&stream, page_address(scratch), PAGE_SIZE); | 550 | xdr_set_scratch_buffer(&stream, page_address(scratch), PAGE_SIZE); |
| 549 | 551 | ||
| @@ -565,6 +567,7 @@ int nfs_readdir_page_filler(nfs_readdir_descriptor_t *desc, struct nfs_entry *en | |||
| 565 | break; | 567 | break; |
| 566 | } while (!entry->eof); | 568 | } while (!entry->eof); |
| 567 | 569 | ||
| 570 | out_nopages: | ||
| 568 | if (count == 0 || (status == -EBADCOOKIE && entry->eof != 0)) { | 571 | if (count == 0 || (status == -EBADCOOKIE && entry->eof != 0)) { |
| 569 | array = nfs_readdir_get_array(page); | 572 | array = nfs_readdir_get_array(page); |
| 570 | if (!IS_ERR(array)) { | 573 | if (!IS_ERR(array)) { |
| @@ -870,7 +873,7 @@ static bool nfs_dir_mapping_need_revalidate(struct inode *dir) | |||
| 870 | static int nfs_readdir(struct file *file, struct dir_context *ctx) | 873 | static int nfs_readdir(struct file *file, struct dir_context *ctx) |
| 871 | { | 874 | { |
| 872 | struct dentry *dentry = file->f_path.dentry; | 875 | struct dentry *dentry = file->f_path.dentry; |
| 873 | struct inode *inode = dentry->d_inode; | 876 | struct inode *inode = d_inode(dentry); |
| 874 | nfs_readdir_descriptor_t my_desc, | 877 | nfs_readdir_descriptor_t my_desc, |
| 875 | *desc = &my_desc; | 878 | *desc = &my_desc; |
| 876 | struct nfs_open_dir_context *dir_ctx = file->private_data; | 879 | struct nfs_open_dir_context *dir_ctx = file->private_data; |
| @@ -1118,15 +1121,15 @@ static int nfs_lookup_revalidate(struct dentry *dentry, unsigned int flags) | |||
| 1118 | 1121 | ||
| 1119 | if (flags & LOOKUP_RCU) { | 1122 | if (flags & LOOKUP_RCU) { |
| 1120 | parent = ACCESS_ONCE(dentry->d_parent); | 1123 | parent = ACCESS_ONCE(dentry->d_parent); |
| 1121 | dir = ACCESS_ONCE(parent->d_inode); | 1124 | dir = d_inode_rcu(parent); |
| 1122 | if (!dir) | 1125 | if (!dir) |
| 1123 | return -ECHILD; | 1126 | return -ECHILD; |
| 1124 | } else { | 1127 | } else { |
| 1125 | parent = dget_parent(dentry); | 1128 | parent = dget_parent(dentry); |
| 1126 | dir = parent->d_inode; | 1129 | dir = d_inode(parent); |
| 1127 | } | 1130 | } |
| 1128 | nfs_inc_stats(dir, NFSIOS_DENTRYREVALIDATE); | 1131 | nfs_inc_stats(dir, NFSIOS_DENTRYREVALIDATE); |
| 1129 | inode = dentry->d_inode; | 1132 | inode = d_inode(dentry); |
| 1130 | 1133 | ||
| 1131 | if (!inode) { | 1134 | if (!inode) { |
| 1132 | if (nfs_neg_need_reval(dir, dentry, flags)) { | 1135 | if (nfs_neg_need_reval(dir, dentry, flags)) { |
| @@ -1242,7 +1245,7 @@ out_error: | |||
| 1242 | } | 1245 | } |
| 1243 | 1246 | ||
| 1244 | /* | 1247 | /* |
| 1245 | * A weaker form of d_revalidate for revalidating just the dentry->d_inode | 1248 | * A weaker form of d_revalidate for revalidating just the d_inode(dentry) |
| 1246 | * when we don't really care about the dentry name. This is called when a | 1249 | * when we don't really care about the dentry name. This is called when a |
| 1247 | * pathwalk ends on a dentry that was not found via a normal lookup in the | 1250 | * pathwalk ends on a dentry that was not found via a normal lookup in the |
| 1248 | * parent dir (e.g.: ".", "..", procfs symlinks or mountpoint traversals). | 1251 | * parent dir (e.g.: ".", "..", procfs symlinks or mountpoint traversals). |
| @@ -1253,7 +1256,7 @@ out_error: | |||
| 1253 | static int nfs_weak_revalidate(struct dentry *dentry, unsigned int flags) | 1256 | static int nfs_weak_revalidate(struct dentry *dentry, unsigned int flags) |
| 1254 | { | 1257 | { |
| 1255 | int error; | 1258 | int error; |
| 1256 | struct inode *inode = dentry->d_inode; | 1259 | struct inode *inode = d_inode(dentry); |
| 1257 | 1260 | ||
| 1258 | /* | 1261 | /* |
| 1259 | * I believe we can only get a negative dentry here in the case of a | 1262 | * I believe we can only get a negative dentry here in the case of a |
| @@ -1287,7 +1290,7 @@ static int nfs_dentry_delete(const struct dentry *dentry) | |||
| 1287 | dentry, dentry->d_flags); | 1290 | dentry, dentry->d_flags); |
| 1288 | 1291 | ||
| 1289 | /* Unhash any dentry with a stale inode */ | 1292 | /* Unhash any dentry with a stale inode */ |
| 1290 | if (dentry->d_inode != NULL && NFS_STALE(dentry->d_inode)) | 1293 | if (d_really_is_positive(dentry) && NFS_STALE(d_inode(dentry))) |
| 1291 | return 1; | 1294 | return 1; |
| 1292 | 1295 | ||
| 1293 | if (dentry->d_flags & DCACHE_NFSFS_RENAMED) { | 1296 | if (dentry->d_flags & DCACHE_NFSFS_RENAMED) { |
| @@ -1491,7 +1494,7 @@ int nfs_atomic_open(struct inode *dir, struct dentry *dentry, | |||
| 1491 | int err; | 1494 | int err; |
| 1492 | 1495 | ||
| 1493 | /* Expect a negative dentry */ | 1496 | /* Expect a negative dentry */ |
| 1494 | BUG_ON(dentry->d_inode); | 1497 | BUG_ON(d_inode(dentry)); |
| 1495 | 1498 | ||
| 1496 | dfprintk(VFS, "NFS: atomic_open(%s/%lu), %pd\n", | 1499 | dfprintk(VFS, "NFS: atomic_open(%s/%lu), %pd\n", |
| 1497 | dir->i_sb->s_id, dir->i_ino, dentry); | 1500 | dir->i_sb->s_id, dir->i_ino, dentry); |
| @@ -1587,7 +1590,7 @@ static int nfs4_lookup_revalidate(struct dentry *dentry, unsigned int flags) | |||
| 1587 | if (NFS_SB(dentry->d_sb)->caps & NFS_CAP_ATOMIC_OPEN_V1) | 1590 | if (NFS_SB(dentry->d_sb)->caps & NFS_CAP_ATOMIC_OPEN_V1) |
| 1588 | goto no_open; | 1591 | goto no_open; |
| 1589 | 1592 | ||
| 1590 | inode = dentry->d_inode; | 1593 | inode = d_inode(dentry); |
| 1591 | 1594 | ||
| 1592 | /* We can't create new files in nfs_open_revalidate(), so we | 1595 | /* We can't create new files in nfs_open_revalidate(), so we |
| 1593 | * optimize away revalidation of negative dentries. | 1596 | * optimize away revalidation of negative dentries. |
| @@ -1598,12 +1601,12 @@ static int nfs4_lookup_revalidate(struct dentry *dentry, unsigned int flags) | |||
| 1598 | 1601 | ||
| 1599 | if (flags & LOOKUP_RCU) { | 1602 | if (flags & LOOKUP_RCU) { |
| 1600 | parent = ACCESS_ONCE(dentry->d_parent); | 1603 | parent = ACCESS_ONCE(dentry->d_parent); |
| 1601 | dir = ACCESS_ONCE(parent->d_inode); | 1604 | dir = d_inode_rcu(parent); |
| 1602 | if (!dir) | 1605 | if (!dir) |
| 1603 | return -ECHILD; | 1606 | return -ECHILD; |
| 1604 | } else { | 1607 | } else { |
| 1605 | parent = dget_parent(dentry); | 1608 | parent = dget_parent(dentry); |
| 1606 | dir = parent->d_inode; | 1609 | dir = d_inode(parent); |
| 1607 | } | 1610 | } |
| 1608 | if (!nfs_neg_need_reval(dir, dentry, flags)) | 1611 | if (!nfs_neg_need_reval(dir, dentry, flags)) |
| 1609 | ret = 1; | 1612 | ret = 1; |
| @@ -1643,14 +1646,14 @@ int nfs_instantiate(struct dentry *dentry, struct nfs_fh *fhandle, | |||
| 1643 | struct nfs4_label *label) | 1646 | struct nfs4_label *label) |
| 1644 | { | 1647 | { |
| 1645 | struct dentry *parent = dget_parent(dentry); | 1648 | struct dentry *parent = dget_parent(dentry); |
| 1646 | struct inode *dir = parent->d_inode; | 1649 | struct inode *dir = d_inode(parent); |
| 1647 | struct inode *inode; | 1650 | struct inode *inode; |
| 1648 | int error = -EACCES; | 1651 | int error = -EACCES; |
| 1649 | 1652 | ||
| 1650 | d_drop(dentry); | 1653 | d_drop(dentry); |
| 1651 | 1654 | ||
| 1652 | /* We may have been initialized further down */ | 1655 | /* We may have been initialized further down */ |
| 1653 | if (dentry->d_inode) | 1656 | if (d_really_is_positive(dentry)) |
| 1654 | goto out; | 1657 | goto out; |
| 1655 | if (fhandle->size == 0) { | 1658 | if (fhandle->size == 0) { |
| 1656 | error = NFS_PROTO(dir)->lookup(dir, &dentry->d_name, fhandle, fattr, NULL); | 1659 | error = NFS_PROTO(dir)->lookup(dir, &dentry->d_name, fhandle, fattr, NULL); |
| @@ -1768,7 +1771,7 @@ EXPORT_SYMBOL_GPL(nfs_mkdir); | |||
| 1768 | 1771 | ||
| 1769 | static void nfs_dentry_handle_enoent(struct dentry *dentry) | 1772 | static void nfs_dentry_handle_enoent(struct dentry *dentry) |
| 1770 | { | 1773 | { |
| 1771 | if (dentry->d_inode != NULL && !d_unhashed(dentry)) | 1774 | if (d_really_is_positive(dentry) && !d_unhashed(dentry)) |
| 1772 | d_delete(dentry); | 1775 | d_delete(dentry); |
| 1773 | } | 1776 | } |
| 1774 | 1777 | ||
| @@ -1780,13 +1783,13 @@ int nfs_rmdir(struct inode *dir, struct dentry *dentry) | |||
| 1780 | dir->i_sb->s_id, dir->i_ino, dentry); | 1783 | dir->i_sb->s_id, dir->i_ino, dentry); |
| 1781 | 1784 | ||
| 1782 | trace_nfs_rmdir_enter(dir, dentry); | 1785 | trace_nfs_rmdir_enter(dir, dentry); |
| 1783 | if (dentry->d_inode) { | 1786 | if (d_really_is_positive(dentry)) { |
| 1784 | nfs_wait_on_sillyrename(dentry); | 1787 | nfs_wait_on_sillyrename(dentry); |
| 1785 | error = NFS_PROTO(dir)->rmdir(dir, &dentry->d_name); | 1788 | error = NFS_PROTO(dir)->rmdir(dir, &dentry->d_name); |
| 1786 | /* Ensure the VFS deletes this inode */ | 1789 | /* Ensure the VFS deletes this inode */ |
| 1787 | switch (error) { | 1790 | switch (error) { |
| 1788 | case 0: | 1791 | case 0: |
| 1789 | clear_nlink(dentry->d_inode); | 1792 | clear_nlink(d_inode(dentry)); |
| 1790 | break; | 1793 | break; |
| 1791 | case -ENOENT: | 1794 | case -ENOENT: |
| 1792 | nfs_dentry_handle_enoent(dentry); | 1795 | nfs_dentry_handle_enoent(dentry); |
| @@ -1808,8 +1811,8 @@ EXPORT_SYMBOL_GPL(nfs_rmdir); | |||
| 1808 | */ | 1811 | */ |
| 1809 | static int nfs_safe_remove(struct dentry *dentry) | 1812 | static int nfs_safe_remove(struct dentry *dentry) |
| 1810 | { | 1813 | { |
| 1811 | struct inode *dir = dentry->d_parent->d_inode; | 1814 | struct inode *dir = d_inode(dentry->d_parent); |
| 1812 | struct inode *inode = dentry->d_inode; | 1815 | struct inode *inode = d_inode(dentry); |
| 1813 | int error = -EBUSY; | 1816 | int error = -EBUSY; |
| 1814 | 1817 | ||
| 1815 | dfprintk(VFS, "NFS: safe_remove(%pd2)\n", dentry); | 1818 | dfprintk(VFS, "NFS: safe_remove(%pd2)\n", dentry); |
| @@ -1853,7 +1856,7 @@ int nfs_unlink(struct inode *dir, struct dentry *dentry) | |||
| 1853 | if (d_count(dentry) > 1) { | 1856 | if (d_count(dentry) > 1) { |
| 1854 | spin_unlock(&dentry->d_lock); | 1857 | spin_unlock(&dentry->d_lock); |
| 1855 | /* Start asynchronous writeout of the inode */ | 1858 | /* Start asynchronous writeout of the inode */ |
| 1856 | write_inode_now(dentry->d_inode, 0); | 1859 | write_inode_now(d_inode(dentry), 0); |
| 1857 | error = nfs_sillyrename(dir, dentry); | 1860 | error = nfs_sillyrename(dir, dentry); |
| 1858 | goto out; | 1861 | goto out; |
| 1859 | } | 1862 | } |
| @@ -1931,7 +1934,7 @@ int nfs_symlink(struct inode *dir, struct dentry *dentry, const char *symname) | |||
| 1931 | * No big deal if we can't add this page to the page cache here. | 1934 | * No big deal if we can't add this page to the page cache here. |
| 1932 | * READLINK will get the missing page from the server if needed. | 1935 | * READLINK will get the missing page from the server if needed. |
| 1933 | */ | 1936 | */ |
| 1934 | if (!add_to_page_cache_lru(page, dentry->d_inode->i_mapping, 0, | 1937 | if (!add_to_page_cache_lru(page, d_inode(dentry)->i_mapping, 0, |
| 1935 | GFP_KERNEL)) { | 1938 | GFP_KERNEL)) { |
| 1936 | SetPageUptodate(page); | 1939 | SetPageUptodate(page); |
| 1937 | unlock_page(page); | 1940 | unlock_page(page); |
| @@ -1950,7 +1953,7 @@ EXPORT_SYMBOL_GPL(nfs_symlink); | |||
| 1950 | int | 1953 | int |
| 1951 | nfs_link(struct dentry *old_dentry, struct inode *dir, struct dentry *dentry) | 1954 | nfs_link(struct dentry *old_dentry, struct inode *dir, struct dentry *dentry) |
| 1952 | { | 1955 | { |
| 1953 | struct inode *inode = old_dentry->d_inode; | 1956 | struct inode *inode = d_inode(old_dentry); |
| 1954 | int error; | 1957 | int error; |
| 1955 | 1958 | ||
| 1956 | dfprintk(VFS, "NFS: link(%pd2 -> %pd2)\n", | 1959 | dfprintk(VFS, "NFS: link(%pd2 -> %pd2)\n", |
| @@ -1997,8 +2000,8 @@ EXPORT_SYMBOL_GPL(nfs_link); | |||
| 1997 | int nfs_rename(struct inode *old_dir, struct dentry *old_dentry, | 2000 | int nfs_rename(struct inode *old_dir, struct dentry *old_dentry, |
| 1998 | struct inode *new_dir, struct dentry *new_dentry) | 2001 | struct inode *new_dir, struct dentry *new_dentry) |
| 1999 | { | 2002 | { |
| 2000 | struct inode *old_inode = old_dentry->d_inode; | 2003 | struct inode *old_inode = d_inode(old_dentry); |
| 2001 | struct inode *new_inode = new_dentry->d_inode; | 2004 | struct inode *new_inode = d_inode(new_dentry); |
| 2002 | struct dentry *dentry = NULL, *rehash = NULL; | 2005 | struct dentry *dentry = NULL, *rehash = NULL; |
| 2003 | struct rpc_task *task; | 2006 | struct rpc_task *task; |
| 2004 | int error = -EBUSY; | 2007 | int error = -EBUSY; |
diff --git a/fs/nfs/direct.c b/fs/nfs/direct.c index 682f65fe09b5..38678d9a5cc4 100644 --- a/fs/nfs/direct.c +++ b/fs/nfs/direct.c | |||
| @@ -129,22 +129,25 @@ nfs_direct_good_bytes(struct nfs_direct_req *dreq, struct nfs_pgio_header *hdr) | |||
| 129 | int i; | 129 | int i; |
| 130 | ssize_t count; | 130 | ssize_t count; |
| 131 | 131 | ||
| 132 | WARN_ON_ONCE(hdr->pgio_mirror_idx >= dreq->mirror_count); | 132 | if (dreq->mirror_count == 1) { |
| 133 | 133 | dreq->mirrors[hdr->pgio_mirror_idx].count += hdr->good_bytes; | |
| 134 | count = dreq->mirrors[hdr->pgio_mirror_idx].count; | 134 | dreq->count += hdr->good_bytes; |
| 135 | if (count + dreq->io_start < hdr->io_start + hdr->good_bytes) { | 135 | } else { |
| 136 | count = hdr->io_start + hdr->good_bytes - dreq->io_start; | 136 | /* mirrored writes */ |
| 137 | dreq->mirrors[hdr->pgio_mirror_idx].count = count; | 137 | count = dreq->mirrors[hdr->pgio_mirror_idx].count; |
| 138 | } | 138 | if (count + dreq->io_start < hdr->io_start + hdr->good_bytes) { |
| 139 | 139 | count = hdr->io_start + hdr->good_bytes - dreq->io_start; | |
| 140 | /* update the dreq->count by finding the minimum agreed count from all | 140 | dreq->mirrors[hdr->pgio_mirror_idx].count = count; |
| 141 | * mirrors */ | 141 | } |
| 142 | count = dreq->mirrors[0].count; | 142 | /* update the dreq->count by finding the minimum agreed count from all |
| 143 | * mirrors */ | ||
| 144 | count = dreq->mirrors[0].count; | ||
| 143 | 145 | ||
| 144 | for (i = 1; i < dreq->mirror_count; i++) | 146 | for (i = 1; i < dreq->mirror_count; i++) |
| 145 | count = min(count, dreq->mirrors[i].count); | 147 | count = min(count, dreq->mirrors[i].count); |
| 146 | 148 | ||
| 147 | dreq->count = count; | 149 | dreq->count = count; |
| 150 | } | ||
| 148 | } | 151 | } |
| 149 | 152 | ||
| 150 | /* | 153 | /* |
| @@ -258,18 +261,11 @@ ssize_t nfs_direct_IO(struct kiocb *iocb, struct iov_iter *iter, loff_t pos) | |||
| 258 | if (!IS_SWAPFILE(inode)) | 261 | if (!IS_SWAPFILE(inode)) |
| 259 | return 0; | 262 | return 0; |
| 260 | 263 | ||
| 261 | #ifndef CONFIG_NFS_SWAP | ||
| 262 | dprintk("NFS: nfs_direct_IO (%pD) off/no(%Ld/%lu) EINVAL\n", | ||
| 263 | iocb->ki_filp, (long long) pos, iter->nr_segs); | ||
| 264 | |||
| 265 | return -EINVAL; | ||
| 266 | #else | ||
| 267 | VM_BUG_ON(iov_iter_count(iter) != PAGE_SIZE); | 264 | VM_BUG_ON(iov_iter_count(iter) != PAGE_SIZE); |
| 268 | 265 | ||
| 269 | if (iov_iter_rw(iter) == READ) | 266 | if (iov_iter_rw(iter) == READ) |
| 270 | return nfs_file_direct_read(iocb, iter, pos); | 267 | return nfs_file_direct_read(iocb, iter, pos); |
| 271 | return nfs_file_direct_write(iocb, iter); | 268 | return nfs_file_direct_write(iocb, iter); |
| 272 | #endif /* CONFIG_NFS_SWAP */ | ||
| 273 | } | 269 | } |
| 274 | 270 | ||
| 275 | static void nfs_direct_release_pages(struct page **pages, unsigned int npages) | 271 | static void nfs_direct_release_pages(struct page **pages, unsigned int npages) |
| @@ -386,7 +382,7 @@ static void nfs_direct_complete(struct nfs_direct_req *dreq, bool write) | |||
| 386 | if (write) | 382 | if (write) |
| 387 | nfs_zap_mapping(inode, inode->i_mapping); | 383 | nfs_zap_mapping(inode, inode->i_mapping); |
| 388 | 384 | ||
| 389 | inode_dio_done(inode); | 385 | inode_dio_end(inode); |
| 390 | 386 | ||
| 391 | if (dreq->iocb) { | 387 | if (dreq->iocb) { |
| 392 | long res = (long) dreq->error; | 388 | long res = (long) dreq->error; |
| @@ -403,8 +399,8 @@ static void nfs_direct_complete(struct nfs_direct_req *dreq, bool write) | |||
| 403 | static void nfs_direct_readpage_release(struct nfs_page *req) | 399 | static void nfs_direct_readpage_release(struct nfs_page *req) |
| 404 | { | 400 | { |
| 405 | dprintk("NFS: direct read done (%s/%llu %d@%lld)\n", | 401 | dprintk("NFS: direct read done (%s/%llu %d@%lld)\n", |
| 406 | req->wb_context->dentry->d_inode->i_sb->s_id, | 402 | d_inode(req->wb_context->dentry)->i_sb->s_id, |
| 407 | (unsigned long long)NFS_FILEID(req->wb_context->dentry->d_inode), | 403 | (unsigned long long)NFS_FILEID(d_inode(req->wb_context->dentry)), |
| 408 | req->wb_bytes, | 404 | req->wb_bytes, |
| 409 | (long long)req_offset(req)); | 405 | (long long)req_offset(req)); |
| 410 | nfs_release_request(req); | 406 | nfs_release_request(req); |
| @@ -486,7 +482,7 @@ static ssize_t nfs_direct_read_schedule_iovec(struct nfs_direct_req *dreq, | |||
| 486 | &nfs_direct_read_completion_ops); | 482 | &nfs_direct_read_completion_ops); |
| 487 | get_dreq(dreq); | 483 | get_dreq(dreq); |
| 488 | desc.pg_dreq = dreq; | 484 | desc.pg_dreq = dreq; |
| 489 | atomic_inc(&inode->i_dio_count); | 485 | inode_dio_begin(inode); |
| 490 | 486 | ||
| 491 | while (iov_iter_count(iter)) { | 487 | while (iov_iter_count(iter)) { |
| 492 | struct page **pagevec; | 488 | struct page **pagevec; |
| @@ -538,7 +534,7 @@ static ssize_t nfs_direct_read_schedule_iovec(struct nfs_direct_req *dreq, | |||
| 538 | * generic layer handle the completion. | 534 | * generic layer handle the completion. |
| 539 | */ | 535 | */ |
| 540 | if (requested_bytes == 0) { | 536 | if (requested_bytes == 0) { |
| 541 | inode_dio_done(inode); | 537 | inode_dio_end(inode); |
| 542 | nfs_direct_req_release(dreq); | 538 | nfs_direct_req_release(dreq); |
| 543 | return result < 0 ? result : -EIO; | 539 | return result < 0 ? result : -EIO; |
| 544 | } | 540 | } |
| @@ -872,7 +868,7 @@ static ssize_t nfs_direct_write_schedule_iovec(struct nfs_direct_req *dreq, | |||
| 872 | &nfs_direct_write_completion_ops); | 868 | &nfs_direct_write_completion_ops); |
| 873 | desc.pg_dreq = dreq; | 869 | desc.pg_dreq = dreq; |
| 874 | get_dreq(dreq); | 870 | get_dreq(dreq); |
| 875 | atomic_inc(&inode->i_dio_count); | 871 | inode_dio_begin(inode); |
| 876 | 872 | ||
| 877 | NFS_I(inode)->write_io += iov_iter_count(iter); | 873 | NFS_I(inode)->write_io += iov_iter_count(iter); |
| 878 | while (iov_iter_count(iter)) { | 874 | while (iov_iter_count(iter)) { |
| @@ -928,7 +924,7 @@ static ssize_t nfs_direct_write_schedule_iovec(struct nfs_direct_req *dreq, | |||
| 928 | * generic layer handle the completion. | 924 | * generic layer handle the completion. |
| 929 | */ | 925 | */ |
| 930 | if (requested_bytes == 0) { | 926 | if (requested_bytes == 0) { |
| 931 | inode_dio_done(inode); | 927 | inode_dio_end(inode); |
| 932 | nfs_direct_req_release(dreq); | 928 | nfs_direct_req_release(dreq); |
| 933 | return result < 0 ? result : -EIO; | 929 | return result < 0 ? result : -EIO; |
| 934 | } | 930 | } |
| @@ -1030,6 +1026,7 @@ ssize_t nfs_file_direct_write(struct kiocb *iocb, struct iov_iter *iter) | |||
| 1030 | if (i_size_read(inode) < iocb->ki_pos) | 1026 | if (i_size_read(inode) < iocb->ki_pos) |
| 1031 | i_size_write(inode, iocb->ki_pos); | 1027 | i_size_write(inode, iocb->ki_pos); |
| 1032 | spin_unlock(&inode->i_lock); | 1028 | spin_unlock(&inode->i_lock); |
| 1029 | generic_write_sync(file, pos, result); | ||
| 1033 | } | 1030 | } |
| 1034 | } | 1031 | } |
| 1035 | nfs_direct_req_release(dreq); | 1032 | nfs_direct_req_release(dreq); |
diff --git a/fs/nfs/file.c b/fs/nfs/file.c index c40e4363e746..8b8d83a526ce 100644 --- a/fs/nfs/file.c +++ b/fs/nfs/file.c | |||
| @@ -280,6 +280,7 @@ nfs_file_fsync(struct file *file, loff_t start, loff_t end, int datasync) | |||
| 280 | 280 | ||
| 281 | trace_nfs_fsync_enter(inode); | 281 | trace_nfs_fsync_enter(inode); |
| 282 | 282 | ||
| 283 | nfs_inode_dio_wait(inode); | ||
| 283 | do { | 284 | do { |
| 284 | ret = filemap_write_and_wait_range(inode->i_mapping, start, end); | 285 | ret = filemap_write_and_wait_range(inode->i_mapping, start, end); |
| 285 | if (ret != 0) | 286 | if (ret != 0) |
| @@ -782,7 +783,7 @@ do_unlk(struct file *filp, int cmd, struct file_lock *fl, int is_local) | |||
| 782 | * Flush all pending writes before doing anything | 783 | * Flush all pending writes before doing anything |
| 783 | * with locks.. | 784 | * with locks.. |
| 784 | */ | 785 | */ |
| 785 | nfs_sync_mapping(filp->f_mapping); | 786 | vfs_fsync(filp, 0); |
| 786 | 787 | ||
| 787 | l_ctx = nfs_get_lock_context(nfs_file_open_context(filp)); | 788 | l_ctx = nfs_get_lock_context(nfs_file_open_context(filp)); |
| 788 | if (!IS_ERR(l_ctx)) { | 789 | if (!IS_ERR(l_ctx)) { |
diff --git a/fs/nfs/filelayout/filelayout.c b/fs/nfs/filelayout/filelayout.c index 91e88a7ecef0..a46bf6de9ce4 100644 --- a/fs/nfs/filelayout/filelayout.c +++ b/fs/nfs/filelayout/filelayout.c | |||
| @@ -258,7 +258,8 @@ filelayout_set_layoutcommit(struct nfs_pgio_header *hdr) | |||
| 258 | hdr->res.verf->committed != NFS_DATA_SYNC) | 258 | hdr->res.verf->committed != NFS_DATA_SYNC) |
| 259 | return; | 259 | return; |
| 260 | 260 | ||
| 261 | pnfs_set_layoutcommit(hdr); | 261 | pnfs_set_layoutcommit(hdr->inode, hdr->lseg, |
| 262 | hdr->mds_offset + hdr->res.count); | ||
| 262 | dprintk("%s inode %lu pls_end_pos %lu\n", __func__, hdr->inode->i_ino, | 263 | dprintk("%s inode %lu pls_end_pos %lu\n", __func__, hdr->inode->i_ino, |
| 263 | (unsigned long) NFS_I(hdr->inode)->layout->plh_lwb); | 264 | (unsigned long) NFS_I(hdr->inode)->layout->plh_lwb); |
| 264 | } | 265 | } |
| @@ -373,7 +374,7 @@ static int filelayout_commit_done_cb(struct rpc_task *task, | |||
| 373 | } | 374 | } |
| 374 | 375 | ||
| 375 | if (data->verf.committed == NFS_UNSTABLE) | 376 | if (data->verf.committed == NFS_UNSTABLE) |
| 376 | pnfs_commit_set_layoutcommit(data); | 377 | pnfs_set_layoutcommit(data->inode, data->lseg, data->lwb); |
| 377 | 378 | ||
| 378 | return 0; | 379 | return 0; |
| 379 | } | 380 | } |
| @@ -1086,7 +1087,7 @@ filelayout_alloc_deviceid_node(struct nfs_server *server, | |||
| 1086 | } | 1087 | } |
| 1087 | 1088 | ||
| 1088 | static void | 1089 | static void |
| 1089 | filelayout_free_deveiceid_node(struct nfs4_deviceid_node *d) | 1090 | filelayout_free_deviceid_node(struct nfs4_deviceid_node *d) |
| 1090 | { | 1091 | { |
| 1091 | nfs4_fl_free_deviceid(container_of(d, struct nfs4_file_layout_dsaddr, id_node)); | 1092 | nfs4_fl_free_deviceid(container_of(d, struct nfs4_file_layout_dsaddr, id_node)); |
| 1092 | } | 1093 | } |
| @@ -1137,7 +1138,8 @@ static struct pnfs_layoutdriver_type filelayout_type = { | |||
| 1137 | .read_pagelist = filelayout_read_pagelist, | 1138 | .read_pagelist = filelayout_read_pagelist, |
| 1138 | .write_pagelist = filelayout_write_pagelist, | 1139 | .write_pagelist = filelayout_write_pagelist, |
| 1139 | .alloc_deviceid_node = filelayout_alloc_deviceid_node, | 1140 | .alloc_deviceid_node = filelayout_alloc_deviceid_node, |
| 1140 | .free_deviceid_node = filelayout_free_deveiceid_node, | 1141 | .free_deviceid_node = filelayout_free_deviceid_node, |
| 1142 | .sync = pnfs_nfs_generic_sync, | ||
| 1141 | }; | 1143 | }; |
| 1142 | 1144 | ||
| 1143 | static int __init nfs4filelayout_init(void) | 1145 | static int __init nfs4filelayout_init(void) |
diff --git a/fs/nfs/filelayout/filelayoutdev.c b/fs/nfs/filelayout/filelayoutdev.c index 4f372e224603..4946ef40ba87 100644 --- a/fs/nfs/filelayout/filelayoutdev.c +++ b/fs/nfs/filelayout/filelayoutdev.c | |||
| @@ -55,7 +55,7 @@ nfs4_fl_free_deviceid(struct nfs4_file_layout_dsaddr *dsaddr) | |||
| 55 | nfs4_pnfs_ds_put(ds); | 55 | nfs4_pnfs_ds_put(ds); |
| 56 | } | 56 | } |
| 57 | kfree(dsaddr->stripe_indices); | 57 | kfree(dsaddr->stripe_indices); |
| 58 | kfree(dsaddr); | 58 | kfree_rcu(dsaddr, id_node.rcu); |
| 59 | } | 59 | } |
| 60 | 60 | ||
| 61 | /* Decode opaque device data and return the result */ | 61 | /* Decode opaque device data and return the result */ |
diff --git a/fs/nfs/flexfilelayout/flexfilelayout.c b/fs/nfs/flexfilelayout/flexfilelayout.c index 315cc68945b9..7d05089e52d6 100644 --- a/fs/nfs/flexfilelayout/flexfilelayout.c +++ b/fs/nfs/flexfilelayout/flexfilelayout.c | |||
| @@ -11,10 +11,10 @@ | |||
| 11 | #include <linux/module.h> | 11 | #include <linux/module.h> |
| 12 | 12 | ||
| 13 | #include <linux/sunrpc/metrics.h> | 13 | #include <linux/sunrpc/metrics.h> |
| 14 | #include <linux/nfs_idmap.h> | ||
| 15 | 14 | ||
| 16 | #include "flexfilelayout.h" | 15 | #include "flexfilelayout.h" |
| 17 | #include "../nfs4session.h" | 16 | #include "../nfs4session.h" |
| 17 | #include "../nfs4idmap.h" | ||
| 18 | #include "../internal.h" | 18 | #include "../internal.h" |
| 19 | #include "../delegation.h" | 19 | #include "../delegation.h" |
| 20 | #include "../nfs4trace.h" | 20 | #include "../nfs4trace.h" |
| @@ -891,7 +891,8 @@ static int ff_layout_read_done_cb(struct rpc_task *task, | |||
| 891 | static void | 891 | static void |
| 892 | ff_layout_set_layoutcommit(struct nfs_pgio_header *hdr) | 892 | ff_layout_set_layoutcommit(struct nfs_pgio_header *hdr) |
| 893 | { | 893 | { |
| 894 | pnfs_set_layoutcommit(hdr); | 894 | pnfs_set_layoutcommit(hdr->inode, hdr->lseg, |
| 895 | hdr->mds_offset + hdr->res.count); | ||
| 895 | dprintk("%s inode %lu pls_end_pos %lu\n", __func__, hdr->inode->i_ino, | 896 | dprintk("%s inode %lu pls_end_pos %lu\n", __func__, hdr->inode->i_ino, |
| 896 | (unsigned long) NFS_I(hdr->inode)->layout->plh_lwb); | 897 | (unsigned long) NFS_I(hdr->inode)->layout->plh_lwb); |
| 897 | } | 898 | } |
| @@ -1074,7 +1075,7 @@ static int ff_layout_commit_done_cb(struct rpc_task *task, | |||
| 1074 | } | 1075 | } |
| 1075 | 1076 | ||
| 1076 | if (data->verf.committed == NFS_UNSTABLE) | 1077 | if (data->verf.committed == NFS_UNSTABLE) |
| 1077 | pnfs_commit_set_layoutcommit(data); | 1078 | pnfs_set_layoutcommit(data->inode, data->lseg, data->lwb); |
| 1078 | 1079 | ||
| 1079 | return 0; | 1080 | return 0; |
| 1080 | } | 1081 | } |
| @@ -1414,7 +1415,7 @@ ff_layout_get_ds_info(struct inode *inode) | |||
| 1414 | } | 1415 | } |
| 1415 | 1416 | ||
| 1416 | static void | 1417 | static void |
| 1417 | ff_layout_free_deveiceid_node(struct nfs4_deviceid_node *d) | 1418 | ff_layout_free_deviceid_node(struct nfs4_deviceid_node *d) |
| 1418 | { | 1419 | { |
| 1419 | nfs4_ff_layout_free_deviceid(container_of(d, struct nfs4_ff_layout_ds, | 1420 | nfs4_ff_layout_free_deviceid(container_of(d, struct nfs4_ff_layout_ds, |
| 1420 | id_node)); | 1421 | id_node)); |
| @@ -1498,7 +1499,7 @@ static struct pnfs_layoutdriver_type flexfilelayout_type = { | |||
| 1498 | .pg_read_ops = &ff_layout_pg_read_ops, | 1499 | .pg_read_ops = &ff_layout_pg_read_ops, |
| 1499 | .pg_write_ops = &ff_layout_pg_write_ops, | 1500 | .pg_write_ops = &ff_layout_pg_write_ops, |
| 1500 | .get_ds_info = ff_layout_get_ds_info, | 1501 | .get_ds_info = ff_layout_get_ds_info, |
| 1501 | .free_deviceid_node = ff_layout_free_deveiceid_node, | 1502 | .free_deviceid_node = ff_layout_free_deviceid_node, |
| 1502 | .mark_request_commit = pnfs_layout_mark_request_commit, | 1503 | .mark_request_commit = pnfs_layout_mark_request_commit, |
| 1503 | .clear_request_commit = pnfs_generic_clear_request_commit, | 1504 | .clear_request_commit = pnfs_generic_clear_request_commit, |
| 1504 | .scan_commit_lists = pnfs_generic_scan_commit_lists, | 1505 | .scan_commit_lists = pnfs_generic_scan_commit_lists, |
| @@ -1508,6 +1509,7 @@ static struct pnfs_layoutdriver_type flexfilelayout_type = { | |||
| 1508 | .write_pagelist = ff_layout_write_pagelist, | 1509 | .write_pagelist = ff_layout_write_pagelist, |
| 1509 | .alloc_deviceid_node = ff_layout_alloc_deviceid_node, | 1510 | .alloc_deviceid_node = ff_layout_alloc_deviceid_node, |
| 1510 | .encode_layoutreturn = ff_layout_encode_layoutreturn, | 1511 | .encode_layoutreturn = ff_layout_encode_layoutreturn, |
| 1512 | .sync = pnfs_nfs_generic_sync, | ||
| 1511 | }; | 1513 | }; |
| 1512 | 1514 | ||
| 1513 | static int __init nfs4flexfilelayout_init(void) | 1515 | static int __init nfs4flexfilelayout_init(void) |
diff --git a/fs/nfs/flexfilelayout/flexfilelayoutdev.c b/fs/nfs/flexfilelayout/flexfilelayoutdev.c index e2c01f204a95..77a2d026aa12 100644 --- a/fs/nfs/flexfilelayout/flexfilelayoutdev.c +++ b/fs/nfs/flexfilelayout/flexfilelayoutdev.c | |||
| @@ -30,7 +30,7 @@ void nfs4_ff_layout_free_deviceid(struct nfs4_ff_layout_ds *mirror_ds) | |||
| 30 | { | 30 | { |
| 31 | nfs4_print_deviceid(&mirror_ds->id_node.deviceid); | 31 | nfs4_print_deviceid(&mirror_ds->id_node.deviceid); |
| 32 | nfs4_pnfs_ds_put(mirror_ds->ds); | 32 | nfs4_pnfs_ds_put(mirror_ds->ds); |
| 33 | kfree(mirror_ds); | 33 | kfree_rcu(mirror_ds, id_node.rcu); |
| 34 | } | 34 | } |
| 35 | 35 | ||
| 36 | /* Decode opaque device data and construct new_ds using it */ | 36 | /* Decode opaque device data and construct new_ds using it */ |
diff --git a/fs/nfs/getroot.c b/fs/nfs/getroot.c index 9ac3846cb59e..a608ffd28acc 100644 --- a/fs/nfs/getroot.c +++ b/fs/nfs/getroot.c | |||
| @@ -56,11 +56,11 @@ static int nfs_superblock_set_dummy_root(struct super_block *sb, struct inode *i | |||
| 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(&d_inode(sb->s_root)->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_u.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(&d_inode(sb->s_root)->i_lock); |
| 64 | } | 64 | } |
| 65 | return 0; | 65 | return 0; |
| 66 | } | 66 | } |
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c index d42dff6d5e98..f734562c6d24 100644 --- a/fs/nfs/inode.c +++ b/fs/nfs/inode.c | |||
| @@ -133,6 +133,13 @@ void nfs_evict_inode(struct inode *inode) | |||
| 133 | nfs_clear_inode(inode); | 133 | nfs_clear_inode(inode); |
| 134 | } | 134 | } |
| 135 | 135 | ||
| 136 | int nfs_sync_inode(struct inode *inode) | ||
| 137 | { | ||
| 138 | nfs_inode_dio_wait(inode); | ||
| 139 | return nfs_wb_all(inode); | ||
| 140 | } | ||
| 141 | EXPORT_SYMBOL_GPL(nfs_sync_inode); | ||
| 142 | |||
| 136 | /** | 143 | /** |
| 137 | * nfs_sync_mapping - helper to flush all mmapped dirty data to disk | 144 | * nfs_sync_mapping - helper to flush all mmapped dirty data to disk |
| 138 | */ | 145 | */ |
| @@ -192,7 +199,6 @@ void nfs_zap_caches(struct inode *inode) | |||
| 192 | nfs_zap_caches_locked(inode); | 199 | nfs_zap_caches_locked(inode); |
| 193 | spin_unlock(&inode->i_lock); | 200 | spin_unlock(&inode->i_lock); |
| 194 | } | 201 | } |
| 195 | EXPORT_SYMBOL_GPL(nfs_zap_caches); | ||
| 196 | 202 | ||
| 197 | void nfs_zap_mapping(struct inode *inode, struct address_space *mapping) | 203 | void nfs_zap_mapping(struct inode *inode, struct address_space *mapping) |
| 198 | { | 204 | { |
| @@ -495,7 +501,7 @@ EXPORT_SYMBOL_GPL(nfs_fhget); | |||
| 495 | int | 501 | int |
| 496 | nfs_setattr(struct dentry *dentry, struct iattr *attr) | 502 | nfs_setattr(struct dentry *dentry, struct iattr *attr) |
| 497 | { | 503 | { |
| 498 | struct inode *inode = dentry->d_inode; | 504 | struct inode *inode = d_inode(dentry); |
| 499 | struct nfs_fattr *fattr; | 505 | struct nfs_fattr *fattr; |
| 500 | int error = -ENOMEM; | 506 | int error = -ENOMEM; |
| 501 | 507 | ||
| @@ -525,10 +531,8 @@ nfs_setattr(struct dentry *dentry, struct iattr *attr) | |||
| 525 | trace_nfs_setattr_enter(inode); | 531 | trace_nfs_setattr_enter(inode); |
| 526 | 532 | ||
| 527 | /* Write all dirty data */ | 533 | /* Write all dirty data */ |
| 528 | if (S_ISREG(inode->i_mode)) { | 534 | if (S_ISREG(inode->i_mode)) |
| 529 | nfs_inode_dio_wait(inode); | 535 | nfs_sync_inode(inode); |
| 530 | nfs_wb_all(inode); | ||
| 531 | } | ||
| 532 | 536 | ||
| 533 | fattr = nfs_alloc_fattr(); | 537 | fattr = nfs_alloc_fattr(); |
| 534 | if (fattr == NULL) | 538 | if (fattr == NULL) |
| @@ -621,7 +625,7 @@ static void nfs_request_parent_use_readdirplus(struct dentry *dentry) | |||
| 621 | struct dentry *parent; | 625 | struct dentry *parent; |
| 622 | 626 | ||
| 623 | parent = dget_parent(dentry); | 627 | parent = dget_parent(dentry); |
| 624 | nfs_force_use_readdirplus(parent->d_inode); | 628 | nfs_force_use_readdirplus(d_inode(parent)); |
| 625 | dput(parent); | 629 | dput(parent); |
| 626 | } | 630 | } |
| 627 | 631 | ||
| @@ -637,15 +641,16 @@ static bool nfs_need_revalidate_inode(struct inode *inode) | |||
| 637 | 641 | ||
| 638 | int nfs_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat) | 642 | int nfs_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat) |
| 639 | { | 643 | { |
| 640 | struct inode *inode = dentry->d_inode; | 644 | struct inode *inode = d_inode(dentry); |
| 641 | int need_atime = NFS_I(inode)->cache_validity & NFS_INO_INVALID_ATIME; | 645 | int need_atime = NFS_I(inode)->cache_validity & NFS_INO_INVALID_ATIME; |
| 642 | int err = 0; | 646 | int err = 0; |
| 643 | 647 | ||
| 644 | trace_nfs_getattr_enter(inode); | 648 | trace_nfs_getattr_enter(inode); |
| 645 | /* Flush out writes to the server in order to update c/mtime. */ | 649 | /* Flush out writes to the server in order to update c/mtime. */ |
| 646 | if (S_ISREG(inode->i_mode)) { | 650 | if (S_ISREG(inode->i_mode)) { |
| 647 | nfs_inode_dio_wait(inode); | 651 | mutex_lock(&inode->i_mutex); |
| 648 | err = filemap_write_and_wait(inode->i_mapping); | 652 | err = nfs_sync_inode(inode); |
| 653 | mutex_unlock(&inode->i_mutex); | ||
| 649 | if (err) | 654 | if (err) |
| 650 | goto out; | 655 | goto out; |
| 651 | } | 656 | } |
| @@ -708,7 +713,7 @@ static struct nfs_lock_context *__nfs_find_lock_context(struct nfs_open_context | |||
| 708 | struct nfs_lock_context *nfs_get_lock_context(struct nfs_open_context *ctx) | 713 | struct nfs_lock_context *nfs_get_lock_context(struct nfs_open_context *ctx) |
| 709 | { | 714 | { |
| 710 | struct nfs_lock_context *res, *new = NULL; | 715 | struct nfs_lock_context *res, *new = NULL; |
| 711 | struct inode *inode = ctx->dentry->d_inode; | 716 | struct inode *inode = d_inode(ctx->dentry); |
| 712 | 717 | ||
| 713 | spin_lock(&inode->i_lock); | 718 | spin_lock(&inode->i_lock); |
| 714 | res = __nfs_find_lock_context(ctx); | 719 | res = __nfs_find_lock_context(ctx); |
| @@ -736,7 +741,7 @@ EXPORT_SYMBOL_GPL(nfs_get_lock_context); | |||
| 736 | void nfs_put_lock_context(struct nfs_lock_context *l_ctx) | 741 | void nfs_put_lock_context(struct nfs_lock_context *l_ctx) |
| 737 | { | 742 | { |
| 738 | struct nfs_open_context *ctx = l_ctx->open_context; | 743 | struct nfs_open_context *ctx = l_ctx->open_context; |
| 739 | struct inode *inode = ctx->dentry->d_inode; | 744 | struct inode *inode = d_inode(ctx->dentry); |
| 740 | 745 | ||
| 741 | if (!atomic_dec_and_lock(&l_ctx->count, &inode->i_lock)) | 746 | if (!atomic_dec_and_lock(&l_ctx->count, &inode->i_lock)) |
| 742 | return; | 747 | return; |
| @@ -763,7 +768,7 @@ void nfs_close_context(struct nfs_open_context *ctx, int is_sync) | |||
| 763 | return; | 768 | return; |
| 764 | if (!is_sync) | 769 | if (!is_sync) |
| 765 | return; | 770 | return; |
| 766 | inode = ctx->dentry->d_inode; | 771 | inode = d_inode(ctx->dentry); |
| 767 | if (!list_empty(&NFS_I(inode)->open_files)) | 772 | if (!list_empty(&NFS_I(inode)->open_files)) |
| 768 | return; | 773 | return; |
| 769 | server = NFS_SERVER(inode); | 774 | server = NFS_SERVER(inode); |
| @@ -810,7 +815,7 @@ EXPORT_SYMBOL_GPL(get_nfs_open_context); | |||
| 810 | 815 | ||
| 811 | static void __put_nfs_open_context(struct nfs_open_context *ctx, int is_sync) | 816 | static void __put_nfs_open_context(struct nfs_open_context *ctx, int is_sync) |
| 812 | { | 817 | { |
| 813 | struct inode *inode = ctx->dentry->d_inode; | 818 | struct inode *inode = d_inode(ctx->dentry); |
| 814 | struct super_block *sb = ctx->dentry->d_sb; | 819 | struct super_block *sb = ctx->dentry->d_sb; |
| 815 | 820 | ||
| 816 | if (!list_empty(&ctx->list)) { | 821 | if (!list_empty(&ctx->list)) { |
| @@ -842,7 +847,7 @@ EXPORT_SYMBOL_GPL(put_nfs_open_context); | |||
| 842 | */ | 847 | */ |
| 843 | void nfs_inode_attach_open_context(struct nfs_open_context *ctx) | 848 | void nfs_inode_attach_open_context(struct nfs_open_context *ctx) |
| 844 | { | 849 | { |
| 845 | struct inode *inode = ctx->dentry->d_inode; | 850 | struct inode *inode = d_inode(ctx->dentry); |
| 846 | struct nfs_inode *nfsi = NFS_I(inode); | 851 | struct nfs_inode *nfsi = NFS_I(inode); |
| 847 | 852 | ||
| 848 | spin_lock(&inode->i_lock); | 853 | spin_lock(&inode->i_lock); |
| @@ -885,7 +890,7 @@ static void nfs_file_clear_open_context(struct file *filp) | |||
| 885 | struct nfs_open_context *ctx = nfs_file_open_context(filp); | 890 | struct nfs_open_context *ctx = nfs_file_open_context(filp); |
| 886 | 891 | ||
| 887 | if (ctx) { | 892 | if (ctx) { |
| 888 | struct inode *inode = ctx->dentry->d_inode; | 893 | struct inode *inode = d_inode(ctx->dentry); |
| 889 | 894 | ||
| 890 | filp->private_data = NULL; | 895 | filp->private_data = NULL; |
| 891 | spin_lock(&inode->i_lock); | 896 | spin_lock(&inode->i_lock); |
| @@ -1588,6 +1593,19 @@ int nfs_post_op_update_inode_force_wcc(struct inode *inode, struct nfs_fattr *fa | |||
| 1588 | } | 1593 | } |
| 1589 | EXPORT_SYMBOL_GPL(nfs_post_op_update_inode_force_wcc); | 1594 | EXPORT_SYMBOL_GPL(nfs_post_op_update_inode_force_wcc); |
| 1590 | 1595 | ||
| 1596 | |||
| 1597 | static inline bool nfs_fileid_valid(struct nfs_inode *nfsi, | ||
| 1598 | struct nfs_fattr *fattr) | ||
| 1599 | { | ||
| 1600 | bool ret1 = true, ret2 = true; | ||
| 1601 | |||
| 1602 | if (fattr->valid & NFS_ATTR_FATTR_FILEID) | ||
| 1603 | ret1 = (nfsi->fileid == fattr->fileid); | ||
| 1604 | if (fattr->valid & NFS_ATTR_FATTR_MOUNTED_ON_FILEID) | ||
| 1605 | ret2 = (nfsi->fileid == fattr->mounted_on_fileid); | ||
| 1606 | return ret1 || ret2; | ||
| 1607 | } | ||
| 1608 | |||
| 1591 | /* | 1609 | /* |
| 1592 | * Many nfs protocol calls return the new file attributes after | 1610 | * Many nfs protocol calls return the new file attributes after |
| 1593 | * an operation. Here we update the inode to reflect the state | 1611 | * an operation. Here we update the inode to reflect the state |
| @@ -1614,7 +1632,7 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr) | |||
| 1614 | nfs_display_fhandle_hash(NFS_FH(inode)), | 1632 | nfs_display_fhandle_hash(NFS_FH(inode)), |
| 1615 | atomic_read(&inode->i_count), fattr->valid); | 1633 | atomic_read(&inode->i_count), fattr->valid); |
| 1616 | 1634 | ||
| 1617 | if ((fattr->valid & NFS_ATTR_FATTR_FILEID) && nfsi->fileid != fattr->fileid) { | 1635 | if (!nfs_fileid_valid(nfsi, fattr)) { |
| 1618 | printk(KERN_ERR "NFS: server %s error: fileid changed\n" | 1636 | printk(KERN_ERR "NFS: server %s error: fileid changed\n" |
| 1619 | "fsid %s: expected fileid 0x%Lx, got 0x%Lx\n", | 1637 | "fsid %s: expected fileid 0x%Lx, got 0x%Lx\n", |
| 1620 | NFS_SERVER(inode)->nfs_client->cl_hostname, | 1638 | NFS_SERVER(inode)->nfs_client->cl_hostname, |
| @@ -1819,7 +1837,7 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr) | |||
| 1819 | struct inode *nfs_alloc_inode(struct super_block *sb) | 1837 | struct inode *nfs_alloc_inode(struct super_block *sb) |
| 1820 | { | 1838 | { |
| 1821 | struct nfs_inode *nfsi; | 1839 | struct nfs_inode *nfsi; |
| 1822 | nfsi = (struct nfs_inode *)kmem_cache_alloc(nfs_inode_cachep, GFP_KERNEL); | 1840 | nfsi = kmem_cache_alloc(nfs_inode_cachep, GFP_KERNEL); |
| 1823 | if (!nfsi) | 1841 | if (!nfsi) |
| 1824 | return NULL; | 1842 | return NULL; |
| 1825 | nfsi->flags = 0UL; | 1843 | nfsi->flags = 0UL; |
diff --git a/fs/nfs/namespace.c b/fs/nfs/namespace.c index b5a0afc3ee10..c8162c660c44 100644 --- a/fs/nfs/namespace.c +++ b/fs/nfs/namespace.c | |||
| @@ -139,7 +139,7 @@ EXPORT_SYMBOL_GPL(nfs_path); | |||
| 139 | struct vfsmount *nfs_d_automount(struct path *path) | 139 | struct vfsmount *nfs_d_automount(struct path *path) |
| 140 | { | 140 | { |
| 141 | struct vfsmount *mnt; | 141 | struct vfsmount *mnt; |
| 142 | struct nfs_server *server = NFS_SERVER(path->dentry->d_inode); | 142 | struct nfs_server *server = NFS_SERVER(d_inode(path->dentry)); |
| 143 | struct nfs_fh *fh = NULL; | 143 | struct nfs_fh *fh = NULL; |
| 144 | struct nfs_fattr *fattr = NULL; | 144 | struct nfs_fattr *fattr = NULL; |
| 145 | 145 | ||
| @@ -180,16 +180,16 @@ out_nofree: | |||
| 180 | static int | 180 | static int |
| 181 | nfs_namespace_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat) | 181 | nfs_namespace_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat) |
| 182 | { | 182 | { |
| 183 | if (NFS_FH(dentry->d_inode)->size != 0) | 183 | if (NFS_FH(d_inode(dentry))->size != 0) |
| 184 | return nfs_getattr(mnt, dentry, stat); | 184 | return nfs_getattr(mnt, dentry, stat); |
| 185 | generic_fillattr(dentry->d_inode, stat); | 185 | generic_fillattr(d_inode(dentry), stat); |
| 186 | return 0; | 186 | return 0; |
| 187 | } | 187 | } |
| 188 | 188 | ||
| 189 | static int | 189 | static int |
| 190 | nfs_namespace_setattr(struct dentry *dentry, struct iattr *attr) | 190 | nfs_namespace_setattr(struct dentry *dentry, struct iattr *attr) |
| 191 | { | 191 | { |
| 192 | if (NFS_FH(dentry->d_inode)->size != 0) | 192 | if (NFS_FH(d_inode(dentry))->size != 0) |
| 193 | return nfs_setattr(dentry, attr); | 193 | return nfs_setattr(dentry, attr); |
| 194 | return -EACCES; | 194 | return -EACCES; |
| 195 | } | 195 | } |
| @@ -279,7 +279,7 @@ struct vfsmount *nfs_submount(struct nfs_server *server, struct dentry *dentry, | |||
| 279 | struct dentry *parent = dget_parent(dentry); | 279 | struct dentry *parent = dget_parent(dentry); |
| 280 | 280 | ||
| 281 | /* Look it up again to get its attributes */ | 281 | /* Look it up again to get its attributes */ |
| 282 | err = server->nfs_client->rpc_ops->lookup(parent->d_inode, &dentry->d_name, fh, fattr, NULL); | 282 | err = server->nfs_client->rpc_ops->lookup(d_inode(parent), &dentry->d_name, fh, fattr, NULL); |
| 283 | dput(parent); | 283 | dput(parent); |
| 284 | if (err != 0) | 284 | if (err != 0) |
| 285 | return ERR_PTR(err); | 285 | return ERR_PTR(err); |
diff --git a/fs/nfs/nfs3acl.c b/fs/nfs/nfs3acl.c index 658e586ca438..1ebe2fc7cda2 100644 --- a/fs/nfs/nfs3acl.c +++ b/fs/nfs/nfs3acl.c | |||
| @@ -279,7 +279,7 @@ nfs3_list_one_acl(struct inode *inode, int type, const char *name, void *data, | |||
| 279 | ssize_t | 279 | ssize_t |
| 280 | nfs3_listxattr(struct dentry *dentry, char *data, size_t size) | 280 | nfs3_listxattr(struct dentry *dentry, char *data, size_t size) |
| 281 | { | 281 | { |
| 282 | struct inode *inode = dentry->d_inode; | 282 | struct inode *inode = d_inode(dentry); |
| 283 | ssize_t result = 0; | 283 | ssize_t result = 0; |
| 284 | int error; | 284 | int error; |
| 285 | 285 | ||
diff --git a/fs/nfs/nfs3proc.c b/fs/nfs/nfs3proc.c index 1f11d2533ee4..cb28cceefebe 100644 --- a/fs/nfs/nfs3proc.c +++ b/fs/nfs/nfs3proc.c | |||
| @@ -120,7 +120,7 @@ static int | |||
| 120 | nfs3_proc_setattr(struct dentry *dentry, struct nfs_fattr *fattr, | 120 | nfs3_proc_setattr(struct dentry *dentry, struct nfs_fattr *fattr, |
| 121 | struct iattr *sattr) | 121 | struct iattr *sattr) |
| 122 | { | 122 | { |
| 123 | struct inode *inode = dentry->d_inode; | 123 | struct inode *inode = d_inode(dentry); |
| 124 | struct nfs3_sattrargs arg = { | 124 | struct nfs3_sattrargs arg = { |
| 125 | .fh = NFS_FH(inode), | 125 | .fh = NFS_FH(inode), |
| 126 | .sattr = sattr, | 126 | .sattr = sattr, |
| @@ -386,13 +386,13 @@ nfs3_proc_create(struct inode *dir, struct dentry *dentry, struct iattr *sattr, | |||
| 386 | * not sure this buys us anything (and I'd have | 386 | * not sure this buys us anything (and I'd have |
| 387 | * to revamp the NFSv3 XDR code) */ | 387 | * to revamp the NFSv3 XDR code) */ |
| 388 | status = nfs3_proc_setattr(dentry, data->res.fattr, sattr); | 388 | status = nfs3_proc_setattr(dentry, data->res.fattr, sattr); |
| 389 | nfs_post_op_update_inode(dentry->d_inode, data->res.fattr); | 389 | nfs_post_op_update_inode(d_inode(dentry), data->res.fattr); |
| 390 | dprintk("NFS reply setattr (post-create): %d\n", status); | 390 | dprintk("NFS reply setattr (post-create): %d\n", status); |
| 391 | if (status != 0) | 391 | if (status != 0) |
| 392 | goto out_release_acls; | 392 | goto out_release_acls; |
| 393 | } | 393 | } |
| 394 | 394 | ||
| 395 | status = nfs3_proc_setacls(dentry->d_inode, acl, default_acl); | 395 | status = nfs3_proc_setacls(d_inode(dentry), acl, default_acl); |
| 396 | 396 | ||
| 397 | out_release_acls: | 397 | out_release_acls: |
| 398 | posix_acl_release(acl); | 398 | posix_acl_release(acl); |
| @@ -570,7 +570,7 @@ nfs3_proc_mkdir(struct inode *dir, struct dentry *dentry, struct iattr *sattr) | |||
| 570 | if (status != 0) | 570 | if (status != 0) |
| 571 | goto out_release_acls; | 571 | goto out_release_acls; |
| 572 | 572 | ||
| 573 | status = nfs3_proc_setacls(dentry->d_inode, acl, default_acl); | 573 | status = nfs3_proc_setacls(d_inode(dentry), acl, default_acl); |
| 574 | 574 | ||
| 575 | out_release_acls: | 575 | out_release_acls: |
| 576 | posix_acl_release(acl); | 576 | posix_acl_release(acl); |
| @@ -623,7 +623,7 @@ static int | |||
| 623 | nfs3_proc_readdir(struct dentry *dentry, struct rpc_cred *cred, | 623 | nfs3_proc_readdir(struct dentry *dentry, struct rpc_cred *cred, |
| 624 | u64 cookie, struct page **pages, unsigned int count, int plus) | 624 | u64 cookie, struct page **pages, unsigned int count, int plus) |
| 625 | { | 625 | { |
| 626 | struct inode *dir = dentry->d_inode; | 626 | struct inode *dir = d_inode(dentry); |
| 627 | __be32 *verf = NFS_I(dir)->cookieverf; | 627 | __be32 *verf = NFS_I(dir)->cookieverf; |
| 628 | struct nfs3_readdirargs arg = { | 628 | struct nfs3_readdirargs arg = { |
| 629 | .fh = NFS_FH(dir), | 629 | .fh = NFS_FH(dir), |
| @@ -715,7 +715,7 @@ nfs3_proc_mknod(struct inode *dir, struct dentry *dentry, struct iattr *sattr, | |||
| 715 | if (status != 0) | 715 | if (status != 0) |
| 716 | goto out_release_acls; | 716 | goto out_release_acls; |
| 717 | 717 | ||
| 718 | status = nfs3_proc_setacls(dentry->d_inode, acl, default_acl); | 718 | status = nfs3_proc_setacls(d_inode(dentry), acl, default_acl); |
| 719 | 719 | ||
| 720 | out_release_acls: | 720 | out_release_acls: |
| 721 | posix_acl_release(acl); | 721 | posix_acl_release(acl); |
diff --git a/fs/nfs/nfs42proc.c b/fs/nfs/nfs42proc.c index cb170722769c..3a9e75235f30 100644 --- a/fs/nfs/nfs42proc.c +++ b/fs/nfs/nfs42proc.c | |||
| @@ -36,13 +36,16 @@ static int _nfs42_proc_fallocate(struct rpc_message *msg, struct file *filep, | |||
| 36 | loff_t offset, loff_t len) | 36 | loff_t offset, loff_t len) |
| 37 | { | 37 | { |
| 38 | struct inode *inode = file_inode(filep); | 38 | struct inode *inode = file_inode(filep); |
| 39 | struct nfs_server *server = NFS_SERVER(inode); | ||
| 39 | struct nfs42_falloc_args args = { | 40 | struct nfs42_falloc_args args = { |
| 40 | .falloc_fh = NFS_FH(inode), | 41 | .falloc_fh = NFS_FH(inode), |
| 41 | .falloc_offset = offset, | 42 | .falloc_offset = offset, |
| 42 | .falloc_length = len, | 43 | .falloc_length = len, |
| 44 | .falloc_bitmask = server->cache_consistency_bitmask, | ||
| 45 | }; | ||
| 46 | struct nfs42_falloc_res res = { | ||
| 47 | .falloc_server = server, | ||
| 43 | }; | 48 | }; |
| 44 | struct nfs42_falloc_res res; | ||
| 45 | struct nfs_server *server = NFS_SERVER(inode); | ||
| 46 | int status; | 49 | int status; |
| 47 | 50 | ||
| 48 | msg->rpc_argp = &args; | 51 | msg->rpc_argp = &args; |
| @@ -52,8 +55,17 @@ static int _nfs42_proc_fallocate(struct rpc_message *msg, struct file *filep, | |||
| 52 | if (status) | 55 | if (status) |
| 53 | return status; | 56 | return status; |
| 54 | 57 | ||
| 55 | return nfs4_call_sync(server->client, server, msg, | 58 | res.falloc_fattr = nfs_alloc_fattr(); |
| 56 | &args.seq_args, &res.seq_res, 0); | 59 | if (!res.falloc_fattr) |
| 60 | return -ENOMEM; | ||
| 61 | |||
| 62 | status = nfs4_call_sync(server->client, server, msg, | ||
| 63 | &args.seq_args, &res.seq_res, 0); | ||
| 64 | if (status == 0) | ||
| 65 | status = nfs_post_op_update_inode(inode, res.falloc_fattr); | ||
| 66 | |||
| 67 | kfree(res.falloc_fattr); | ||
| 68 | return status; | ||
| 57 | } | 69 | } |
| 58 | 70 | ||
| 59 | static int nfs42_proc_fallocate(struct rpc_message *msg, struct file *filep, | 71 | static int nfs42_proc_fallocate(struct rpc_message *msg, struct file *filep, |
| @@ -84,9 +96,13 @@ int nfs42_proc_allocate(struct file *filep, loff_t offset, loff_t len) | |||
| 84 | if (!nfs_server_capable(inode, NFS_CAP_ALLOCATE)) | 96 | if (!nfs_server_capable(inode, NFS_CAP_ALLOCATE)) |
| 85 | return -EOPNOTSUPP; | 97 | return -EOPNOTSUPP; |
| 86 | 98 | ||
| 99 | mutex_lock(&inode->i_mutex); | ||
| 100 | |||
| 87 | err = nfs42_proc_fallocate(&msg, filep, offset, len); | 101 | err = nfs42_proc_fallocate(&msg, filep, offset, len); |
| 88 | if (err == -EOPNOTSUPP) | 102 | if (err == -EOPNOTSUPP) |
| 89 | NFS_SERVER(inode)->caps &= ~NFS_CAP_ALLOCATE; | 103 | NFS_SERVER(inode)->caps &= ~NFS_CAP_ALLOCATE; |
| 104 | |||
| 105 | mutex_unlock(&inode->i_mutex); | ||
| 90 | return err; | 106 | return err; |
| 91 | } | 107 | } |
| 92 | 108 | ||
| @@ -101,9 +117,16 @@ int nfs42_proc_deallocate(struct file *filep, loff_t offset, loff_t len) | |||
| 101 | if (!nfs_server_capable(inode, NFS_CAP_DEALLOCATE)) | 117 | if (!nfs_server_capable(inode, NFS_CAP_DEALLOCATE)) |
| 102 | return -EOPNOTSUPP; | 118 | return -EOPNOTSUPP; |
| 103 | 119 | ||
| 120 | nfs_wb_all(inode); | ||
| 121 | mutex_lock(&inode->i_mutex); | ||
| 122 | |||
| 104 | err = nfs42_proc_fallocate(&msg, filep, offset, len); | 123 | err = nfs42_proc_fallocate(&msg, filep, offset, len); |
| 124 | if (err == 0) | ||
| 125 | truncate_pagecache_range(inode, offset, (offset + len) -1); | ||
| 105 | if (err == -EOPNOTSUPP) | 126 | if (err == -EOPNOTSUPP) |
| 106 | NFS_SERVER(inode)->caps &= ~NFS_CAP_DEALLOCATE; | 127 | NFS_SERVER(inode)->caps &= ~NFS_CAP_DEALLOCATE; |
| 128 | |||
| 129 | mutex_unlock(&inode->i_mutex); | ||
| 107 | return err; | 130 | return err; |
| 108 | } | 131 | } |
| 109 | 132 | ||
diff --git a/fs/nfs/nfs42xdr.c b/fs/nfs/nfs42xdr.c index 038a7e1521fa..1a25b27248f2 100644 --- a/fs/nfs/nfs42xdr.c +++ b/fs/nfs/nfs42xdr.c | |||
| @@ -25,16 +25,20 @@ | |||
| 25 | 25 | ||
| 26 | #define NFS4_enc_allocate_sz (compound_encode_hdr_maxsz + \ | 26 | #define NFS4_enc_allocate_sz (compound_encode_hdr_maxsz + \ |
| 27 | encode_putfh_maxsz + \ | 27 | encode_putfh_maxsz + \ |
| 28 | encode_allocate_maxsz) | 28 | encode_allocate_maxsz + \ |
| 29 | encode_getattr_maxsz) | ||
| 29 | #define NFS4_dec_allocate_sz (compound_decode_hdr_maxsz + \ | 30 | #define NFS4_dec_allocate_sz (compound_decode_hdr_maxsz + \ |
| 30 | decode_putfh_maxsz + \ | 31 | decode_putfh_maxsz + \ |
| 31 | decode_allocate_maxsz) | 32 | decode_allocate_maxsz + \ |
| 33 | decode_getattr_maxsz) | ||
| 32 | #define NFS4_enc_deallocate_sz (compound_encode_hdr_maxsz + \ | 34 | #define NFS4_enc_deallocate_sz (compound_encode_hdr_maxsz + \ |
| 33 | encode_putfh_maxsz + \ | 35 | encode_putfh_maxsz + \ |
| 34 | encode_deallocate_maxsz) | 36 | encode_deallocate_maxsz + \ |
| 37 | encode_getattr_maxsz) | ||
| 35 | #define NFS4_dec_deallocate_sz (compound_decode_hdr_maxsz + \ | 38 | #define NFS4_dec_deallocate_sz (compound_decode_hdr_maxsz + \ |
| 36 | decode_putfh_maxsz + \ | 39 | decode_putfh_maxsz + \ |
| 37 | decode_deallocate_maxsz) | 40 | decode_deallocate_maxsz + \ |
| 41 | decode_getattr_maxsz) | ||
| 38 | #define NFS4_enc_seek_sz (compound_encode_hdr_maxsz + \ | 42 | #define NFS4_enc_seek_sz (compound_encode_hdr_maxsz + \ |
| 39 | encode_putfh_maxsz + \ | 43 | encode_putfh_maxsz + \ |
| 40 | encode_seek_maxsz) | 44 | encode_seek_maxsz) |
| @@ -92,6 +96,7 @@ static void nfs4_xdr_enc_allocate(struct rpc_rqst *req, | |||
| 92 | encode_sequence(xdr, &args->seq_args, &hdr); | 96 | encode_sequence(xdr, &args->seq_args, &hdr); |
| 93 | encode_putfh(xdr, args->falloc_fh, &hdr); | 97 | encode_putfh(xdr, args->falloc_fh, &hdr); |
| 94 | encode_allocate(xdr, args, &hdr); | 98 | encode_allocate(xdr, args, &hdr); |
| 99 | encode_getfattr(xdr, args->falloc_bitmask, &hdr); | ||
| 95 | encode_nops(&hdr); | 100 | encode_nops(&hdr); |
| 96 | } | 101 | } |
| 97 | 102 | ||
| @@ -110,6 +115,7 @@ static void nfs4_xdr_enc_deallocate(struct rpc_rqst *req, | |||
| 110 | encode_sequence(xdr, &args->seq_args, &hdr); | 115 | encode_sequence(xdr, &args->seq_args, &hdr); |
| 111 | encode_putfh(xdr, args->falloc_fh, &hdr); | 116 | encode_putfh(xdr, args->falloc_fh, &hdr); |
| 112 | encode_deallocate(xdr, args, &hdr); | 117 | encode_deallocate(xdr, args, &hdr); |
| 118 | encode_getfattr(xdr, args->falloc_bitmask, &hdr); | ||
| 113 | encode_nops(&hdr); | 119 | encode_nops(&hdr); |
| 114 | } | 120 | } |
| 115 | 121 | ||
| @@ -183,6 +189,9 @@ static int nfs4_xdr_dec_allocate(struct rpc_rqst *rqstp, | |||
| 183 | if (status) | 189 | if (status) |
| 184 | goto out; | 190 | goto out; |
| 185 | status = decode_allocate(xdr, res); | 191 | status = decode_allocate(xdr, res); |
| 192 | if (status) | ||
| 193 | goto out; | ||
| 194 | decode_getfattr(xdr, res->falloc_fattr, res->falloc_server); | ||
| 186 | out: | 195 | out: |
| 187 | return status; | 196 | return status; |
| 188 | } | 197 | } |
| @@ -207,6 +216,9 @@ static int nfs4_xdr_dec_deallocate(struct rpc_rqst *rqstp, | |||
| 207 | if (status) | 216 | if (status) |
| 208 | goto out; | 217 | goto out; |
| 209 | status = decode_deallocate(xdr, res); | 218 | status = decode_deallocate(xdr, res); |
| 219 | if (status) | ||
| 220 | goto out; | ||
| 221 | decode_getfattr(xdr, res->falloc_fattr, res->falloc_server); | ||
| 210 | out: | 222 | out: |
| 211 | return status; | 223 | return status; |
| 212 | } | 224 | } |
diff --git a/fs/nfs/nfs4client.c b/fs/nfs/nfs4client.c index 86d6214ea022..e42be52a8c18 100644 --- a/fs/nfs/nfs4client.c +++ b/fs/nfs/nfs4client.c | |||
| @@ -4,7 +4,6 @@ | |||
| 4 | */ | 4 | */ |
| 5 | #include <linux/module.h> | 5 | #include <linux/module.h> |
| 6 | #include <linux/nfs_fs.h> | 6 | #include <linux/nfs_fs.h> |
| 7 | #include <linux/nfs_idmap.h> | ||
| 8 | #include <linux/nfs_mount.h> | 7 | #include <linux/nfs_mount.h> |
| 9 | #include <linux/sunrpc/addr.h> | 8 | #include <linux/sunrpc/addr.h> |
| 10 | #include <linux/sunrpc/auth.h> | 9 | #include <linux/sunrpc/auth.h> |
| @@ -15,6 +14,7 @@ | |||
| 15 | #include "callback.h" | 14 | #include "callback.h" |
| 16 | #include "delegation.h" | 15 | #include "delegation.h" |
| 17 | #include "nfs4session.h" | 16 | #include "nfs4session.h" |
| 17 | #include "nfs4idmap.h" | ||
| 18 | #include "pnfs.h" | 18 | #include "pnfs.h" |
| 19 | #include "netns.h" | 19 | #include "netns.h" |
| 20 | 20 | ||
| @@ -1130,7 +1130,7 @@ error: | |||
| 1130 | */ | 1130 | */ |
| 1131 | static int nfs_probe_destination(struct nfs_server *server) | 1131 | static int nfs_probe_destination(struct nfs_server *server) |
| 1132 | { | 1132 | { |
| 1133 | struct inode *inode = server->super->s_root->d_inode; | 1133 | struct inode *inode = d_inode(server->super->s_root); |
| 1134 | struct nfs_fattr *fattr; | 1134 | struct nfs_fattr *fattr; |
| 1135 | int error; | 1135 | int error; |
| 1136 | 1136 | ||
diff --git a/fs/nfs/nfs4file.c b/fs/nfs/nfs4file.c index 0181cde1d102..f58c17b3b480 100644 --- a/fs/nfs/nfs4file.c +++ b/fs/nfs/nfs4file.c | |||
| @@ -10,6 +10,8 @@ | |||
| 10 | #include "fscache.h" | 10 | #include "fscache.h" |
| 11 | #include "pnfs.h" | 11 | #include "pnfs.h" |
| 12 | 12 | ||
| 13 | #include "nfstrace.h" | ||
| 14 | |||
| 13 | #ifdef CONFIG_NFS_V4_2 | 15 | #ifdef CONFIG_NFS_V4_2 |
| 14 | #include "nfs42.h" | 16 | #include "nfs42.h" |
| 15 | #endif | 17 | #endif |
| @@ -46,7 +48,7 @@ nfs4_file_open(struct inode *inode, struct file *filp) | |||
| 46 | openflags &= ~(O_CREAT|O_EXCL); | 48 | openflags &= ~(O_CREAT|O_EXCL); |
| 47 | 49 | ||
| 48 | parent = dget_parent(dentry); | 50 | parent = dget_parent(dentry); |
| 49 | dir = parent->d_inode; | 51 | dir = d_inode(parent); |
| 50 | 52 | ||
| 51 | ctx = alloc_nfs_open_context(filp->f_path.dentry, filp->f_mode); | 53 | ctx = alloc_nfs_open_context(filp->f_path.dentry, filp->f_mode); |
| 52 | err = PTR_ERR(ctx); | 54 | err = PTR_ERR(ctx); |
| @@ -57,7 +59,7 @@ nfs4_file_open(struct inode *inode, struct file *filp) | |||
| 57 | if (openflags & O_TRUNC) { | 59 | if (openflags & O_TRUNC) { |
| 58 | attr.ia_valid |= ATTR_SIZE; | 60 | attr.ia_valid |= ATTR_SIZE; |
| 59 | attr.ia_size = 0; | 61 | attr.ia_size = 0; |
| 60 | nfs_wb_all(inode); | 62 | nfs_sync_inode(inode); |
| 61 | } | 63 | } |
| 62 | 64 | ||
| 63 | inode = NFS_PROTO(dir)->open_context(dir, ctx, openflags, &attr, &opened); | 65 | inode = NFS_PROTO(dir)->open_context(dir, ctx, openflags, &attr, &opened); |
| @@ -74,7 +76,7 @@ nfs4_file_open(struct inode *inode, struct file *filp) | |||
| 74 | goto out_drop; | 76 | goto out_drop; |
| 75 | } | 77 | } |
| 76 | } | 78 | } |
| 77 | if (inode != dentry->d_inode) | 79 | if (inode != d_inode(dentry)) |
| 78 | goto out_drop; | 80 | goto out_drop; |
| 79 | 81 | ||
| 80 | nfs_set_verifier(dentry, nfs_save_change_attribute(dir)); | 82 | nfs_set_verifier(dentry, nfs_save_change_attribute(dir)); |
| @@ -100,6 +102,9 @@ nfs4_file_fsync(struct file *file, loff_t start, loff_t end, int datasync) | |||
| 100 | int ret; | 102 | int ret; |
| 101 | struct inode *inode = file_inode(file); | 103 | struct inode *inode = file_inode(file); |
| 102 | 104 | ||
| 105 | trace_nfs_fsync_enter(inode); | ||
| 106 | |||
| 107 | nfs_inode_dio_wait(inode); | ||
| 103 | do { | 108 | do { |
| 104 | ret = filemap_write_and_wait_range(inode->i_mapping, start, end); | 109 | ret = filemap_write_and_wait_range(inode->i_mapping, start, end); |
| 105 | if (ret != 0) | 110 | if (ret != 0) |
| @@ -107,7 +112,7 @@ nfs4_file_fsync(struct file *file, loff_t start, loff_t end, int datasync) | |||
| 107 | mutex_lock(&inode->i_mutex); | 112 | mutex_lock(&inode->i_mutex); |
| 108 | ret = nfs_file_fsync_commit(file, start, end, datasync); | 113 | ret = nfs_file_fsync_commit(file, start, end, datasync); |
| 109 | if (!ret) | 114 | if (!ret) |
| 110 | ret = pnfs_layoutcommit_inode(inode, true); | 115 | ret = pnfs_sync_inode(inode, !!datasync); |
| 111 | mutex_unlock(&inode->i_mutex); | 116 | mutex_unlock(&inode->i_mutex); |
| 112 | /* | 117 | /* |
| 113 | * If nfs_file_fsync_commit detected a server reboot, then | 118 | * If nfs_file_fsync_commit detected a server reboot, then |
| @@ -118,6 +123,7 @@ nfs4_file_fsync(struct file *file, loff_t start, loff_t end, int datasync) | |||
| 118 | end = LLONG_MAX; | 123 | end = LLONG_MAX; |
| 119 | } while (ret == -EAGAIN); | 124 | } while (ret == -EAGAIN); |
| 120 | 125 | ||
| 126 | trace_nfs_fsync_exit(inode, ret); | ||
| 121 | return ret; | 127 | return ret; |
| 122 | } | 128 | } |
| 123 | 129 | ||
| @@ -152,15 +158,9 @@ static long nfs42_fallocate(struct file *filep, int mode, loff_t offset, loff_t | |||
| 152 | if (ret < 0) | 158 | if (ret < 0) |
| 153 | return ret; | 159 | return ret; |
| 154 | 160 | ||
| 155 | mutex_lock(&inode->i_mutex); | ||
| 156 | if (mode & FALLOC_FL_PUNCH_HOLE) | 161 | if (mode & FALLOC_FL_PUNCH_HOLE) |
| 157 | ret = nfs42_proc_deallocate(filep, offset, len); | 162 | return nfs42_proc_deallocate(filep, offset, len); |
| 158 | else | 163 | return nfs42_proc_allocate(filep, offset, len); |
| 159 | ret = nfs42_proc_allocate(filep, offset, len); | ||
| 160 | mutex_unlock(&inode->i_mutex); | ||
| 161 | |||
| 162 | nfs_zap_caches(inode); | ||
| 163 | return ret; | ||
| 164 | } | 164 | } |
| 165 | #endif /* CONFIG_NFS_V4_2 */ | 165 | #endif /* CONFIG_NFS_V4_2 */ |
| 166 | 166 | ||
diff --git a/fs/nfs/idmap.c b/fs/nfs/nfs4idmap.c index 857e2a99acc8..2e1737c40a29 100644 --- a/fs/nfs/idmap.c +++ b/fs/nfs/nfs4idmap.c | |||
| @@ -36,7 +36,6 @@ | |||
| 36 | #include <linux/types.h> | 36 | #include <linux/types.h> |
| 37 | #include <linux/parser.h> | 37 | #include <linux/parser.h> |
| 38 | #include <linux/fs.h> | 38 | #include <linux/fs.h> |
| 39 | #include <linux/nfs_idmap.h> | ||
| 40 | #include <net/net_namespace.h> | 39 | #include <net/net_namespace.h> |
| 41 | #include <linux/sunrpc/rpc_pipe_fs.h> | 40 | #include <linux/sunrpc/rpc_pipe_fs.h> |
| 42 | #include <linux/nfs_fs.h> | 41 | #include <linux/nfs_fs.h> |
| @@ -49,6 +48,7 @@ | |||
| 49 | 48 | ||
| 50 | #include "internal.h" | 49 | #include "internal.h" |
| 51 | #include "netns.h" | 50 | #include "netns.h" |
| 51 | #include "nfs4idmap.h" | ||
| 52 | #include "nfs4trace.h" | 52 | #include "nfs4trace.h" |
| 53 | 53 | ||
| 54 | #define NFS_UINT_MAXLEN 11 | 54 | #define NFS_UINT_MAXLEN 11 |
diff --git a/include/linux/nfs_idmap.h b/fs/nfs/nfs4idmap.h index 333844e38f66..de44d7330ab3 100644 --- a/include/linux/nfs_idmap.h +++ b/fs/nfs/nfs4idmap.h | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * include/linux/nfs_idmap.h | 2 | * fs/nfs/nfs4idmap.h |
| 3 | * | 3 | * |
| 4 | * UID and GID to name mapping for clients. | 4 | * UID and GID to name mapping for clients. |
| 5 | * | 5 | * |
| @@ -46,19 +46,8 @@ struct nfs_server; | |||
| 46 | struct nfs_fattr; | 46 | struct nfs_fattr; |
| 47 | struct nfs4_string; | 47 | struct nfs4_string; |
| 48 | 48 | ||
| 49 | #if IS_ENABLED(CONFIG_NFS_V4) | ||
| 50 | int nfs_idmap_init(void); | 49 | int nfs_idmap_init(void); |
| 51 | void nfs_idmap_quit(void); | 50 | void nfs_idmap_quit(void); |
| 52 | #else | ||
| 53 | static inline int nfs_idmap_init(void) | ||
| 54 | { | ||
| 55 | return 0; | ||
| 56 | } | ||
| 57 | |||
| 58 | static inline void nfs_idmap_quit(void) | ||
| 59 | {} | ||
| 60 | #endif | ||
| 61 | |||
| 62 | int nfs_idmap_new(struct nfs_client *); | 51 | int nfs_idmap_new(struct nfs_client *); |
| 63 | void nfs_idmap_delete(struct nfs_client *); | 52 | void nfs_idmap_delete(struct nfs_client *); |
| 64 | 53 | ||
diff --git a/fs/nfs/nfs4namespace.c b/fs/nfs/nfs4namespace.c index 3d83cb1fdc70..f592672373cb 100644 --- a/fs/nfs/nfs4namespace.c +++ b/fs/nfs/nfs4namespace.c | |||
| @@ -375,7 +375,7 @@ static struct vfsmount *nfs_do_refmount(struct rpc_clnt *client, struct dentry * | |||
| 375 | dprintk("%s: getting locations for %pd2\n", | 375 | dprintk("%s: getting locations for %pd2\n", |
| 376 | __func__, dentry); | 376 | __func__, dentry); |
| 377 | 377 | ||
| 378 | err = nfs4_proc_fs_locations(client, parent->d_inode, &dentry->d_name, fs_locations, page); | 378 | err = nfs4_proc_fs_locations(client, d_inode(parent), &dentry->d_name, fs_locations, page); |
| 379 | dput(parent); | 379 | dput(parent); |
| 380 | if (err != 0 || | 380 | if (err != 0 || |
| 381 | fs_locations->nlocations <= 0 || | 381 | fs_locations->nlocations <= 0 || |
| @@ -396,7 +396,7 @@ struct vfsmount *nfs4_submount(struct nfs_server *server, struct dentry *dentry, | |||
| 396 | { | 396 | { |
| 397 | rpc_authflavor_t flavor = server->client->cl_auth->au_flavor; | 397 | rpc_authflavor_t flavor = server->client->cl_auth->au_flavor; |
| 398 | struct dentry *parent = dget_parent(dentry); | 398 | struct dentry *parent = dget_parent(dentry); |
| 399 | struct inode *dir = parent->d_inode; | 399 | struct inode *dir = d_inode(parent); |
| 400 | struct qstr *name = &dentry->d_name; | 400 | struct qstr *name = &dentry->d_name; |
| 401 | struct rpc_clnt *client; | 401 | struct rpc_clnt *client; |
| 402 | struct vfsmount *mnt; | 402 | struct vfsmount *mnt; |
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index 627f37c44456..45b35b9b1e36 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c | |||
| @@ -51,7 +51,6 @@ | |||
| 51 | #include <linux/namei.h> | 51 | #include <linux/namei.h> |
| 52 | #include <linux/mount.h> | 52 | #include <linux/mount.h> |
| 53 | #include <linux/module.h> | 53 | #include <linux/module.h> |
| 54 | #include <linux/nfs_idmap.h> | ||
| 55 | #include <linux/xattr.h> | 54 | #include <linux/xattr.h> |
| 56 | #include <linux/utsname.h> | 55 | #include <linux/utsname.h> |
| 57 | #include <linux/freezer.h> | 56 | #include <linux/freezer.h> |
| @@ -63,6 +62,7 @@ | |||
| 63 | #include "callback.h" | 62 | #include "callback.h" |
| 64 | #include "pnfs.h" | 63 | #include "pnfs.h" |
| 65 | #include "netns.h" | 64 | #include "netns.h" |
| 65 | #include "nfs4idmap.h" | ||
| 66 | #include "nfs4session.h" | 66 | #include "nfs4session.h" |
| 67 | #include "fscache.h" | 67 | #include "fscache.h" |
| 68 | 68 | ||
| @@ -185,7 +185,8 @@ const u32 nfs4_fattr_bitmap[3] = { | |||
| 185 | | FATTR4_WORD1_SPACE_USED | 185 | | FATTR4_WORD1_SPACE_USED |
| 186 | | FATTR4_WORD1_TIME_ACCESS | 186 | | FATTR4_WORD1_TIME_ACCESS |
| 187 | | FATTR4_WORD1_TIME_METADATA | 187 | | FATTR4_WORD1_TIME_METADATA |
| 188 | | FATTR4_WORD1_TIME_MODIFY, | 188 | | FATTR4_WORD1_TIME_MODIFY |
| 189 | | FATTR4_WORD1_MOUNTED_ON_FILEID, | ||
| 189 | #ifdef CONFIG_NFS_V4_SECURITY_LABEL | 190 | #ifdef CONFIG_NFS_V4_SECURITY_LABEL |
| 190 | FATTR4_WORD2_SECURITY_LABEL | 191 | FATTR4_WORD2_SECURITY_LABEL |
| 191 | #endif | 192 | #endif |
| @@ -293,7 +294,7 @@ static void nfs4_setup_readdir(u64 cookie, __be32 *verifier, struct dentry *dent | |||
| 293 | *p++ = xdr_one; /* bitmap length */ | 294 | *p++ = xdr_one; /* bitmap length */ |
| 294 | *p++ = htonl(FATTR4_WORD0_FILEID); /* bitmap */ | 295 | *p++ = htonl(FATTR4_WORD0_FILEID); /* bitmap */ |
| 295 | *p++ = htonl(8); /* attribute buffer length */ | 296 | *p++ = htonl(8); /* attribute buffer length */ |
| 296 | p = xdr_encode_hyper(p, NFS_FILEID(dentry->d_inode)); | 297 | p = xdr_encode_hyper(p, NFS_FILEID(d_inode(dentry))); |
| 297 | } | 298 | } |
| 298 | 299 | ||
| 299 | *p++ = xdr_one; /* next */ | 300 | *p++ = xdr_one; /* next */ |
| @@ -305,7 +306,7 @@ static void nfs4_setup_readdir(u64 cookie, __be32 *verifier, struct dentry *dent | |||
| 305 | *p++ = xdr_one; /* bitmap length */ | 306 | *p++ = xdr_one; /* bitmap length */ |
| 306 | *p++ = htonl(FATTR4_WORD0_FILEID); /* bitmap */ | 307 | *p++ = htonl(FATTR4_WORD0_FILEID); /* bitmap */ |
| 307 | *p++ = htonl(8); /* attribute buffer length */ | 308 | *p++ = htonl(8); /* attribute buffer length */ |
| 308 | p = xdr_encode_hyper(p, NFS_FILEID(dentry->d_parent->d_inode)); | 309 | p = xdr_encode_hyper(p, NFS_FILEID(d_inode(dentry->d_parent))); |
| 309 | 310 | ||
| 310 | readdir->pgbase = (char *)p - (char *)start; | 311 | readdir->pgbase = (char *)p - (char *)start; |
| 311 | readdir->count -= readdir->pgbase; | 312 | readdir->count -= readdir->pgbase; |
| @@ -1004,7 +1005,7 @@ static struct nfs4_opendata *nfs4_opendata_alloc(struct dentry *dentry, | |||
| 1004 | gfp_t gfp_mask) | 1005 | gfp_t gfp_mask) |
| 1005 | { | 1006 | { |
| 1006 | struct dentry *parent = dget_parent(dentry); | 1007 | struct dentry *parent = dget_parent(dentry); |
| 1007 | struct inode *dir = parent->d_inode; | 1008 | struct inode *dir = d_inode(parent); |
| 1008 | struct nfs_server *server = NFS_SERVER(dir); | 1009 | struct nfs_server *server = NFS_SERVER(dir); |
| 1009 | struct nfs_seqid *(*alloc_seqid)(struct nfs_seqid_counter *, gfp_t); | 1010 | struct nfs_seqid *(*alloc_seqid)(struct nfs_seqid_counter *, gfp_t); |
| 1010 | struct nfs4_opendata *p; | 1011 | struct nfs4_opendata *p; |
| @@ -1057,7 +1058,7 @@ static struct nfs4_opendata *nfs4_opendata_alloc(struct dentry *dentry, | |||
| 1057 | case NFS4_OPEN_CLAIM_FH: | 1058 | case NFS4_OPEN_CLAIM_FH: |
| 1058 | case NFS4_OPEN_CLAIM_DELEG_CUR_FH: | 1059 | case NFS4_OPEN_CLAIM_DELEG_CUR_FH: |
| 1059 | case NFS4_OPEN_CLAIM_DELEG_PREV_FH: | 1060 | case NFS4_OPEN_CLAIM_DELEG_PREV_FH: |
| 1060 | p->o_arg.fh = NFS_FH(dentry->d_inode); | 1061 | p->o_arg.fh = NFS_FH(d_inode(dentry)); |
| 1061 | } | 1062 | } |
| 1062 | if (attrs != NULL && attrs->ia_valid != 0) { | 1063 | if (attrs != NULL && attrs->ia_valid != 0) { |
| 1063 | __u32 verf[2]; | 1064 | __u32 verf[2]; |
| @@ -1794,7 +1795,7 @@ static const struct rpc_call_ops nfs4_open_confirm_ops = { | |||
| 1794 | */ | 1795 | */ |
| 1795 | static int _nfs4_proc_open_confirm(struct nfs4_opendata *data) | 1796 | static int _nfs4_proc_open_confirm(struct nfs4_opendata *data) |
| 1796 | { | 1797 | { |
| 1797 | struct nfs_server *server = NFS_SERVER(data->dir->d_inode); | 1798 | struct nfs_server *server = NFS_SERVER(d_inode(data->dir)); |
| 1798 | struct rpc_task *task; | 1799 | struct rpc_task *task; |
| 1799 | struct rpc_message msg = { | 1800 | struct rpc_message msg = { |
| 1800 | .rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_OPEN_CONFIRM], | 1801 | .rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_OPEN_CONFIRM], |
| @@ -1951,7 +1952,7 @@ static const struct rpc_call_ops nfs4_open_ops = { | |||
| 1951 | 1952 | ||
| 1952 | static int nfs4_run_open_task(struct nfs4_opendata *data, int isrecover) | 1953 | static int nfs4_run_open_task(struct nfs4_opendata *data, int isrecover) |
| 1953 | { | 1954 | { |
| 1954 | struct inode *dir = data->dir->d_inode; | 1955 | struct inode *dir = d_inode(data->dir); |
| 1955 | struct nfs_server *server = NFS_SERVER(dir); | 1956 | struct nfs_server *server = NFS_SERVER(dir); |
| 1956 | struct nfs_openargs *o_arg = &data->o_arg; | 1957 | struct nfs_openargs *o_arg = &data->o_arg; |
| 1957 | struct nfs_openres *o_res = &data->o_res; | 1958 | struct nfs_openres *o_res = &data->o_res; |
| @@ -1998,7 +1999,7 @@ static int nfs4_run_open_task(struct nfs4_opendata *data, int isrecover) | |||
| 1998 | 1999 | ||
| 1999 | static int _nfs4_recover_proc_open(struct nfs4_opendata *data) | 2000 | static int _nfs4_recover_proc_open(struct nfs4_opendata *data) |
| 2000 | { | 2001 | { |
| 2001 | struct inode *dir = data->dir->d_inode; | 2002 | struct inode *dir = d_inode(data->dir); |
| 2002 | struct nfs_openres *o_res = &data->o_res; | 2003 | struct nfs_openres *o_res = &data->o_res; |
| 2003 | int status; | 2004 | int status; |
| 2004 | 2005 | ||
| @@ -2067,7 +2068,7 @@ static int nfs4_opendata_access(struct rpc_cred *cred, | |||
| 2067 | */ | 2068 | */ |
| 2068 | static int _nfs4_proc_open(struct nfs4_opendata *data) | 2069 | static int _nfs4_proc_open(struct nfs4_opendata *data) |
| 2069 | { | 2070 | { |
| 2070 | struct inode *dir = data->dir->d_inode; | 2071 | struct inode *dir = d_inode(data->dir); |
| 2071 | struct nfs_server *server = NFS_SERVER(dir); | 2072 | struct nfs_server *server = NFS_SERVER(dir); |
| 2072 | struct nfs_openargs *o_arg = &data->o_arg; | 2073 | struct nfs_openargs *o_arg = &data->o_arg; |
| 2073 | struct nfs_openres *o_res = &data->o_res; | 2074 | struct nfs_openres *o_res = &data->o_res; |
| @@ -2314,7 +2315,7 @@ static int _nfs4_open_and_get_state(struct nfs4_opendata *opendata, | |||
| 2314 | set_bit(NFS_STATE_POSIX_LOCKS, &state->flags); | 2315 | set_bit(NFS_STATE_POSIX_LOCKS, &state->flags); |
| 2315 | 2316 | ||
| 2316 | dentry = opendata->dentry; | 2317 | dentry = opendata->dentry; |
| 2317 | if (dentry->d_inode == NULL) { | 2318 | if (d_really_is_negative(dentry)) { |
| 2318 | /* FIXME: Is this d_drop() ever needed? */ | 2319 | /* FIXME: Is this d_drop() ever needed? */ |
| 2319 | d_drop(dentry); | 2320 | d_drop(dentry); |
| 2320 | dentry = d_add_unique(dentry, igrab(state->inode)); | 2321 | dentry = d_add_unique(dentry, igrab(state->inode)); |
| @@ -2325,7 +2326,7 @@ static int _nfs4_open_and_get_state(struct nfs4_opendata *opendata, | |||
| 2325 | ctx->dentry = dget(dentry); | 2326 | ctx->dentry = dget(dentry); |
| 2326 | } | 2327 | } |
| 2327 | nfs_set_verifier(dentry, | 2328 | nfs_set_verifier(dentry, |
| 2328 | nfs_save_change_attribute(opendata->dir->d_inode)); | 2329 | nfs_save_change_attribute(d_inode(opendata->dir))); |
| 2329 | } | 2330 | } |
| 2330 | 2331 | ||
| 2331 | ret = nfs4_opendata_access(sp->so_cred, opendata, state, fmode, flags); | 2332 | ret = nfs4_opendata_access(sp->so_cred, opendata, state, fmode, flags); |
| @@ -2333,7 +2334,7 @@ static int _nfs4_open_and_get_state(struct nfs4_opendata *opendata, | |||
| 2333 | goto out; | 2334 | goto out; |
| 2334 | 2335 | ||
| 2335 | ctx->state = state; | 2336 | ctx->state = state; |
| 2336 | if (dentry->d_inode == state->inode) { | 2337 | if (d_inode(dentry) == state->inode) { |
| 2337 | nfs_inode_attach_open_context(ctx); | 2338 | nfs_inode_attach_open_context(ctx); |
| 2338 | if (read_seqcount_retry(&sp->so_reclaim_seqcount, seq)) | 2339 | if (read_seqcount_retry(&sp->so_reclaim_seqcount, seq)) |
| 2339 | nfs4_schedule_stateid_recovery(server, state); | 2340 | nfs4_schedule_stateid_recovery(server, state); |
| @@ -2374,10 +2375,10 @@ static int _nfs4_do_open(struct inode *dir, | |||
| 2374 | status = nfs4_recover_expired_lease(server); | 2375 | status = nfs4_recover_expired_lease(server); |
| 2375 | if (status != 0) | 2376 | if (status != 0) |
| 2376 | goto err_put_state_owner; | 2377 | goto err_put_state_owner; |
| 2377 | if (dentry->d_inode != NULL) | 2378 | if (d_really_is_positive(dentry)) |
| 2378 | nfs4_return_incompatible_delegation(dentry->d_inode, fmode); | 2379 | nfs4_return_incompatible_delegation(d_inode(dentry), fmode); |
| 2379 | status = -ENOMEM; | 2380 | status = -ENOMEM; |
| 2380 | if (dentry->d_inode) | 2381 | if (d_really_is_positive(dentry)) |
| 2381 | claim = NFS4_OPEN_CLAIM_FH; | 2382 | claim = NFS4_OPEN_CLAIM_FH; |
| 2382 | opendata = nfs4_opendata_alloc(dentry, sp, fmode, flags, sattr, | 2383 | opendata = nfs4_opendata_alloc(dentry, sp, fmode, flags, sattr, |
| 2383 | label, claim, GFP_KERNEL); | 2384 | label, claim, GFP_KERNEL); |
| @@ -2400,8 +2401,8 @@ static int _nfs4_do_open(struct inode *dir, | |||
| 2400 | } | 2401 | } |
| 2401 | opendata->o_arg.open_bitmap = &nfs4_pnfs_open_bitmap[0]; | 2402 | opendata->o_arg.open_bitmap = &nfs4_pnfs_open_bitmap[0]; |
| 2402 | } | 2403 | } |
| 2403 | if (dentry->d_inode != NULL) | 2404 | if (d_really_is_positive(dentry)) |
| 2404 | opendata->state = nfs4_get_open_state(dentry->d_inode, sp); | 2405 | opendata->state = nfs4_get_open_state(d_inode(dentry), sp); |
| 2405 | 2406 | ||
| 2406 | status = _nfs4_open_and_get_state(opendata, fmode, flags, ctx); | 2407 | status = _nfs4_open_and_get_state(opendata, fmode, flags, ctx); |
| 2407 | if (status != 0) | 2408 | if (status != 0) |
| @@ -3095,16 +3096,13 @@ int nfs4_proc_get_rootfh(struct nfs_server *server, struct nfs_fh *fhandle, | |||
| 3095 | struct nfs_fsinfo *info, | 3096 | struct nfs_fsinfo *info, |
| 3096 | bool auth_probe) | 3097 | bool auth_probe) |
| 3097 | { | 3098 | { |
| 3098 | int status; | 3099 | int status = 0; |
| 3099 | 3100 | ||
| 3100 | switch (auth_probe) { | 3101 | if (!auth_probe) |
| 3101 | case false: | ||
| 3102 | status = nfs4_lookup_root(server, fhandle, info); | 3102 | status = nfs4_lookup_root(server, fhandle, info); |
| 3103 | if (status != -NFS4ERR_WRONGSEC) | 3103 | |
| 3104 | break; | 3104 | if (auth_probe || status == NFS4ERR_WRONGSEC) |
| 3105 | default: | ||
| 3106 | status = nfs4_do_find_root_sec(server, fhandle, info); | 3105 | status = nfs4_do_find_root_sec(server, fhandle, info); |
| 3107 | } | ||
| 3108 | 3106 | ||
| 3109 | if (status == 0) | 3107 | if (status == 0) |
| 3110 | status = nfs4_server_capabilities(server, fhandle); | 3108 | status = nfs4_server_capabilities(server, fhandle); |
| @@ -3254,7 +3252,7 @@ static int | |||
| 3254 | nfs4_proc_setattr(struct dentry *dentry, struct nfs_fattr *fattr, | 3252 | nfs4_proc_setattr(struct dentry *dentry, struct nfs_fattr *fattr, |
| 3255 | struct iattr *sattr) | 3253 | struct iattr *sattr) |
| 3256 | { | 3254 | { |
| 3257 | struct inode *inode = dentry->d_inode; | 3255 | struct inode *inode = d_inode(dentry); |
| 3258 | struct rpc_cred *cred = NULL; | 3256 | struct rpc_cred *cred = NULL; |
| 3259 | struct nfs4_state *state = NULL; | 3257 | struct nfs4_state *state = NULL; |
| 3260 | struct nfs4_label *label = NULL; | 3258 | struct nfs4_label *label = NULL; |
| @@ -3871,13 +3869,13 @@ static int nfs4_proc_mkdir(struct inode *dir, struct dentry *dentry, | |||
| 3871 | static int _nfs4_proc_readdir(struct dentry *dentry, struct rpc_cred *cred, | 3869 | static int _nfs4_proc_readdir(struct dentry *dentry, struct rpc_cred *cred, |
| 3872 | u64 cookie, struct page **pages, unsigned int count, int plus) | 3870 | u64 cookie, struct page **pages, unsigned int count, int plus) |
| 3873 | { | 3871 | { |
| 3874 | struct inode *dir = dentry->d_inode; | 3872 | struct inode *dir = d_inode(dentry); |
| 3875 | struct nfs4_readdir_arg args = { | 3873 | struct nfs4_readdir_arg args = { |
| 3876 | .fh = NFS_FH(dir), | 3874 | .fh = NFS_FH(dir), |
| 3877 | .pages = pages, | 3875 | .pages = pages, |
| 3878 | .pgbase = 0, | 3876 | .pgbase = 0, |
| 3879 | .count = count, | 3877 | .count = count, |
| 3880 | .bitmask = NFS_SERVER(dentry->d_inode)->attr_bitmask, | 3878 | .bitmask = NFS_SERVER(d_inode(dentry))->attr_bitmask, |
| 3881 | .plus = plus, | 3879 | .plus = plus, |
| 3882 | }; | 3880 | }; |
| 3883 | struct nfs4_readdir_res res; | 3881 | struct nfs4_readdir_res res; |
| @@ -3914,8 +3912,8 @@ static int nfs4_proc_readdir(struct dentry *dentry, struct rpc_cred *cred, | |||
| 3914 | do { | 3912 | do { |
| 3915 | err = _nfs4_proc_readdir(dentry, cred, cookie, | 3913 | err = _nfs4_proc_readdir(dentry, cred, cookie, |
| 3916 | pages, count, plus); | 3914 | pages, count, plus); |
| 3917 | trace_nfs4_readdir(dentry->d_inode, err); | 3915 | trace_nfs4_readdir(d_inode(dentry), err); |
| 3918 | err = nfs4_handle_exception(NFS_SERVER(dentry->d_inode), err, | 3916 | err = nfs4_handle_exception(NFS_SERVER(d_inode(dentry)), err, |
| 3919 | &exception); | 3917 | &exception); |
| 3920 | } while (exception.retry); | 3918 | } while (exception.retry); |
| 3921 | return err; | 3919 | return err; |
| @@ -4830,7 +4828,7 @@ nfs4_set_security_label(struct dentry *dentry, const void *buf, size_t buflen) | |||
| 4830 | struct nfs4_label ilabel, *olabel = NULL; | 4828 | struct nfs4_label ilabel, *olabel = NULL; |
| 4831 | struct nfs_fattr fattr; | 4829 | struct nfs_fattr fattr; |
| 4832 | struct rpc_cred *cred; | 4830 | struct rpc_cred *cred; |
| 4833 | struct inode *inode = dentry->d_inode; | 4831 | struct inode *inode = d_inode(dentry); |
| 4834 | int status; | 4832 | int status; |
| 4835 | 4833 | ||
| 4836 | if (!nfs_server_capable(inode, NFS_CAP_SECURITY_LABEL)) | 4834 | if (!nfs_server_capable(inode, NFS_CAP_SECURITY_LABEL)) |
| @@ -5670,7 +5668,7 @@ static void nfs4_lock_done(struct rpc_task *task, void *calldata) | |||
| 5670 | data->rpc_status = task->tk_status; | 5668 | data->rpc_status = task->tk_status; |
| 5671 | switch (task->tk_status) { | 5669 | switch (task->tk_status) { |
| 5672 | case 0: | 5670 | case 0: |
| 5673 | renew_lease(NFS_SERVER(data->ctx->dentry->d_inode), | 5671 | renew_lease(NFS_SERVER(d_inode(data->ctx->dentry)), |
| 5674 | data->timestamp); | 5672 | data->timestamp); |
| 5675 | if (data->arg.new_lock) { | 5673 | if (data->arg.new_lock) { |
| 5676 | data->fl.fl_flags &= ~(FL_SLEEP | FL_ACCESS); | 5674 | data->fl.fl_flags &= ~(FL_SLEEP | FL_ACCESS); |
| @@ -6112,7 +6110,7 @@ static int nfs4_xattr_set_nfs4_acl(struct dentry *dentry, const char *key, | |||
| 6112 | if (strcmp(key, "") != 0) | 6110 | if (strcmp(key, "") != 0) |
| 6113 | return -EINVAL; | 6111 | return -EINVAL; |
| 6114 | 6112 | ||
| 6115 | return nfs4_proc_set_acl(dentry->d_inode, buf, buflen); | 6113 | return nfs4_proc_set_acl(d_inode(dentry), buf, buflen); |
| 6116 | } | 6114 | } |
| 6117 | 6115 | ||
| 6118 | static int nfs4_xattr_get_nfs4_acl(struct dentry *dentry, const char *key, | 6116 | static int nfs4_xattr_get_nfs4_acl(struct dentry *dentry, const char *key, |
| @@ -6121,7 +6119,7 @@ static int nfs4_xattr_get_nfs4_acl(struct dentry *dentry, const char *key, | |||
| 6121 | if (strcmp(key, "") != 0) | 6119 | if (strcmp(key, "") != 0) |
| 6122 | return -EINVAL; | 6120 | return -EINVAL; |
| 6123 | 6121 | ||
| 6124 | return nfs4_proc_get_acl(dentry->d_inode, buf, buflen); | 6122 | return nfs4_proc_get_acl(d_inode(dentry), buf, buflen); |
| 6125 | } | 6123 | } |
| 6126 | 6124 | ||
| 6127 | static size_t nfs4_xattr_list_nfs4_acl(struct dentry *dentry, char *list, | 6125 | static size_t nfs4_xattr_list_nfs4_acl(struct dentry *dentry, char *list, |
| @@ -6130,7 +6128,7 @@ static size_t nfs4_xattr_list_nfs4_acl(struct dentry *dentry, char *list, | |||
| 6130 | { | 6128 | { |
| 6131 | size_t len = sizeof(XATTR_NAME_NFSV4_ACL); | 6129 | size_t len = sizeof(XATTR_NAME_NFSV4_ACL); |
| 6132 | 6130 | ||
| 6133 | if (!nfs4_server_supports_acls(NFS_SERVER(dentry->d_inode))) | 6131 | if (!nfs4_server_supports_acls(NFS_SERVER(d_inode(dentry)))) |
| 6134 | return 0; | 6132 | return 0; |
| 6135 | 6133 | ||
| 6136 | if (list && len <= list_len) | 6134 | if (list && len <= list_len) |
| @@ -6158,7 +6156,7 @@ static int nfs4_xattr_get_nfs4_label(struct dentry *dentry, const char *key, | |||
| 6158 | void *buf, size_t buflen, int type) | 6156 | void *buf, size_t buflen, int type) |
| 6159 | { | 6157 | { |
| 6160 | if (security_ismaclabel(key)) | 6158 | if (security_ismaclabel(key)) |
| 6161 | return nfs4_get_security_label(dentry->d_inode, buf, buflen); | 6159 | return nfs4_get_security_label(d_inode(dentry), buf, buflen); |
| 6162 | return -EOPNOTSUPP; | 6160 | return -EOPNOTSUPP; |
| 6163 | } | 6161 | } |
| 6164 | 6162 | ||
| @@ -6168,10 +6166,10 @@ static size_t nfs4_xattr_list_nfs4_label(struct dentry *dentry, char *list, | |||
| 6168 | { | 6166 | { |
| 6169 | size_t len = 0; | 6167 | size_t len = 0; |
| 6170 | 6168 | ||
| 6171 | if (nfs_server_capable(dentry->d_inode, NFS_CAP_SECURITY_LABEL)) { | 6169 | if (nfs_server_capable(d_inode(dentry), NFS_CAP_SECURITY_LABEL)) { |
| 6172 | len = security_inode_listsecurity(dentry->d_inode, NULL, 0); | 6170 | len = security_inode_listsecurity(d_inode(dentry), NULL, 0); |
| 6173 | if (list && len <= list_len) | 6171 | if (list && len <= list_len) |
| 6174 | security_inode_listsecurity(dentry->d_inode, list, len); | 6172 | security_inode_listsecurity(d_inode(dentry), list, len); |
| 6175 | } | 6173 | } |
| 6176 | return len; | 6174 | return len; |
| 6177 | } | 6175 | } |
| @@ -7944,6 +7942,8 @@ _nfs4_proc_getdeviceinfo(struct nfs_server *server, | |||
| 7944 | { | 7942 | { |
| 7945 | struct nfs4_getdeviceinfo_args args = { | 7943 | struct nfs4_getdeviceinfo_args args = { |
| 7946 | .pdev = pdev, | 7944 | .pdev = pdev, |
| 7945 | .notify_types = NOTIFY_DEVICEID4_CHANGE | | ||
| 7946 | NOTIFY_DEVICEID4_DELETE, | ||
| 7947 | }; | 7947 | }; |
| 7948 | struct nfs4_getdeviceinfo_res res = { | 7948 | struct nfs4_getdeviceinfo_res res = { |
| 7949 | .pdev = pdev, | 7949 | .pdev = pdev, |
| @@ -7958,6 +7958,11 @@ _nfs4_proc_getdeviceinfo(struct nfs_server *server, | |||
| 7958 | 7958 | ||
| 7959 | dprintk("--> %s\n", __func__); | 7959 | dprintk("--> %s\n", __func__); |
| 7960 | status = nfs4_call_sync(server->client, server, &msg, &args.seq_args, &res.seq_res, 0); | 7960 | status = nfs4_call_sync(server->client, server, &msg, &args.seq_args, &res.seq_res, 0); |
| 7961 | if (res.notification & ~args.notify_types) | ||
| 7962 | dprintk("%s: unsupported notification\n", __func__); | ||
| 7963 | if (res.notification != args.notify_types) | ||
| 7964 | pdev->nocache = 1; | ||
| 7965 | |||
| 7961 | dprintk("<-- %s status=%d\n", __func__, status); | 7966 | dprintk("<-- %s status=%d\n", __func__, status); |
| 7962 | 7967 | ||
| 7963 | return status; | 7968 | return status; |
diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c index f95e3b58bbc3..2782cfca2265 100644 --- a/fs/nfs/nfs4state.c +++ b/fs/nfs/nfs4state.c | |||
| @@ -42,7 +42,6 @@ | |||
| 42 | #include <linux/slab.h> | 42 | #include <linux/slab.h> |
| 43 | #include <linux/fs.h> | 43 | #include <linux/fs.h> |
| 44 | #include <linux/nfs_fs.h> | 44 | #include <linux/nfs_fs.h> |
| 45 | #include <linux/nfs_idmap.h> | ||
| 46 | #include <linux/kthread.h> | 45 | #include <linux/kthread.h> |
| 47 | #include <linux/module.h> | 46 | #include <linux/module.h> |
| 48 | #include <linux/random.h> | 47 | #include <linux/random.h> |
| @@ -57,6 +56,7 @@ | |||
| 57 | #include "callback.h" | 56 | #include "callback.h" |
| 58 | #include "delegation.h" | 57 | #include "delegation.h" |
| 59 | #include "internal.h" | 58 | #include "internal.h" |
| 59 | #include "nfs4idmap.h" | ||
| 60 | #include "nfs4session.h" | 60 | #include "nfs4session.h" |
| 61 | #include "pnfs.h" | 61 | #include "pnfs.h" |
| 62 | #include "netns.h" | 62 | #include "netns.h" |
| @@ -1902,7 +1902,7 @@ static int nfs4_try_migration(struct nfs_server *server, struct rpc_cred *cred) | |||
| 1902 | goto out; | 1902 | goto out; |
| 1903 | } | 1903 | } |
| 1904 | 1904 | ||
| 1905 | inode = server->super->s_root->d_inode; | 1905 | inode = d_inode(server->super->s_root); |
| 1906 | result = nfs4_proc_get_locations(inode, locations, page, cred); | 1906 | result = nfs4_proc_get_locations(inode, locations, page, cred); |
| 1907 | if (result) { | 1907 | if (result) { |
| 1908 | dprintk("<-- %s: failed to retrieve fs_locations: %d\n", | 1908 | dprintk("<-- %s: failed to retrieve fs_locations: %d\n", |
| @@ -2021,7 +2021,7 @@ restart: | |||
| 2021 | 2021 | ||
| 2022 | rcu_read_unlock(); | 2022 | rcu_read_unlock(); |
| 2023 | 2023 | ||
| 2024 | inode = server->super->s_root->d_inode; | 2024 | inode = d_inode(server->super->s_root); |
| 2025 | status = nfs4_proc_fsid_present(inode, cred); | 2025 | status = nfs4_proc_fsid_present(inode, cred); |
| 2026 | if (status != -NFS4ERR_MOVED) | 2026 | if (status != -NFS4ERR_MOVED) |
| 2027 | goto restart; /* wasn't this one */ | 2027 | goto restart; /* wasn't this one */ |
diff --git a/fs/nfs/nfs4super.c b/fs/nfs/nfs4super.c index 75090feeafad..6fb7cb6b3f4b 100644 --- a/fs/nfs/nfs4super.c +++ b/fs/nfs/nfs4super.c | |||
| @@ -3,12 +3,12 @@ | |||
| 3 | */ | 3 | */ |
| 4 | #include <linux/init.h> | 4 | #include <linux/init.h> |
| 5 | #include <linux/module.h> | 5 | #include <linux/module.h> |
| 6 | #include <linux/nfs_idmap.h> | ||
| 7 | #include <linux/nfs4_mount.h> | 6 | #include <linux/nfs4_mount.h> |
| 8 | #include <linux/nfs_fs.h> | 7 | #include <linux/nfs_fs.h> |
| 9 | #include "delegation.h" | 8 | #include "delegation.h" |
| 10 | #include "internal.h" | 9 | #include "internal.h" |
| 11 | #include "nfs4_fs.h" | 10 | #include "nfs4_fs.h" |
| 11 | #include "nfs4idmap.h" | ||
| 12 | #include "dns_resolve.h" | 12 | #include "dns_resolve.h" |
| 13 | #include "pnfs.h" | 13 | #include "pnfs.h" |
| 14 | #include "nfs.h" | 14 | #include "nfs.h" |
| @@ -91,10 +91,11 @@ static void nfs4_evict_inode(struct inode *inode) | |||
| 91 | { | 91 | { |
| 92 | truncate_inode_pages_final(&inode->i_data); | 92 | truncate_inode_pages_final(&inode->i_data); |
| 93 | clear_inode(inode); | 93 | clear_inode(inode); |
| 94 | pnfs_return_layout(inode); | ||
| 95 | pnfs_destroy_layout(NFS_I(inode)); | ||
| 96 | /* If we are holding a delegation, return it! */ | 94 | /* If we are holding a delegation, return it! */ |
| 97 | nfs_inode_return_delegation_noreclaim(inode); | 95 | nfs_inode_return_delegation_noreclaim(inode); |
| 96 | /* Note that above delegreturn would trigger pnfs return-on-close */ | ||
| 97 | pnfs_return_layout(inode); | ||
| 98 | pnfs_destroy_layout(NFS_I(inode)); | ||
| 98 | /* First call standard NFS clear_inode() code */ | 99 | /* First call standard NFS clear_inode() code */ |
| 99 | nfs_clear_inode(inode); | 100 | nfs_clear_inode(inode); |
| 100 | } | 101 | } |
diff --git a/fs/nfs/nfs4sysctl.c b/fs/nfs/nfs4sysctl.c index b6ebe7e445f6..0fbd3ab1be22 100644 --- a/fs/nfs/nfs4sysctl.c +++ b/fs/nfs/nfs4sysctl.c | |||
| @@ -6,10 +6,10 @@ | |||
| 6 | * Copyright (c) 2006 Trond Myklebust <Trond.Myklebust@netapp.com> | 6 | * Copyright (c) 2006 Trond Myklebust <Trond.Myklebust@netapp.com> |
| 7 | */ | 7 | */ |
| 8 | #include <linux/sysctl.h> | 8 | #include <linux/sysctl.h> |
| 9 | #include <linux/nfs_idmap.h> | ||
| 10 | #include <linux/nfs_fs.h> | 9 | #include <linux/nfs_fs.h> |
| 11 | 10 | ||
| 12 | #include "nfs4_fs.h" | 11 | #include "nfs4_fs.h" |
| 12 | #include "nfs4idmap.h" | ||
| 13 | #include "callback.h" | 13 | #include "callback.h" |
| 14 | 14 | ||
| 15 | static const int nfs_set_port_min = 0; | 15 | static const int nfs_set_port_min = 0; |
diff --git a/fs/nfs/nfs4trace.h b/fs/nfs/nfs4trace.h index 1c32adbe728d..470af1a78bec 100644 --- a/fs/nfs/nfs4trace.h +++ b/fs/nfs/nfs4trace.h | |||
| @@ -418,7 +418,7 @@ DECLARE_EVENT_CLASS(nfs4_open_event, | |||
| 418 | __entry->fileid = 0; | 418 | __entry->fileid = 0; |
| 419 | __entry->fhandle = 0; | 419 | __entry->fhandle = 0; |
| 420 | } | 420 | } |
| 421 | __entry->dir = NFS_FILEID(ctx->dentry->d_parent->d_inode); | 421 | __entry->dir = NFS_FILEID(d_inode(ctx->dentry->d_parent)); |
| 422 | __assign_str(name, ctx->dentry->d_name.name); | 422 | __assign_str(name, ctx->dentry->d_name.name); |
| 423 | ), | 423 | ), |
| 424 | 424 | ||
| @@ -1110,7 +1110,7 @@ TRACE_EVENT(nfs4_layoutget, | |||
| 1110 | ), | 1110 | ), |
| 1111 | 1111 | ||
| 1112 | TP_fast_assign( | 1112 | TP_fast_assign( |
| 1113 | const struct inode *inode = ctx->dentry->d_inode; | 1113 | const struct inode *inode = d_inode(ctx->dentry); |
| 1114 | __entry->dev = inode->i_sb->s_dev; | 1114 | __entry->dev = inode->i_sb->s_dev; |
| 1115 | __entry->fileid = NFS_FILEID(inode); | 1115 | __entry->fileid = NFS_FILEID(inode); |
| 1116 | __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode)); | 1116 | __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode)); |
diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c index 5c399ec41079..0aea97841d30 100644 --- a/fs/nfs/nfs4xdr.c +++ b/fs/nfs/nfs4xdr.c | |||
| @@ -52,10 +52,10 @@ | |||
| 52 | #include <linux/nfs.h> | 52 | #include <linux/nfs.h> |
| 53 | #include <linux/nfs4.h> | 53 | #include <linux/nfs4.h> |
| 54 | #include <linux/nfs_fs.h> | 54 | #include <linux/nfs_fs.h> |
| 55 | #include <linux/nfs_idmap.h> | ||
| 56 | 55 | ||
| 57 | #include "nfs4_fs.h" | 56 | #include "nfs4_fs.h" |
| 58 | #include "internal.h" | 57 | #include "internal.h" |
| 58 | #include "nfs4idmap.h" | ||
| 59 | #include "nfs4session.h" | 59 | #include "nfs4session.h" |
| 60 | #include "pnfs.h" | 60 | #include "pnfs.h" |
| 61 | #include "netns.h" | 61 | #include "netns.h" |
| @@ -1920,7 +1920,7 @@ encode_getdeviceinfo(struct xdr_stream *xdr, | |||
| 1920 | 1920 | ||
| 1921 | p = reserve_space(xdr, 4 + 4); | 1921 | p = reserve_space(xdr, 4 + 4); |
| 1922 | *p++ = cpu_to_be32(1); /* bitmap length */ | 1922 | *p++ = cpu_to_be32(1); /* bitmap length */ |
| 1923 | *p++ = cpu_to_be32(NOTIFY_DEVICEID4_CHANGE | NOTIFY_DEVICEID4_DELETE); | 1923 | *p++ = cpu_to_be32(args->notify_types); |
| 1924 | } | 1924 | } |
| 1925 | 1925 | ||
| 1926 | static void | 1926 | static void |
| @@ -5753,8 +5753,9 @@ out_overflow: | |||
| 5753 | 5753 | ||
| 5754 | #if defined(CONFIG_NFS_V4_1) | 5754 | #if defined(CONFIG_NFS_V4_1) |
| 5755 | static int decode_getdeviceinfo(struct xdr_stream *xdr, | 5755 | static int decode_getdeviceinfo(struct xdr_stream *xdr, |
| 5756 | struct pnfs_device *pdev) | 5756 | struct nfs4_getdeviceinfo_res *res) |
| 5757 | { | 5757 | { |
| 5758 | struct pnfs_device *pdev = res->pdev; | ||
| 5758 | __be32 *p; | 5759 | __be32 *p; |
| 5759 | uint32_t len, type; | 5760 | uint32_t len, type; |
| 5760 | int status; | 5761 | int status; |
| @@ -5802,12 +5803,7 @@ static int decode_getdeviceinfo(struct xdr_stream *xdr, | |||
| 5802 | if (unlikely(!p)) | 5803 | if (unlikely(!p)) |
| 5803 | goto out_overflow; | 5804 | goto out_overflow; |
| 5804 | 5805 | ||
| 5805 | if (be32_to_cpup(p++) & | 5806 | res->notification = be32_to_cpup(p++); |
| 5806 | ~(NOTIFY_DEVICEID4_CHANGE | NOTIFY_DEVICEID4_DELETE)) { | ||
| 5807 | dprintk("%s: unsupported notification\n", | ||
| 5808 | __func__); | ||
| 5809 | } | ||
| 5810 | |||
| 5811 | for (i = 1; i < len; i++) { | 5807 | for (i = 1; i < len; i++) { |
| 5812 | if (be32_to_cpup(p++)) { | 5808 | if (be32_to_cpup(p++)) { |
| 5813 | dprintk("%s: unsupported notification\n", | 5809 | dprintk("%s: unsupported notification\n", |
| @@ -7061,7 +7057,7 @@ static int nfs4_xdr_dec_getdeviceinfo(struct rpc_rqst *rqstp, | |||
| 7061 | status = decode_sequence(xdr, &res->seq_res, rqstp); | 7057 | status = decode_sequence(xdr, &res->seq_res, rqstp); |
| 7062 | if (status != 0) | 7058 | if (status != 0) |
| 7063 | goto out; | 7059 | goto out; |
| 7064 | status = decode_getdeviceinfo(xdr, res->pdev); | 7060 | status = decode_getdeviceinfo(xdr, res); |
| 7065 | out: | 7061 | out: |
| 7066 | return status; | 7062 | return status; |
| 7067 | } | 7063 | } |
| @@ -7365,6 +7361,11 @@ nfs4_stat_to_errno(int stat) | |||
| 7365 | .p_name = #proc, \ | 7361 | .p_name = #proc, \ |
| 7366 | } | 7362 | } |
| 7367 | 7363 | ||
| 7364 | #define STUB(proc) \ | ||
| 7365 | [NFSPROC4_CLNT_##proc] = { \ | ||
| 7366 | .p_name = #proc, \ | ||
| 7367 | } | ||
| 7368 | |||
| 7368 | struct rpc_procinfo nfs4_procedures[] = { | 7369 | struct rpc_procinfo nfs4_procedures[] = { |
| 7369 | PROC(READ, enc_read, dec_read), | 7370 | PROC(READ, enc_read, dec_read), |
| 7370 | PROC(WRITE, enc_write, dec_write), | 7371 | PROC(WRITE, enc_write, dec_write), |
| @@ -7417,6 +7418,7 @@ struct rpc_procinfo nfs4_procedures[] = { | |||
| 7417 | PROC(SECINFO_NO_NAME, enc_secinfo_no_name, dec_secinfo_no_name), | 7418 | PROC(SECINFO_NO_NAME, enc_secinfo_no_name, dec_secinfo_no_name), |
| 7418 | PROC(TEST_STATEID, enc_test_stateid, dec_test_stateid), | 7419 | PROC(TEST_STATEID, enc_test_stateid, dec_test_stateid), |
| 7419 | PROC(FREE_STATEID, enc_free_stateid, dec_free_stateid), | 7420 | PROC(FREE_STATEID, enc_free_stateid, dec_free_stateid), |
| 7421 | STUB(GETDEVICELIST), | ||
| 7420 | PROC(BIND_CONN_TO_SESSION, | 7422 | PROC(BIND_CONN_TO_SESSION, |
| 7421 | enc_bind_conn_to_session, dec_bind_conn_to_session), | 7423 | enc_bind_conn_to_session, dec_bind_conn_to_session), |
| 7422 | PROC(DESTROY_CLIENTID, enc_destroy_clientid, dec_destroy_clientid), | 7424 | PROC(DESTROY_CLIENTID, enc_destroy_clientid, dec_destroy_clientid), |
diff --git a/fs/nfs/nfstrace.c b/fs/nfs/nfstrace.c index 4eb0aead69b6..c74f7af23d77 100644 --- a/fs/nfs/nfstrace.c +++ b/fs/nfs/nfstrace.c | |||
| @@ -7,3 +7,6 @@ | |||
| 7 | 7 | ||
| 8 | #define CREATE_TRACE_POINTS | 8 | #define CREATE_TRACE_POINTS |
| 9 | #include "nfstrace.h" | 9 | #include "nfstrace.h" |
| 10 | |||
| 11 | EXPORT_TRACEPOINT_SYMBOL_GPL(nfs_fsync_enter); | ||
| 12 | EXPORT_TRACEPOINT_SYMBOL_GPL(nfs_fsync_exit); | ||
diff --git a/fs/nfs/objlayout/objio_osd.c b/fs/nfs/objlayout/objio_osd.c index 24e1d7403c0b..5aaed363556a 100644 --- a/fs/nfs/objlayout/objio_osd.c +++ b/fs/nfs/objlayout/objio_osd.c | |||
| @@ -57,7 +57,7 @@ objio_free_deviceid_node(struct nfs4_deviceid_node *d) | |||
| 57 | 57 | ||
| 58 | dprintk("%s: free od=%p\n", __func__, de->od.od); | 58 | dprintk("%s: free od=%p\n", __func__, de->od.od); |
| 59 | osduld_put_device(de->od.od); | 59 | osduld_put_device(de->od.od); |
| 60 | kfree(de); | 60 | kfree_rcu(d, rcu); |
| 61 | } | 61 | } |
| 62 | 62 | ||
| 63 | struct objio_segment { | 63 | struct objio_segment { |
| @@ -637,6 +637,8 @@ static struct pnfs_layoutdriver_type objlayout_type = { | |||
| 637 | .pg_read_ops = &objio_pg_read_ops, | 637 | .pg_read_ops = &objio_pg_read_ops, |
| 638 | .pg_write_ops = &objio_pg_write_ops, | 638 | .pg_write_ops = &objio_pg_write_ops, |
| 639 | 639 | ||
| 640 | .sync = pnfs_generic_sync, | ||
| 641 | |||
| 640 | .free_deviceid_node = objio_free_deviceid_node, | 642 | .free_deviceid_node = objio_free_deviceid_node, |
| 641 | 643 | ||
| 642 | .encode_layoutcommit = objlayout_encode_layoutcommit, | 644 | .encode_layoutcommit = objlayout_encode_layoutcommit, |
diff --git a/fs/nfs/pagelist.c b/fs/nfs/pagelist.c index d57190a0d533..282b39369510 100644 --- a/fs/nfs/pagelist.c +++ b/fs/nfs/pagelist.c | |||
| @@ -938,7 +938,7 @@ static bool nfs_can_coalesce_requests(struct nfs_page *prev, | |||
| 938 | if (prev) { | 938 | if (prev) { |
| 939 | if (!nfs_match_open_context(req->wb_context, prev->wb_context)) | 939 | if (!nfs_match_open_context(req->wb_context, prev->wb_context)) |
| 940 | return false; | 940 | return false; |
| 941 | flctx = req->wb_context->dentry->d_inode->i_flctx; | 941 | flctx = d_inode(req->wb_context->dentry)->i_flctx; |
| 942 | if (flctx != NULL && | 942 | if (flctx != NULL && |
| 943 | !(list_empty_careful(&flctx->flc_posix) && | 943 | !(list_empty_careful(&flctx->flc_posix) && |
| 944 | list_empty_careful(&flctx->flc_flock)) && | 944 | list_empty_careful(&flctx->flc_flock)) && |
diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c index 4f802b02fbb9..230606243be6 100644 --- a/fs/nfs/pnfs.c +++ b/fs/nfs/pnfs.c | |||
| @@ -1090,6 +1090,7 @@ bool pnfs_roc(struct inode *ino) | |||
| 1090 | pnfs_get_layout_hdr(lo); /* matched in pnfs_roc_release */ | 1090 | pnfs_get_layout_hdr(lo); /* matched in pnfs_roc_release */ |
| 1091 | spin_unlock(&ino->i_lock); | 1091 | spin_unlock(&ino->i_lock); |
| 1092 | pnfs_free_lseg_list(&tmp_list); | 1092 | pnfs_free_lseg_list(&tmp_list); |
| 1093 | pnfs_layoutcommit_inode(ino, true); | ||
| 1093 | return true; | 1094 | return true; |
| 1094 | 1095 | ||
| 1095 | out_noroc: | 1096 | out_noroc: |
| @@ -1104,8 +1105,10 @@ out_noroc: | |||
| 1104 | } | 1105 | } |
| 1105 | } | 1106 | } |
| 1106 | spin_unlock(&ino->i_lock); | 1107 | spin_unlock(&ino->i_lock); |
| 1107 | if (layoutreturn) | 1108 | if (layoutreturn) { |
| 1109 | pnfs_layoutcommit_inode(ino, true); | ||
| 1108 | pnfs_send_layoutreturn(lo, stateid, IOMODE_ANY, true); | 1110 | pnfs_send_layoutreturn(lo, stateid, IOMODE_ANY, true); |
| 1111 | } | ||
| 1109 | return false; | 1112 | return false; |
| 1110 | } | 1113 | } |
| 1111 | 1114 | ||
| @@ -1841,7 +1844,8 @@ void pnfs_ld_write_done(struct nfs_pgio_header *hdr) | |||
| 1841 | { | 1844 | { |
| 1842 | trace_nfs4_pnfs_write(hdr, hdr->pnfs_error); | 1845 | trace_nfs4_pnfs_write(hdr, hdr->pnfs_error); |
| 1843 | if (!hdr->pnfs_error) { | 1846 | if (!hdr->pnfs_error) { |
| 1844 | pnfs_set_layoutcommit(hdr); | 1847 | pnfs_set_layoutcommit(hdr->inode, hdr->lseg, |
| 1848 | hdr->mds_offset + hdr->res.count); | ||
| 1845 | hdr->mds_ops->rpc_call_done(&hdr->task, hdr); | 1849 | hdr->mds_ops->rpc_call_done(&hdr->task, hdr); |
| 1846 | } else | 1850 | } else |
| 1847 | pnfs_ld_handle_write_error(hdr); | 1851 | pnfs_ld_handle_write_error(hdr); |
| @@ -1902,7 +1906,6 @@ static void pnfs_writehdr_free(struct nfs_pgio_header *hdr) | |||
| 1902 | pnfs_put_lseg(hdr->lseg); | 1906 | pnfs_put_lseg(hdr->lseg); |
| 1903 | nfs_pgio_header_free(hdr); | 1907 | nfs_pgio_header_free(hdr); |
| 1904 | } | 1908 | } |
| 1905 | EXPORT_SYMBOL_GPL(pnfs_writehdr_free); | ||
| 1906 | 1909 | ||
| 1907 | int | 1910 | int |
| 1908 | pnfs_generic_pg_writepages(struct nfs_pageio_descriptor *desc) | 1911 | pnfs_generic_pg_writepages(struct nfs_pageio_descriptor *desc) |
| @@ -2032,7 +2035,6 @@ static void pnfs_readhdr_free(struct nfs_pgio_header *hdr) | |||
| 2032 | pnfs_put_lseg(hdr->lseg); | 2035 | pnfs_put_lseg(hdr->lseg); |
| 2033 | nfs_pgio_header_free(hdr); | 2036 | nfs_pgio_header_free(hdr); |
| 2034 | } | 2037 | } |
| 2035 | EXPORT_SYMBOL_GPL(pnfs_readhdr_free); | ||
| 2036 | 2038 | ||
| 2037 | int | 2039 | int |
| 2038 | pnfs_generic_pg_readpages(struct nfs_pageio_descriptor *desc) | 2040 | pnfs_generic_pg_readpages(struct nfs_pageio_descriptor *desc) |
| @@ -2099,64 +2101,34 @@ void pnfs_set_lo_fail(struct pnfs_layout_segment *lseg) | |||
| 2099 | EXPORT_SYMBOL_GPL(pnfs_set_lo_fail); | 2101 | EXPORT_SYMBOL_GPL(pnfs_set_lo_fail); |
| 2100 | 2102 | ||
| 2101 | void | 2103 | void |
| 2102 | pnfs_set_layoutcommit(struct nfs_pgio_header *hdr) | 2104 | pnfs_set_layoutcommit(struct inode *inode, struct pnfs_layout_segment *lseg, |
| 2105 | loff_t end_pos) | ||
| 2103 | { | 2106 | { |
| 2104 | struct inode *inode = hdr->inode; | ||
| 2105 | struct nfs_inode *nfsi = NFS_I(inode); | 2107 | struct nfs_inode *nfsi = NFS_I(inode); |
| 2106 | loff_t end_pos = hdr->mds_offset + hdr->res.count; | ||
| 2107 | bool mark_as_dirty = false; | 2108 | bool mark_as_dirty = false; |
| 2108 | 2109 | ||
| 2109 | spin_lock(&inode->i_lock); | 2110 | spin_lock(&inode->i_lock); |
| 2110 | if (!test_and_set_bit(NFS_INO_LAYOUTCOMMIT, &nfsi->flags)) { | 2111 | if (!test_and_set_bit(NFS_INO_LAYOUTCOMMIT, &nfsi->flags)) { |
| 2111 | mark_as_dirty = true; | ||
| 2112 | dprintk("%s: Set layoutcommit for inode %lu ", | ||
| 2113 | __func__, inode->i_ino); | ||
| 2114 | } | ||
| 2115 | if (!test_and_set_bit(NFS_LSEG_LAYOUTCOMMIT, &hdr->lseg->pls_flags)) { | ||
| 2116 | /* references matched in nfs4_layoutcommit_release */ | ||
| 2117 | pnfs_get_lseg(hdr->lseg); | ||
| 2118 | } | ||
| 2119 | if (end_pos > nfsi->layout->plh_lwb) | ||
| 2120 | nfsi->layout->plh_lwb = end_pos; | 2112 | nfsi->layout->plh_lwb = end_pos; |
| 2121 | spin_unlock(&inode->i_lock); | ||
| 2122 | dprintk("%s: lseg %p end_pos %llu\n", | ||
| 2123 | __func__, hdr->lseg, nfsi->layout->plh_lwb); | ||
| 2124 | |||
| 2125 | /* if pnfs_layoutcommit_inode() runs between inode locks, the next one | ||
| 2126 | * will be a noop because NFS_INO_LAYOUTCOMMIT will not be set */ | ||
| 2127 | if (mark_as_dirty) | ||
| 2128 | mark_inode_dirty_sync(inode); | ||
| 2129 | } | ||
| 2130 | EXPORT_SYMBOL_GPL(pnfs_set_layoutcommit); | ||
| 2131 | |||
| 2132 | void pnfs_commit_set_layoutcommit(struct nfs_commit_data *data) | ||
| 2133 | { | ||
| 2134 | struct inode *inode = data->inode; | ||
| 2135 | struct nfs_inode *nfsi = NFS_I(inode); | ||
| 2136 | bool mark_as_dirty = false; | ||
| 2137 | |||
| 2138 | spin_lock(&inode->i_lock); | ||
| 2139 | if (!test_and_set_bit(NFS_INO_LAYOUTCOMMIT, &nfsi->flags)) { | ||
| 2140 | mark_as_dirty = true; | 2113 | mark_as_dirty = true; |
| 2141 | dprintk("%s: Set layoutcommit for inode %lu ", | 2114 | dprintk("%s: Set layoutcommit for inode %lu ", |
| 2142 | __func__, inode->i_ino); | 2115 | __func__, inode->i_ino); |
| 2143 | } | 2116 | } else if (end_pos > nfsi->layout->plh_lwb) |
| 2144 | if (!test_and_set_bit(NFS_LSEG_LAYOUTCOMMIT, &data->lseg->pls_flags)) { | 2117 | nfsi->layout->plh_lwb = end_pos; |
| 2118 | if (!test_and_set_bit(NFS_LSEG_LAYOUTCOMMIT, &lseg->pls_flags)) { | ||
| 2145 | /* references matched in nfs4_layoutcommit_release */ | 2119 | /* references matched in nfs4_layoutcommit_release */ |
| 2146 | pnfs_get_lseg(data->lseg); | 2120 | pnfs_get_lseg(lseg); |
| 2147 | } | 2121 | } |
| 2148 | if (data->lwb > nfsi->layout->plh_lwb) | ||
| 2149 | nfsi->layout->plh_lwb = data->lwb; | ||
| 2150 | spin_unlock(&inode->i_lock); | 2122 | spin_unlock(&inode->i_lock); |
| 2151 | dprintk("%s: lseg %p end_pos %llu\n", | 2123 | dprintk("%s: lseg %p end_pos %llu\n", |
| 2152 | __func__, data->lseg, nfsi->layout->plh_lwb); | 2124 | __func__, lseg, nfsi->layout->plh_lwb); |
| 2153 | 2125 | ||
| 2154 | /* if pnfs_layoutcommit_inode() runs between inode locks, the next one | 2126 | /* if pnfs_layoutcommit_inode() runs between inode locks, the next one |
| 2155 | * will be a noop because NFS_INO_LAYOUTCOMMIT will not be set */ | 2127 | * will be a noop because NFS_INO_LAYOUTCOMMIT will not be set */ |
| 2156 | if (mark_as_dirty) | 2128 | if (mark_as_dirty) |
| 2157 | mark_inode_dirty_sync(inode); | 2129 | mark_inode_dirty_sync(inode); |
| 2158 | } | 2130 | } |
| 2159 | EXPORT_SYMBOL_GPL(pnfs_commit_set_layoutcommit); | 2131 | EXPORT_SYMBOL_GPL(pnfs_set_layoutcommit); |
| 2160 | 2132 | ||
| 2161 | void pnfs_cleanup_layoutcommit(struct nfs4_layoutcommit_data *data) | 2133 | void pnfs_cleanup_layoutcommit(struct nfs4_layoutcommit_data *data) |
| 2162 | { | 2134 | { |
| @@ -2216,7 +2188,6 @@ pnfs_layoutcommit_inode(struct inode *inode, bool sync) | |||
| 2216 | pnfs_list_write_lseg(inode, &data->lseg_list); | 2188 | pnfs_list_write_lseg(inode, &data->lseg_list); |
| 2217 | 2189 | ||
| 2218 | end_pos = nfsi->layout->plh_lwb; | 2190 | end_pos = nfsi->layout->plh_lwb; |
| 2219 | nfsi->layout->plh_lwb = 0; | ||
| 2220 | 2191 | ||
| 2221 | nfs4_stateid_copy(&data->args.stateid, &nfsi->layout->plh_stateid); | 2192 | nfs4_stateid_copy(&data->args.stateid, &nfsi->layout->plh_stateid); |
| 2222 | spin_unlock(&inode->i_lock); | 2193 | spin_unlock(&inode->i_lock); |
| @@ -2233,11 +2204,11 @@ pnfs_layoutcommit_inode(struct inode *inode, bool sync) | |||
| 2233 | status = ld->prepare_layoutcommit(&data->args); | 2204 | status = ld->prepare_layoutcommit(&data->args); |
| 2234 | if (status) { | 2205 | if (status) { |
| 2235 | spin_lock(&inode->i_lock); | 2206 | spin_lock(&inode->i_lock); |
| 2236 | if (end_pos < nfsi->layout->plh_lwb) | 2207 | set_bit(NFS_INO_LAYOUTCOMMIT, &nfsi->flags); |
| 2208 | if (end_pos > nfsi->layout->plh_lwb) | ||
| 2237 | nfsi->layout->plh_lwb = end_pos; | 2209 | nfsi->layout->plh_lwb = end_pos; |
| 2238 | spin_unlock(&inode->i_lock); | 2210 | spin_unlock(&inode->i_lock); |
| 2239 | put_rpccred(data->cred); | 2211 | put_rpccred(data->cred); |
| 2240 | set_bit(NFS_INO_LAYOUTCOMMIT, &nfsi->flags); | ||
| 2241 | goto clear_layoutcommitting; | 2212 | goto clear_layoutcommitting; |
| 2242 | } | 2213 | } |
| 2243 | } | 2214 | } |
| @@ -2258,6 +2229,13 @@ clear_layoutcommitting: | |||
| 2258 | } | 2229 | } |
| 2259 | EXPORT_SYMBOL_GPL(pnfs_layoutcommit_inode); | 2230 | EXPORT_SYMBOL_GPL(pnfs_layoutcommit_inode); |
| 2260 | 2231 | ||
| 2232 | int | ||
| 2233 | pnfs_generic_sync(struct inode *inode, bool datasync) | ||
| 2234 | { | ||
| 2235 | return pnfs_layoutcommit_inode(inode, true); | ||
| 2236 | } | ||
| 2237 | EXPORT_SYMBOL_GPL(pnfs_generic_sync); | ||
| 2238 | |||
| 2261 | struct nfs4_threshold *pnfs_mdsthreshold_alloc(void) | 2239 | struct nfs4_threshold *pnfs_mdsthreshold_alloc(void) |
| 2262 | { | 2240 | { |
| 2263 | struct nfs4_threshold *thp; | 2241 | struct nfs4_threshold *thp; |
diff --git a/fs/nfs/pnfs.h b/fs/nfs/pnfs.h index 635f0865671c..1e6308f82fc3 100644 --- a/fs/nfs/pnfs.h +++ b/fs/nfs/pnfs.h | |||
| @@ -155,6 +155,8 @@ struct pnfs_layoutdriver_type { | |||
| 155 | int how, | 155 | int how, |
| 156 | struct nfs_commit_info *cinfo); | 156 | struct nfs_commit_info *cinfo); |
| 157 | 157 | ||
| 158 | int (*sync)(struct inode *inode, bool datasync); | ||
| 159 | |||
| 158 | /* | 160 | /* |
| 159 | * Return PNFS_ATTEMPTED to indicate the layout code has attempted | 161 | * Return PNFS_ATTEMPTED to indicate the layout code has attempted |
| 160 | * I/O, else return PNFS_NOT_ATTEMPTED to fall back to normal NFS | 162 | * I/O, else return PNFS_NOT_ATTEMPTED to fall back to normal NFS |
| @@ -203,6 +205,7 @@ struct pnfs_device { | |||
| 203 | struct page **pages; | 205 | struct page **pages; |
| 204 | unsigned int pgbase; | 206 | unsigned int pgbase; |
| 205 | unsigned int pglen; /* reply buffer length */ | 207 | unsigned int pglen; /* reply buffer length */ |
| 208 | unsigned char nocache : 1;/* May not be cached */ | ||
| 206 | }; | 209 | }; |
| 207 | 210 | ||
| 208 | #define NFS4_PNFS_GETDEVLIST_MAXNUM 16 | 211 | #define NFS4_PNFS_GETDEVLIST_MAXNUM 16 |
| @@ -263,10 +266,11 @@ bool pnfs_roc(struct inode *ino); | |||
| 263 | void pnfs_roc_release(struct inode *ino); | 266 | void pnfs_roc_release(struct inode *ino); |
| 264 | void pnfs_roc_set_barrier(struct inode *ino, u32 barrier); | 267 | void pnfs_roc_set_barrier(struct inode *ino, u32 barrier); |
| 265 | bool pnfs_roc_drain(struct inode *ino, u32 *barrier, struct rpc_task *task); | 268 | bool pnfs_roc_drain(struct inode *ino, u32 *barrier, struct rpc_task *task); |
| 266 | void pnfs_set_layoutcommit(struct nfs_pgio_header *); | 269 | void pnfs_set_layoutcommit(struct inode *, struct pnfs_layout_segment *, loff_t); |
| 267 | void pnfs_commit_set_layoutcommit(struct nfs_commit_data *data); | ||
| 268 | void pnfs_cleanup_layoutcommit(struct nfs4_layoutcommit_data *data); | 270 | void pnfs_cleanup_layoutcommit(struct nfs4_layoutcommit_data *data); |
| 269 | int pnfs_layoutcommit_inode(struct inode *inode, bool sync); | 271 | int pnfs_layoutcommit_inode(struct inode *inode, bool sync); |
| 272 | int pnfs_generic_sync(struct inode *inode, bool datasync); | ||
| 273 | int pnfs_nfs_generic_sync(struct inode *inode, bool datasync); | ||
| 270 | int _pnfs_return_layout(struct inode *); | 274 | int _pnfs_return_layout(struct inode *); |
| 271 | int pnfs_commit_and_return_layout(struct inode *); | 275 | int pnfs_commit_and_return_layout(struct inode *); |
| 272 | void pnfs_ld_write_done(struct nfs_pgio_header *); | 276 | void pnfs_ld_write_done(struct nfs_pgio_header *); |
| @@ -291,6 +295,7 @@ void pnfs_error_mark_layout_for_return(struct inode *inode, | |||
| 291 | enum { | 295 | enum { |
| 292 | NFS_DEVICEID_INVALID = 0, /* set when MDS clientid recalled */ | 296 | NFS_DEVICEID_INVALID = 0, /* set when MDS clientid recalled */ |
| 293 | NFS_DEVICEID_UNAVAILABLE, /* device temporarily unavailable */ | 297 | NFS_DEVICEID_UNAVAILABLE, /* device temporarily unavailable */ |
| 298 | NFS_DEVICEID_NOCACHE, /* device may not be cached */ | ||
| 294 | }; | 299 | }; |
| 295 | 300 | ||
| 296 | /* pnfs_dev.c */ | 301 | /* pnfs_dev.c */ |
| @@ -302,6 +307,7 @@ struct nfs4_deviceid_node { | |||
| 302 | unsigned long flags; | 307 | unsigned long flags; |
| 303 | unsigned long timestamp_unavailable; | 308 | unsigned long timestamp_unavailable; |
| 304 | struct nfs4_deviceid deviceid; | 309 | struct nfs4_deviceid deviceid; |
| 310 | struct rcu_head rcu; | ||
| 305 | atomic_t ref; | 311 | atomic_t ref; |
| 306 | }; | 312 | }; |
| 307 | 313 | ||
| @@ -426,7 +432,7 @@ static inline bool | |||
| 426 | pnfs_mark_request_commit(struct nfs_page *req, struct pnfs_layout_segment *lseg, | 432 | pnfs_mark_request_commit(struct nfs_page *req, struct pnfs_layout_segment *lseg, |
| 427 | struct nfs_commit_info *cinfo, u32 ds_commit_idx) | 433 | struct nfs_commit_info *cinfo, u32 ds_commit_idx) |
| 428 | { | 434 | { |
| 429 | struct inode *inode = req->wb_context->dentry->d_inode; | 435 | struct inode *inode = d_inode(req->wb_context->dentry); |
| 430 | struct pnfs_layoutdriver_type *ld = NFS_SERVER(inode)->pnfs_curr_ld; | 436 | struct pnfs_layoutdriver_type *ld = NFS_SERVER(inode)->pnfs_curr_ld; |
| 431 | 437 | ||
| 432 | if (lseg == NULL || ld->mark_request_commit == NULL) | 438 | if (lseg == NULL || ld->mark_request_commit == NULL) |
| @@ -438,7 +444,7 @@ pnfs_mark_request_commit(struct nfs_page *req, struct pnfs_layout_segment *lseg, | |||
| 438 | static inline bool | 444 | static inline bool |
| 439 | pnfs_clear_request_commit(struct nfs_page *req, struct nfs_commit_info *cinfo) | 445 | pnfs_clear_request_commit(struct nfs_page *req, struct nfs_commit_info *cinfo) |
| 440 | { | 446 | { |
| 441 | struct inode *inode = req->wb_context->dentry->d_inode; | 447 | struct inode *inode = d_inode(req->wb_context->dentry); |
| 442 | struct pnfs_layoutdriver_type *ld = NFS_SERVER(inode)->pnfs_curr_ld; | 448 | struct pnfs_layoutdriver_type *ld = NFS_SERVER(inode)->pnfs_curr_ld; |
| 443 | 449 | ||
| 444 | if (ld == NULL || ld->clear_request_commit == NULL) | 450 | if (ld == NULL || ld->clear_request_commit == NULL) |
| @@ -486,6 +492,14 @@ pnfs_ld_read_whole_page(struct inode *inode) | |||
| 486 | return NFS_SERVER(inode)->pnfs_curr_ld->flags & PNFS_READ_WHOLE_PAGE; | 492 | return NFS_SERVER(inode)->pnfs_curr_ld->flags & PNFS_READ_WHOLE_PAGE; |
| 487 | } | 493 | } |
| 488 | 494 | ||
| 495 | static inline int | ||
| 496 | pnfs_sync_inode(struct inode *inode, bool datasync) | ||
| 497 | { | ||
| 498 | if (!pnfs_enabled_sb(NFS_SERVER(inode))) | ||
| 499 | return 0; | ||
| 500 | return NFS_SERVER(inode)->pnfs_curr_ld->sync(inode, datasync); | ||
| 501 | } | ||
| 502 | |||
| 489 | static inline bool | 503 | static inline bool |
| 490 | pnfs_layoutcommit_outstanding(struct inode *inode) | 504 | pnfs_layoutcommit_outstanding(struct inode *inode) |
| 491 | { | 505 | { |
| @@ -568,6 +582,12 @@ pnfs_ld_read_whole_page(struct inode *inode) | |||
| 568 | return false; | 582 | return false; |
| 569 | } | 583 | } |
| 570 | 584 | ||
| 585 | static inline int | ||
| 586 | pnfs_sync_inode(struct inode *inode, bool datasync) | ||
| 587 | { | ||
| 588 | return 0; | ||
| 589 | } | ||
| 590 | |||
| 571 | static inline bool | 591 | static inline bool |
| 572 | pnfs_roc(struct inode *ino) | 592 | pnfs_roc(struct inode *ino) |
| 573 | { | 593 | { |
diff --git a/fs/nfs/pnfs_dev.c b/fs/nfs/pnfs_dev.c index aa2ec0015183..2961fcd7a2df 100644 --- a/fs/nfs/pnfs_dev.c +++ b/fs/nfs/pnfs_dev.c | |||
| @@ -149,6 +149,8 @@ nfs4_get_device_info(struct nfs_server *server, | |||
| 149 | */ | 149 | */ |
| 150 | d = server->pnfs_curr_ld->alloc_deviceid_node(server, pdev, | 150 | d = server->pnfs_curr_ld->alloc_deviceid_node(server, pdev, |
| 151 | gfp_flags); | 151 | gfp_flags); |
| 152 | if (d && pdev->nocache) | ||
| 153 | set_bit(NFS_DEVICEID_NOCACHE, &d->flags); | ||
| 152 | 154 | ||
| 153 | out_free_pages: | 155 | out_free_pages: |
| 154 | for (i = 0; i < max_pages; i++) | 156 | for (i = 0; i < max_pages; i++) |
| @@ -175,8 +177,8 @@ __nfs4_find_get_deviceid(struct nfs_server *server, | |||
| 175 | rcu_read_lock(); | 177 | rcu_read_lock(); |
| 176 | d = _lookup_deviceid(server->pnfs_curr_ld, server->nfs_client, id, | 178 | d = _lookup_deviceid(server->pnfs_curr_ld, server->nfs_client, id, |
| 177 | hash); | 179 | hash); |
| 178 | if (d != NULL) | 180 | if (d != NULL && !atomic_inc_not_zero(&d->ref)) |
| 179 | atomic_inc(&d->ref); | 181 | d = NULL; |
| 180 | rcu_read_unlock(); | 182 | rcu_read_unlock(); |
| 181 | return d; | 183 | return d; |
| 182 | } | 184 | } |
| @@ -235,12 +237,11 @@ nfs4_delete_deviceid(const struct pnfs_layoutdriver_type *ld, | |||
| 235 | return; | 237 | return; |
| 236 | } | 238 | } |
| 237 | hlist_del_init_rcu(&d->node); | 239 | hlist_del_init_rcu(&d->node); |
| 240 | clear_bit(NFS_DEVICEID_NOCACHE, &d->flags); | ||
| 238 | spin_unlock(&nfs4_deviceid_lock); | 241 | spin_unlock(&nfs4_deviceid_lock); |
| 239 | synchronize_rcu(); | ||
| 240 | 242 | ||
| 241 | /* balance the initial ref set in pnfs_insert_deviceid */ | 243 | /* balance the initial ref set in pnfs_insert_deviceid */ |
| 242 | if (atomic_dec_and_test(&d->ref)) | 244 | nfs4_put_deviceid_node(d); |
| 243 | d->ld->free_deviceid_node(d); | ||
| 244 | } | 245 | } |
| 245 | EXPORT_SYMBOL_GPL(nfs4_delete_deviceid); | 246 | EXPORT_SYMBOL_GPL(nfs4_delete_deviceid); |
| 246 | 247 | ||
| @@ -271,6 +272,11 @@ EXPORT_SYMBOL_GPL(nfs4_init_deviceid_node); | |||
| 271 | bool | 272 | bool |
| 272 | nfs4_put_deviceid_node(struct nfs4_deviceid_node *d) | 273 | nfs4_put_deviceid_node(struct nfs4_deviceid_node *d) |
| 273 | { | 274 | { |
| 275 | if (test_bit(NFS_DEVICEID_NOCACHE, &d->flags)) { | ||
| 276 | if (atomic_add_unless(&d->ref, -1, 2)) | ||
| 277 | return false; | ||
| 278 | nfs4_delete_deviceid(d->ld, d->nfs_client, &d->deviceid); | ||
| 279 | } | ||
| 274 | if (!atomic_dec_and_test(&d->ref)) | 280 | if (!atomic_dec_and_test(&d->ref)) |
| 275 | return false; | 281 | return false; |
| 276 | d->ld->free_deviceid_node(d); | 282 | d->ld->free_deviceid_node(d); |
| @@ -314,6 +320,7 @@ _deviceid_purge_client(const struct nfs_client *clp, long hash) | |||
| 314 | if (d->nfs_client == clp && atomic_read(&d->ref)) { | 320 | if (d->nfs_client == clp && atomic_read(&d->ref)) { |
| 315 | hlist_del_init_rcu(&d->node); | 321 | hlist_del_init_rcu(&d->node); |
| 316 | hlist_add_head(&d->tmpnode, &tmp); | 322 | hlist_add_head(&d->tmpnode, &tmp); |
| 323 | clear_bit(NFS_DEVICEID_NOCACHE, &d->flags); | ||
| 317 | } | 324 | } |
| 318 | rcu_read_unlock(); | 325 | rcu_read_unlock(); |
| 319 | spin_unlock(&nfs4_deviceid_lock); | 326 | spin_unlock(&nfs4_deviceid_lock); |
| @@ -321,12 +328,10 @@ _deviceid_purge_client(const struct nfs_client *clp, long hash) | |||
| 321 | if (hlist_empty(&tmp)) | 328 | if (hlist_empty(&tmp)) |
| 322 | return; | 329 | return; |
| 323 | 330 | ||
| 324 | synchronize_rcu(); | ||
| 325 | while (!hlist_empty(&tmp)) { | 331 | while (!hlist_empty(&tmp)) { |
| 326 | d = hlist_entry(tmp.first, struct nfs4_deviceid_node, tmpnode); | 332 | d = hlist_entry(tmp.first, struct nfs4_deviceid_node, tmpnode); |
| 327 | hlist_del(&d->tmpnode); | 333 | hlist_del(&d->tmpnode); |
| 328 | if (atomic_dec_and_test(&d->ref)) | 334 | nfs4_put_deviceid_node(d); |
| 329 | d->ld->free_deviceid_node(d); | ||
| 330 | } | 335 | } |
| 331 | } | 336 | } |
| 332 | 337 | ||
diff --git a/fs/nfs/pnfs_nfs.c b/fs/nfs/pnfs_nfs.c index 54e36b38fb5f..f37e25b6311c 100644 --- a/fs/nfs/pnfs_nfs.c +++ b/fs/nfs/pnfs_nfs.c | |||
| @@ -561,7 +561,7 @@ static bool load_v3_ds_connect(void) | |||
| 561 | return(get_v3_ds_connect != NULL); | 561 | return(get_v3_ds_connect != NULL); |
| 562 | } | 562 | } |
| 563 | 563 | ||
| 564 | void __exit nfs4_pnfs_v3_ds_connect_unload(void) | 564 | void nfs4_pnfs_v3_ds_connect_unload(void) |
| 565 | { | 565 | { |
| 566 | if (get_v3_ds_connect) { | 566 | if (get_v3_ds_connect) { |
| 567 | symbol_put(nfs3_set_ds_client); | 567 | symbol_put(nfs3_set_ds_client); |
| @@ -868,3 +868,13 @@ pnfs_layout_mark_request_commit(struct nfs_page *req, | |||
| 868 | nfs_request_add_commit_list(req, list, cinfo); | 868 | nfs_request_add_commit_list(req, list, cinfo); |
| 869 | } | 869 | } |
| 870 | EXPORT_SYMBOL_GPL(pnfs_layout_mark_request_commit); | 870 | EXPORT_SYMBOL_GPL(pnfs_layout_mark_request_commit); |
| 871 | |||
| 872 | int | ||
| 873 | pnfs_nfs_generic_sync(struct inode *inode, bool datasync) | ||
| 874 | { | ||
| 875 | if (datasync) | ||
| 876 | return 0; | ||
| 877 | return pnfs_layoutcommit_inode(inode, true); | ||
| 878 | } | ||
| 879 | EXPORT_SYMBOL_GPL(pnfs_nfs_generic_sync); | ||
| 880 | |||
diff --git a/fs/nfs/proc.c b/fs/nfs/proc.c index c63189acd052..b417bbcd9704 100644 --- a/fs/nfs/proc.c +++ b/fs/nfs/proc.c | |||
| @@ -118,7 +118,7 @@ static int | |||
| 118 | nfs_proc_setattr(struct dentry *dentry, struct nfs_fattr *fattr, | 118 | nfs_proc_setattr(struct dentry *dentry, struct nfs_fattr *fattr, |
| 119 | struct iattr *sattr) | 119 | struct iattr *sattr) |
| 120 | { | 120 | { |
| 121 | struct inode *inode = dentry->d_inode; | 121 | struct inode *inode = d_inode(dentry); |
| 122 | struct nfs_sattrargs arg = { | 122 | struct nfs_sattrargs arg = { |
| 123 | .fh = NFS_FH(inode), | 123 | .fh = NFS_FH(inode), |
| 124 | .sattr = sattr | 124 | .sattr = sattr |
| @@ -487,7 +487,7 @@ static int | |||
| 487 | nfs_proc_readdir(struct dentry *dentry, struct rpc_cred *cred, | 487 | nfs_proc_readdir(struct dentry *dentry, struct rpc_cred *cred, |
| 488 | u64 cookie, struct page **pages, unsigned int count, int plus) | 488 | u64 cookie, struct page **pages, unsigned int count, int plus) |
| 489 | { | 489 | { |
| 490 | struct inode *dir = dentry->d_inode; | 490 | struct inode *dir = d_inode(dentry); |
| 491 | struct nfs_readdirargs arg = { | 491 | struct nfs_readdirargs arg = { |
| 492 | .fh = NFS_FH(dir), | 492 | .fh = NFS_FH(dir), |
| 493 | .cookie = cookie, | 493 | .cookie = cookie, |
diff --git a/fs/nfs/read.c b/fs/nfs/read.c index b8f5c63f77b2..ae0ff7a11b40 100644 --- a/fs/nfs/read.c +++ b/fs/nfs/read.c | |||
| @@ -117,7 +117,7 @@ int nfs_readpage_async(struct nfs_open_context *ctx, struct inode *inode, | |||
| 117 | 117 | ||
| 118 | static void nfs_readpage_release(struct nfs_page *req) | 118 | static void nfs_readpage_release(struct nfs_page *req) |
| 119 | { | 119 | { |
| 120 | struct inode *inode = req->wb_context->dentry->d_inode; | 120 | struct inode *inode = d_inode(req->wb_context->dentry); |
| 121 | 121 | ||
| 122 | dprintk("NFS: read done (%s/%llu %d@%lld)\n", inode->i_sb->s_id, | 122 | dprintk("NFS: read done (%s/%llu %d@%lld)\n", inode->i_sb->s_id, |
| 123 | (unsigned long long)NFS_FILEID(inode), req->wb_bytes, | 123 | (unsigned long long)NFS_FILEID(inode), req->wb_bytes, |
| @@ -284,7 +284,7 @@ int nfs_readpage(struct file *file, struct page *page) | |||
| 284 | dprintk("NFS: nfs_readpage (%p %ld@%lu)\n", | 284 | dprintk("NFS: nfs_readpage (%p %ld@%lu)\n", |
| 285 | page, PAGE_CACHE_SIZE, page_file_index(page)); | 285 | page, PAGE_CACHE_SIZE, page_file_index(page)); |
| 286 | nfs_inc_stats(inode, NFSIOS_VFSREADPAGE); | 286 | nfs_inc_stats(inode, NFSIOS_VFSREADPAGE); |
| 287 | nfs_inc_stats(inode, NFSIOS_READPAGES); | 287 | nfs_add_stats(inode, NFSIOS_READPAGES, 1); |
| 288 | 288 | ||
| 289 | /* | 289 | /* |
| 290 | * Try to flush any pending writes to the file.. | 290 | * Try to flush any pending writes to the file.. |
diff --git a/fs/nfs/super.c b/fs/nfs/super.c index 322b2de02988..f175b833b6ba 100644 --- a/fs/nfs/super.c +++ b/fs/nfs/super.c | |||
| @@ -43,7 +43,6 @@ | |||
| 43 | #include <linux/seq_file.h> | 43 | #include <linux/seq_file.h> |
| 44 | #include <linux/mount.h> | 44 | #include <linux/mount.h> |
| 45 | #include <linux/namei.h> | 45 | #include <linux/namei.h> |
| 46 | #include <linux/nfs_idmap.h> | ||
| 47 | #include <linux/vfs.h> | 46 | #include <linux/vfs.h> |
| 48 | #include <linux/inet.h> | 47 | #include <linux/inet.h> |
| 49 | #include <linux/in6.h> | 48 | #include <linux/in6.h> |
| @@ -433,7 +432,7 @@ int nfs_statfs(struct dentry *dentry, struct kstatfs *buf) | |||
| 433 | struct nfs_server *server = NFS_SB(dentry->d_sb); | 432 | struct nfs_server *server = NFS_SB(dentry->d_sb); |
| 434 | unsigned char blockbits; | 433 | unsigned char blockbits; |
| 435 | unsigned long blockres; | 434 | unsigned long blockres; |
| 436 | struct nfs_fh *fh = NFS_FH(dentry->d_inode); | 435 | struct nfs_fh *fh = NFS_FH(d_inode(dentry)); |
| 437 | struct nfs_fsstat res; | 436 | struct nfs_fsstat res; |
| 438 | int error = -ENOMEM; | 437 | int error = -ENOMEM; |
| 439 | 438 | ||
| @@ -447,7 +446,7 @@ int nfs_statfs(struct dentry *dentry, struct kstatfs *buf) | |||
| 447 | 446 | ||
| 448 | pd_dentry = dget_parent(dentry); | 447 | pd_dentry = dget_parent(dentry); |
| 449 | if (pd_dentry != NULL) { | 448 | if (pd_dentry != NULL) { |
| 450 | nfs_zap_caches(pd_dentry->d_inode); | 449 | nfs_zap_caches(d_inode(pd_dentry)); |
| 451 | dput(pd_dentry); | 450 | dput(pd_dentry); |
| 452 | } | 451 | } |
| 453 | } | 452 | } |
| @@ -2193,7 +2192,7 @@ nfs_compare_remount_data(struct nfs_server *nfss, | |||
| 2193 | data->version != nfss->nfs_client->rpc_ops->version || | 2192 | data->version != nfss->nfs_client->rpc_ops->version || |
| 2194 | data->minorversion != nfss->nfs_client->cl_minorversion || | 2193 | data->minorversion != nfss->nfs_client->cl_minorversion || |
| 2195 | data->retrans != nfss->client->cl_timeout->to_retries || | 2194 | data->retrans != nfss->client->cl_timeout->to_retries || |
| 2196 | data->selected_flavor != nfss->client->cl_auth->au_flavor || | 2195 | !nfs_auth_info_match(&data->auth_info, nfss->client->cl_auth->au_flavor) || |
| 2197 | data->acregmin != nfss->acregmin / HZ || | 2196 | data->acregmin != nfss->acregmin / HZ || |
| 2198 | data->acregmax != nfss->acregmax / HZ || | 2197 | data->acregmax != nfss->acregmax / HZ || |
| 2199 | data->acdirmin != nfss->acdirmin / HZ || | 2198 | data->acdirmin != nfss->acdirmin / HZ || |
| @@ -2241,7 +2240,6 @@ nfs_remount(struct super_block *sb, int *flags, char *raw_data) | |||
| 2241 | data->wsize = nfss->wsize; | 2240 | data->wsize = nfss->wsize; |
| 2242 | data->retrans = nfss->client->cl_timeout->to_retries; | 2241 | data->retrans = nfss->client->cl_timeout->to_retries; |
| 2243 | data->selected_flavor = nfss->client->cl_auth->au_flavor; | 2242 | data->selected_flavor = nfss->client->cl_auth->au_flavor; |
| 2244 | data->auth_info = nfss->auth_info; | ||
| 2245 | data->acregmin = nfss->acregmin / HZ; | 2243 | data->acregmin = nfss->acregmin / HZ; |
| 2246 | data->acregmax = nfss->acregmax / HZ; | 2244 | data->acregmax = nfss->acregmax / HZ; |
| 2247 | data->acdirmin = nfss->acdirmin / HZ; | 2245 | data->acdirmin = nfss->acdirmin / HZ; |
| @@ -2526,7 +2524,7 @@ int nfs_clone_sb_security(struct super_block *s, struct dentry *mntroot, | |||
| 2526 | struct nfs_mount_info *mount_info) | 2524 | struct nfs_mount_info *mount_info) |
| 2527 | { | 2525 | { |
| 2528 | /* clone any lsm security options from the parent to the new sb */ | 2526 | /* clone any lsm security options from the parent to the new sb */ |
| 2529 | if (mntroot->d_inode->i_op != NFS_SB(s)->nfs_client->rpc_ops->dir_inode_ops) | 2527 | if (d_inode(mntroot)->i_op != NFS_SB(s)->nfs_client->rpc_ops->dir_inode_ops) |
| 2530 | return -ESTALE; | 2528 | return -ESTALE; |
| 2531 | return security_sb_clone_mnt_opts(mount_info->cloned->sb, s); | 2529 | return security_sb_clone_mnt_opts(mount_info->cloned->sb, s); |
| 2532 | } | 2530 | } |
diff --git a/fs/nfs/symlink.c b/fs/nfs/symlink.c index 05c9e02f4153..2d56200655fe 100644 --- a/fs/nfs/symlink.c +++ b/fs/nfs/symlink.c | |||
| @@ -45,7 +45,7 @@ error: | |||
| 45 | 45 | ||
| 46 | static void *nfs_follow_link(struct dentry *dentry, struct nameidata *nd) | 46 | static void *nfs_follow_link(struct dentry *dentry, struct nameidata *nd) |
| 47 | { | 47 | { |
| 48 | struct inode *inode = dentry->d_inode; | 48 | struct inode *inode = d_inode(dentry); |
| 49 | struct page *page; | 49 | struct page *page; |
| 50 | void *err; | 50 | void *err; |
| 51 | 51 | ||
diff --git a/fs/nfs/unlink.c b/fs/nfs/unlink.c index de54129336c6..fa538b2ba251 100644 --- a/fs/nfs/unlink.c +++ b/fs/nfs/unlink.c | |||
| @@ -143,7 +143,7 @@ static int nfs_do_call_unlink(struct dentry *parent, struct inode *dir, struct n | |||
| 143 | nfs_free_dname(data); | 143 | nfs_free_dname(data); |
| 144 | ret = nfs_copy_dname(alias, data); | 144 | ret = nfs_copy_dname(alias, data); |
| 145 | spin_lock(&alias->d_lock); | 145 | spin_lock(&alias->d_lock); |
| 146 | if (ret == 0 && alias->d_inode != NULL && | 146 | if (ret == 0 && d_really_is_positive(alias) && |
| 147 | !(alias->d_flags & DCACHE_NFSFS_RENAMED)) { | 147 | !(alias->d_flags & DCACHE_NFSFS_RENAMED)) { |
| 148 | devname_garbage = alias->d_fsdata; | 148 | devname_garbage = alias->d_fsdata; |
| 149 | alias->d_fsdata = data; | 149 | alias->d_fsdata = data; |
| @@ -190,7 +190,7 @@ static int nfs_call_unlink(struct dentry *dentry, struct nfs_unlinkdata *data) | |||
| 190 | parent = dget_parent(dentry); | 190 | parent = dget_parent(dentry); |
| 191 | if (parent == NULL) | 191 | if (parent == NULL) |
| 192 | goto out_free; | 192 | goto out_free; |
| 193 | dir = parent->d_inode; | 193 | dir = d_inode(parent); |
| 194 | /* Non-exclusive lock protects against concurrent lookup() calls */ | 194 | /* Non-exclusive lock protects against concurrent lookup() calls */ |
| 195 | spin_lock(&dir->i_lock); | 195 | spin_lock(&dir->i_lock); |
| 196 | if (atomic_inc_not_zero(&NFS_I(dir)->silly_count) == 0) { | 196 | if (atomic_inc_not_zero(&NFS_I(dir)->silly_count) == 0) { |
| @@ -210,21 +210,21 @@ out_free: | |||
| 210 | 210 | ||
| 211 | void nfs_wait_on_sillyrename(struct dentry *dentry) | 211 | void nfs_wait_on_sillyrename(struct dentry *dentry) |
| 212 | { | 212 | { |
| 213 | struct nfs_inode *nfsi = NFS_I(dentry->d_inode); | 213 | struct nfs_inode *nfsi = NFS_I(d_inode(dentry)); |
| 214 | 214 | ||
| 215 | wait_event(nfsi->waitqueue, atomic_read(&nfsi->silly_count) <= 1); | 215 | wait_event(nfsi->waitqueue, atomic_read(&nfsi->silly_count) <= 1); |
| 216 | } | 216 | } |
| 217 | 217 | ||
| 218 | void nfs_block_sillyrename(struct dentry *dentry) | 218 | void nfs_block_sillyrename(struct dentry *dentry) |
| 219 | { | 219 | { |
| 220 | struct nfs_inode *nfsi = NFS_I(dentry->d_inode); | 220 | struct nfs_inode *nfsi = NFS_I(d_inode(dentry)); |
| 221 | 221 | ||
| 222 | wait_event(nfsi->waitqueue, atomic_cmpxchg(&nfsi->silly_count, 1, 0) == 1); | 222 | wait_event(nfsi->waitqueue, atomic_cmpxchg(&nfsi->silly_count, 1, 0) == 1); |
| 223 | } | 223 | } |
| 224 | 224 | ||
| 225 | void nfs_unblock_sillyrename(struct dentry *dentry) | 225 | void nfs_unblock_sillyrename(struct dentry *dentry) |
| 226 | { | 226 | { |
| 227 | struct inode *dir = dentry->d_inode; | 227 | struct inode *dir = d_inode(dentry); |
| 228 | struct nfs_inode *nfsi = NFS_I(dir); | 228 | struct nfs_inode *nfsi = NFS_I(dir); |
| 229 | struct nfs_unlinkdata *data; | 229 | struct nfs_unlinkdata *data; |
| 230 | 230 | ||
| @@ -367,8 +367,8 @@ static void nfs_async_rename_release(void *calldata) | |||
| 367 | struct nfs_renamedata *data = calldata; | 367 | struct nfs_renamedata *data = calldata; |
| 368 | struct super_block *sb = data->old_dir->i_sb; | 368 | struct super_block *sb = data->old_dir->i_sb; |
| 369 | 369 | ||
| 370 | if (data->old_dentry->d_inode) | 370 | if (d_really_is_positive(data->old_dentry)) |
| 371 | nfs_mark_for_revalidate(data->old_dentry->d_inode); | 371 | nfs_mark_for_revalidate(d_inode(data->old_dentry)); |
| 372 | 372 | ||
| 373 | dput(data->old_dentry); | 373 | dput(data->old_dentry); |
| 374 | dput(data->new_dentry); | 374 | dput(data->new_dentry); |
| @@ -529,10 +529,10 @@ nfs_sillyrename(struct inode *dir, struct dentry *dentry) | |||
| 529 | if (dentry->d_flags & DCACHE_NFSFS_RENAMED) | 529 | if (dentry->d_flags & DCACHE_NFSFS_RENAMED) |
| 530 | goto out; | 530 | goto out; |
| 531 | 531 | ||
| 532 | fileid = NFS_FILEID(dentry->d_inode); | 532 | fileid = NFS_FILEID(d_inode(dentry)); |
| 533 | 533 | ||
| 534 | /* Return delegation in anticipation of the rename */ | 534 | /* Return delegation in anticipation of the rename */ |
| 535 | NFS_PROTO(dentry->d_inode)->return_delegation(dentry->d_inode); | 535 | NFS_PROTO(d_inode(dentry))->return_delegation(d_inode(dentry)); |
| 536 | 536 | ||
| 537 | sdentry = NULL; | 537 | sdentry = NULL; |
| 538 | do { | 538 | do { |
| @@ -554,7 +554,7 @@ nfs_sillyrename(struct inode *dir, struct dentry *dentry) | |||
| 554 | */ | 554 | */ |
| 555 | if (IS_ERR(sdentry)) | 555 | if (IS_ERR(sdentry)) |
| 556 | goto out; | 556 | goto out; |
| 557 | } while (sdentry->d_inode != NULL); /* need negative lookup */ | 557 | } while (d_inode(sdentry) != NULL); /* need negative lookup */ |
| 558 | 558 | ||
| 559 | /* queue unlink first. Can't do this from rpc_release as it | 559 | /* queue unlink first. Can't do this from rpc_release as it |
| 560 | * has to allocate memory | 560 | * has to allocate memory |
diff --git a/fs/nfs/write.c b/fs/nfs/write.c index 759931088094..d12a4be613a5 100644 --- a/fs/nfs/write.c +++ b/fs/nfs/write.c | |||
| @@ -580,7 +580,7 @@ static int nfs_do_writepage(struct page *page, struct writeback_control *wbc, st | |||
| 580 | int ret; | 580 | int ret; |
| 581 | 581 | ||
| 582 | nfs_inc_stats(inode, NFSIOS_VFSWRITEPAGE); | 582 | nfs_inc_stats(inode, NFSIOS_VFSWRITEPAGE); |
| 583 | nfs_inc_stats(inode, NFSIOS_WRITEPAGES); | 583 | nfs_add_stats(inode, NFSIOS_WRITEPAGES, 1); |
| 584 | 584 | ||
| 585 | nfs_pageio_cond_complete(pgio, page_file_index(page)); | 585 | nfs_pageio_cond_complete(pgio, page_file_index(page)); |
| 586 | ret = nfs_page_async_flush(pgio, page, wbc->sync_mode == WB_SYNC_NONE); | 586 | ret = nfs_page_async_flush(pgio, page, wbc->sync_mode == WB_SYNC_NONE); |
| @@ -702,7 +702,7 @@ static void nfs_inode_add_request(struct inode *inode, struct nfs_page *req) | |||
| 702 | */ | 702 | */ |
| 703 | static void nfs_inode_remove_request(struct nfs_page *req) | 703 | static void nfs_inode_remove_request(struct nfs_page *req) |
| 704 | { | 704 | { |
| 705 | struct inode *inode = req->wb_context->dentry->d_inode; | 705 | struct inode *inode = d_inode(req->wb_context->dentry); |
| 706 | struct nfs_inode *nfsi = NFS_I(inode); | 706 | struct nfs_inode *nfsi = NFS_I(inode); |
| 707 | struct nfs_page *head; | 707 | struct nfs_page *head; |
| 708 | 708 | ||
| @@ -861,7 +861,7 @@ static void | |||
| 861 | nfs_clear_request_commit(struct nfs_page *req) | 861 | nfs_clear_request_commit(struct nfs_page *req) |
| 862 | { | 862 | { |
| 863 | if (test_bit(PG_CLEAN, &req->wb_flags)) { | 863 | if (test_bit(PG_CLEAN, &req->wb_flags)) { |
| 864 | struct inode *inode = req->wb_context->dentry->d_inode; | 864 | struct inode *inode = d_inode(req->wb_context->dentry); |
| 865 | struct nfs_commit_info cinfo; | 865 | struct nfs_commit_info cinfo; |
| 866 | 866 | ||
| 867 | nfs_init_cinfo_from_inode(&cinfo, inode); | 867 | nfs_init_cinfo_from_inode(&cinfo, inode); |
| @@ -1591,7 +1591,7 @@ void nfs_init_commit(struct nfs_commit_data *data, | |||
| 1591 | struct nfs_commit_info *cinfo) | 1591 | struct nfs_commit_info *cinfo) |
| 1592 | { | 1592 | { |
| 1593 | struct nfs_page *first = nfs_list_entry(head->next); | 1593 | struct nfs_page *first = nfs_list_entry(head->next); |
| 1594 | struct inode *inode = first->wb_context->dentry->d_inode; | 1594 | struct inode *inode = d_inode(first->wb_context->dentry); |
| 1595 | 1595 | ||
| 1596 | /* Set up the RPC argument and reply structs | 1596 | /* Set up the RPC argument and reply structs |
| 1597 | * NB: take care not to mess about with data->commit et al. */ | 1597 | * NB: take care not to mess about with data->commit et al. */ |
| @@ -1690,7 +1690,7 @@ static void nfs_commit_release_pages(struct nfs_commit_data *data) | |||
| 1690 | 1690 | ||
| 1691 | dprintk("NFS: commit (%s/%llu %d@%lld)", | 1691 | dprintk("NFS: commit (%s/%llu %d@%lld)", |
| 1692 | req->wb_context->dentry->d_sb->s_id, | 1692 | req->wb_context->dentry->d_sb->s_id, |
| 1693 | (unsigned long long)NFS_FILEID(req->wb_context->dentry->d_inode), | 1693 | (unsigned long long)NFS_FILEID(d_inode(req->wb_context->dentry)), |
| 1694 | req->wb_bytes, | 1694 | req->wb_bytes, |
| 1695 | (long long)req_offset(req)); | 1695 | (long long)req_offset(req)); |
| 1696 | if (status < 0) { | 1696 | if (status < 0) { |
| @@ -1840,17 +1840,16 @@ EXPORT_SYMBOL_GPL(nfs_write_inode); | |||
| 1840 | */ | 1840 | */ |
| 1841 | int nfs_wb_all(struct inode *inode) | 1841 | int nfs_wb_all(struct inode *inode) |
| 1842 | { | 1842 | { |
| 1843 | struct writeback_control wbc = { | ||
| 1844 | .sync_mode = WB_SYNC_ALL, | ||
| 1845 | .nr_to_write = LONG_MAX, | ||
| 1846 | .range_start = 0, | ||
| 1847 | .range_end = LLONG_MAX, | ||
| 1848 | }; | ||
| 1849 | int ret; | 1843 | int ret; |
| 1850 | 1844 | ||
| 1851 | trace_nfs_writeback_inode_enter(inode); | 1845 | trace_nfs_writeback_inode_enter(inode); |
| 1852 | 1846 | ||
| 1853 | ret = sync_inode(inode, &wbc); | 1847 | ret = filemap_write_and_wait(inode->i_mapping); |
| 1848 | if (!ret) { | ||
| 1849 | ret = nfs_commit_inode(inode, FLUSH_SYNC); | ||
| 1850 | if (!ret) | ||
| 1851 | pnfs_sync_inode(inode, true); | ||
| 1852 | } | ||
| 1854 | 1853 | ||
| 1855 | trace_nfs_writeback_inode_exit(inode, ret); | 1854 | trace_nfs_writeback_inode_exit(inode, ret); |
| 1856 | return ret; | 1855 | return ret; |
diff --git a/fs/nfsd/export.c b/fs/nfsd/export.c index 900c3ae94adc..f79521a59747 100644 --- a/fs/nfsd/export.c +++ b/fs/nfsd/export.c | |||
| @@ -599,7 +599,7 @@ static int svc_export_parse(struct cache_detail *cd, char *mesg, int mlen) | |||
| 599 | goto out4; | 599 | goto out4; |
| 600 | } | 600 | } |
| 601 | 601 | ||
| 602 | err = check_export(exp.ex_path.dentry->d_inode, &exp.ex_flags, | 602 | err = check_export(d_inode(exp.ex_path.dentry), &exp.ex_flags, |
| 603 | exp.ex_uuid); | 603 | exp.ex_uuid); |
| 604 | if (err) | 604 | if (err) |
| 605 | goto out4; | 605 | goto out4; |
| @@ -890,7 +890,7 @@ exp_rootfh(struct net *net, struct auth_domain *clp, char *name, | |||
| 890 | printk("nfsd: exp_rootfh path not found %s", name); | 890 | printk("nfsd: exp_rootfh path not found %s", name); |
| 891 | return err; | 891 | return err; |
| 892 | } | 892 | } |
| 893 | inode = path.dentry->d_inode; | 893 | inode = d_inode(path.dentry); |
| 894 | 894 | ||
| 895 | dprintk("nfsd: exp_rootfh(%s [%p] %s:%s/%ld)\n", | 895 | dprintk("nfsd: exp_rootfh(%s [%p] %s:%s/%ld)\n", |
| 896 | name, path.dentry, clp->name, | 896 | name, path.dentry, clp->name, |
diff --git a/fs/nfsd/nfs2acl.c b/fs/nfsd/nfs2acl.c index ac54ea60b3f6..d54701f6dc78 100644 --- a/fs/nfsd/nfs2acl.c +++ b/fs/nfsd/nfs2acl.c | |||
| @@ -42,7 +42,7 @@ static __be32 nfsacld_proc_getacl(struct svc_rqst * rqstp, | |||
| 42 | if (nfserr) | 42 | if (nfserr) |
| 43 | RETURN_STATUS(nfserr); | 43 | RETURN_STATUS(nfserr); |
| 44 | 44 | ||
| 45 | inode = fh->fh_dentry->d_inode; | 45 | inode = d_inode(fh->fh_dentry); |
| 46 | 46 | ||
| 47 | if (argp->mask & ~(NFS_ACL|NFS_ACLCNT|NFS_DFACL|NFS_DFACLCNT)) | 47 | if (argp->mask & ~(NFS_ACL|NFS_ACLCNT|NFS_DFACL|NFS_DFACLCNT)) |
| 48 | RETURN_STATUS(nfserr_inval); | 48 | RETURN_STATUS(nfserr_inval); |
| @@ -103,7 +103,7 @@ static __be32 nfsacld_proc_setacl(struct svc_rqst * rqstp, | |||
| 103 | if (nfserr) | 103 | if (nfserr) |
| 104 | goto out; | 104 | goto out; |
| 105 | 105 | ||
| 106 | inode = fh->fh_dentry->d_inode; | 106 | inode = d_inode(fh->fh_dentry); |
| 107 | if (!IS_POSIXACL(inode) || !inode->i_op->set_acl) { | 107 | if (!IS_POSIXACL(inode) || !inode->i_op->set_acl) { |
| 108 | error = -EOPNOTSUPP; | 108 | error = -EOPNOTSUPP; |
| 109 | goto out_errno; | 109 | goto out_errno; |
| @@ -266,9 +266,9 @@ static int nfsaclsvc_encode_getaclres(struct svc_rqst *rqstp, __be32 *p, | |||
| 266 | * nfsd_dispatch actually ensures the following cannot happen. | 266 | * nfsd_dispatch actually ensures the following cannot happen. |
| 267 | * However, it seems fragile to depend on that. | 267 | * However, it seems fragile to depend on that. |
| 268 | */ | 268 | */ |
| 269 | if (dentry == NULL || dentry->d_inode == NULL) | 269 | if (dentry == NULL || d_really_is_negative(dentry)) |
| 270 | return 0; | 270 | return 0; |
| 271 | inode = dentry->d_inode; | 271 | inode = d_inode(dentry); |
| 272 | 272 | ||
| 273 | p = nfs2svc_encode_fattr(rqstp, p, &resp->fh, &resp->stat); | 273 | p = nfs2svc_encode_fattr(rqstp, p, &resp->fh, &resp->stat); |
| 274 | *p++ = htonl(resp->mask); | 274 | *p++ = htonl(resp->mask); |
diff --git a/fs/nfsd/nfs3acl.c b/fs/nfsd/nfs3acl.c index 34cbbab6abd7..882b1a14bc3e 100644 --- a/fs/nfsd/nfs3acl.c +++ b/fs/nfsd/nfs3acl.c | |||
| @@ -39,7 +39,7 @@ static __be32 nfsd3_proc_getacl(struct svc_rqst * rqstp, | |||
| 39 | if (nfserr) | 39 | if (nfserr) |
| 40 | RETURN_STATUS(nfserr); | 40 | RETURN_STATUS(nfserr); |
| 41 | 41 | ||
| 42 | inode = fh->fh_dentry->d_inode; | 42 | inode = d_inode(fh->fh_dentry); |
| 43 | 43 | ||
| 44 | if (argp->mask & ~(NFS_ACL|NFS_ACLCNT|NFS_DFACL|NFS_DFACLCNT)) | 44 | if (argp->mask & ~(NFS_ACL|NFS_ACLCNT|NFS_DFACL|NFS_DFACLCNT)) |
| 45 | RETURN_STATUS(nfserr_inval); | 45 | RETURN_STATUS(nfserr_inval); |
| @@ -94,7 +94,7 @@ static __be32 nfsd3_proc_setacl(struct svc_rqst * rqstp, | |||
| 94 | if (nfserr) | 94 | if (nfserr) |
| 95 | goto out; | 95 | goto out; |
| 96 | 96 | ||
| 97 | inode = fh->fh_dentry->d_inode; | 97 | inode = d_inode(fh->fh_dentry); |
| 98 | if (!IS_POSIXACL(inode) || !inode->i_op->set_acl) { | 98 | if (!IS_POSIXACL(inode) || !inode->i_op->set_acl) { |
| 99 | error = -EOPNOTSUPP; | 99 | error = -EOPNOTSUPP; |
| 100 | goto out_errno; | 100 | goto out_errno; |
| @@ -174,8 +174,8 @@ static int nfs3svc_encode_getaclres(struct svc_rqst *rqstp, __be32 *p, | |||
| 174 | struct dentry *dentry = resp->fh.fh_dentry; | 174 | struct dentry *dentry = resp->fh.fh_dentry; |
| 175 | 175 | ||
| 176 | p = nfs3svc_encode_post_op_attr(rqstp, p, &resp->fh); | 176 | p = nfs3svc_encode_post_op_attr(rqstp, p, &resp->fh); |
| 177 | if (resp->status == 0 && dentry && dentry->d_inode) { | 177 | if (resp->status == 0 && dentry && d_really_is_positive(dentry)) { |
| 178 | struct inode *inode = dentry->d_inode; | 178 | struct inode *inode = d_inode(dentry); |
| 179 | struct kvec *head = rqstp->rq_res.head; | 179 | struct kvec *head = rqstp->rq_res.head; |
| 180 | unsigned int base; | 180 | unsigned int base; |
| 181 | int n; | 181 | int n; |
diff --git a/fs/nfsd/nfs3proc.c b/fs/nfsd/nfs3proc.c index 12f2aab4f614..7b755b7f785c 100644 --- a/fs/nfsd/nfs3proc.c +++ b/fs/nfsd/nfs3proc.c | |||
| @@ -166,7 +166,7 @@ nfsd3_proc_read(struct svc_rqst *rqstp, struct nfsd3_readargs *argp, | |||
| 166 | rqstp->rq_vec, argp->vlen, | 166 | rqstp->rq_vec, argp->vlen, |
| 167 | &resp->count); | 167 | &resp->count); |
| 168 | if (nfserr == 0) { | 168 | if (nfserr == 0) { |
| 169 | struct inode *inode = resp->fh.fh_dentry->d_inode; | 169 | struct inode *inode = d_inode(resp->fh.fh_dentry); |
| 170 | 170 | ||
| 171 | resp->eof = (argp->offset + resp->count) >= inode->i_size; | 171 | resp->eof = (argp->offset + resp->count) >= inode->i_size; |
| 172 | } | 172 | } |
| @@ -551,7 +551,7 @@ nfsd3_proc_fsinfo(struct svc_rqst * rqstp, struct nfsd_fhandle *argp, | |||
| 551 | * different read/write sizes for file systems known to have | 551 | * different read/write sizes for file systems known to have |
| 552 | * problems with large blocks */ | 552 | * problems with large blocks */ |
| 553 | if (nfserr == 0) { | 553 | if (nfserr == 0) { |
| 554 | struct super_block *sb = argp->fh.fh_dentry->d_inode->i_sb; | 554 | struct super_block *sb = d_inode(argp->fh.fh_dentry)->i_sb; |
| 555 | 555 | ||
| 556 | /* Note that we don't care for remote fs's here */ | 556 | /* Note that we don't care for remote fs's here */ |
| 557 | if (sb->s_magic == MSDOS_SUPER_MAGIC) { | 557 | if (sb->s_magic == MSDOS_SUPER_MAGIC) { |
| @@ -587,7 +587,7 @@ nfsd3_proc_pathconf(struct svc_rqst * rqstp, struct nfsd_fhandle *argp, | |||
| 587 | nfserr = fh_verify(rqstp, &argp->fh, 0, NFSD_MAY_NOP); | 587 | nfserr = fh_verify(rqstp, &argp->fh, 0, NFSD_MAY_NOP); |
| 588 | 588 | ||
| 589 | if (nfserr == 0) { | 589 | if (nfserr == 0) { |
| 590 | struct super_block *sb = argp->fh.fh_dentry->d_inode->i_sb; | 590 | struct super_block *sb = d_inode(argp->fh.fh_dentry)->i_sb; |
| 591 | 591 | ||
| 592 | /* Note that we don't care for remote fs's here */ | 592 | /* Note that we don't care for remote fs's here */ |
| 593 | switch (sb->s_magic) { | 593 | switch (sb->s_magic) { |
diff --git a/fs/nfsd/nfs3xdr.c b/fs/nfsd/nfs3xdr.c index 39c5eb3ad33a..e4b2b4322553 100644 --- a/fs/nfsd/nfs3xdr.c +++ b/fs/nfsd/nfs3xdr.c | |||
| @@ -146,7 +146,7 @@ static __be32 *encode_fsid(__be32 *p, struct svc_fh *fhp) | |||
| 146 | default: | 146 | default: |
| 147 | case FSIDSOURCE_DEV: | 147 | case FSIDSOURCE_DEV: |
| 148 | p = xdr_encode_hyper(p, (u64)huge_encode_dev | 148 | p = xdr_encode_hyper(p, (u64)huge_encode_dev |
| 149 | (fhp->fh_dentry->d_inode->i_sb->s_dev)); | 149 | (d_inode(fhp->fh_dentry)->i_sb->s_dev)); |
| 150 | break; | 150 | break; |
| 151 | case FSIDSOURCE_FSID: | 151 | case FSIDSOURCE_FSID: |
| 152 | p = xdr_encode_hyper(p, (u64) fhp->fh_export->ex_fsid); | 152 | p = xdr_encode_hyper(p, (u64) fhp->fh_export->ex_fsid); |
| @@ -203,14 +203,14 @@ static __be32 * | |||
| 203 | encode_post_op_attr(struct svc_rqst *rqstp, __be32 *p, struct svc_fh *fhp) | 203 | encode_post_op_attr(struct svc_rqst *rqstp, __be32 *p, struct svc_fh *fhp) |
| 204 | { | 204 | { |
| 205 | struct dentry *dentry = fhp->fh_dentry; | 205 | struct dentry *dentry = fhp->fh_dentry; |
| 206 | if (dentry && dentry->d_inode) { | 206 | if (dentry && d_really_is_positive(dentry)) { |
| 207 | __be32 err; | 207 | __be32 err; |
| 208 | struct kstat stat; | 208 | struct kstat stat; |
| 209 | 209 | ||
| 210 | err = fh_getattr(fhp, &stat); | 210 | err = fh_getattr(fhp, &stat); |
| 211 | if (!err) { | 211 | if (!err) { |
| 212 | *p++ = xdr_one; /* attributes follow */ | 212 | *p++ = xdr_one; /* attributes follow */ |
| 213 | lease_get_mtime(dentry->d_inode, &stat.mtime); | 213 | lease_get_mtime(d_inode(dentry), &stat.mtime); |
| 214 | return encode_fattr3(rqstp, p, fhp, &stat); | 214 | return encode_fattr3(rqstp, p, fhp, &stat); |
| 215 | } | 215 | } |
| 216 | } | 216 | } |
| @@ -233,7 +233,7 @@ encode_wcc_data(struct svc_rqst *rqstp, __be32 *p, struct svc_fh *fhp) | |||
| 233 | { | 233 | { |
| 234 | struct dentry *dentry = fhp->fh_dentry; | 234 | struct dentry *dentry = fhp->fh_dentry; |
| 235 | 235 | ||
| 236 | if (dentry && dentry->d_inode && fhp->fh_post_saved) { | 236 | if (dentry && d_really_is_positive(dentry) && fhp->fh_post_saved) { |
| 237 | if (fhp->fh_pre_saved) { | 237 | if (fhp->fh_pre_saved) { |
| 238 | *p++ = xdr_one; | 238 | *p++ = xdr_one; |
| 239 | p = xdr_encode_hyper(p, (u64) fhp->fh_pre_size); | 239 | p = xdr_encode_hyper(p, (u64) fhp->fh_pre_size); |
| @@ -260,11 +260,11 @@ void fill_post_wcc(struct svc_fh *fhp) | |||
| 260 | printk("nfsd: inode locked twice during operation.\n"); | 260 | printk("nfsd: inode locked twice during operation.\n"); |
| 261 | 261 | ||
| 262 | err = fh_getattr(fhp, &fhp->fh_post_attr); | 262 | err = fh_getattr(fhp, &fhp->fh_post_attr); |
| 263 | fhp->fh_post_change = fhp->fh_dentry->d_inode->i_version; | 263 | fhp->fh_post_change = d_inode(fhp->fh_dentry)->i_version; |
| 264 | if (err) { | 264 | if (err) { |
| 265 | fhp->fh_post_saved = 0; | 265 | fhp->fh_post_saved = 0; |
| 266 | /* Grab the ctime anyway - set_change_info might use it */ | 266 | /* Grab the ctime anyway - set_change_info might use it */ |
| 267 | fhp->fh_post_attr.ctime = fhp->fh_dentry->d_inode->i_ctime; | 267 | fhp->fh_post_attr.ctime = d_inode(fhp->fh_dentry)->i_ctime; |
| 268 | } else | 268 | } else |
| 269 | fhp->fh_post_saved = 1; | 269 | fhp->fh_post_saved = 1; |
| 270 | } | 270 | } |
| @@ -628,7 +628,7 @@ nfs3svc_encode_attrstat(struct svc_rqst *rqstp, __be32 *p, | |||
| 628 | struct nfsd3_attrstat *resp) | 628 | struct nfsd3_attrstat *resp) |
| 629 | { | 629 | { |
| 630 | if (resp->status == 0) { | 630 | if (resp->status == 0) { |
| 631 | lease_get_mtime(resp->fh.fh_dentry->d_inode, | 631 | lease_get_mtime(d_inode(resp->fh.fh_dentry), |
| 632 | &resp->stat.mtime); | 632 | &resp->stat.mtime); |
| 633 | p = encode_fattr3(rqstp, p, &resp->fh, &resp->stat); | 633 | p = encode_fattr3(rqstp, p, &resp->fh, &resp->stat); |
| 634 | } | 634 | } |
| @@ -828,7 +828,7 @@ compose_entry_fh(struct nfsd3_readdirres *cd, struct svc_fh *fhp, | |||
| 828 | return rv; | 828 | return rv; |
| 829 | if (d_mountpoint(dchild)) | 829 | if (d_mountpoint(dchild)) |
| 830 | goto out; | 830 | goto out; |
| 831 | if (!dchild->d_inode) | 831 | if (d_really_is_negative(dchild)) |
| 832 | goto out; | 832 | goto out; |
| 833 | rv = fh_compose(fhp, exp, dchild, &cd->fh); | 833 | rv = fh_compose(fhp, exp, dchild, &cd->fh); |
| 834 | out: | 834 | out: |
diff --git a/fs/nfsd/nfs4acl.c b/fs/nfsd/nfs4acl.c index eaf4605a4b9e..67242bf7c6cc 100644 --- a/fs/nfsd/nfs4acl.c +++ b/fs/nfsd/nfs4acl.c | |||
| @@ -139,7 +139,7 @@ int | |||
| 139 | nfsd4_get_nfs4_acl(struct svc_rqst *rqstp, struct dentry *dentry, | 139 | nfsd4_get_nfs4_acl(struct svc_rqst *rqstp, struct dentry *dentry, |
| 140 | struct nfs4_acl **acl) | 140 | struct nfs4_acl **acl) |
| 141 | { | 141 | { |
| 142 | struct inode *inode = dentry->d_inode; | 142 | struct inode *inode = d_inode(dentry); |
| 143 | int error = 0; | 143 | int error = 0; |
| 144 | struct posix_acl *pacl = NULL, *dpacl = NULL; | 144 | struct posix_acl *pacl = NULL, *dpacl = NULL; |
| 145 | unsigned int flags = 0; | 145 | unsigned int flags = 0; |
| @@ -780,7 +780,7 @@ nfsd4_set_nfs4_acl(struct svc_rqst *rqstp, struct svc_fh *fhp, | |||
| 780 | return error; | 780 | return error; |
| 781 | 781 | ||
| 782 | dentry = fhp->fh_dentry; | 782 | dentry = fhp->fh_dentry; |
| 783 | inode = dentry->d_inode; | 783 | inode = d_inode(dentry); |
| 784 | 784 | ||
| 785 | if (!inode->i_op->set_acl || !IS_POSIXACL(inode)) | 785 | if (!inode->i_op->set_acl || !IS_POSIXACL(inode)) |
| 786 | return nfserr_attrnotsupp; | 786 | return nfserr_attrnotsupp; |
diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c index 4a8314f08a0e..864e2003e8de 100644 --- a/fs/nfsd/nfs4proc.c +++ b/fs/nfsd/nfs4proc.c | |||
| @@ -52,7 +52,7 @@ | |||
| 52 | static inline void | 52 | static inline void |
| 53 | nfsd4_security_inode_setsecctx(struct svc_fh *resfh, struct xdr_netobj *label, u32 *bmval) | 53 | nfsd4_security_inode_setsecctx(struct svc_fh *resfh, struct xdr_netobj *label, u32 *bmval) |
| 54 | { | 54 | { |
| 55 | struct inode *inode = resfh->fh_dentry->d_inode; | 55 | struct inode *inode = d_inode(resfh->fh_dentry); |
| 56 | int status; | 56 | int status; |
| 57 | 57 | ||
| 58 | mutex_lock(&inode->i_mutex); | 58 | mutex_lock(&inode->i_mutex); |
| @@ -110,7 +110,7 @@ check_attr_support(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, | |||
| 110 | * in current environment or not. | 110 | * in current environment or not. |
| 111 | */ | 111 | */ |
| 112 | if (bmval[0] & FATTR4_WORD0_ACL) { | 112 | if (bmval[0] & FATTR4_WORD0_ACL) { |
| 113 | if (!IS_POSIXACL(dentry->d_inode)) | 113 | if (!IS_POSIXACL(d_inode(dentry))) |
| 114 | return nfserr_attrnotsupp; | 114 | return nfserr_attrnotsupp; |
| 115 | } | 115 | } |
| 116 | 116 | ||
| @@ -209,7 +209,7 @@ do_open_permission(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfs | |||
| 209 | 209 | ||
| 210 | static __be32 nfsd_check_obj_isreg(struct svc_fh *fh) | 210 | static __be32 nfsd_check_obj_isreg(struct svc_fh *fh) |
| 211 | { | 211 | { |
| 212 | umode_t mode = fh->fh_dentry->d_inode->i_mode; | 212 | umode_t mode = d_inode(fh->fh_dentry)->i_mode; |
| 213 | 213 | ||
| 214 | if (S_ISREG(mode)) | 214 | if (S_ISREG(mode)) |
| 215 | return nfs_ok; | 215 | return nfs_ok; |
| @@ -881,7 +881,7 @@ nfsd4_secinfo(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, | |||
| 881 | &exp, &dentry); | 881 | &exp, &dentry); |
| 882 | if (err) | 882 | if (err) |
| 883 | return err; | 883 | return err; |
| 884 | if (dentry->d_inode == NULL) { | 884 | if (d_really_is_negative(dentry)) { |
| 885 | exp_put(exp); | 885 | exp_put(exp); |
| 886 | err = nfserr_noent; | 886 | err = nfserr_noent; |
| 887 | } else | 887 | } else |
| @@ -1312,7 +1312,7 @@ nfsd4_layoutget(struct svc_rqst *rqstp, | |||
| 1312 | if (atomic_read(&ls->ls_stid.sc_file->fi_lo_recalls)) | 1312 | if (atomic_read(&ls->ls_stid.sc_file->fi_lo_recalls)) |
| 1313 | goto out_put_stid; | 1313 | goto out_put_stid; |
| 1314 | 1314 | ||
| 1315 | nfserr = ops->proc_layoutget(current_fh->fh_dentry->d_inode, | 1315 | nfserr = ops->proc_layoutget(d_inode(current_fh->fh_dentry), |
| 1316 | current_fh, lgp); | 1316 | current_fh, lgp); |
| 1317 | if (nfserr) | 1317 | if (nfserr) |
| 1318 | goto out_put_stid; | 1318 | goto out_put_stid; |
| @@ -1346,7 +1346,7 @@ nfsd4_layoutcommit(struct svc_rqst *rqstp, | |||
| 1346 | ops = nfsd4_layout_verify(current_fh->fh_export, lcp->lc_layout_type); | 1346 | ops = nfsd4_layout_verify(current_fh->fh_export, lcp->lc_layout_type); |
| 1347 | if (!ops) | 1347 | if (!ops) |
| 1348 | goto out; | 1348 | goto out; |
| 1349 | inode = current_fh->fh_dentry->d_inode; | 1349 | inode = d_inode(current_fh->fh_dentry); |
| 1350 | 1350 | ||
| 1351 | nfserr = nfserr_inval; | 1351 | nfserr = nfserr_inval; |
| 1352 | if (new_size <= seg->offset) { | 1352 | if (new_size <= seg->offset) { |
diff --git a/fs/nfsd/nfs4recover.c b/fs/nfsd/nfs4recover.c index 1c307f02baa8..d88ea7b9a85c 100644 --- a/fs/nfsd/nfs4recover.c +++ b/fs/nfsd/nfs4recover.c | |||
| @@ -192,14 +192,14 @@ nfsd4_create_clid_dir(struct nfs4_client *clp) | |||
| 192 | 192 | ||
| 193 | dir = nn->rec_file->f_path.dentry; | 193 | dir = nn->rec_file->f_path.dentry; |
| 194 | /* lock the parent */ | 194 | /* lock the parent */ |
| 195 | mutex_lock(&dir->d_inode->i_mutex); | 195 | mutex_lock(&d_inode(dir)->i_mutex); |
| 196 | 196 | ||
| 197 | dentry = lookup_one_len(dname, dir, HEXDIR_LEN-1); | 197 | dentry = lookup_one_len(dname, dir, HEXDIR_LEN-1); |
| 198 | if (IS_ERR(dentry)) { | 198 | if (IS_ERR(dentry)) { |
| 199 | status = PTR_ERR(dentry); | 199 | status = PTR_ERR(dentry); |
| 200 | goto out_unlock; | 200 | goto out_unlock; |
| 201 | } | 201 | } |
| 202 | if (dentry->d_inode) | 202 | if (d_really_is_positive(dentry)) |
| 203 | /* | 203 | /* |
| 204 | * In the 4.1 case, where we're called from | 204 | * In the 4.1 case, where we're called from |
| 205 | * reclaim_complete(), records from the previous reboot | 205 | * reclaim_complete(), records from the previous reboot |
| @@ -209,11 +209,11 @@ nfsd4_create_clid_dir(struct nfs4_client *clp) | |||
| 209 | * as well be forgiving and just succeed silently. | 209 | * as well be forgiving and just succeed silently. |
| 210 | */ | 210 | */ |
| 211 | goto out_put; | 211 | goto out_put; |
| 212 | status = vfs_mkdir(dir->d_inode, dentry, S_IRWXU); | 212 | status = vfs_mkdir(d_inode(dir), dentry, S_IRWXU); |
| 213 | out_put: | 213 | out_put: |
| 214 | dput(dentry); | 214 | dput(dentry); |
| 215 | out_unlock: | 215 | out_unlock: |
| 216 | mutex_unlock(&dir->d_inode->i_mutex); | 216 | mutex_unlock(&d_inode(dir)->i_mutex); |
| 217 | if (status == 0) { | 217 | if (status == 0) { |
| 218 | if (nn->in_grace) { | 218 | if (nn->in_grace) { |
| 219 | crp = nfs4_client_to_reclaim(dname, nn); | 219 | crp = nfs4_client_to_reclaim(dname, nn); |
| @@ -285,7 +285,7 @@ nfsd4_list_rec_dir(recdir_func *f, struct nfsd_net *nn) | |||
| 285 | } | 285 | } |
| 286 | 286 | ||
| 287 | status = iterate_dir(nn->rec_file, &ctx.ctx); | 287 | status = iterate_dir(nn->rec_file, &ctx.ctx); |
| 288 | mutex_lock_nested(&dir->d_inode->i_mutex, I_MUTEX_PARENT); | 288 | mutex_lock_nested(&d_inode(dir)->i_mutex, I_MUTEX_PARENT); |
| 289 | while (!list_empty(&ctx.names)) { | 289 | while (!list_empty(&ctx.names)) { |
| 290 | struct name_list *entry; | 290 | struct name_list *entry; |
| 291 | entry = list_entry(ctx.names.next, struct name_list, list); | 291 | entry = list_entry(ctx.names.next, struct name_list, list); |
| @@ -302,7 +302,7 @@ nfsd4_list_rec_dir(recdir_func *f, struct nfsd_net *nn) | |||
| 302 | list_del(&entry->list); | 302 | list_del(&entry->list); |
| 303 | kfree(entry); | 303 | kfree(entry); |
| 304 | } | 304 | } |
| 305 | mutex_unlock(&dir->d_inode->i_mutex); | 305 | mutex_unlock(&d_inode(dir)->i_mutex); |
| 306 | nfs4_reset_creds(original_cred); | 306 | nfs4_reset_creds(original_cred); |
| 307 | return status; | 307 | return status; |
| 308 | } | 308 | } |
| @@ -316,20 +316,20 @@ nfsd4_unlink_clid_dir(char *name, int namlen, struct nfsd_net *nn) | |||
| 316 | dprintk("NFSD: nfsd4_unlink_clid_dir. name %.*s\n", namlen, name); | 316 | dprintk("NFSD: nfsd4_unlink_clid_dir. name %.*s\n", namlen, name); |
| 317 | 317 | ||
| 318 | dir = nn->rec_file->f_path.dentry; | 318 | dir = nn->rec_file->f_path.dentry; |
| 319 | mutex_lock_nested(&dir->d_inode->i_mutex, I_MUTEX_PARENT); | 319 | mutex_lock_nested(&d_inode(dir)->i_mutex, I_MUTEX_PARENT); |
| 320 | dentry = lookup_one_len(name, dir, namlen); | 320 | dentry = lookup_one_len(name, dir, namlen); |
| 321 | if (IS_ERR(dentry)) { | 321 | if (IS_ERR(dentry)) { |
| 322 | status = PTR_ERR(dentry); | 322 | status = PTR_ERR(dentry); |
| 323 | goto out_unlock; | 323 | goto out_unlock; |
| 324 | } | 324 | } |
| 325 | status = -ENOENT; | 325 | status = -ENOENT; |
| 326 | if (!dentry->d_inode) | 326 | if (d_really_is_negative(dentry)) |
| 327 | goto out; | 327 | goto out; |
| 328 | status = vfs_rmdir(dir->d_inode, dentry); | 328 | status = vfs_rmdir(d_inode(dir), dentry); |
| 329 | out: | 329 | out: |
| 330 | dput(dentry); | 330 | dput(dentry); |
| 331 | out_unlock: | 331 | out_unlock: |
| 332 | mutex_unlock(&dir->d_inode->i_mutex); | 332 | mutex_unlock(&d_inode(dir)->i_mutex); |
| 333 | return status; | 333 | return status; |
| 334 | } | 334 | } |
| 335 | 335 | ||
| @@ -385,7 +385,7 @@ purge_old(struct dentry *parent, struct dentry *child, struct nfsd_net *nn) | |||
| 385 | if (nfs4_has_reclaimed_state(child->d_name.name, nn)) | 385 | if (nfs4_has_reclaimed_state(child->d_name.name, nn)) |
| 386 | return 0; | 386 | return 0; |
| 387 | 387 | ||
| 388 | status = vfs_rmdir(parent->d_inode, child); | 388 | status = vfs_rmdir(d_inode(parent), child); |
| 389 | if (status) | 389 | if (status) |
| 390 | printk("failed to remove client recovery directory %pd\n", | 390 | printk("failed to remove client recovery directory %pd\n", |
| 391 | child); | 391 | child); |
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index d42786ee39af..38f2d7abe3a7 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c | |||
| @@ -4472,7 +4472,7 @@ nfs4_preprocess_stateid_op(struct net *net, struct nfsd4_compound_state *cstate, | |||
| 4472 | struct nfs4_ol_stateid *stp = NULL; | 4472 | struct nfs4_ol_stateid *stp = NULL; |
| 4473 | struct nfs4_delegation *dp = NULL; | 4473 | struct nfs4_delegation *dp = NULL; |
| 4474 | struct svc_fh *current_fh = &cstate->current_fh; | 4474 | struct svc_fh *current_fh = &cstate->current_fh; |
| 4475 | struct inode *ino = current_fh->fh_dentry->d_inode; | 4475 | struct inode *ino = d_inode(current_fh->fh_dentry); |
| 4476 | struct nfsd_net *nn = net_generic(net, nfsd_net_id); | 4476 | struct nfsd_net *nn = net_generic(net, nfsd_net_id); |
| 4477 | struct file *file = NULL; | 4477 | struct file *file = NULL; |
| 4478 | __be32 status; | 4478 | __be32 status; |
| @@ -5170,7 +5170,7 @@ lookup_or_create_lock_state(struct nfsd4_compound_state *cstate, | |||
| 5170 | struct nfs4_file *fi = ost->st_stid.sc_file; | 5170 | struct nfs4_file *fi = ost->st_stid.sc_file; |
| 5171 | struct nfs4_openowner *oo = openowner(ost->st_stateowner); | 5171 | struct nfs4_openowner *oo = openowner(ost->st_stateowner); |
| 5172 | struct nfs4_client *cl = oo->oo_owner.so_client; | 5172 | struct nfs4_client *cl = oo->oo_owner.so_client; |
| 5173 | struct inode *inode = cstate->current_fh.fh_dentry->d_inode; | 5173 | struct inode *inode = d_inode(cstate->current_fh.fh_dentry); |
| 5174 | struct nfs4_lockowner *lo; | 5174 | struct nfs4_lockowner *lo; |
| 5175 | unsigned int strhashval; | 5175 | unsigned int strhashval; |
| 5176 | 5176 | ||
diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c index a45032ce7b80..158badf945df 100644 --- a/fs/nfsd/nfs4xdr.c +++ b/fs/nfsd/nfs4xdr.c | |||
| @@ -2292,7 +2292,7 @@ nfsd4_encode_fattr(struct xdr_stream *xdr, struct svc_fh *fhp, | |||
| 2292 | #ifdef CONFIG_NFSD_V4_SECURITY_LABEL | 2292 | #ifdef CONFIG_NFSD_V4_SECURITY_LABEL |
| 2293 | if ((bmval[2] & FATTR4_WORD2_SECURITY_LABEL) || | 2293 | if ((bmval[2] & FATTR4_WORD2_SECURITY_LABEL) || |
| 2294 | bmval[0] & FATTR4_WORD0_SUPPORTED_ATTRS) { | 2294 | bmval[0] & FATTR4_WORD0_SUPPORTED_ATTRS) { |
| 2295 | err = security_inode_getsecctx(dentry->d_inode, | 2295 | err = security_inode_getsecctx(d_inode(dentry), |
| 2296 | &context, &contextlen); | 2296 | &context, &contextlen); |
| 2297 | contextsupport = (err == 0); | 2297 | contextsupport = (err == 0); |
| 2298 | if (bmval2 & FATTR4_WORD2_SECURITY_LABEL) { | 2298 | if (bmval2 & FATTR4_WORD2_SECURITY_LABEL) { |
| @@ -2384,7 +2384,7 @@ nfsd4_encode_fattr(struct xdr_stream *xdr, struct svc_fh *fhp, | |||
| 2384 | p = xdr_reserve_space(xdr, 8); | 2384 | p = xdr_reserve_space(xdr, 8); |
| 2385 | if (!p) | 2385 | if (!p) |
| 2386 | goto out_resource; | 2386 | goto out_resource; |
| 2387 | p = encode_change(p, &stat, dentry->d_inode); | 2387 | p = encode_change(p, &stat, d_inode(dentry)); |
| 2388 | } | 2388 | } |
| 2389 | if (bmval0 & FATTR4_WORD0_SIZE) { | 2389 | if (bmval0 & FATTR4_WORD0_SIZE) { |
| 2390 | p = xdr_reserve_space(xdr, 8); | 2390 | p = xdr_reserve_space(xdr, 8); |
| @@ -2807,7 +2807,7 @@ nfsd4_encode_dirent_fattr(struct xdr_stream *xdr, struct nfsd4_readdir *cd, | |||
| 2807 | dentry = lookup_one_len(name, cd->rd_fhp->fh_dentry, namlen); | 2807 | dentry = lookup_one_len(name, cd->rd_fhp->fh_dentry, namlen); |
| 2808 | if (IS_ERR(dentry)) | 2808 | if (IS_ERR(dentry)) |
| 2809 | return nfserrno(PTR_ERR(dentry)); | 2809 | return nfserrno(PTR_ERR(dentry)); |
| 2810 | if (!dentry->d_inode) { | 2810 | if (d_really_is_negative(dentry)) { |
| 2811 | /* | 2811 | /* |
| 2812 | * nfsd_buffered_readdir drops the i_mutex between | 2812 | * nfsd_buffered_readdir drops the i_mutex between |
| 2813 | * readdir and calling this callback, leaving a window | 2813 | * readdir and calling this callback, leaving a window |
| @@ -3324,7 +3324,7 @@ static __be32 nfsd4_encode_splice_read( | |||
| 3324 | } | 3324 | } |
| 3325 | 3325 | ||
| 3326 | eof = (read->rd_offset + maxcount >= | 3326 | eof = (read->rd_offset + maxcount >= |
| 3327 | read->rd_fhp->fh_dentry->d_inode->i_size); | 3327 | d_inode(read->rd_fhp->fh_dentry)->i_size); |
| 3328 | 3328 | ||
| 3329 | *(p++) = htonl(eof); | 3329 | *(p++) = htonl(eof); |
| 3330 | *(p++) = htonl(maxcount); | 3330 | *(p++) = htonl(maxcount); |
| @@ -3401,7 +3401,7 @@ static __be32 nfsd4_encode_readv(struct nfsd4_compoundres *resp, | |||
| 3401 | xdr_truncate_encode(xdr, starting_len + 8 + ((maxcount+3)&~3)); | 3401 | xdr_truncate_encode(xdr, starting_len + 8 + ((maxcount+3)&~3)); |
| 3402 | 3402 | ||
| 3403 | eof = (read->rd_offset + maxcount >= | 3403 | eof = (read->rd_offset + maxcount >= |
| 3404 | read->rd_fhp->fh_dentry->d_inode->i_size); | 3404 | d_inode(read->rd_fhp->fh_dentry)->i_size); |
| 3405 | 3405 | ||
| 3406 | tmp = htonl(eof); | 3406 | tmp = htonl(eof); |
| 3407 | write_bytes_to_xdr_buf(xdr->buf, starting_len , &tmp, 4); | 3407 | write_bytes_to_xdr_buf(xdr->buf, starting_len , &tmp, 4); |
diff --git a/fs/nfsd/nfsfh.c b/fs/nfsd/nfsfh.c index e9fa966fc37f..350041a40fe5 100644 --- a/fs/nfsd/nfsfh.c +++ b/fs/nfsd/nfsfh.c | |||
| @@ -38,7 +38,7 @@ static int nfsd_acceptable(void *expv, struct dentry *dentry) | |||
| 38 | /* make sure parents give x permission to user */ | 38 | /* make sure parents give x permission to user */ |
| 39 | int err; | 39 | int err; |
| 40 | parent = dget_parent(tdentry); | 40 | parent = dget_parent(tdentry); |
| 41 | err = inode_permission(parent->d_inode, MAY_EXEC); | 41 | err = inode_permission(d_inode(parent), MAY_EXEC); |
| 42 | if (err < 0) { | 42 | if (err < 0) { |
| 43 | dput(parent); | 43 | dput(parent); |
| 44 | break; | 44 | break; |
| @@ -340,7 +340,7 @@ fh_verify(struct svc_rqst *rqstp, struct svc_fh *fhp, umode_t type, int access) | |||
| 340 | if (error) | 340 | if (error) |
| 341 | goto out; | 341 | goto out; |
| 342 | 342 | ||
| 343 | error = nfsd_mode_check(rqstp, dentry->d_inode->i_mode, type); | 343 | error = nfsd_mode_check(rqstp, d_inode(dentry)->i_mode, type); |
| 344 | if (error) | 344 | if (error) |
| 345 | goto out; | 345 | goto out; |
| 346 | 346 | ||
| @@ -412,8 +412,8 @@ static inline void _fh_update_old(struct dentry *dentry, | |||
| 412 | struct svc_export *exp, | 412 | struct svc_export *exp, |
| 413 | struct knfsd_fh *fh) | 413 | struct knfsd_fh *fh) |
| 414 | { | 414 | { |
| 415 | fh->ofh_ino = ino_t_to_u32(dentry->d_inode->i_ino); | 415 | fh->ofh_ino = ino_t_to_u32(d_inode(dentry)->i_ino); |
| 416 | fh->ofh_generation = dentry->d_inode->i_generation; | 416 | fh->ofh_generation = d_inode(dentry)->i_generation; |
| 417 | if (d_is_dir(dentry) || | 417 | if (d_is_dir(dentry) || |
| 418 | (exp->ex_flags & NFSEXP_NOSUBTREECHECK)) | 418 | (exp->ex_flags & NFSEXP_NOSUBTREECHECK)) |
| 419 | fh->ofh_dirino = 0; | 419 | fh->ofh_dirino = 0; |
| @@ -426,7 +426,7 @@ static bool is_root_export(struct svc_export *exp) | |||
| 426 | 426 | ||
| 427 | static struct super_block *exp_sb(struct svc_export *exp) | 427 | static struct super_block *exp_sb(struct svc_export *exp) |
| 428 | { | 428 | { |
| 429 | return exp->ex_path.dentry->d_inode->i_sb; | 429 | return d_inode(exp->ex_path.dentry)->i_sb; |
| 430 | } | 430 | } |
| 431 | 431 | ||
| 432 | static bool fsid_type_ok_for_exp(u8 fsid_type, struct svc_export *exp) | 432 | static bool fsid_type_ok_for_exp(u8 fsid_type, struct svc_export *exp) |
| @@ -520,12 +520,12 @@ fh_compose(struct svc_fh *fhp, struct svc_export *exp, struct dentry *dentry, | |||
| 520 | * | 520 | * |
| 521 | */ | 521 | */ |
| 522 | 522 | ||
| 523 | struct inode * inode = dentry->d_inode; | 523 | struct inode * inode = d_inode(dentry); |
| 524 | dev_t ex_dev = exp_sb(exp)->s_dev; | 524 | dev_t ex_dev = exp_sb(exp)->s_dev; |
| 525 | 525 | ||
| 526 | dprintk("nfsd: fh_compose(exp %02x:%02x/%ld %pd2, ino=%ld)\n", | 526 | dprintk("nfsd: fh_compose(exp %02x:%02x/%ld %pd2, ino=%ld)\n", |
| 527 | MAJOR(ex_dev), MINOR(ex_dev), | 527 | MAJOR(ex_dev), MINOR(ex_dev), |
| 528 | (long) exp->ex_path.dentry->d_inode->i_ino, | 528 | (long) d_inode(exp->ex_path.dentry)->i_ino, |
| 529 | dentry, | 529 | dentry, |
| 530 | (inode ? inode->i_ino : 0)); | 530 | (inode ? inode->i_ino : 0)); |
| 531 | 531 | ||
| @@ -558,7 +558,7 @@ fh_compose(struct svc_fh *fhp, struct svc_export *exp, struct dentry *dentry, | |||
| 558 | fhp->fh_handle.ofh_dev = old_encode_dev(ex_dev); | 558 | fhp->fh_handle.ofh_dev = old_encode_dev(ex_dev); |
| 559 | fhp->fh_handle.ofh_xdev = fhp->fh_handle.ofh_dev; | 559 | fhp->fh_handle.ofh_xdev = fhp->fh_handle.ofh_dev; |
| 560 | fhp->fh_handle.ofh_xino = | 560 | fhp->fh_handle.ofh_xino = |
| 561 | ino_t_to_u32(exp->ex_path.dentry->d_inode->i_ino); | 561 | ino_t_to_u32(d_inode(exp->ex_path.dentry)->i_ino); |
| 562 | fhp->fh_handle.ofh_dirino = ino_t_to_u32(parent_ino(dentry)); | 562 | fhp->fh_handle.ofh_dirino = ino_t_to_u32(parent_ino(dentry)); |
| 563 | if (inode) | 563 | if (inode) |
| 564 | _fh_update_old(dentry, exp, &fhp->fh_handle); | 564 | _fh_update_old(dentry, exp, &fhp->fh_handle); |
| @@ -570,7 +570,7 @@ fh_compose(struct svc_fh *fhp, struct svc_export *exp, struct dentry *dentry, | |||
| 570 | mk_fsid(fhp->fh_handle.fh_fsid_type, | 570 | mk_fsid(fhp->fh_handle.fh_fsid_type, |
| 571 | fhp->fh_handle.fh_fsid, | 571 | fhp->fh_handle.fh_fsid, |
| 572 | ex_dev, | 572 | ex_dev, |
| 573 | exp->ex_path.dentry->d_inode->i_ino, | 573 | d_inode(exp->ex_path.dentry)->i_ino, |
| 574 | exp->ex_fsid, exp->ex_uuid); | 574 | exp->ex_fsid, exp->ex_uuid); |
| 575 | 575 | ||
| 576 | if (inode) | 576 | if (inode) |
| @@ -597,7 +597,7 @@ fh_update(struct svc_fh *fhp) | |||
| 597 | goto out_bad; | 597 | goto out_bad; |
| 598 | 598 | ||
| 599 | dentry = fhp->fh_dentry; | 599 | dentry = fhp->fh_dentry; |
| 600 | if (!dentry->d_inode) | 600 | if (d_really_is_negative(dentry)) |
| 601 | goto out_negative; | 601 | goto out_negative; |
| 602 | if (fhp->fh_handle.fh_version != 1) { | 602 | if (fhp->fh_handle.fh_version != 1) { |
| 603 | _fh_update_old(dentry, fhp->fh_export, &fhp->fh_handle); | 603 | _fh_update_old(dentry, fhp->fh_export, &fhp->fh_handle); |
diff --git a/fs/nfsd/nfsfh.h b/fs/nfsd/nfsfh.h index f22920442172..1e90dad4926b 100644 --- a/fs/nfsd/nfsfh.h +++ b/fs/nfsd/nfsfh.h | |||
| @@ -225,7 +225,7 @@ fill_pre_wcc(struct svc_fh *fhp) | |||
| 225 | { | 225 | { |
| 226 | struct inode *inode; | 226 | struct inode *inode; |
| 227 | 227 | ||
| 228 | inode = fhp->fh_dentry->d_inode; | 228 | inode = d_inode(fhp->fh_dentry); |
| 229 | if (!fhp->fh_pre_saved) { | 229 | if (!fhp->fh_pre_saved) { |
| 230 | fhp->fh_pre_mtime = inode->i_mtime; | 230 | fhp->fh_pre_mtime = inode->i_mtime; |
| 231 | fhp->fh_pre_ctime = inode->i_ctime; | 231 | fhp->fh_pre_ctime = inode->i_ctime; |
| @@ -264,7 +264,7 @@ fh_lock_nested(struct svc_fh *fhp, unsigned int subclass) | |||
| 264 | return; | 264 | return; |
| 265 | } | 265 | } |
| 266 | 266 | ||
| 267 | inode = dentry->d_inode; | 267 | inode = d_inode(dentry); |
| 268 | mutex_lock_nested(&inode->i_mutex, subclass); | 268 | mutex_lock_nested(&inode->i_mutex, subclass); |
| 269 | fill_pre_wcc(fhp); | 269 | fill_pre_wcc(fhp); |
| 270 | fhp->fh_locked = 1; | 270 | fhp->fh_locked = 1; |
| @@ -284,7 +284,7 @@ fh_unlock(struct svc_fh *fhp) | |||
| 284 | { | 284 | { |
| 285 | if (fhp->fh_locked) { | 285 | if (fhp->fh_locked) { |
| 286 | fill_post_wcc(fhp); | 286 | fill_post_wcc(fhp); |
| 287 | mutex_unlock(&fhp->fh_dentry->d_inode->i_mutex); | 287 | mutex_unlock(&d_inode(fhp->fh_dentry)->i_mutex); |
| 288 | fhp->fh_locked = 0; | 288 | fhp->fh_locked = 0; |
| 289 | } | 289 | } |
| 290 | } | 290 | } |
diff --git a/fs/nfsd/nfsproc.c b/fs/nfsd/nfsproc.c index b8680738f588..aecbcd34d336 100644 --- a/fs/nfsd/nfsproc.c +++ b/fs/nfsd/nfsproc.c | |||
| @@ -223,7 +223,7 @@ nfsd_proc_create(struct svc_rqst *rqstp, struct nfsd_createargs *argp, | |||
| 223 | } | 223 | } |
| 224 | fh_init(newfhp, NFS_FHSIZE); | 224 | fh_init(newfhp, NFS_FHSIZE); |
| 225 | nfserr = fh_compose(newfhp, dirfhp->fh_export, dchild, dirfhp); | 225 | nfserr = fh_compose(newfhp, dirfhp->fh_export, dchild, dirfhp); |
| 226 | if (!nfserr && !dchild->d_inode) | 226 | if (!nfserr && d_really_is_negative(dchild)) |
| 227 | nfserr = nfserr_noent; | 227 | nfserr = nfserr_noent; |
| 228 | dput(dchild); | 228 | dput(dchild); |
| 229 | if (nfserr) { | 229 | if (nfserr) { |
| @@ -241,7 +241,7 @@ nfsd_proc_create(struct svc_rqst *rqstp, struct nfsd_createargs *argp, | |||
| 241 | } | 241 | } |
| 242 | } | 242 | } |
| 243 | 243 | ||
| 244 | inode = newfhp->fh_dentry->d_inode; | 244 | inode = d_inode(newfhp->fh_dentry); |
| 245 | 245 | ||
| 246 | /* Unfudge the mode bits */ | 246 | /* Unfudge the mode bits */ |
| 247 | if (attr->ia_valid & ATTR_MODE) { | 247 | if (attr->ia_valid & ATTR_MODE) { |
diff --git a/fs/nfsd/nfsxdr.c b/fs/nfsd/nfsxdr.c index 412d7061f9e5..79d964aa8079 100644 --- a/fs/nfsd/nfsxdr.c +++ b/fs/nfsd/nfsxdr.c | |||
| @@ -187,7 +187,7 @@ encode_fattr(struct svc_rqst *rqstp, __be32 *p, struct svc_fh *fhp, | |||
| 187 | *p++ = htonl((u32) stat->ino); | 187 | *p++ = htonl((u32) stat->ino); |
| 188 | *p++ = htonl((u32) stat->atime.tv_sec); | 188 | *p++ = htonl((u32) stat->atime.tv_sec); |
| 189 | *p++ = htonl(stat->atime.tv_nsec ? stat->atime.tv_nsec / 1000 : 0); | 189 | *p++ = htonl(stat->atime.tv_nsec ? stat->atime.tv_nsec / 1000 : 0); |
| 190 | lease_get_mtime(dentry->d_inode, &time); | 190 | lease_get_mtime(d_inode(dentry), &time); |
| 191 | *p++ = htonl((u32) time.tv_sec); | 191 | *p++ = htonl((u32) time.tv_sec); |
| 192 | *p++ = htonl(time.tv_nsec ? time.tv_nsec / 1000 : 0); | 192 | *p++ = htonl(time.tv_nsec ? time.tv_nsec / 1000 : 0); |
| 193 | *p++ = htonl((u32) stat->ctime.tv_sec); | 193 | *p++ = htonl((u32) stat->ctime.tv_sec); |
diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c index 368526582429..84d770be056e 100644 --- a/fs/nfsd/vfs.c +++ b/fs/nfsd/vfs.c | |||
| @@ -174,7 +174,7 @@ int nfsd_mountpoint(struct dentry *dentry, struct svc_export *exp) | |||
| 174 | return 1; | 174 | return 1; |
| 175 | if (!(exp->ex_flags & NFSEXP_V4ROOT)) | 175 | if (!(exp->ex_flags & NFSEXP_V4ROOT)) |
| 176 | return 0; | 176 | return 0; |
| 177 | return dentry->d_inode != NULL; | 177 | return d_inode(dentry) != NULL; |
| 178 | } | 178 | } |
| 179 | 179 | ||
| 180 | __be32 | 180 | __be32 |
| @@ -270,7 +270,7 @@ nfsd_lookup(struct svc_rqst *rqstp, struct svc_fh *fhp, const char *name, | |||
| 270 | * dentry may be negative, it may need to be updated. | 270 | * dentry may be negative, it may need to be updated. |
| 271 | */ | 271 | */ |
| 272 | err = fh_compose(resfh, exp, dentry, fhp); | 272 | err = fh_compose(resfh, exp, dentry, fhp); |
| 273 | if (!err && !dentry->d_inode) | 273 | if (!err && d_really_is_negative(dentry)) |
| 274 | err = nfserr_noent; | 274 | err = nfserr_noent; |
| 275 | out: | 275 | out: |
| 276 | dput(dentry); | 276 | dput(dentry); |
| @@ -284,7 +284,7 @@ out: | |||
| 284 | static int | 284 | static int |
| 285 | commit_metadata(struct svc_fh *fhp) | 285 | commit_metadata(struct svc_fh *fhp) |
| 286 | { | 286 | { |
| 287 | struct inode *inode = fhp->fh_dentry->d_inode; | 287 | struct inode *inode = d_inode(fhp->fh_dentry); |
| 288 | const struct export_operations *export_ops = inode->i_sb->s_export_op; | 288 | const struct export_operations *export_ops = inode->i_sb->s_export_op; |
| 289 | 289 | ||
| 290 | if (!EX_ISSYNC(fhp->fh_export)) | 290 | if (!EX_ISSYNC(fhp->fh_export)) |
| @@ -364,7 +364,7 @@ static __be32 | |||
| 364 | nfsd_get_write_access(struct svc_rqst *rqstp, struct svc_fh *fhp, | 364 | nfsd_get_write_access(struct svc_rqst *rqstp, struct svc_fh *fhp, |
| 365 | struct iattr *iap) | 365 | struct iattr *iap) |
| 366 | { | 366 | { |
| 367 | struct inode *inode = fhp->fh_dentry->d_inode; | 367 | struct inode *inode = d_inode(fhp->fh_dentry); |
| 368 | int host_err; | 368 | int host_err; |
| 369 | 369 | ||
| 370 | if (iap->ia_size < inode->i_size) { | 370 | if (iap->ia_size < inode->i_size) { |
| @@ -426,7 +426,7 @@ nfsd_setattr(struct svc_rqst *rqstp, struct svc_fh *fhp, struct iattr *iap, | |||
| 426 | } | 426 | } |
| 427 | 427 | ||
| 428 | dentry = fhp->fh_dentry; | 428 | dentry = fhp->fh_dentry; |
| 429 | inode = dentry->d_inode; | 429 | inode = d_inode(dentry); |
| 430 | 430 | ||
| 431 | /* Ignore any mode updates on symlinks */ | 431 | /* Ignore any mode updates on symlinks */ |
| 432 | if (S_ISLNK(inode->i_mode)) | 432 | if (S_ISLNK(inode->i_mode)) |
| @@ -495,7 +495,7 @@ out: | |||
| 495 | */ | 495 | */ |
| 496 | int nfsd4_is_junction(struct dentry *dentry) | 496 | int nfsd4_is_junction(struct dentry *dentry) |
| 497 | { | 497 | { |
| 498 | struct inode *inode = dentry->d_inode; | 498 | struct inode *inode = d_inode(dentry); |
| 499 | 499 | ||
| 500 | if (inode == NULL) | 500 | if (inode == NULL) |
| 501 | return 0; | 501 | return 0; |
| @@ -521,9 +521,9 @@ __be32 nfsd4_set_nfs4_label(struct svc_rqst *rqstp, struct svc_fh *fhp, | |||
| 521 | 521 | ||
| 522 | dentry = fhp->fh_dentry; | 522 | dentry = fhp->fh_dentry; |
| 523 | 523 | ||
| 524 | mutex_lock(&dentry->d_inode->i_mutex); | 524 | mutex_lock(&d_inode(dentry)->i_mutex); |
| 525 | host_error = security_inode_setsecctx(dentry, label->data, label->len); | 525 | host_error = security_inode_setsecctx(dentry, label->data, label->len); |
| 526 | mutex_unlock(&dentry->d_inode->i_mutex); | 526 | mutex_unlock(&d_inode(dentry)->i_mutex); |
| 527 | return nfserrno(host_error); | 527 | return nfserrno(host_error); |
| 528 | } | 528 | } |
| 529 | #else | 529 | #else |
| @@ -706,7 +706,7 @@ nfsd_open(struct svc_rqst *rqstp, struct svc_fh *fhp, umode_t type, | |||
| 706 | 706 | ||
| 707 | path.mnt = fhp->fh_export->ex_path.mnt; | 707 | path.mnt = fhp->fh_export->ex_path.mnt; |
| 708 | path.dentry = fhp->fh_dentry; | 708 | path.dentry = fhp->fh_dentry; |
| 709 | inode = path.dentry->d_inode; | 709 | inode = d_inode(path.dentry); |
| 710 | 710 | ||
| 711 | /* Disallow write access to files with the append-only bit set | 711 | /* Disallow write access to files with the append-only bit set |
| 712 | * or any access when mandatory locking enabled | 712 | * or any access when mandatory locking enabled |
| @@ -1211,7 +1211,7 @@ nfsd_create(struct svc_rqst *rqstp, struct svc_fh *fhp, | |||
| 1211 | goto out; | 1211 | goto out; |
| 1212 | 1212 | ||
| 1213 | dentry = fhp->fh_dentry; | 1213 | dentry = fhp->fh_dentry; |
| 1214 | dirp = dentry->d_inode; | 1214 | dirp = d_inode(dentry); |
| 1215 | 1215 | ||
| 1216 | err = nfserr_notdir; | 1216 | err = nfserr_notdir; |
| 1217 | if (!dirp->i_op->lookup) | 1217 | if (!dirp->i_op->lookup) |
| @@ -1250,7 +1250,7 @@ nfsd_create(struct svc_rqst *rqstp, struct svc_fh *fhp, | |||
| 1250 | * Make sure the child dentry is still negative ... | 1250 | * Make sure the child dentry is still negative ... |
| 1251 | */ | 1251 | */ |
| 1252 | err = nfserr_exist; | 1252 | err = nfserr_exist; |
| 1253 | if (dchild->d_inode) { | 1253 | if (d_really_is_positive(dchild)) { |
| 1254 | dprintk("nfsd_create: dentry %pd/%pd not negative!\n", | 1254 | dprintk("nfsd_create: dentry %pd/%pd not negative!\n", |
| 1255 | dentry, dchild); | 1255 | dentry, dchild); |
| 1256 | goto out; | 1256 | goto out; |
| @@ -1353,7 +1353,7 @@ do_nfsd_create(struct svc_rqst *rqstp, struct svc_fh *fhp, | |||
| 1353 | goto out; | 1353 | goto out; |
| 1354 | 1354 | ||
| 1355 | dentry = fhp->fh_dentry; | 1355 | dentry = fhp->fh_dentry; |
| 1356 | dirp = dentry->d_inode; | 1356 | dirp = d_inode(dentry); |
| 1357 | 1357 | ||
| 1358 | /* Get all the sanity checks out of the way before | 1358 | /* Get all the sanity checks out of the way before |
| 1359 | * we lock the parent. */ | 1359 | * we lock the parent. */ |
| @@ -1376,7 +1376,7 @@ do_nfsd_create(struct svc_rqst *rqstp, struct svc_fh *fhp, | |||
| 1376 | goto out_nfserr; | 1376 | goto out_nfserr; |
| 1377 | 1377 | ||
| 1378 | /* If file doesn't exist, check for permissions to create one */ | 1378 | /* If file doesn't exist, check for permissions to create one */ |
| 1379 | if (!dchild->d_inode) { | 1379 | if (d_really_is_negative(dchild)) { |
| 1380 | err = fh_verify(rqstp, fhp, S_IFDIR, NFSD_MAY_CREATE); | 1380 | err = fh_verify(rqstp, fhp, S_IFDIR, NFSD_MAY_CREATE); |
| 1381 | if (err) | 1381 | if (err) |
| 1382 | goto out; | 1382 | goto out; |
| @@ -1397,7 +1397,7 @@ do_nfsd_create(struct svc_rqst *rqstp, struct svc_fh *fhp, | |||
| 1397 | v_atime = verifier[1]&0x7fffffff; | 1397 | v_atime = verifier[1]&0x7fffffff; |
| 1398 | } | 1398 | } |
| 1399 | 1399 | ||
| 1400 | if (dchild->d_inode) { | 1400 | if (d_really_is_positive(dchild)) { |
| 1401 | err = 0; | 1401 | err = 0; |
| 1402 | 1402 | ||
| 1403 | switch (createmode) { | 1403 | switch (createmode) { |
| @@ -1420,17 +1420,17 @@ do_nfsd_create(struct svc_rqst *rqstp, struct svc_fh *fhp, | |||
| 1420 | } | 1420 | } |
| 1421 | break; | 1421 | break; |
| 1422 | case NFS3_CREATE_EXCLUSIVE: | 1422 | case NFS3_CREATE_EXCLUSIVE: |
| 1423 | if ( dchild->d_inode->i_mtime.tv_sec == v_mtime | 1423 | if ( d_inode(dchild)->i_mtime.tv_sec == v_mtime |
| 1424 | && dchild->d_inode->i_atime.tv_sec == v_atime | 1424 | && d_inode(dchild)->i_atime.tv_sec == v_atime |
| 1425 | && dchild->d_inode->i_size == 0 ) { | 1425 | && d_inode(dchild)->i_size == 0 ) { |
| 1426 | if (created) | 1426 | if (created) |
| 1427 | *created = 1; | 1427 | *created = 1; |
| 1428 | break; | 1428 | break; |
| 1429 | } | 1429 | } |
| 1430 | case NFS4_CREATE_EXCLUSIVE4_1: | 1430 | case NFS4_CREATE_EXCLUSIVE4_1: |
| 1431 | if ( dchild->d_inode->i_mtime.tv_sec == v_mtime | 1431 | if ( d_inode(dchild)->i_mtime.tv_sec == v_mtime |
| 1432 | && dchild->d_inode->i_atime.tv_sec == v_atime | 1432 | && d_inode(dchild)->i_atime.tv_sec == v_atime |
| 1433 | && dchild->d_inode->i_size == 0 ) { | 1433 | && d_inode(dchild)->i_size == 0 ) { |
| 1434 | if (created) | 1434 | if (created) |
| 1435 | *created = 1; | 1435 | *created = 1; |
| 1436 | goto set_attr; | 1436 | goto set_attr; |
| @@ -1513,7 +1513,7 @@ nfsd_readlink(struct svc_rqst *rqstp, struct svc_fh *fhp, char *buf, int *lenp) | |||
| 1513 | 1513 | ||
| 1514 | path.mnt = fhp->fh_export->ex_path.mnt; | 1514 | path.mnt = fhp->fh_export->ex_path.mnt; |
| 1515 | path.dentry = fhp->fh_dentry; | 1515 | path.dentry = fhp->fh_dentry; |
| 1516 | inode = path.dentry->d_inode; | 1516 | inode = d_inode(path.dentry); |
| 1517 | 1517 | ||
| 1518 | err = nfserr_inval; | 1518 | err = nfserr_inval; |
| 1519 | if (!inode->i_op->readlink) | 1519 | if (!inode->i_op->readlink) |
| @@ -1576,7 +1576,7 @@ nfsd_symlink(struct svc_rqst *rqstp, struct svc_fh *fhp, | |||
| 1576 | if (IS_ERR(dnew)) | 1576 | if (IS_ERR(dnew)) |
| 1577 | goto out_nfserr; | 1577 | goto out_nfserr; |
| 1578 | 1578 | ||
| 1579 | host_err = vfs_symlink(dentry->d_inode, dnew, path); | 1579 | host_err = vfs_symlink(d_inode(dentry), dnew, path); |
| 1580 | err = nfserrno(host_err); | 1580 | err = nfserrno(host_err); |
| 1581 | if (!err) | 1581 | if (!err) |
| 1582 | err = nfserrno(commit_metadata(fhp)); | 1582 | err = nfserrno(commit_metadata(fhp)); |
| @@ -1632,7 +1632,7 @@ nfsd_link(struct svc_rqst *rqstp, struct svc_fh *ffhp, | |||
| 1632 | 1632 | ||
| 1633 | fh_lock_nested(ffhp, I_MUTEX_PARENT); | 1633 | fh_lock_nested(ffhp, I_MUTEX_PARENT); |
| 1634 | ddir = ffhp->fh_dentry; | 1634 | ddir = ffhp->fh_dentry; |
| 1635 | dirp = ddir->d_inode; | 1635 | dirp = d_inode(ddir); |
| 1636 | 1636 | ||
| 1637 | dnew = lookup_one_len(name, ddir, len); | 1637 | dnew = lookup_one_len(name, ddir, len); |
| 1638 | host_err = PTR_ERR(dnew); | 1638 | host_err = PTR_ERR(dnew); |
| @@ -1642,7 +1642,7 @@ nfsd_link(struct svc_rqst *rqstp, struct svc_fh *ffhp, | |||
| 1642 | dold = tfhp->fh_dentry; | 1642 | dold = tfhp->fh_dentry; |
| 1643 | 1643 | ||
| 1644 | err = nfserr_noent; | 1644 | err = nfserr_noent; |
| 1645 | if (!dold->d_inode) | 1645 | if (d_really_is_negative(dold)) |
| 1646 | goto out_dput; | 1646 | goto out_dput; |
| 1647 | host_err = vfs_link(dold, dirp, dnew, NULL); | 1647 | host_err = vfs_link(dold, dirp, dnew, NULL); |
| 1648 | if (!host_err) { | 1648 | if (!host_err) { |
| @@ -1689,10 +1689,10 @@ nfsd_rename(struct svc_rqst *rqstp, struct svc_fh *ffhp, char *fname, int flen, | |||
| 1689 | goto out; | 1689 | goto out; |
| 1690 | 1690 | ||
| 1691 | fdentry = ffhp->fh_dentry; | 1691 | fdentry = ffhp->fh_dentry; |
| 1692 | fdir = fdentry->d_inode; | 1692 | fdir = d_inode(fdentry); |
| 1693 | 1693 | ||
| 1694 | tdentry = tfhp->fh_dentry; | 1694 | tdentry = tfhp->fh_dentry; |
| 1695 | tdir = tdentry->d_inode; | 1695 | tdir = d_inode(tdentry); |
| 1696 | 1696 | ||
| 1697 | err = nfserr_perm; | 1697 | err = nfserr_perm; |
| 1698 | if (!flen || isdotent(fname, flen) || !tlen || isdotent(tname, tlen)) | 1698 | if (!flen || isdotent(fname, flen) || !tlen || isdotent(tname, tlen)) |
| @@ -1717,7 +1717,7 @@ nfsd_rename(struct svc_rqst *rqstp, struct svc_fh *ffhp, char *fname, int flen, | |||
| 1717 | goto out_nfserr; | 1717 | goto out_nfserr; |
| 1718 | 1718 | ||
| 1719 | host_err = -ENOENT; | 1719 | host_err = -ENOENT; |
| 1720 | if (!odentry->d_inode) | 1720 | if (d_really_is_negative(odentry)) |
| 1721 | goto out_dput_old; | 1721 | goto out_dput_old; |
| 1722 | host_err = -EINVAL; | 1722 | host_err = -EINVAL; |
| 1723 | if (odentry == trap) | 1723 | if (odentry == trap) |
| @@ -1790,21 +1790,21 @@ nfsd_unlink(struct svc_rqst *rqstp, struct svc_fh *fhp, int type, | |||
| 1790 | 1790 | ||
| 1791 | fh_lock_nested(fhp, I_MUTEX_PARENT); | 1791 | fh_lock_nested(fhp, I_MUTEX_PARENT); |
| 1792 | dentry = fhp->fh_dentry; | 1792 | dentry = fhp->fh_dentry; |
| 1793 | dirp = dentry->d_inode; | 1793 | dirp = d_inode(dentry); |
| 1794 | 1794 | ||
| 1795 | rdentry = lookup_one_len(fname, dentry, flen); | 1795 | rdentry = lookup_one_len(fname, dentry, flen); |
| 1796 | host_err = PTR_ERR(rdentry); | 1796 | host_err = PTR_ERR(rdentry); |
| 1797 | if (IS_ERR(rdentry)) | 1797 | if (IS_ERR(rdentry)) |
| 1798 | goto out_nfserr; | 1798 | goto out_nfserr; |
| 1799 | 1799 | ||
| 1800 | if (!rdentry->d_inode) { | 1800 | if (d_really_is_negative(rdentry)) { |
| 1801 | dput(rdentry); | 1801 | dput(rdentry); |
| 1802 | err = nfserr_noent; | 1802 | err = nfserr_noent; |
| 1803 | goto out; | 1803 | goto out; |
| 1804 | } | 1804 | } |
| 1805 | 1805 | ||
| 1806 | if (!type) | 1806 | if (!type) |
| 1807 | type = rdentry->d_inode->i_mode & S_IFMT; | 1807 | type = d_inode(rdentry)->i_mode & S_IFMT; |
| 1808 | 1808 | ||
| 1809 | if (type != S_IFDIR) | 1809 | if (type != S_IFDIR) |
| 1810 | host_err = vfs_unlink(dirp, rdentry, NULL); | 1810 | host_err = vfs_unlink(dirp, rdentry, NULL); |
| @@ -2015,7 +2015,7 @@ __be32 | |||
| 2015 | nfsd_permission(struct svc_rqst *rqstp, struct svc_export *exp, | 2015 | nfsd_permission(struct svc_rqst *rqstp, struct svc_export *exp, |
| 2016 | struct dentry *dentry, int acc) | 2016 | struct dentry *dentry, int acc) |
| 2017 | { | 2017 | { |
| 2018 | struct inode *inode = dentry->d_inode; | 2018 | struct inode *inode = d_inode(dentry); |
| 2019 | int err; | 2019 | int err; |
| 2020 | 2020 | ||
| 2021 | if ((acc & NFSD_MAY_MASK) == NFSD_MAY_NOP) | 2021 | if ((acc & NFSD_MAY_MASK) == NFSD_MAY_NOP) |
diff --git a/fs/nfsd/xdr4.h b/fs/nfsd/xdr4.h index 556ce2e47555..f982ae84f0cd 100644 --- a/fs/nfsd/xdr4.h +++ b/fs/nfsd/xdr4.h | |||
| @@ -631,7 +631,7 @@ set_change_info(struct nfsd4_change_info *cinfo, struct svc_fh *fhp) | |||
| 631 | { | 631 | { |
| 632 | BUG_ON(!fhp->fh_pre_saved); | 632 | BUG_ON(!fhp->fh_pre_saved); |
| 633 | cinfo->atomic = fhp->fh_post_saved; | 633 | cinfo->atomic = fhp->fh_post_saved; |
| 634 | cinfo->change_supported = IS_I_VERSION(fhp->fh_dentry->d_inode); | 634 | cinfo->change_supported = IS_I_VERSION(d_inode(fhp->fh_dentry)); |
| 635 | 635 | ||
| 636 | cinfo->before_change = fhp->fh_pre_change; | 636 | cinfo->before_change = fhp->fh_pre_change; |
| 637 | cinfo->after_change = fhp->fh_post_change; | 637 | cinfo->after_change = fhp->fh_post_change; |
diff --git a/fs/nilfs2/dir.c b/fs/nilfs2/dir.c index 197a63e9d102..0ee0bed3649b 100644 --- a/fs/nilfs2/dir.c +++ b/fs/nilfs2/dir.c | |||
| @@ -435,7 +435,7 @@ void nilfs_set_link(struct inode *dir, struct nilfs_dir_entry *de, | |||
| 435 | */ | 435 | */ |
| 436 | int nilfs_add_link(struct dentry *dentry, struct inode *inode) | 436 | int nilfs_add_link(struct dentry *dentry, struct inode *inode) |
| 437 | { | 437 | { |
| 438 | struct inode *dir = dentry->d_parent->d_inode; | 438 | struct inode *dir = d_inode(dentry->d_parent); |
| 439 | const unsigned char *name = dentry->d_name.name; | 439 | const unsigned char *name = dentry->d_name.name; |
| 440 | int namelen = dentry->d_name.len; | 440 | int namelen = dentry->d_name.len; |
| 441 | unsigned chunk_size = nilfs_chunk_size(dir); | 441 | unsigned chunk_size = nilfs_chunk_size(dir); |
diff --git a/fs/nilfs2/inode.c b/fs/nilfs2/inode.c index be936df4ba73..258d9fe2521a 100644 --- a/fs/nilfs2/inode.c +++ b/fs/nilfs2/inode.c | |||
| @@ -835,7 +835,7 @@ void nilfs_evict_inode(struct inode *inode) | |||
| 835 | int nilfs_setattr(struct dentry *dentry, struct iattr *iattr) | 835 | int nilfs_setattr(struct dentry *dentry, struct iattr *iattr) |
| 836 | { | 836 | { |
| 837 | struct nilfs_transaction_info ti; | 837 | struct nilfs_transaction_info ti; |
| 838 | struct inode *inode = dentry->d_inode; | 838 | struct inode *inode = d_inode(dentry); |
| 839 | struct super_block *sb = inode->i_sb; | 839 | struct super_block *sb = inode->i_sb; |
| 840 | int err; | 840 | int err; |
| 841 | 841 | ||
diff --git a/fs/nilfs2/namei.c b/fs/nilfs2/namei.c index 0f84b257932c..22180836ec22 100644 --- a/fs/nilfs2/namei.c +++ b/fs/nilfs2/namei.c | |||
| @@ -192,7 +192,7 @@ out_fail: | |||
| 192 | static int nilfs_link(struct dentry *old_dentry, struct inode *dir, | 192 | static int nilfs_link(struct dentry *old_dentry, struct inode *dir, |
| 193 | struct dentry *dentry) | 193 | struct dentry *dentry) |
| 194 | { | 194 | { |
| 195 | struct inode *inode = old_dentry->d_inode; | 195 | struct inode *inode = d_inode(old_dentry); |
| 196 | struct nilfs_transaction_info ti; | 196 | struct nilfs_transaction_info ti; |
| 197 | int err; | 197 | int err; |
| 198 | 198 | ||
| @@ -283,7 +283,7 @@ static int nilfs_do_unlink(struct inode *dir, struct dentry *dentry) | |||
| 283 | if (!de) | 283 | if (!de) |
| 284 | goto out; | 284 | goto out; |
| 285 | 285 | ||
| 286 | inode = dentry->d_inode; | 286 | inode = d_inode(dentry); |
| 287 | err = -EIO; | 287 | err = -EIO; |
| 288 | if (le64_to_cpu(de->inode) != inode->i_ino) | 288 | if (le64_to_cpu(de->inode) != inode->i_ino) |
| 289 | goto out; | 289 | goto out; |
| @@ -318,7 +318,7 @@ static int nilfs_unlink(struct inode *dir, struct dentry *dentry) | |||
| 318 | 318 | ||
| 319 | if (!err) { | 319 | if (!err) { |
| 320 | nilfs_mark_inode_dirty(dir); | 320 | nilfs_mark_inode_dirty(dir); |
| 321 | nilfs_mark_inode_dirty(dentry->d_inode); | 321 | nilfs_mark_inode_dirty(d_inode(dentry)); |
| 322 | err = nilfs_transaction_commit(dir->i_sb); | 322 | err = nilfs_transaction_commit(dir->i_sb); |
| 323 | } else | 323 | } else |
| 324 | nilfs_transaction_abort(dir->i_sb); | 324 | nilfs_transaction_abort(dir->i_sb); |
| @@ -328,7 +328,7 @@ static int nilfs_unlink(struct inode *dir, struct dentry *dentry) | |||
| 328 | 328 | ||
| 329 | static int nilfs_rmdir(struct inode *dir, struct dentry *dentry) | 329 | static int nilfs_rmdir(struct inode *dir, struct dentry *dentry) |
| 330 | { | 330 | { |
| 331 | struct inode *inode = dentry->d_inode; | 331 | struct inode *inode = d_inode(dentry); |
| 332 | struct nilfs_transaction_info ti; | 332 | struct nilfs_transaction_info ti; |
| 333 | int err; | 333 | int err; |
| 334 | 334 | ||
| @@ -358,8 +358,8 @@ static int nilfs_rmdir(struct inode *dir, struct dentry *dentry) | |||
| 358 | static int nilfs_rename(struct inode *old_dir, struct dentry *old_dentry, | 358 | static int nilfs_rename(struct inode *old_dir, struct dentry *old_dentry, |
| 359 | struct inode *new_dir, struct dentry *new_dentry) | 359 | struct inode *new_dir, struct dentry *new_dentry) |
| 360 | { | 360 | { |
| 361 | struct inode *old_inode = old_dentry->d_inode; | 361 | struct inode *old_inode = d_inode(old_dentry); |
| 362 | struct inode *new_inode = new_dentry->d_inode; | 362 | struct inode *new_inode = d_inode(new_dentry); |
| 363 | struct page *dir_page = NULL; | 363 | struct page *dir_page = NULL; |
| 364 | struct nilfs_dir_entry *dir_de = NULL; | 364 | struct nilfs_dir_entry *dir_de = NULL; |
| 365 | struct page *old_page; | 365 | struct page *old_page; |
| @@ -453,13 +453,13 @@ static struct dentry *nilfs_get_parent(struct dentry *child) | |||
| 453 | struct qstr dotdot = QSTR_INIT("..", 2); | 453 | struct qstr dotdot = QSTR_INIT("..", 2); |
| 454 | struct nilfs_root *root; | 454 | struct nilfs_root *root; |
| 455 | 455 | ||
| 456 | ino = nilfs_inode_by_name(child->d_inode, &dotdot); | 456 | ino = nilfs_inode_by_name(d_inode(child), &dotdot); |
| 457 | if (!ino) | 457 | if (!ino) |
| 458 | return ERR_PTR(-ENOENT); | 458 | return ERR_PTR(-ENOENT); |
| 459 | 459 | ||
| 460 | root = NILFS_I(child->d_inode)->i_root; | 460 | root = NILFS_I(d_inode(child))->i_root; |
| 461 | 461 | ||
| 462 | inode = nilfs_iget(child->d_inode->i_sb, root, ino); | 462 | inode = nilfs_iget(d_inode(child)->i_sb, root, ino); |
| 463 | if (IS_ERR(inode)) | 463 | if (IS_ERR(inode)) |
| 464 | return ERR_CAST(inode); | 464 | return ERR_CAST(inode); |
| 465 | 465 | ||
diff --git a/fs/nilfs2/super.c b/fs/nilfs2/super.c index c1725f20a9d1..f47585bfeb01 100644 --- a/fs/nilfs2/super.c +++ b/fs/nilfs2/super.c | |||
| @@ -610,7 +610,7 @@ static int nilfs_unfreeze(struct super_block *sb) | |||
| 610 | static int nilfs_statfs(struct dentry *dentry, struct kstatfs *buf) | 610 | static int nilfs_statfs(struct dentry *dentry, struct kstatfs *buf) |
| 611 | { | 611 | { |
| 612 | struct super_block *sb = dentry->d_sb; | 612 | struct super_block *sb = dentry->d_sb; |
| 613 | struct nilfs_root *root = NILFS_I(dentry->d_inode)->i_root; | 613 | struct nilfs_root *root = NILFS_I(d_inode(dentry))->i_root; |
| 614 | struct the_nilfs *nilfs = root->nilfs; | 614 | struct the_nilfs *nilfs = root->nilfs; |
| 615 | u64 id = huge_encode_dev(sb->s_bdev->bd_dev); | 615 | u64 id = huge_encode_dev(sb->s_bdev->bd_dev); |
| 616 | unsigned long long blocks; | 616 | unsigned long long blocks; |
| @@ -681,7 +681,7 @@ static int nilfs_show_options(struct seq_file *seq, struct dentry *dentry) | |||
| 681 | { | 681 | { |
| 682 | struct super_block *sb = dentry->d_sb; | 682 | struct super_block *sb = dentry->d_sb; |
| 683 | struct the_nilfs *nilfs = sb->s_fs_info; | 683 | struct the_nilfs *nilfs = sb->s_fs_info; |
| 684 | struct nilfs_root *root = NILFS_I(dentry->d_inode)->i_root; | 684 | struct nilfs_root *root = NILFS_I(d_inode(dentry))->i_root; |
| 685 | 685 | ||
| 686 | if (!nilfs_test_opt(nilfs, BARRIER)) | 686 | if (!nilfs_test_opt(nilfs, BARRIER)) |
| 687 | seq_puts(seq, ",nobarrier"); | 687 | seq_puts(seq, ",nobarrier"); |
| @@ -1190,7 +1190,7 @@ static int nilfs_remount(struct super_block *sb, int *flags, char *data) | |||
| 1190 | 1190 | ||
| 1191 | sb->s_flags &= ~MS_RDONLY; | 1191 | sb->s_flags &= ~MS_RDONLY; |
| 1192 | 1192 | ||
| 1193 | root = NILFS_I(sb->s_root->d_inode)->i_root; | 1193 | root = NILFS_I(d_inode(sb->s_root))->i_root; |
| 1194 | err = nilfs_attach_log_writer(sb, root); | 1194 | err = nilfs_attach_log_writer(sb, root); |
| 1195 | if (err) | 1195 | if (err) |
| 1196 | goto restore_opts; | 1196 | goto restore_opts; |
| @@ -13,7 +13,7 @@ static const struct file_operations ns_file_operations = { | |||
| 13 | 13 | ||
| 14 | static char *ns_dname(struct dentry *dentry, char *buffer, int buflen) | 14 | static char *ns_dname(struct dentry *dentry, char *buffer, int buflen) |
| 15 | { | 15 | { |
| 16 | struct inode *inode = dentry->d_inode; | 16 | struct inode *inode = d_inode(dentry); |
| 17 | const struct proc_ns_operations *ns_ops = dentry->d_fsdata; | 17 | const struct proc_ns_operations *ns_ops = dentry->d_fsdata; |
| 18 | 18 | ||
| 19 | return dynamic_dname(dentry, buffer, buflen, "%s:[%lu]", | 19 | return dynamic_dname(dentry, buffer, buflen, "%s:[%lu]", |
| @@ -22,7 +22,7 @@ static char *ns_dname(struct dentry *dentry, char *buffer, int buflen) | |||
| 22 | 22 | ||
| 23 | static void ns_prune_dentry(struct dentry *dentry) | 23 | static void ns_prune_dentry(struct dentry *dentry) |
| 24 | { | 24 | { |
| 25 | struct inode *inode = dentry->d_inode; | 25 | struct inode *inode = d_inode(dentry); |
| 26 | if (inode) { | 26 | if (inode) { |
| 27 | struct ns_common *ns = inode->i_private; | 27 | struct ns_common *ns = inode->i_private; |
| 28 | atomic_long_set(&ns->stashed, 0); | 28 | atomic_long_set(&ns->stashed, 0); |
diff --git a/fs/ntfs/inode.c b/fs/ntfs/inode.c index 1d0c21df0d80..d284f07eda77 100644 --- a/fs/ntfs/inode.c +++ b/fs/ntfs/inode.c | |||
| @@ -2889,7 +2889,7 @@ void ntfs_truncate_vfs(struct inode *vi) { | |||
| 2889 | */ | 2889 | */ |
| 2890 | int ntfs_setattr(struct dentry *dentry, struct iattr *attr) | 2890 | int ntfs_setattr(struct dentry *dentry, struct iattr *attr) |
| 2891 | { | 2891 | { |
| 2892 | struct inode *vi = dentry->d_inode; | 2892 | struct inode *vi = d_inode(dentry); |
| 2893 | int err; | 2893 | int err; |
| 2894 | unsigned int ia_valid = attr->ia_valid; | 2894 | unsigned int ia_valid = attr->ia_valid; |
| 2895 | 2895 | ||
diff --git a/fs/ntfs/namei.c b/fs/ntfs/namei.c index b3973c2fd190..0f35b80d17fe 100644 --- a/fs/ntfs/namei.c +++ b/fs/ntfs/namei.c | |||
| @@ -292,14 +292,14 @@ const struct inode_operations ntfs_dir_inode_ops = { | |||
| 292 | * The code is based on the ext3 ->get_parent() implementation found in | 292 | * The code is based on the ext3 ->get_parent() implementation found in |
| 293 | * fs/ext3/namei.c::ext3_get_parent(). | 293 | * fs/ext3/namei.c::ext3_get_parent(). |
| 294 | * | 294 | * |
| 295 | * Note: ntfs_get_parent() is called with @child_dent->d_inode->i_mutex down. | 295 | * Note: ntfs_get_parent() is called with @d_inode(child_dent)->i_mutex down. |
| 296 | * | 296 | * |
| 297 | * Return the dentry of the parent directory on success or the error code on | 297 | * Return the dentry of the parent directory on success or the error code on |
| 298 | * error (IS_ERR() is true). | 298 | * error (IS_ERR() is true). |
| 299 | */ | 299 | */ |
| 300 | static struct dentry *ntfs_get_parent(struct dentry *child_dent) | 300 | static struct dentry *ntfs_get_parent(struct dentry *child_dent) |
| 301 | { | 301 | { |
| 302 | struct inode *vi = child_dent->d_inode; | 302 | struct inode *vi = d_inode(child_dent); |
| 303 | ntfs_inode *ni = NTFS_I(vi); | 303 | ntfs_inode *ni = NTFS_I(vi); |
| 304 | MFT_RECORD *mrec; | 304 | MFT_RECORD *mrec; |
| 305 | ntfs_attr_search_ctx *ctx; | 305 | ntfs_attr_search_ctx *ctx; |
diff --git a/fs/ocfs2/dcache.c b/fs/ocfs2/dcache.c index 4fda7a5f3088..290373024d9d 100644 --- a/fs/ocfs2/dcache.c +++ b/fs/ocfs2/dcache.c | |||
| @@ -42,8 +42,8 @@ | |||
| 42 | void ocfs2_dentry_attach_gen(struct dentry *dentry) | 42 | void ocfs2_dentry_attach_gen(struct dentry *dentry) |
| 43 | { | 43 | { |
| 44 | unsigned long gen = | 44 | unsigned long gen = |
| 45 | OCFS2_I(dentry->d_parent->d_inode)->ip_dir_lock_gen; | 45 | OCFS2_I(d_inode(dentry->d_parent))->ip_dir_lock_gen; |
| 46 | BUG_ON(dentry->d_inode); | 46 | BUG_ON(d_inode(dentry)); |
| 47 | dentry->d_fsdata = (void *)gen; | 47 | dentry->d_fsdata = (void *)gen; |
| 48 | } | 48 | } |
| 49 | 49 | ||
| @@ -57,7 +57,7 @@ static int ocfs2_dentry_revalidate(struct dentry *dentry, unsigned int flags) | |||
| 57 | if (flags & LOOKUP_RCU) | 57 | if (flags & LOOKUP_RCU) |
| 58 | return -ECHILD; | 58 | return -ECHILD; |
| 59 | 59 | ||
| 60 | inode = dentry->d_inode; | 60 | inode = d_inode(dentry); |
| 61 | osb = OCFS2_SB(dentry->d_sb); | 61 | osb = OCFS2_SB(dentry->d_sb); |
| 62 | 62 | ||
| 63 | trace_ocfs2_dentry_revalidate(dentry, dentry->d_name.len, | 63 | trace_ocfs2_dentry_revalidate(dentry, dentry->d_name.len, |
| @@ -71,7 +71,7 @@ static int ocfs2_dentry_revalidate(struct dentry *dentry, unsigned int flags) | |||
| 71 | unsigned long gen = (unsigned long) dentry->d_fsdata; | 71 | unsigned long gen = (unsigned long) dentry->d_fsdata; |
| 72 | unsigned long pgen; | 72 | unsigned long pgen; |
| 73 | spin_lock(&dentry->d_lock); | 73 | spin_lock(&dentry->d_lock); |
| 74 | pgen = OCFS2_I(dentry->d_parent->d_inode)->ip_dir_lock_gen; | 74 | pgen = OCFS2_I(d_inode(dentry->d_parent))->ip_dir_lock_gen; |
| 75 | spin_unlock(&dentry->d_lock); | 75 | spin_unlock(&dentry->d_lock); |
| 76 | trace_ocfs2_dentry_revalidate_negative(dentry->d_name.len, | 76 | trace_ocfs2_dentry_revalidate_negative(dentry->d_name.len, |
| 77 | dentry->d_name.name, | 77 | dentry->d_name.name, |
| @@ -146,7 +146,7 @@ static int ocfs2_match_dentry(struct dentry *dentry, | |||
| 146 | if (skip_unhashed && d_unhashed(dentry)) | 146 | if (skip_unhashed && d_unhashed(dentry)) |
| 147 | return 0; | 147 | return 0; |
| 148 | 148 | ||
| 149 | parent = dentry->d_parent->d_inode; | 149 | parent = d_inode(dentry->d_parent); |
| 150 | /* Negative parent dentry? */ | 150 | /* Negative parent dentry? */ |
| 151 | if (!parent) | 151 | if (!parent) |
| 152 | return 0; | 152 | return 0; |
| @@ -243,7 +243,7 @@ int ocfs2_dentry_attach_lock(struct dentry *dentry, | |||
| 243 | if (!inode) | 243 | if (!inode) |
| 244 | return 0; | 244 | return 0; |
| 245 | 245 | ||
| 246 | if (!dentry->d_inode && dentry->d_fsdata) { | 246 | if (d_really_is_negative(dentry) && dentry->d_fsdata) { |
| 247 | /* Converting a negative dentry to positive | 247 | /* Converting a negative dentry to positive |
| 248 | Clear dentry->d_fsdata */ | 248 | Clear dentry->d_fsdata */ |
| 249 | dentry->d_fsdata = dl = NULL; | 249 | dentry->d_fsdata = dl = NULL; |
| @@ -446,7 +446,7 @@ void ocfs2_dentry_move(struct dentry *dentry, struct dentry *target, | |||
| 446 | { | 446 | { |
| 447 | int ret; | 447 | int ret; |
| 448 | struct ocfs2_super *osb = OCFS2_SB(old_dir->i_sb); | 448 | struct ocfs2_super *osb = OCFS2_SB(old_dir->i_sb); |
| 449 | struct inode *inode = dentry->d_inode; | 449 | struct inode *inode = d_inode(dentry); |
| 450 | 450 | ||
| 451 | /* | 451 | /* |
| 452 | * Move within the same directory, so the actual lock info won't | 452 | * Move within the same directory, so the actual lock info won't |
diff --git a/fs/ocfs2/dir.h b/fs/ocfs2/dir.h index f0344b75b14d..3d8639f38973 100644 --- a/fs/ocfs2/dir.h +++ b/fs/ocfs2/dir.h | |||
| @@ -72,7 +72,7 @@ static inline int ocfs2_add_entry(handle_t *handle, | |||
| 72 | struct buffer_head *parent_fe_bh, | 72 | struct buffer_head *parent_fe_bh, |
| 73 | struct ocfs2_dir_lookup_result *lookup) | 73 | struct ocfs2_dir_lookup_result *lookup) |
| 74 | { | 74 | { |
| 75 | return __ocfs2_add_entry(handle, dentry->d_parent->d_inode, | 75 | return __ocfs2_add_entry(handle, d_inode(dentry->d_parent), |
| 76 | dentry->d_name.name, dentry->d_name.len, | 76 | dentry->d_name.name, dentry->d_name.len, |
| 77 | inode, blkno, parent_fe_bh, lookup); | 77 | inode, blkno, parent_fe_bh, lookup); |
| 78 | } | 78 | } |
diff --git a/fs/ocfs2/dlmfs/dlmfs.c b/fs/ocfs2/dlmfs/dlmfs.c index 061ba6a91bf2..b5cf27dcb18a 100644 --- a/fs/ocfs2/dlmfs/dlmfs.c +++ b/fs/ocfs2/dlmfs/dlmfs.c | |||
| @@ -208,7 +208,7 @@ static int dlmfs_file_release(struct inode *inode, | |||
| 208 | static int dlmfs_file_setattr(struct dentry *dentry, struct iattr *attr) | 208 | static int dlmfs_file_setattr(struct dentry *dentry, struct iattr *attr) |
| 209 | { | 209 | { |
| 210 | int error; | 210 | int error; |
| 211 | struct inode *inode = dentry->d_inode; | 211 | struct inode *inode = d_inode(dentry); |
| 212 | 212 | ||
| 213 | attr->ia_valid &= ~ATTR_SIZE; | 213 | attr->ia_valid &= ~ATTR_SIZE; |
| 214 | error = inode_change_ok(inode, attr); | 214 | error = inode_change_ok(inode, attr); |
| @@ -549,7 +549,7 @@ static int dlmfs_unlink(struct inode *dir, | |||
| 549 | struct dentry *dentry) | 549 | struct dentry *dentry) |
| 550 | { | 550 | { |
| 551 | int status; | 551 | int status; |
| 552 | struct inode *inode = dentry->d_inode; | 552 | struct inode *inode = d_inode(dentry); |
| 553 | 553 | ||
| 554 | mlog(0, "unlink inode %lu\n", inode->i_ino); | 554 | mlog(0, "unlink inode %lu\n", inode->i_ino); |
| 555 | 555 | ||
diff --git a/fs/ocfs2/export.c b/fs/ocfs2/export.c index 540dc4bdd042..827fc9809bc2 100644 --- a/fs/ocfs2/export.c +++ b/fs/ocfs2/export.c | |||
| @@ -147,7 +147,7 @@ static struct dentry *ocfs2_get_parent(struct dentry *child) | |||
| 147 | int status; | 147 | int status; |
| 148 | u64 blkno; | 148 | u64 blkno; |
| 149 | struct dentry *parent; | 149 | struct dentry *parent; |
| 150 | struct inode *dir = child->d_inode; | 150 | struct inode *dir = d_inode(child); |
| 151 | 151 | ||
| 152 | trace_ocfs2_get_parent(child, child->d_name.len, child->d_name.name, | 152 | trace_ocfs2_get_parent(child, child->d_name.len, child->d_name.name, |
| 153 | (unsigned long long)OCFS2_I(dir)->ip_blkno); | 153 | (unsigned long long)OCFS2_I(dir)->ip_blkno); |
diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c index 913fc250d85a..d8b670cbd909 100644 --- a/fs/ocfs2/file.c +++ b/fs/ocfs2/file.c | |||
| @@ -1126,7 +1126,7 @@ out: | |||
| 1126 | int ocfs2_setattr(struct dentry *dentry, struct iattr *attr) | 1126 | int ocfs2_setattr(struct dentry *dentry, struct iattr *attr) |
| 1127 | { | 1127 | { |
| 1128 | int status = 0, size_change; | 1128 | int status = 0, size_change; |
| 1129 | struct inode *inode = dentry->d_inode; | 1129 | struct inode *inode = d_inode(dentry); |
| 1130 | struct super_block *sb = inode->i_sb; | 1130 | struct super_block *sb = inode->i_sb; |
| 1131 | struct ocfs2_super *osb = OCFS2_SB(sb); | 1131 | struct ocfs2_super *osb = OCFS2_SB(sb); |
| 1132 | struct buffer_head *bh = NULL; | 1132 | struct buffer_head *bh = NULL; |
| @@ -1275,8 +1275,8 @@ int ocfs2_getattr(struct vfsmount *mnt, | |||
| 1275 | struct dentry *dentry, | 1275 | struct dentry *dentry, |
| 1276 | struct kstat *stat) | 1276 | struct kstat *stat) |
| 1277 | { | 1277 | { |
| 1278 | struct inode *inode = dentry->d_inode; | 1278 | struct inode *inode = d_inode(dentry); |
| 1279 | struct super_block *sb = dentry->d_inode->i_sb; | 1279 | struct super_block *sb = d_inode(dentry)->i_sb; |
| 1280 | struct ocfs2_super *osb = sb->s_fs_info; | 1280 | struct ocfs2_super *osb = sb->s_fs_info; |
| 1281 | int err; | 1281 | int err; |
| 1282 | 1282 | ||
| @@ -2114,7 +2114,7 @@ static int ocfs2_prepare_inode_for_write(struct file *file, | |||
| 2114 | { | 2114 | { |
| 2115 | int ret = 0, meta_level = 0; | 2115 | int ret = 0, meta_level = 0; |
| 2116 | struct dentry *dentry = file->f_path.dentry; | 2116 | struct dentry *dentry = file->f_path.dentry; |
| 2117 | struct inode *inode = dentry->d_inode; | 2117 | struct inode *inode = d_inode(dentry); |
| 2118 | loff_t end; | 2118 | loff_t end; |
| 2119 | struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); | 2119 | struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); |
| 2120 | int full_coherency = !(osb->s_mount_opt & | 2120 | int full_coherency = !(osb->s_mount_opt & |
diff --git a/fs/ocfs2/inode.c b/fs/ocfs2/inode.c index be71ca0937f7..b254416dc8d9 100644 --- a/fs/ocfs2/inode.c +++ b/fs/ocfs2/inode.c | |||
| @@ -1209,7 +1209,7 @@ int ocfs2_drop_inode(struct inode *inode) | |||
| 1209 | */ | 1209 | */ |
| 1210 | int ocfs2_inode_revalidate(struct dentry *dentry) | 1210 | int ocfs2_inode_revalidate(struct dentry *dentry) |
| 1211 | { | 1211 | { |
| 1212 | struct inode *inode = dentry->d_inode; | 1212 | struct inode *inode = d_inode(dentry); |
| 1213 | int status = 0; | 1213 | int status = 0; |
| 1214 | 1214 | ||
| 1215 | trace_ocfs2_inode_revalidate(inode, | 1215 | trace_ocfs2_inode_revalidate(inode, |
diff --git a/fs/ocfs2/namei.c b/fs/ocfs2/namei.c index 09f90cbf0e24..176fe6afd94e 100644 --- a/fs/ocfs2/namei.c +++ b/fs/ocfs2/namei.c | |||
| @@ -689,8 +689,8 @@ static int ocfs2_link(struct dentry *old_dentry, | |||
| 689 | struct dentry *dentry) | 689 | struct dentry *dentry) |
| 690 | { | 690 | { |
| 691 | handle_t *handle; | 691 | handle_t *handle; |
| 692 | struct inode *inode = old_dentry->d_inode; | 692 | struct inode *inode = d_inode(old_dentry); |
| 693 | struct inode *old_dir = old_dentry->d_parent->d_inode; | 693 | struct inode *old_dir = d_inode(old_dentry->d_parent); |
| 694 | int err; | 694 | int err; |
| 695 | struct buffer_head *fe_bh = NULL; | 695 | struct buffer_head *fe_bh = NULL; |
| 696 | struct buffer_head *old_dir_bh = NULL; | 696 | struct buffer_head *old_dir_bh = NULL; |
| @@ -879,7 +879,7 @@ static int ocfs2_unlink(struct inode *dir, | |||
| 879 | int status; | 879 | int status; |
| 880 | int child_locked = 0; | 880 | int child_locked = 0; |
| 881 | bool is_unlinkable = false; | 881 | bool is_unlinkable = false; |
| 882 | struct inode *inode = dentry->d_inode; | 882 | struct inode *inode = d_inode(dentry); |
| 883 | struct inode *orphan_dir = NULL; | 883 | struct inode *orphan_dir = NULL; |
| 884 | struct ocfs2_super *osb = OCFS2_SB(dir->i_sb); | 884 | struct ocfs2_super *osb = OCFS2_SB(dir->i_sb); |
| 885 | u64 blkno; | 885 | u64 blkno; |
| @@ -898,7 +898,7 @@ static int ocfs2_unlink(struct inode *dir, | |||
| 898 | 898 | ||
| 899 | dquot_initialize(dir); | 899 | dquot_initialize(dir); |
| 900 | 900 | ||
| 901 | BUG_ON(dentry->d_parent->d_inode != dir); | 901 | BUG_ON(d_inode(dentry->d_parent) != dir); |
| 902 | 902 | ||
| 903 | if (inode == osb->root_inode) | 903 | if (inode == osb->root_inode) |
| 904 | return -EPERM; | 904 | return -EPERM; |
| @@ -1209,8 +1209,8 @@ static int ocfs2_rename(struct inode *old_dir, | |||
| 1209 | { | 1209 | { |
| 1210 | int status = 0, rename_lock = 0, parents_locked = 0, target_exists = 0; | 1210 | int status = 0, rename_lock = 0, parents_locked = 0, target_exists = 0; |
| 1211 | int old_child_locked = 0, new_child_locked = 0, update_dot_dot = 0; | 1211 | int old_child_locked = 0, new_child_locked = 0, update_dot_dot = 0; |
| 1212 | struct inode *old_inode = old_dentry->d_inode; | 1212 | struct inode *old_inode = d_inode(old_dentry); |
| 1213 | struct inode *new_inode = new_dentry->d_inode; | 1213 | struct inode *new_inode = d_inode(new_dentry); |
| 1214 | struct inode *orphan_dir = NULL; | 1214 | struct inode *orphan_dir = NULL; |
| 1215 | struct ocfs2_dinode *newfe = NULL; | 1215 | struct ocfs2_dinode *newfe = NULL; |
| 1216 | char orphan_name[OCFS2_ORPHAN_NAMELEN + 1]; | 1216 | char orphan_name[OCFS2_ORPHAN_NAMELEN + 1]; |
| @@ -1454,7 +1454,7 @@ static int ocfs2_rename(struct inode *old_dir, | |||
| 1454 | should_add_orphan = true; | 1454 | should_add_orphan = true; |
| 1455 | } | 1455 | } |
| 1456 | } else { | 1456 | } else { |
| 1457 | BUG_ON(new_dentry->d_parent->d_inode != new_dir); | 1457 | BUG_ON(d_inode(new_dentry->d_parent) != new_dir); |
| 1458 | 1458 | ||
| 1459 | status = ocfs2_check_dir_for_entry(new_dir, | 1459 | status = ocfs2_check_dir_for_entry(new_dir, |
| 1460 | new_dentry->d_name.name, | 1460 | new_dentry->d_name.name, |
diff --git a/fs/ocfs2/refcounttree.c b/fs/ocfs2/refcounttree.c index df3a500789c7..d8c6af101f3f 100644 --- a/fs/ocfs2/refcounttree.c +++ b/fs/ocfs2/refcounttree.c | |||
| @@ -4194,7 +4194,7 @@ static int __ocfs2_reflink(struct dentry *old_dentry, | |||
| 4194 | bool preserve) | 4194 | bool preserve) |
| 4195 | { | 4195 | { |
| 4196 | int ret; | 4196 | int ret; |
| 4197 | struct inode *inode = old_dentry->d_inode; | 4197 | struct inode *inode = d_inode(old_dentry); |
| 4198 | struct buffer_head *new_bh = NULL; | 4198 | struct buffer_head *new_bh = NULL; |
| 4199 | 4199 | ||
| 4200 | if (OCFS2_I(inode)->ip_flags & OCFS2_INODE_SYSTEM_FILE) { | 4200 | if (OCFS2_I(inode)->ip_flags & OCFS2_INODE_SYSTEM_FILE) { |
| @@ -4263,7 +4263,7 @@ static int ocfs2_reflink(struct dentry *old_dentry, struct inode *dir, | |||
| 4263 | struct dentry *new_dentry, bool preserve) | 4263 | struct dentry *new_dentry, bool preserve) |
| 4264 | { | 4264 | { |
| 4265 | int error; | 4265 | int error; |
| 4266 | struct inode *inode = old_dentry->d_inode; | 4266 | struct inode *inode = d_inode(old_dentry); |
| 4267 | struct buffer_head *old_bh = NULL; | 4267 | struct buffer_head *old_bh = NULL; |
| 4268 | struct inode *new_orphan_inode = NULL; | 4268 | struct inode *new_orphan_inode = NULL; |
| 4269 | struct posix_acl *default_acl, *acl; | 4269 | struct posix_acl *default_acl, *acl; |
| @@ -4357,7 +4357,7 @@ out: | |||
| 4357 | /* copied from may_create in VFS. */ | 4357 | /* copied from may_create in VFS. */ |
| 4358 | static inline int ocfs2_may_create(struct inode *dir, struct dentry *child) | 4358 | static inline int ocfs2_may_create(struct inode *dir, struct dentry *child) |
| 4359 | { | 4359 | { |
| 4360 | if (child->d_inode) | 4360 | if (d_really_is_positive(child)) |
| 4361 | return -EEXIST; | 4361 | return -EEXIST; |
| 4362 | if (IS_DEADDIR(dir)) | 4362 | if (IS_DEADDIR(dir)) |
| 4363 | return -ENOENT; | 4363 | return -ENOENT; |
| @@ -4375,7 +4375,7 @@ static inline int ocfs2_may_create(struct inode *dir, struct dentry *child) | |||
| 4375 | static int ocfs2_vfs_reflink(struct dentry *old_dentry, struct inode *dir, | 4375 | static int ocfs2_vfs_reflink(struct dentry *old_dentry, struct inode *dir, |
| 4376 | struct dentry *new_dentry, bool preserve) | 4376 | struct dentry *new_dentry, bool preserve) |
| 4377 | { | 4377 | { |
| 4378 | struct inode *inode = old_dentry->d_inode; | 4378 | struct inode *inode = d_inode(old_dentry); |
| 4379 | int error; | 4379 | int error; |
| 4380 | 4380 | ||
| 4381 | if (!inode) | 4381 | if (!inode) |
| @@ -4463,7 +4463,7 @@ int ocfs2_reflink_ioctl(struct inode *inode, | |||
| 4463 | } | 4463 | } |
| 4464 | 4464 | ||
| 4465 | error = ocfs2_vfs_reflink(old_path.dentry, | 4465 | error = ocfs2_vfs_reflink(old_path.dentry, |
| 4466 | new_path.dentry->d_inode, | 4466 | d_inode(new_path.dentry), |
| 4467 | new_dentry, preserve); | 4467 | new_dentry, preserve); |
| 4468 | out_dput: | 4468 | out_dput: |
| 4469 | done_path_create(&new_path, new_dentry); | 4469 | done_path_create(&new_path, new_dentry); |
diff --git a/fs/ocfs2/xattr.c b/fs/ocfs2/xattr.c index 4ca7533be479..d03bfbf3d27d 100644 --- a/fs/ocfs2/xattr.c +++ b/fs/ocfs2/xattr.c | |||
| @@ -1020,7 +1020,7 @@ ssize_t ocfs2_listxattr(struct dentry *dentry, | |||
| 1020 | int ret = 0, i_ret = 0, b_ret = 0; | 1020 | int ret = 0, i_ret = 0, b_ret = 0; |
| 1021 | struct buffer_head *di_bh = NULL; | 1021 | struct buffer_head *di_bh = NULL; |
| 1022 | struct ocfs2_dinode *di = NULL; | 1022 | struct ocfs2_dinode *di = NULL; |
| 1023 | struct ocfs2_inode_info *oi = OCFS2_I(dentry->d_inode); | 1023 | struct ocfs2_inode_info *oi = OCFS2_I(d_inode(dentry)); |
| 1024 | 1024 | ||
| 1025 | if (!ocfs2_supports_xattr(OCFS2_SB(dentry->d_sb))) | 1025 | if (!ocfs2_supports_xattr(OCFS2_SB(dentry->d_sb))) |
| 1026 | return -EOPNOTSUPP; | 1026 | return -EOPNOTSUPP; |
| @@ -1028,7 +1028,7 @@ ssize_t ocfs2_listxattr(struct dentry *dentry, | |||
| 1028 | if (!(oi->ip_dyn_features & OCFS2_HAS_XATTR_FL)) | 1028 | if (!(oi->ip_dyn_features & OCFS2_HAS_XATTR_FL)) |
| 1029 | return ret; | 1029 | return ret; |
| 1030 | 1030 | ||
| 1031 | ret = ocfs2_inode_lock(dentry->d_inode, &di_bh, 0); | 1031 | ret = ocfs2_inode_lock(d_inode(dentry), &di_bh, 0); |
| 1032 | if (ret < 0) { | 1032 | if (ret < 0) { |
| 1033 | mlog_errno(ret); | 1033 | mlog_errno(ret); |
| 1034 | return ret; | 1034 | return ret; |
| @@ -1037,7 +1037,7 @@ ssize_t ocfs2_listxattr(struct dentry *dentry, | |||
| 1037 | di = (struct ocfs2_dinode *)di_bh->b_data; | 1037 | di = (struct ocfs2_dinode *)di_bh->b_data; |
| 1038 | 1038 | ||
| 1039 | down_read(&oi->ip_xattr_sem); | 1039 | down_read(&oi->ip_xattr_sem); |
| 1040 | i_ret = ocfs2_xattr_ibody_list(dentry->d_inode, di, buffer, size); | 1040 | i_ret = ocfs2_xattr_ibody_list(d_inode(dentry), di, buffer, size); |
| 1041 | if (i_ret < 0) | 1041 | if (i_ret < 0) |
| 1042 | b_ret = 0; | 1042 | b_ret = 0; |
| 1043 | else { | 1043 | else { |
| @@ -1045,13 +1045,13 @@ ssize_t ocfs2_listxattr(struct dentry *dentry, | |||
| 1045 | buffer += i_ret; | 1045 | buffer += i_ret; |
| 1046 | size -= i_ret; | 1046 | size -= i_ret; |
| 1047 | } | 1047 | } |
| 1048 | b_ret = ocfs2_xattr_block_list(dentry->d_inode, di, | 1048 | b_ret = ocfs2_xattr_block_list(d_inode(dentry), di, |
| 1049 | buffer, size); | 1049 | buffer, size); |
| 1050 | if (b_ret < 0) | 1050 | if (b_ret < 0) |
| 1051 | i_ret = 0; | 1051 | i_ret = 0; |
| 1052 | } | 1052 | } |
| 1053 | up_read(&oi->ip_xattr_sem); | 1053 | up_read(&oi->ip_xattr_sem); |
| 1054 | ocfs2_inode_unlock(dentry->d_inode, 0); | 1054 | ocfs2_inode_unlock(d_inode(dentry), 0); |
| 1055 | 1055 | ||
| 1056 | brelse(di_bh); | 1056 | brelse(di_bh); |
| 1057 | 1057 | ||
| @@ -7257,7 +7257,7 @@ static int ocfs2_xattr_security_get(struct dentry *dentry, const char *name, | |||
| 7257 | { | 7257 | { |
| 7258 | if (strcmp(name, "") == 0) | 7258 | if (strcmp(name, "") == 0) |
| 7259 | return -EINVAL; | 7259 | return -EINVAL; |
| 7260 | return ocfs2_xattr_get(dentry->d_inode, OCFS2_XATTR_INDEX_SECURITY, | 7260 | return ocfs2_xattr_get(d_inode(dentry), OCFS2_XATTR_INDEX_SECURITY, |
| 7261 | name, buffer, size); | 7261 | name, buffer, size); |
| 7262 | } | 7262 | } |
| 7263 | 7263 | ||
| @@ -7267,7 +7267,7 @@ static int ocfs2_xattr_security_set(struct dentry *dentry, const char *name, | |||
| 7267 | if (strcmp(name, "") == 0) | 7267 | if (strcmp(name, "") == 0) |
| 7268 | return -EINVAL; | 7268 | return -EINVAL; |
| 7269 | 7269 | ||
| 7270 | return ocfs2_xattr_set(dentry->d_inode, OCFS2_XATTR_INDEX_SECURITY, | 7270 | return ocfs2_xattr_set(d_inode(dentry), OCFS2_XATTR_INDEX_SECURITY, |
| 7271 | name, value, size, flags); | 7271 | name, value, size, flags); |
| 7272 | } | 7272 | } |
| 7273 | 7273 | ||
| @@ -7347,7 +7347,7 @@ static int ocfs2_xattr_trusted_get(struct dentry *dentry, const char *name, | |||
| 7347 | { | 7347 | { |
| 7348 | if (strcmp(name, "") == 0) | 7348 | if (strcmp(name, "") == 0) |
| 7349 | return -EINVAL; | 7349 | return -EINVAL; |
| 7350 | return ocfs2_xattr_get(dentry->d_inode, OCFS2_XATTR_INDEX_TRUSTED, | 7350 | return ocfs2_xattr_get(d_inode(dentry), OCFS2_XATTR_INDEX_TRUSTED, |
| 7351 | name, buffer, size); | 7351 | name, buffer, size); |
| 7352 | } | 7352 | } |
| 7353 | 7353 | ||
| @@ -7357,7 +7357,7 @@ static int ocfs2_xattr_trusted_set(struct dentry *dentry, const char *name, | |||
| 7357 | if (strcmp(name, "") == 0) | 7357 | if (strcmp(name, "") == 0) |
| 7358 | return -EINVAL; | 7358 | return -EINVAL; |
| 7359 | 7359 | ||
| 7360 | return ocfs2_xattr_set(dentry->d_inode, OCFS2_XATTR_INDEX_TRUSTED, | 7360 | return ocfs2_xattr_set(d_inode(dentry), OCFS2_XATTR_INDEX_TRUSTED, |
| 7361 | name, value, size, flags); | 7361 | name, value, size, flags); |
| 7362 | } | 7362 | } |
| 7363 | 7363 | ||
| @@ -7399,7 +7399,7 @@ static int ocfs2_xattr_user_get(struct dentry *dentry, const char *name, | |||
| 7399 | return -EINVAL; | 7399 | return -EINVAL; |
| 7400 | if (osb->s_mount_opt & OCFS2_MOUNT_NOUSERXATTR) | 7400 | if (osb->s_mount_opt & OCFS2_MOUNT_NOUSERXATTR) |
| 7401 | return -EOPNOTSUPP; | 7401 | return -EOPNOTSUPP; |
| 7402 | return ocfs2_xattr_get(dentry->d_inode, OCFS2_XATTR_INDEX_USER, name, | 7402 | return ocfs2_xattr_get(d_inode(dentry), OCFS2_XATTR_INDEX_USER, name, |
| 7403 | buffer, size); | 7403 | buffer, size); |
| 7404 | } | 7404 | } |
| 7405 | 7405 | ||
| @@ -7413,7 +7413,7 @@ static int ocfs2_xattr_user_set(struct dentry *dentry, const char *name, | |||
| 7413 | if (osb->s_mount_opt & OCFS2_MOUNT_NOUSERXATTR) | 7413 | if (osb->s_mount_opt & OCFS2_MOUNT_NOUSERXATTR) |
| 7414 | return -EOPNOTSUPP; | 7414 | return -EOPNOTSUPP; |
| 7415 | 7415 | ||
| 7416 | return ocfs2_xattr_set(dentry->d_inode, OCFS2_XATTR_INDEX_USER, | 7416 | return ocfs2_xattr_set(d_inode(dentry), OCFS2_XATTR_INDEX_USER, |
| 7417 | name, value, size, flags); | 7417 | name, value, size, flags); |
| 7418 | } | 7418 | } |
| 7419 | 7419 | ||
diff --git a/fs/omfs/dir.c b/fs/omfs/dir.c index 1b8e9e8405b2..f833bf8d5792 100644 --- a/fs/omfs/dir.c +++ b/fs/omfs/dir.c | |||
| @@ -110,7 +110,7 @@ int omfs_make_empty(struct inode *inode, struct super_block *sb) | |||
| 110 | 110 | ||
| 111 | static int omfs_add_link(struct dentry *dentry, struct inode *inode) | 111 | static int omfs_add_link(struct dentry *dentry, struct inode *inode) |
| 112 | { | 112 | { |
| 113 | struct inode *dir = dentry->d_parent->d_inode; | 113 | struct inode *dir = d_inode(dentry->d_parent); |
| 114 | const char *name = dentry->d_name.name; | 114 | const char *name = dentry->d_name.name; |
| 115 | int namelen = dentry->d_name.len; | 115 | int namelen = dentry->d_name.len; |
| 116 | struct omfs_inode *oi; | 116 | struct omfs_inode *oi; |
| @@ -155,7 +155,7 @@ out: | |||
| 155 | 155 | ||
| 156 | static int omfs_delete_entry(struct dentry *dentry) | 156 | static int omfs_delete_entry(struct dentry *dentry) |
| 157 | { | 157 | { |
| 158 | struct inode *dir = dentry->d_parent->d_inode; | 158 | struct inode *dir = d_inode(dentry->d_parent); |
| 159 | struct inode *dirty; | 159 | struct inode *dirty; |
| 160 | const char *name = dentry->d_name.name; | 160 | const char *name = dentry->d_name.name; |
| 161 | int namelen = dentry->d_name.len; | 161 | int namelen = dentry->d_name.len; |
| @@ -237,7 +237,7 @@ static int omfs_dir_is_empty(struct inode *inode) | |||
| 237 | 237 | ||
| 238 | static int omfs_remove(struct inode *dir, struct dentry *dentry) | 238 | static int omfs_remove(struct inode *dir, struct dentry *dentry) |
| 239 | { | 239 | { |
| 240 | struct inode *inode = dentry->d_inode; | 240 | struct inode *inode = d_inode(dentry); |
| 241 | int ret; | 241 | int ret; |
| 242 | 242 | ||
| 243 | 243 | ||
| @@ -373,8 +373,8 @@ static bool omfs_fill_chain(struct inode *dir, struct dir_context *ctx, | |||
| 373 | static int omfs_rename(struct inode *old_dir, struct dentry *old_dentry, | 373 | static int omfs_rename(struct inode *old_dir, struct dentry *old_dentry, |
| 374 | struct inode *new_dir, struct dentry *new_dentry) | 374 | struct inode *new_dir, struct dentry *new_dentry) |
| 375 | { | 375 | { |
| 376 | struct inode *new_inode = new_dentry->d_inode; | 376 | struct inode *new_inode = d_inode(new_dentry); |
| 377 | struct inode *old_inode = old_dentry->d_inode; | 377 | struct inode *old_inode = d_inode(old_dentry); |
| 378 | int err; | 378 | int err; |
| 379 | 379 | ||
| 380 | if (new_inode) { | 380 | if (new_inode) { |
diff --git a/fs/omfs/file.c b/fs/omfs/file.c index f993be7f2156..d9e26cfbb793 100644 --- a/fs/omfs/file.c +++ b/fs/omfs/file.c | |||
| @@ -346,7 +346,7 @@ const struct file_operations omfs_file_operations = { | |||
| 346 | 346 | ||
| 347 | static int omfs_setattr(struct dentry *dentry, struct iattr *attr) | 347 | static int omfs_setattr(struct dentry *dentry, struct iattr *attr) |
| 348 | { | 348 | { |
| 349 | struct inode *inode = dentry->d_inode; | 349 | struct inode *inode = d_inode(dentry); |
| 350 | int error; | 350 | int error; |
| 351 | 351 | ||
| 352 | error = inode_change_ok(inode, attr); | 352 | error = inode_change_ok(inode, attr); |
| @@ -627,7 +627,7 @@ static struct vfsmount *pipe_mnt __read_mostly; | |||
| 627 | static char *pipefs_dname(struct dentry *dentry, char *buffer, int buflen) | 627 | static char *pipefs_dname(struct dentry *dentry, char *buffer, int buflen) |
| 628 | { | 628 | { |
| 629 | return dynamic_dname(dentry, buffer, buflen, "pipe:[%lu]", | 629 | return dynamic_dname(dentry, buffer, buflen, "pipe:[%lu]", |
| 630 | dentry->d_inode->i_ino); | 630 | d_inode(dentry)->i_ino); |
| 631 | } | 631 | } |
| 632 | 632 | ||
| 633 | static const struct dentry_operations pipefs_dentry_operations = { | 633 | static const struct dentry_operations pipefs_dentry_operations = { |
diff --git a/fs/posix_acl.c b/fs/posix_acl.c index 3a48bb789c9f..84bb65b83570 100644 --- a/fs/posix_acl.c +++ b/fs/posix_acl.c | |||
| @@ -774,12 +774,12 @@ posix_acl_xattr_get(struct dentry *dentry, const char *name, | |||
| 774 | struct posix_acl *acl; | 774 | struct posix_acl *acl; |
| 775 | int error; | 775 | int error; |
| 776 | 776 | ||
| 777 | if (!IS_POSIXACL(dentry->d_inode)) | 777 | if (!IS_POSIXACL(d_backing_inode(dentry))) |
| 778 | return -EOPNOTSUPP; | 778 | return -EOPNOTSUPP; |
| 779 | if (d_is_symlink(dentry)) | 779 | if (d_is_symlink(dentry)) |
| 780 | return -EOPNOTSUPP; | 780 | return -EOPNOTSUPP; |
| 781 | 781 | ||
| 782 | acl = get_acl(dentry->d_inode, type); | 782 | acl = get_acl(d_backing_inode(dentry), type); |
| 783 | if (IS_ERR(acl)) | 783 | if (IS_ERR(acl)) |
| 784 | return PTR_ERR(acl); | 784 | return PTR_ERR(acl); |
| 785 | if (acl == NULL) | 785 | if (acl == NULL) |
| @@ -795,7 +795,7 @@ static int | |||
| 795 | posix_acl_xattr_set(struct dentry *dentry, const char *name, | 795 | posix_acl_xattr_set(struct dentry *dentry, const char *name, |
| 796 | const void *value, size_t size, int flags, int type) | 796 | const void *value, size_t size, int flags, int type) |
| 797 | { | 797 | { |
| 798 | struct inode *inode = dentry->d_inode; | 798 | struct inode *inode = d_backing_inode(dentry); |
| 799 | struct posix_acl *acl = NULL; | 799 | struct posix_acl *acl = NULL; |
| 800 | int ret; | 800 | int ret; |
| 801 | 801 | ||
| @@ -834,7 +834,7 @@ posix_acl_xattr_list(struct dentry *dentry, char *list, size_t list_size, | |||
| 834 | const char *xname; | 834 | const char *xname; |
| 835 | size_t size; | 835 | size_t size; |
| 836 | 836 | ||
| 837 | if (!IS_POSIXACL(dentry->d_inode)) | 837 | if (!IS_POSIXACL(d_backing_inode(dentry))) |
| 838 | return -EOPNOTSUPP; | 838 | return -EOPNOTSUPP; |
| 839 | if (d_is_symlink(dentry)) | 839 | if (d_is_symlink(dentry)) |
| 840 | return -EOPNOTSUPP; | 840 | return -EOPNOTSUPP; |
diff --git a/fs/proc/base.c b/fs/proc/base.c index 7a3b82f986dd..093ca14f5701 100644 --- a/fs/proc/base.c +++ b/fs/proc/base.c | |||
| @@ -169,7 +169,7 @@ static int get_task_root(struct task_struct *task, struct path *root) | |||
| 169 | 169 | ||
| 170 | static int proc_cwd_link(struct dentry *dentry, struct path *path) | 170 | static int proc_cwd_link(struct dentry *dentry, struct path *path) |
| 171 | { | 171 | { |
| 172 | struct task_struct *task = get_proc_task(dentry->d_inode); | 172 | struct task_struct *task = get_proc_task(d_inode(dentry)); |
| 173 | int result = -ENOENT; | 173 | int result = -ENOENT; |
| 174 | 174 | ||
| 175 | if (task) { | 175 | if (task) { |
| @@ -186,7 +186,7 @@ static int proc_cwd_link(struct dentry *dentry, struct path *path) | |||
| 186 | 186 | ||
| 187 | static int proc_root_link(struct dentry *dentry, struct path *path) | 187 | static int proc_root_link(struct dentry *dentry, struct path *path) |
| 188 | { | 188 | { |
| 189 | struct task_struct *task = get_proc_task(dentry->d_inode); | 189 | struct task_struct *task = get_proc_task(d_inode(dentry)); |
| 190 | int result = -ENOENT; | 190 | int result = -ENOENT; |
| 191 | 191 | ||
| 192 | if (task) { | 192 | if (task) { |
| @@ -514,7 +514,7 @@ static int proc_fd_access_allowed(struct inode *inode) | |||
| 514 | int proc_setattr(struct dentry *dentry, struct iattr *attr) | 514 | int proc_setattr(struct dentry *dentry, struct iattr *attr) |
| 515 | { | 515 | { |
| 516 | int error; | 516 | int error; |
| 517 | struct inode *inode = dentry->d_inode; | 517 | struct inode *inode = d_inode(dentry); |
| 518 | 518 | ||
| 519 | if (attr->ia_valid & ATTR_MODE) | 519 | if (attr->ia_valid & ATTR_MODE) |
| 520 | return -EPERM; | 520 | return -EPERM; |
| @@ -1362,7 +1362,7 @@ static int proc_exe_link(struct dentry *dentry, struct path *exe_path) | |||
| 1362 | struct mm_struct *mm; | 1362 | struct mm_struct *mm; |
| 1363 | struct file *exe_file; | 1363 | struct file *exe_file; |
| 1364 | 1364 | ||
| 1365 | task = get_proc_task(dentry->d_inode); | 1365 | task = get_proc_task(d_inode(dentry)); |
| 1366 | if (!task) | 1366 | if (!task) |
| 1367 | return -ENOENT; | 1367 | return -ENOENT; |
| 1368 | mm = get_task_mm(task); | 1368 | mm = get_task_mm(task); |
| @@ -1382,7 +1382,7 @@ static int proc_exe_link(struct dentry *dentry, struct path *exe_path) | |||
| 1382 | 1382 | ||
| 1383 | static void *proc_pid_follow_link(struct dentry *dentry, struct nameidata *nd) | 1383 | static void *proc_pid_follow_link(struct dentry *dentry, struct nameidata *nd) |
| 1384 | { | 1384 | { |
| 1385 | struct inode *inode = dentry->d_inode; | 1385 | struct inode *inode = d_inode(dentry); |
| 1386 | struct path path; | 1386 | struct path path; |
| 1387 | int error = -EACCES; | 1387 | int error = -EACCES; |
| 1388 | 1388 | ||
| @@ -1427,7 +1427,7 @@ static int do_proc_readlink(struct path *path, char __user *buffer, int buflen) | |||
| 1427 | static int proc_pid_readlink(struct dentry * dentry, char __user * buffer, int buflen) | 1427 | static int proc_pid_readlink(struct dentry * dentry, char __user * buffer, int buflen) |
| 1428 | { | 1428 | { |
| 1429 | int error = -EACCES; | 1429 | int error = -EACCES; |
| 1430 | struct inode *inode = dentry->d_inode; | 1430 | struct inode *inode = d_inode(dentry); |
| 1431 | struct path path; | 1431 | struct path path; |
| 1432 | 1432 | ||
| 1433 | /* Are we allowed to snoop on the tasks file descriptors? */ | 1433 | /* Are we allowed to snoop on the tasks file descriptors? */ |
| @@ -1497,7 +1497,7 @@ out_unlock: | |||
| 1497 | 1497 | ||
| 1498 | int pid_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat) | 1498 | int pid_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat) |
| 1499 | { | 1499 | { |
| 1500 | struct inode *inode = dentry->d_inode; | 1500 | struct inode *inode = d_inode(dentry); |
| 1501 | struct task_struct *task; | 1501 | struct task_struct *task; |
| 1502 | const struct cred *cred; | 1502 | const struct cred *cred; |
| 1503 | struct pid_namespace *pid = dentry->d_sb->s_fs_info; | 1503 | struct pid_namespace *pid = dentry->d_sb->s_fs_info; |
| @@ -1554,7 +1554,7 @@ int pid_revalidate(struct dentry *dentry, unsigned int flags) | |||
| 1554 | if (flags & LOOKUP_RCU) | 1554 | if (flags & LOOKUP_RCU) |
| 1555 | return -ECHILD; | 1555 | return -ECHILD; |
| 1556 | 1556 | ||
| 1557 | inode = dentry->d_inode; | 1557 | inode = d_inode(dentry); |
| 1558 | task = get_proc_task(inode); | 1558 | task = get_proc_task(inode); |
| 1559 | 1559 | ||
| 1560 | if (task) { | 1560 | if (task) { |
| @@ -1588,7 +1588,7 @@ int pid_delete_dentry(const struct dentry *dentry) | |||
| 1588 | * If so, then don't put the dentry on the lru list, | 1588 | * If so, then don't put the dentry on the lru list, |
| 1589 | * kill it immediately. | 1589 | * kill it immediately. |
| 1590 | */ | 1590 | */ |
| 1591 | return proc_inode_is_dead(dentry->d_inode); | 1591 | return proc_inode_is_dead(d_inode(dentry)); |
| 1592 | } | 1592 | } |
| 1593 | 1593 | ||
| 1594 | const struct dentry_operations pid_dentry_operations = | 1594 | const struct dentry_operations pid_dentry_operations = |
| @@ -1626,12 +1626,12 @@ bool proc_fill_cache(struct file *file, struct dir_context *ctx, | |||
| 1626 | child = d_alloc(dir, &qname); | 1626 | child = d_alloc(dir, &qname); |
| 1627 | if (!child) | 1627 | if (!child) |
| 1628 | goto end_instantiate; | 1628 | goto end_instantiate; |
| 1629 | if (instantiate(dir->d_inode, child, task, ptr) < 0) { | 1629 | if (instantiate(d_inode(dir), child, task, ptr) < 0) { |
| 1630 | dput(child); | 1630 | dput(child); |
| 1631 | goto end_instantiate; | 1631 | goto end_instantiate; |
| 1632 | } | 1632 | } |
| 1633 | } | 1633 | } |
| 1634 | inode = child->d_inode; | 1634 | inode = d_inode(child); |
| 1635 | ino = inode->i_ino; | 1635 | ino = inode->i_ino; |
| 1636 | type = inode->i_mode >> 12; | 1636 | type = inode->i_mode >> 12; |
| 1637 | dput(child); | 1637 | dput(child); |
| @@ -1674,7 +1674,7 @@ static int map_files_d_revalidate(struct dentry *dentry, unsigned int flags) | |||
| 1674 | goto out_notask; | 1674 | goto out_notask; |
| 1675 | } | 1675 | } |
| 1676 | 1676 | ||
| 1677 | inode = dentry->d_inode; | 1677 | inode = d_inode(dentry); |
| 1678 | task = get_proc_task(inode); | 1678 | task = get_proc_task(inode); |
| 1679 | if (!task) | 1679 | if (!task) |
| 1680 | goto out_notask; | 1680 | goto out_notask; |
| @@ -1727,7 +1727,7 @@ static int proc_map_files_get_link(struct dentry *dentry, struct path *path) | |||
| 1727 | int rc; | 1727 | int rc; |
| 1728 | 1728 | ||
| 1729 | rc = -ENOENT; | 1729 | rc = -ENOENT; |
| 1730 | task = get_proc_task(dentry->d_inode); | 1730 | task = get_proc_task(d_inode(dentry)); |
| 1731 | if (!task) | 1731 | if (!task) |
| 1732 | goto out; | 1732 | goto out; |
| 1733 | 1733 | ||
| @@ -2863,13 +2863,13 @@ int proc_pid_readdir(struct file *file, struct dir_context *ctx) | |||
| 2863 | return 0; | 2863 | return 0; |
| 2864 | 2864 | ||
| 2865 | if (pos == TGID_OFFSET - 2) { | 2865 | if (pos == TGID_OFFSET - 2) { |
| 2866 | struct inode *inode = ns->proc_self->d_inode; | 2866 | struct inode *inode = d_inode(ns->proc_self); |
| 2867 | if (!dir_emit(ctx, "self", 4, inode->i_ino, DT_LNK)) | 2867 | if (!dir_emit(ctx, "self", 4, inode->i_ino, DT_LNK)) |
| 2868 | return 0; | 2868 | return 0; |
| 2869 | ctx->pos = pos = pos + 1; | 2869 | ctx->pos = pos = pos + 1; |
| 2870 | } | 2870 | } |
| 2871 | if (pos == TGID_OFFSET - 1) { | 2871 | if (pos == TGID_OFFSET - 1) { |
| 2872 | struct inode *inode = ns->proc_thread_self->d_inode; | 2872 | struct inode *inode = d_inode(ns->proc_thread_self); |
| 2873 | if (!dir_emit(ctx, "thread-self", 11, inode->i_ino, DT_LNK)) | 2873 | if (!dir_emit(ctx, "thread-self", 11, inode->i_ino, DT_LNK)) |
| 2874 | return 0; | 2874 | return 0; |
| 2875 | ctx->pos = pos = pos + 1; | 2875 | ctx->pos = pos = pos + 1; |
| @@ -3188,7 +3188,7 @@ static int proc_task_readdir(struct file *file, struct dir_context *ctx) | |||
| 3188 | 3188 | ||
| 3189 | static int proc_task_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat) | 3189 | static int proc_task_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat) |
| 3190 | { | 3190 | { |
| 3191 | struct inode *inode = dentry->d_inode; | 3191 | struct inode *inode = d_inode(dentry); |
| 3192 | struct task_struct *p = get_proc_task(inode); | 3192 | struct task_struct *p = get_proc_task(inode); |
| 3193 | generic_fillattr(inode, stat); | 3193 | generic_fillattr(inode, stat); |
| 3194 | 3194 | ||
diff --git a/fs/proc/fd.c b/fs/proc/fd.c index af84ad04df77..6e5fcd00733e 100644 --- a/fs/proc/fd.c +++ b/fs/proc/fd.c | |||
| @@ -91,7 +91,7 @@ static int tid_fd_revalidate(struct dentry *dentry, unsigned int flags) | |||
| 91 | if (flags & LOOKUP_RCU) | 91 | if (flags & LOOKUP_RCU) |
| 92 | return -ECHILD; | 92 | return -ECHILD; |
| 93 | 93 | ||
| 94 | inode = dentry->d_inode; | 94 | inode = d_inode(dentry); |
| 95 | task = get_proc_task(inode); | 95 | task = get_proc_task(inode); |
| 96 | fd = proc_fd(inode); | 96 | fd = proc_fd(inode); |
| 97 | 97 | ||
| @@ -151,14 +151,14 @@ static int proc_fd_link(struct dentry *dentry, struct path *path) | |||
| 151 | struct task_struct *task; | 151 | struct task_struct *task; |
| 152 | int ret = -ENOENT; | 152 | int ret = -ENOENT; |
| 153 | 153 | ||
| 154 | task = get_proc_task(dentry->d_inode); | 154 | task = get_proc_task(d_inode(dentry)); |
| 155 | if (task) { | 155 | if (task) { |
| 156 | files = get_files_struct(task); | 156 | files = get_files_struct(task); |
| 157 | put_task_struct(task); | 157 | put_task_struct(task); |
| 158 | } | 158 | } |
| 159 | 159 | ||
| 160 | if (files) { | 160 | if (files) { |
| 161 | int fd = proc_fd(dentry->d_inode); | 161 | int fd = proc_fd(d_inode(dentry)); |
| 162 | struct file *fd_file; | 162 | struct file *fd_file; |
| 163 | 163 | ||
| 164 | spin_lock(&files->file_lock); | 164 | spin_lock(&files->file_lock); |
diff --git a/fs/proc/generic.c b/fs/proc/generic.c index be65b2082135..df6327a2b865 100644 --- a/fs/proc/generic.c +++ b/fs/proc/generic.c | |||
| @@ -101,7 +101,7 @@ static bool pde_subdir_insert(struct proc_dir_entry *dir, | |||
| 101 | 101 | ||
| 102 | static int proc_notify_change(struct dentry *dentry, struct iattr *iattr) | 102 | static int proc_notify_change(struct dentry *dentry, struct iattr *iattr) |
| 103 | { | 103 | { |
| 104 | struct inode *inode = dentry->d_inode; | 104 | struct inode *inode = d_inode(dentry); |
| 105 | struct proc_dir_entry *de = PDE(inode); | 105 | struct proc_dir_entry *de = PDE(inode); |
| 106 | int error; | 106 | int error; |
| 107 | 107 | ||
| @@ -120,7 +120,7 @@ static int proc_notify_change(struct dentry *dentry, struct iattr *iattr) | |||
| 120 | static int proc_getattr(struct vfsmount *mnt, struct dentry *dentry, | 120 | static int proc_getattr(struct vfsmount *mnt, struct dentry *dentry, |
| 121 | struct kstat *stat) | 121 | struct kstat *stat) |
| 122 | { | 122 | { |
| 123 | struct inode *inode = dentry->d_inode; | 123 | struct inode *inode = d_inode(dentry); |
| 124 | struct proc_dir_entry *de = PDE(inode); | 124 | struct proc_dir_entry *de = PDE(inode); |
| 125 | if (de && de->nlink) | 125 | if (de && de->nlink) |
| 126 | set_nlink(inode, de->nlink); | 126 | set_nlink(inode, de->nlink); |
diff --git a/fs/proc/inode.c b/fs/proc/inode.c index 7697b6621cfd..8272aaba1bb0 100644 --- a/fs/proc/inode.c +++ b/fs/proc/inode.c | |||
| @@ -396,7 +396,7 @@ static const struct file_operations proc_reg_file_ops_no_compat = { | |||
| 396 | 396 | ||
| 397 | static void *proc_follow_link(struct dentry *dentry, struct nameidata *nd) | 397 | static void *proc_follow_link(struct dentry *dentry, struct nameidata *nd) |
| 398 | { | 398 | { |
| 399 | struct proc_dir_entry *pde = PDE(dentry->d_inode); | 399 | struct proc_dir_entry *pde = PDE(d_inode(dentry)); |
| 400 | if (unlikely(!use_pde(pde))) | 400 | if (unlikely(!use_pde(pde))) |
| 401 | return ERR_PTR(-EINVAL); | 401 | return ERR_PTR(-EINVAL); |
| 402 | nd_set_link(nd, pde->data); | 402 | nd_set_link(nd, pde->data); |
diff --git a/fs/proc/namespaces.c b/fs/proc/namespaces.c index c9eac4563fa8..e512642dbbdc 100644 --- a/fs/proc/namespaces.c +++ b/fs/proc/namespaces.c | |||
| @@ -32,7 +32,7 @@ static const struct proc_ns_operations *ns_entries[] = { | |||
| 32 | 32 | ||
| 33 | static void *proc_ns_follow_link(struct dentry *dentry, struct nameidata *nd) | 33 | static void *proc_ns_follow_link(struct dentry *dentry, struct nameidata *nd) |
| 34 | { | 34 | { |
| 35 | struct inode *inode = dentry->d_inode; | 35 | struct inode *inode = d_inode(dentry); |
| 36 | const struct proc_ns_operations *ns_ops = PROC_I(inode)->ns_ops; | 36 | const struct proc_ns_operations *ns_ops = PROC_I(inode)->ns_ops; |
| 37 | struct task_struct *task; | 37 | struct task_struct *task; |
| 38 | struct path ns_path; | 38 | struct path ns_path; |
| @@ -53,7 +53,7 @@ static void *proc_ns_follow_link(struct dentry *dentry, struct nameidata *nd) | |||
| 53 | 53 | ||
| 54 | static int proc_ns_readlink(struct dentry *dentry, char __user *buffer, int buflen) | 54 | static int proc_ns_readlink(struct dentry *dentry, char __user *buffer, int buflen) |
| 55 | { | 55 | { |
| 56 | struct inode *inode = dentry->d_inode; | 56 | struct inode *inode = d_inode(dentry); |
| 57 | const struct proc_ns_operations *ns_ops = PROC_I(inode)->ns_ops; | 57 | const struct proc_ns_operations *ns_ops = PROC_I(inode)->ns_ops; |
| 58 | struct task_struct *task; | 58 | struct task_struct *task; |
| 59 | char name[50]; | 59 | char name[50]; |
diff --git a/fs/proc/proc_net.c b/fs/proc/proc_net.c index 1bde894bc624..350984a19c83 100644 --- a/fs/proc/proc_net.c +++ b/fs/proc/proc_net.c | |||
| @@ -142,7 +142,7 @@ static struct dentry *proc_tgid_net_lookup(struct inode *dir, | |||
| 142 | static int proc_tgid_net_getattr(struct vfsmount *mnt, struct dentry *dentry, | 142 | static int proc_tgid_net_getattr(struct vfsmount *mnt, struct dentry *dentry, |
| 143 | struct kstat *stat) | 143 | struct kstat *stat) |
| 144 | { | 144 | { |
| 145 | struct inode *inode = dentry->d_inode; | 145 | struct inode *inode = d_inode(dentry); |
| 146 | struct net *net; | 146 | struct net *net; |
| 147 | 147 | ||
| 148 | net = get_proc_task_net(inode); | 148 | net = get_proc_task_net(inode); |
diff --git a/fs/proc/proc_sysctl.c b/fs/proc/proc_sysctl.c index f92d5dd578a4..fea2561d773b 100644 --- a/fs/proc/proc_sysctl.c +++ b/fs/proc/proc_sysctl.c | |||
| @@ -604,7 +604,7 @@ static bool proc_sys_fill_cache(struct file *file, | |||
| 604 | return false; | 604 | return false; |
| 605 | } | 605 | } |
| 606 | } | 606 | } |
| 607 | inode = child->d_inode; | 607 | inode = d_inode(child); |
| 608 | ino = inode->i_ino; | 608 | ino = inode->i_ino; |
| 609 | type = inode->i_mode >> 12; | 609 | type = inode->i_mode >> 12; |
| 610 | dput(child); | 610 | dput(child); |
| @@ -710,7 +710,7 @@ static int proc_sys_permission(struct inode *inode, int mask) | |||
| 710 | 710 | ||
| 711 | static int proc_sys_setattr(struct dentry *dentry, struct iattr *attr) | 711 | static int proc_sys_setattr(struct dentry *dentry, struct iattr *attr) |
| 712 | { | 712 | { |
| 713 | struct inode *inode = dentry->d_inode; | 713 | struct inode *inode = d_inode(dentry); |
| 714 | int error; | 714 | int error; |
| 715 | 715 | ||
| 716 | if (attr->ia_valid & (ATTR_MODE | ATTR_UID | ATTR_GID)) | 716 | if (attr->ia_valid & (ATTR_MODE | ATTR_UID | ATTR_GID)) |
| @@ -727,7 +727,7 @@ static int proc_sys_setattr(struct dentry *dentry, struct iattr *attr) | |||
| 727 | 727 | ||
| 728 | static int proc_sys_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat) | 728 | static int proc_sys_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat) |
| 729 | { | 729 | { |
| 730 | struct inode *inode = dentry->d_inode; | 730 | struct inode *inode = d_inode(dentry); |
| 731 | struct ctl_table_header *head = grab_header(inode); | 731 | struct ctl_table_header *head = grab_header(inode); |
| 732 | struct ctl_table *table = PROC_I(inode)->sysctl_entry; | 732 | struct ctl_table *table = PROC_I(inode)->sysctl_entry; |
| 733 | 733 | ||
| @@ -773,12 +773,12 @@ static int proc_sys_revalidate(struct dentry *dentry, unsigned int flags) | |||
| 773 | { | 773 | { |
| 774 | if (flags & LOOKUP_RCU) | 774 | if (flags & LOOKUP_RCU) |
| 775 | return -ECHILD; | 775 | return -ECHILD; |
| 776 | return !PROC_I(dentry->d_inode)->sysctl->unregistering; | 776 | return !PROC_I(d_inode(dentry))->sysctl->unregistering; |
| 777 | } | 777 | } |
| 778 | 778 | ||
| 779 | static int proc_sys_delete(const struct dentry *dentry) | 779 | static int proc_sys_delete(const struct dentry *dentry) |
| 780 | { | 780 | { |
| 781 | return !!PROC_I(dentry->d_inode)->sysctl->unregistering; | 781 | return !!PROC_I(d_inode(dentry))->sysctl->unregistering; |
| 782 | } | 782 | } |
| 783 | 783 | ||
| 784 | static int sysctl_is_seen(struct ctl_table_header *p) | 784 | static int sysctl_is_seen(struct ctl_table_header *p) |
| @@ -805,7 +805,7 @@ static int proc_sys_compare(const struct dentry *parent, const struct dentry *de | |||
| 805 | /* Although proc doesn't have negative dentries, rcu-walk means | 805 | /* Although proc doesn't have negative dentries, rcu-walk means |
| 806 | * that inode here can be NULL */ | 806 | * that inode here can be NULL */ |
| 807 | /* AV: can it, indeed? */ | 807 | /* AV: can it, indeed? */ |
| 808 | inode = ACCESS_ONCE(dentry->d_inode); | 808 | inode = d_inode_rcu(dentry); |
| 809 | if (!inode) | 809 | if (!inode) |
| 810 | return 1; | 810 | return 1; |
| 811 | if (name->len != len) | 811 | if (name->len != len) |
diff --git a/fs/proc/root.c b/fs/proc/root.c index e74ac9f1a2c0..b7fa4bfe896a 100644 --- a/fs/proc/root.c +++ b/fs/proc/root.c | |||
| @@ -195,7 +195,7 @@ void __init proc_root_init(void) | |||
| 195 | static int proc_root_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat | 195 | static int proc_root_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat |
| 196 | ) | 196 | ) |
| 197 | { | 197 | { |
| 198 | generic_fillattr(dentry->d_inode, stat); | 198 | generic_fillattr(d_inode(dentry), stat); |
| 199 | stat->nlink = proc_root.nlink + nr_processes(); | 199 | stat->nlink = proc_root.nlink + nr_processes(); |
| 200 | return 0; | 200 | return 0; |
| 201 | } | 201 | } |
diff --git a/fs/proc/self.c b/fs/proc/self.c index 4348bb8907c2..6195b4a7c3b1 100644 --- a/fs/proc/self.c +++ b/fs/proc/self.c | |||
| @@ -46,7 +46,7 @@ static unsigned self_inum; | |||
| 46 | 46 | ||
| 47 | int proc_setup_self(struct super_block *s) | 47 | int proc_setup_self(struct super_block *s) |
| 48 | { | 48 | { |
| 49 | struct inode *root_inode = s->s_root->d_inode; | 49 | struct inode *root_inode = d_inode(s->s_root); |
| 50 | struct pid_namespace *ns = s->s_fs_info; | 50 | struct pid_namespace *ns = s->s_fs_info; |
| 51 | struct dentry *self; | 51 | struct dentry *self; |
| 52 | 52 | ||
diff --git a/fs/proc/thread_self.c b/fs/proc/thread_self.c index 59075b509df3..a8371993b4fb 100644 --- a/fs/proc/thread_self.c +++ b/fs/proc/thread_self.c | |||
| @@ -47,7 +47,7 @@ static unsigned thread_self_inum; | |||
| 47 | 47 | ||
| 48 | int proc_setup_thread_self(struct super_block *s) | 48 | int proc_setup_thread_self(struct super_block *s) |
| 49 | { | 49 | { |
| 50 | struct inode *root_inode = s->s_root->d_inode; | 50 | struct inode *root_inode = d_inode(s->s_root); |
| 51 | struct pid_namespace *ns = s->s_fs_info; | 51 | struct pid_namespace *ns = s->s_fs_info; |
| 52 | struct dentry *thread_self; | 52 | struct dentry *thread_self; |
| 53 | 53 | ||
diff --git a/fs/pstore/inode.c b/fs/pstore/inode.c index 56e1ffda4d89..dc43b5f29305 100644 --- a/fs/pstore/inode.c +++ b/fs/pstore/inode.c | |||
| @@ -190,7 +190,7 @@ static const struct file_operations pstore_file_operations = { | |||
| 190 | */ | 190 | */ |
| 191 | static int pstore_unlink(struct inode *dir, struct dentry *dentry) | 191 | static int pstore_unlink(struct inode *dir, struct dentry *dentry) |
| 192 | { | 192 | { |
| 193 | struct pstore_private *p = dentry->d_inode->i_private; | 193 | struct pstore_private *p = d_inode(dentry)->i_private; |
| 194 | int err; | 194 | int err; |
| 195 | 195 | ||
| 196 | err = pstore_check_syslog_permissions(p); | 196 | err = pstore_check_syslog_permissions(p); |
| @@ -199,7 +199,7 @@ static int pstore_unlink(struct inode *dir, struct dentry *dentry) | |||
| 199 | 199 | ||
| 200 | if (p->psi->erase) | 200 | if (p->psi->erase) |
| 201 | p->psi->erase(p->type, p->id, p->count, | 201 | p->psi->erase(p->type, p->id, p->count, |
| 202 | dentry->d_inode->i_ctime, p->psi); | 202 | d_inode(dentry)->i_ctime, p->psi); |
| 203 | else | 203 | else |
| 204 | return -EPERM; | 204 | return -EPERM; |
| 205 | 205 | ||
| @@ -376,7 +376,7 @@ int pstore_mkfile(enum pstore_type_id type, char *psname, u64 id, int count, | |||
| 376 | break; | 376 | break; |
| 377 | } | 377 | } |
| 378 | 378 | ||
| 379 | mutex_lock(&root->d_inode->i_mutex); | 379 | mutex_lock(&d_inode(root)->i_mutex); |
| 380 | 380 | ||
| 381 | dentry = d_alloc_name(root, name); | 381 | dentry = d_alloc_name(root, name); |
| 382 | if (!dentry) | 382 | if (!dentry) |
| @@ -396,12 +396,12 @@ int pstore_mkfile(enum pstore_type_id type, char *psname, u64 id, int count, | |||
| 396 | list_add(&private->list, &allpstore); | 396 | list_add(&private->list, &allpstore); |
| 397 | spin_unlock_irqrestore(&allpstore_lock, flags); | 397 | spin_unlock_irqrestore(&allpstore_lock, flags); |
| 398 | 398 | ||
| 399 | mutex_unlock(&root->d_inode->i_mutex); | 399 | mutex_unlock(&d_inode(root)->i_mutex); |
| 400 | 400 | ||
| 401 | return 0; | 401 | return 0; |
| 402 | 402 | ||
| 403 | fail_lockedalloc: | 403 | fail_lockedalloc: |
| 404 | mutex_unlock(&root->d_inode->i_mutex); | 404 | mutex_unlock(&d_inode(root)->i_mutex); |
| 405 | kfree(private); | 405 | kfree(private); |
| 406 | fail_alloc: | 406 | fail_alloc: |
| 407 | iput(inode); | 407 | iput(inode); |
diff --git a/fs/qnx6/inode.c b/fs/qnx6/inode.c index 44e73923670d..32d2e1a9774c 100644 --- a/fs/qnx6/inode.c +++ b/fs/qnx6/inode.c | |||
| @@ -182,7 +182,7 @@ static const char *qnx6_checkroot(struct super_block *s) | |||
| 182 | static char match_root[2][3] = {".\0\0", "..\0"}; | 182 | static char match_root[2][3] = {".\0\0", "..\0"}; |
| 183 | int i, error = 0; | 183 | int i, error = 0; |
| 184 | struct qnx6_dir_entry *dir_entry; | 184 | struct qnx6_dir_entry *dir_entry; |
| 185 | struct inode *root = s->s_root->d_inode; | 185 | struct inode *root = d_inode(s->s_root); |
| 186 | struct address_space *mapping = root->i_mapping; | 186 | struct address_space *mapping = root->i_mapping; |
| 187 | struct page *page = read_mapping_page(mapping, 0, NULL); | 187 | struct page *page = read_mapping_page(mapping, 0, NULL); |
| 188 | if (IS_ERR(page)) | 188 | if (IS_ERR(page)) |
diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c index ecc25cf0ee6e..20d1f74561cf 100644 --- a/fs/quota/dquot.c +++ b/fs/quota/dquot.c | |||
| @@ -2328,7 +2328,7 @@ int dquot_quota_on(struct super_block *sb, int type, int format_id, | |||
| 2328 | if (path->dentry->d_sb != sb) | 2328 | if (path->dentry->d_sb != sb) |
| 2329 | error = -EXDEV; | 2329 | error = -EXDEV; |
| 2330 | else | 2330 | else |
| 2331 | error = vfs_load_quota_inode(path->dentry->d_inode, type, | 2331 | error = vfs_load_quota_inode(d_inode(path->dentry), type, |
| 2332 | format_id, DQUOT_USAGE_ENABLED | | 2332 | format_id, DQUOT_USAGE_ENABLED | |
| 2333 | DQUOT_LIMITS_ENABLED); | 2333 | DQUOT_LIMITS_ENABLED); |
| 2334 | return error; | 2334 | return error; |
| @@ -2392,20 +2392,20 @@ int dquot_quota_on_mount(struct super_block *sb, char *qf_name, | |||
| 2392 | struct dentry *dentry; | 2392 | struct dentry *dentry; |
| 2393 | int error; | 2393 | int error; |
| 2394 | 2394 | ||
| 2395 | mutex_lock(&sb->s_root->d_inode->i_mutex); | 2395 | mutex_lock(&d_inode(sb->s_root)->i_mutex); |
| 2396 | dentry = lookup_one_len(qf_name, sb->s_root, strlen(qf_name)); | 2396 | dentry = lookup_one_len(qf_name, sb->s_root, strlen(qf_name)); |
| 2397 | mutex_unlock(&sb->s_root->d_inode->i_mutex); | 2397 | mutex_unlock(&d_inode(sb->s_root)->i_mutex); |
| 2398 | if (IS_ERR(dentry)) | 2398 | if (IS_ERR(dentry)) |
| 2399 | return PTR_ERR(dentry); | 2399 | return PTR_ERR(dentry); |
| 2400 | 2400 | ||
| 2401 | if (!dentry->d_inode) { | 2401 | if (d_really_is_negative(dentry)) { |
| 2402 | error = -ENOENT; | 2402 | error = -ENOENT; |
| 2403 | goto out; | 2403 | goto out; |
| 2404 | } | 2404 | } |
| 2405 | 2405 | ||
| 2406 | error = security_quota_on(dentry); | 2406 | error = security_quota_on(dentry); |
| 2407 | if (!error) | 2407 | if (!error) |
| 2408 | error = vfs_load_quota_inode(dentry->d_inode, type, format_id, | 2408 | error = vfs_load_quota_inode(d_inode(dentry), type, format_id, |
| 2409 | DQUOT_USAGE_ENABLED | DQUOT_LIMITS_ENABLED); | 2409 | DQUOT_USAGE_ENABLED | DQUOT_LIMITS_ENABLED); |
| 2410 | 2410 | ||
| 2411 | out: | 2411 | out: |
diff --git a/fs/ramfs/file-nommu.c b/fs/ramfs/file-nommu.c index 0b38befa69f3..ba1323a94924 100644 --- a/fs/ramfs/file-nommu.c +++ b/fs/ramfs/file-nommu.c | |||
| @@ -163,7 +163,7 @@ static int ramfs_nommu_resize(struct inode *inode, loff_t newsize, loff_t size) | |||
| 163 | */ | 163 | */ |
| 164 | static int ramfs_nommu_setattr(struct dentry *dentry, struct iattr *ia) | 164 | static int ramfs_nommu_setattr(struct dentry *dentry, struct iattr *ia) |
| 165 | { | 165 | { |
| 166 | struct inode *inode = dentry->d_inode; | 166 | struct inode *inode = d_inode(dentry); |
| 167 | unsigned int old_ia_valid = ia->ia_valid; | 167 | unsigned int old_ia_valid = ia->ia_valid; |
| 168 | int ret = 0; | 168 | int ret = 0; |
| 169 | 169 | ||
diff --git a/fs/reiserfs/dir.c b/fs/reiserfs/dir.c index 0a7dc941aaf4..4a024e2ceb9f 100644 --- a/fs/reiserfs/dir.c +++ b/fs/reiserfs/dir.c | |||
| @@ -53,8 +53,8 @@ static int reiserfs_dir_fsync(struct file *filp, loff_t start, loff_t end, | |||
| 53 | static inline bool is_privroot_deh(struct inode *dir, struct reiserfs_de_head *deh) | 53 | static inline bool is_privroot_deh(struct inode *dir, struct reiserfs_de_head *deh) |
| 54 | { | 54 | { |
| 55 | struct dentry *privroot = REISERFS_SB(dir->i_sb)->priv_root; | 55 | struct dentry *privroot = REISERFS_SB(dir->i_sb)->priv_root; |
| 56 | return (privroot->d_inode && | 56 | return (d_really_is_positive(privroot) && |
| 57 | deh->deh_objectid == INODE_PKEY(privroot->d_inode)->k_objectid); | 57 | deh->deh_objectid == INODE_PKEY(d_inode(privroot))->k_objectid); |
| 58 | } | 58 | } |
| 59 | 59 | ||
| 60 | int reiserfs_readdir_inode(struct inode *inode, struct dir_context *ctx) | 60 | int reiserfs_readdir_inode(struct inode *inode, struct dir_context *ctx) |
diff --git a/fs/reiserfs/inode.c b/fs/reiserfs/inode.c index 742242b60972..f6f2fbad9777 100644 --- a/fs/reiserfs/inode.c +++ b/fs/reiserfs/inode.c | |||
| @@ -3308,7 +3308,7 @@ static ssize_t reiserfs_direct_IO(struct kiocb *iocb, struct iov_iter *iter, | |||
| 3308 | 3308 | ||
| 3309 | int reiserfs_setattr(struct dentry *dentry, struct iattr *attr) | 3309 | int reiserfs_setattr(struct dentry *dentry, struct iattr *attr) |
| 3310 | { | 3310 | { |
| 3311 | struct inode *inode = dentry->d_inode; | 3311 | struct inode *inode = d_inode(dentry); |
| 3312 | unsigned int ia_valid; | 3312 | unsigned int ia_valid; |
| 3313 | int error; | 3313 | int error; |
| 3314 | 3314 | ||
diff --git a/fs/reiserfs/namei.c b/fs/reiserfs/namei.c index cd11358b10c7..b55a074653d7 100644 --- a/fs/reiserfs/namei.c +++ b/fs/reiserfs/namei.c | |||
| @@ -400,7 +400,7 @@ struct dentry *reiserfs_get_parent(struct dentry *child) | |||
| 400 | struct inode *inode = NULL; | 400 | struct inode *inode = NULL; |
| 401 | struct reiserfs_dir_entry de; | 401 | struct reiserfs_dir_entry de; |
| 402 | INITIALIZE_PATH(path_to_entry); | 402 | INITIALIZE_PATH(path_to_entry); |
| 403 | struct inode *dir = child->d_inode; | 403 | struct inode *dir = d_inode(child); |
| 404 | 404 | ||
| 405 | if (dir->i_nlink == 0) { | 405 | if (dir->i_nlink == 0) { |
| 406 | return ERR_PTR(-ENOENT); | 406 | return ERR_PTR(-ENOENT); |
| @@ -917,7 +917,7 @@ static int reiserfs_rmdir(struct inode *dir, struct dentry *dentry) | |||
| 917 | goto end_rmdir; | 917 | goto end_rmdir; |
| 918 | } | 918 | } |
| 919 | 919 | ||
| 920 | inode = dentry->d_inode; | 920 | inode = d_inode(dentry); |
| 921 | 921 | ||
| 922 | reiserfs_update_inode_transaction(inode); | 922 | reiserfs_update_inode_transaction(inode); |
| 923 | reiserfs_update_inode_transaction(dir); | 923 | reiserfs_update_inode_transaction(dir); |
| @@ -987,7 +987,7 @@ static int reiserfs_unlink(struct inode *dir, struct dentry *dentry) | |||
| 987 | 987 | ||
| 988 | dquot_initialize(dir); | 988 | dquot_initialize(dir); |
| 989 | 989 | ||
| 990 | inode = dentry->d_inode; | 990 | inode = d_inode(dentry); |
| 991 | 991 | ||
| 992 | /* | 992 | /* |
| 993 | * in this transaction we can be doing at max two balancings and | 993 | * in this transaction we can be doing at max two balancings and |
| @@ -1174,7 +1174,7 @@ static int reiserfs_link(struct dentry *old_dentry, struct inode *dir, | |||
| 1174 | struct dentry *dentry) | 1174 | struct dentry *dentry) |
| 1175 | { | 1175 | { |
| 1176 | int retval; | 1176 | int retval; |
| 1177 | struct inode *inode = old_dentry->d_inode; | 1177 | struct inode *inode = d_inode(old_dentry); |
| 1178 | struct reiserfs_transaction_handle th; | 1178 | struct reiserfs_transaction_handle th; |
| 1179 | /* | 1179 | /* |
| 1180 | * We need blocks for transaction + update of quotas for | 1180 | * We need blocks for transaction + update of quotas for |
| @@ -1311,8 +1311,8 @@ static int reiserfs_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
| 1311 | dquot_initialize(old_dir); | 1311 | dquot_initialize(old_dir); |
| 1312 | dquot_initialize(new_dir); | 1312 | dquot_initialize(new_dir); |
| 1313 | 1313 | ||
| 1314 | old_inode = old_dentry->d_inode; | 1314 | old_inode = d_inode(old_dentry); |
| 1315 | new_dentry_inode = new_dentry->d_inode; | 1315 | new_dentry_inode = d_inode(new_dentry); |
| 1316 | 1316 | ||
| 1317 | /* | 1317 | /* |
| 1318 | * make sure that oldname still exists and points to an object we | 1318 | * make sure that oldname still exists and points to an object we |
diff --git a/fs/reiserfs/super.c b/fs/reiserfs/super.c index 68b5f182984e..0111ad0466ed 100644 --- a/fs/reiserfs/super.c +++ b/fs/reiserfs/super.c | |||
| @@ -1687,7 +1687,7 @@ static __u32 find_hash_out(struct super_block *s) | |||
| 1687 | __u32 hash = DEFAULT_HASH; | 1687 | __u32 hash = DEFAULT_HASH; |
| 1688 | __u32 deh_hashval, teahash, r5hash, yurahash; | 1688 | __u32 deh_hashval, teahash, r5hash, yurahash; |
| 1689 | 1689 | ||
| 1690 | inode = s->s_root->d_inode; | 1690 | inode = d_inode(s->s_root); |
| 1691 | 1691 | ||
| 1692 | make_cpu_key(&key, inode, ~0, TYPE_DIRENTRY, 3); | 1692 | make_cpu_key(&key, inode, ~0, TYPE_DIRENTRY, 3); |
| 1693 | retval = search_by_entry_key(s, &key, &path, &de); | 1693 | retval = search_by_entry_key(s, &key, &path, &de); |
| @@ -2347,7 +2347,7 @@ static int reiserfs_quota_on(struct super_block *sb, int type, int format_id, | |||
| 2347 | err = -EXDEV; | 2347 | err = -EXDEV; |
| 2348 | goto out; | 2348 | goto out; |
| 2349 | } | 2349 | } |
| 2350 | inode = path->dentry->d_inode; | 2350 | inode = d_inode(path->dentry); |
| 2351 | /* | 2351 | /* |
| 2352 | * We must not pack tails for quota files on reiserfs for quota | 2352 | * We must not pack tails for quota files on reiserfs for quota |
| 2353 | * IO to work | 2353 | * IO to work |
diff --git a/fs/reiserfs/xattr.c b/fs/reiserfs/xattr.c index 4e781e697c90..e87f9b52bf06 100644 --- a/fs/reiserfs/xattr.c +++ b/fs/reiserfs/xattr.c | |||
| @@ -87,9 +87,9 @@ static int xattr_unlink(struct inode *dir, struct dentry *dentry) | |||
| 87 | 87 | ||
| 88 | BUG_ON(!mutex_is_locked(&dir->i_mutex)); | 88 | BUG_ON(!mutex_is_locked(&dir->i_mutex)); |
| 89 | 89 | ||
| 90 | mutex_lock_nested(&dentry->d_inode->i_mutex, I_MUTEX_CHILD); | 90 | mutex_lock_nested(&d_inode(dentry)->i_mutex, I_MUTEX_CHILD); |
| 91 | error = dir->i_op->unlink(dir, dentry); | 91 | error = dir->i_op->unlink(dir, dentry); |
| 92 | mutex_unlock(&dentry->d_inode->i_mutex); | 92 | mutex_unlock(&d_inode(dentry)->i_mutex); |
| 93 | 93 | ||
| 94 | if (!error) | 94 | if (!error) |
| 95 | d_delete(dentry); | 95 | d_delete(dentry); |
| @@ -102,11 +102,11 @@ static int xattr_rmdir(struct inode *dir, struct dentry *dentry) | |||
| 102 | 102 | ||
| 103 | BUG_ON(!mutex_is_locked(&dir->i_mutex)); | 103 | BUG_ON(!mutex_is_locked(&dir->i_mutex)); |
| 104 | 104 | ||
| 105 | mutex_lock_nested(&dentry->d_inode->i_mutex, I_MUTEX_CHILD); | 105 | mutex_lock_nested(&d_inode(dentry)->i_mutex, I_MUTEX_CHILD); |
| 106 | error = dir->i_op->rmdir(dir, dentry); | 106 | error = dir->i_op->rmdir(dir, dentry); |
| 107 | if (!error) | 107 | if (!error) |
| 108 | dentry->d_inode->i_flags |= S_DEAD; | 108 | d_inode(dentry)->i_flags |= S_DEAD; |
| 109 | mutex_unlock(&dentry->d_inode->i_mutex); | 109 | mutex_unlock(&d_inode(dentry)->i_mutex); |
| 110 | if (!error) | 110 | if (!error) |
| 111 | d_delete(dentry); | 111 | d_delete(dentry); |
| 112 | 112 | ||
| @@ -120,26 +120,26 @@ static struct dentry *open_xa_root(struct super_block *sb, int flags) | |||
| 120 | struct dentry *privroot = REISERFS_SB(sb)->priv_root; | 120 | struct dentry *privroot = REISERFS_SB(sb)->priv_root; |
| 121 | struct dentry *xaroot; | 121 | struct dentry *xaroot; |
| 122 | 122 | ||
| 123 | if (!privroot->d_inode) | 123 | if (d_really_is_negative(privroot)) |
| 124 | return ERR_PTR(-ENODATA); | 124 | return ERR_PTR(-ENODATA); |
| 125 | 125 | ||
| 126 | mutex_lock_nested(&privroot->d_inode->i_mutex, I_MUTEX_XATTR); | 126 | mutex_lock_nested(&d_inode(privroot)->i_mutex, I_MUTEX_XATTR); |
| 127 | 127 | ||
| 128 | xaroot = dget(REISERFS_SB(sb)->xattr_root); | 128 | xaroot = dget(REISERFS_SB(sb)->xattr_root); |
| 129 | if (!xaroot) | 129 | if (!xaroot) |
| 130 | xaroot = ERR_PTR(-ENODATA); | 130 | xaroot = ERR_PTR(-ENODATA); |
| 131 | else if (!xaroot->d_inode) { | 131 | else if (d_really_is_negative(xaroot)) { |
| 132 | int err = -ENODATA; | 132 | int err = -ENODATA; |
| 133 | 133 | ||
| 134 | if (xattr_may_create(flags)) | 134 | if (xattr_may_create(flags)) |
| 135 | err = xattr_mkdir(privroot->d_inode, xaroot, 0700); | 135 | err = xattr_mkdir(d_inode(privroot), xaroot, 0700); |
| 136 | if (err) { | 136 | if (err) { |
| 137 | dput(xaroot); | 137 | dput(xaroot); |
| 138 | xaroot = ERR_PTR(err); | 138 | xaroot = ERR_PTR(err); |
| 139 | } | 139 | } |
| 140 | } | 140 | } |
| 141 | 141 | ||
| 142 | mutex_unlock(&privroot->d_inode->i_mutex); | 142 | mutex_unlock(&d_inode(privroot)->i_mutex); |
| 143 | return xaroot; | 143 | return xaroot; |
| 144 | } | 144 | } |
| 145 | 145 | ||
| @@ -156,21 +156,21 @@ static struct dentry *open_xa_dir(const struct inode *inode, int flags) | |||
| 156 | le32_to_cpu(INODE_PKEY(inode)->k_objectid), | 156 | le32_to_cpu(INODE_PKEY(inode)->k_objectid), |
| 157 | inode->i_generation); | 157 | inode->i_generation); |
| 158 | 158 | ||
| 159 | mutex_lock_nested(&xaroot->d_inode->i_mutex, I_MUTEX_XATTR); | 159 | mutex_lock_nested(&d_inode(xaroot)->i_mutex, I_MUTEX_XATTR); |
| 160 | 160 | ||
| 161 | xadir = lookup_one_len(namebuf, xaroot, strlen(namebuf)); | 161 | xadir = lookup_one_len(namebuf, xaroot, strlen(namebuf)); |
| 162 | if (!IS_ERR(xadir) && !xadir->d_inode) { | 162 | if (!IS_ERR(xadir) && d_really_is_negative(xadir)) { |
| 163 | int err = -ENODATA; | 163 | int err = -ENODATA; |
| 164 | 164 | ||
| 165 | if (xattr_may_create(flags)) | 165 | if (xattr_may_create(flags)) |
| 166 | err = xattr_mkdir(xaroot->d_inode, xadir, 0700); | 166 | err = xattr_mkdir(d_inode(xaroot), xadir, 0700); |
| 167 | if (err) { | 167 | if (err) { |
| 168 | dput(xadir); | 168 | dput(xadir); |
| 169 | xadir = ERR_PTR(err); | 169 | xadir = ERR_PTR(err); |
| 170 | } | 170 | } |
| 171 | } | 171 | } |
| 172 | 172 | ||
| 173 | mutex_unlock(&xaroot->d_inode->i_mutex); | 173 | mutex_unlock(&d_inode(xaroot)->i_mutex); |
| 174 | dput(xaroot); | 174 | dput(xaroot); |
| 175 | return xadir; | 175 | return xadir; |
| 176 | } | 176 | } |
| @@ -195,7 +195,7 @@ fill_with_dentries(struct dir_context *ctx, const char *name, int namelen, | |||
| 195 | container_of(ctx, struct reiserfs_dentry_buf, ctx); | 195 | container_of(ctx, struct reiserfs_dentry_buf, ctx); |
| 196 | struct dentry *dentry; | 196 | struct dentry *dentry; |
| 197 | 197 | ||
| 198 | WARN_ON_ONCE(!mutex_is_locked(&dbuf->xadir->d_inode->i_mutex)); | 198 | WARN_ON_ONCE(!mutex_is_locked(&d_inode(dbuf->xadir)->i_mutex)); |
| 199 | 199 | ||
| 200 | if (dbuf->count == ARRAY_SIZE(dbuf->dentries)) | 200 | if (dbuf->count == ARRAY_SIZE(dbuf->dentries)) |
| 201 | return -ENOSPC; | 201 | return -ENOSPC; |
| @@ -207,7 +207,7 @@ fill_with_dentries(struct dir_context *ctx, const char *name, int namelen, | |||
| 207 | dentry = lookup_one_len(name, dbuf->xadir, namelen); | 207 | dentry = lookup_one_len(name, dbuf->xadir, namelen); |
| 208 | if (IS_ERR(dentry)) { | 208 | if (IS_ERR(dentry)) { |
| 209 | return PTR_ERR(dentry); | 209 | return PTR_ERR(dentry); |
| 210 | } else if (!dentry->d_inode) { | 210 | } else if (d_really_is_negative(dentry)) { |
| 211 | /* A directory entry exists, but no file? */ | 211 | /* A directory entry exists, but no file? */ |
| 212 | reiserfs_error(dentry->d_sb, "xattr-20003", | 212 | reiserfs_error(dentry->d_sb, "xattr-20003", |
| 213 | "Corrupted directory: xattr %pd listed but " | 213 | "Corrupted directory: xattr %pd listed but " |
| @@ -249,16 +249,16 @@ static int reiserfs_for_each_xattr(struct inode *inode, | |||
| 249 | if (IS_ERR(dir)) { | 249 | if (IS_ERR(dir)) { |
| 250 | err = PTR_ERR(dir); | 250 | err = PTR_ERR(dir); |
| 251 | goto out; | 251 | goto out; |
| 252 | } else if (!dir->d_inode) { | 252 | } else if (d_really_is_negative(dir)) { |
| 253 | err = 0; | 253 | err = 0; |
| 254 | goto out_dir; | 254 | goto out_dir; |
| 255 | } | 255 | } |
| 256 | 256 | ||
| 257 | mutex_lock_nested(&dir->d_inode->i_mutex, I_MUTEX_XATTR); | 257 | mutex_lock_nested(&d_inode(dir)->i_mutex, I_MUTEX_XATTR); |
| 258 | 258 | ||
| 259 | buf.xadir = dir; | 259 | buf.xadir = dir; |
| 260 | while (1) { | 260 | while (1) { |
| 261 | err = reiserfs_readdir_inode(dir->d_inode, &buf.ctx); | 261 | err = reiserfs_readdir_inode(d_inode(dir), &buf.ctx); |
| 262 | if (err) | 262 | if (err) |
| 263 | break; | 263 | break; |
| 264 | if (!buf.count) | 264 | if (!buf.count) |
| @@ -276,7 +276,7 @@ static int reiserfs_for_each_xattr(struct inode *inode, | |||
| 276 | break; | 276 | break; |
| 277 | buf.count = 0; | 277 | buf.count = 0; |
| 278 | } | 278 | } |
| 279 | mutex_unlock(&dir->d_inode->i_mutex); | 279 | mutex_unlock(&d_inode(dir)->i_mutex); |
| 280 | 280 | ||
| 281 | cleanup_dentry_buf(&buf); | 281 | cleanup_dentry_buf(&buf); |
| 282 | 282 | ||
| @@ -298,13 +298,13 @@ static int reiserfs_for_each_xattr(struct inode *inode, | |||
| 298 | if (!err) { | 298 | if (!err) { |
| 299 | int jerror; | 299 | int jerror; |
| 300 | 300 | ||
| 301 | mutex_lock_nested(&dir->d_parent->d_inode->i_mutex, | 301 | mutex_lock_nested(&d_inode(dir->d_parent)->i_mutex, |
| 302 | I_MUTEX_XATTR); | 302 | I_MUTEX_XATTR); |
| 303 | err = action(dir, data); | 303 | err = action(dir, data); |
| 304 | reiserfs_write_lock(inode->i_sb); | 304 | reiserfs_write_lock(inode->i_sb); |
| 305 | jerror = journal_end(&th); | 305 | jerror = journal_end(&th); |
| 306 | reiserfs_write_unlock(inode->i_sb); | 306 | reiserfs_write_unlock(inode->i_sb); |
| 307 | mutex_unlock(&dir->d_parent->d_inode->i_mutex); | 307 | mutex_unlock(&d_inode(dir->d_parent)->i_mutex); |
| 308 | err = jerror ?: err; | 308 | err = jerror ?: err; |
| 309 | } | 309 | } |
| 310 | } | 310 | } |
| @@ -319,7 +319,7 @@ out: | |||
| 319 | 319 | ||
| 320 | static int delete_one_xattr(struct dentry *dentry, void *data) | 320 | static int delete_one_xattr(struct dentry *dentry, void *data) |
| 321 | { | 321 | { |
| 322 | struct inode *dir = dentry->d_parent->d_inode; | 322 | struct inode *dir = d_inode(dentry->d_parent); |
| 323 | 323 | ||
| 324 | /* This is the xattr dir, handle specially. */ | 324 | /* This is the xattr dir, handle specially. */ |
| 325 | if (d_is_dir(dentry)) | 325 | if (d_is_dir(dentry)) |
| @@ -384,27 +384,27 @@ static struct dentry *xattr_lookup(struct inode *inode, const char *name, | |||
| 384 | if (IS_ERR(xadir)) | 384 | if (IS_ERR(xadir)) |
| 385 | return ERR_CAST(xadir); | 385 | return ERR_CAST(xadir); |
| 386 | 386 | ||
| 387 | mutex_lock_nested(&xadir->d_inode->i_mutex, I_MUTEX_XATTR); | 387 | mutex_lock_nested(&d_inode(xadir)->i_mutex, I_MUTEX_XATTR); |
| 388 | xafile = lookup_one_len(name, xadir, strlen(name)); | 388 | xafile = lookup_one_len(name, xadir, strlen(name)); |
| 389 | if (IS_ERR(xafile)) { | 389 | if (IS_ERR(xafile)) { |
| 390 | err = PTR_ERR(xafile); | 390 | err = PTR_ERR(xafile); |
| 391 | goto out; | 391 | goto out; |
| 392 | } | 392 | } |
| 393 | 393 | ||
| 394 | if (xafile->d_inode && (flags & XATTR_CREATE)) | 394 | if (d_really_is_positive(xafile) && (flags & XATTR_CREATE)) |
| 395 | err = -EEXIST; | 395 | err = -EEXIST; |
| 396 | 396 | ||
| 397 | if (!xafile->d_inode) { | 397 | if (d_really_is_negative(xafile)) { |
| 398 | err = -ENODATA; | 398 | err = -ENODATA; |
| 399 | if (xattr_may_create(flags)) | 399 | if (xattr_may_create(flags)) |
| 400 | err = xattr_create(xadir->d_inode, xafile, | 400 | err = xattr_create(d_inode(xadir), xafile, |
| 401 | 0700|S_IFREG); | 401 | 0700|S_IFREG); |
| 402 | } | 402 | } |
| 403 | 403 | ||
| 404 | if (err) | 404 | if (err) |
| 405 | dput(xafile); | 405 | dput(xafile); |
| 406 | out: | 406 | out: |
| 407 | mutex_unlock(&xadir->d_inode->i_mutex); | 407 | mutex_unlock(&d_inode(xadir)->i_mutex); |
| 408 | dput(xadir); | 408 | dput(xadir); |
| 409 | if (err) | 409 | if (err) |
| 410 | return ERR_PTR(err); | 410 | return ERR_PTR(err); |
| @@ -469,21 +469,21 @@ static int lookup_and_delete_xattr(struct inode *inode, const char *name) | |||
| 469 | if (IS_ERR(xadir)) | 469 | if (IS_ERR(xadir)) |
| 470 | return PTR_ERR(xadir); | 470 | return PTR_ERR(xadir); |
| 471 | 471 | ||
| 472 | mutex_lock_nested(&xadir->d_inode->i_mutex, I_MUTEX_XATTR); | 472 | mutex_lock_nested(&d_inode(xadir)->i_mutex, I_MUTEX_XATTR); |
| 473 | dentry = lookup_one_len(name, xadir, strlen(name)); | 473 | dentry = lookup_one_len(name, xadir, strlen(name)); |
| 474 | if (IS_ERR(dentry)) { | 474 | if (IS_ERR(dentry)) { |
| 475 | err = PTR_ERR(dentry); | 475 | err = PTR_ERR(dentry); |
| 476 | goto out_dput; | 476 | goto out_dput; |
| 477 | } | 477 | } |
| 478 | 478 | ||
| 479 | if (dentry->d_inode) { | 479 | if (d_really_is_positive(dentry)) { |
| 480 | err = xattr_unlink(xadir->d_inode, dentry); | 480 | err = xattr_unlink(d_inode(xadir), dentry); |
| 481 | update_ctime(inode); | 481 | update_ctime(inode); |
| 482 | } | 482 | } |
| 483 | 483 | ||
| 484 | dput(dentry); | 484 | dput(dentry); |
| 485 | out_dput: | 485 | out_dput: |
| 486 | mutex_unlock(&xadir->d_inode->i_mutex); | 486 | mutex_unlock(&d_inode(xadir)->i_mutex); |
| 487 | dput(xadir); | 487 | dput(xadir); |
| 488 | return err; | 488 | return err; |
| 489 | } | 489 | } |
| @@ -533,7 +533,7 @@ reiserfs_xattr_set_handle(struct reiserfs_transaction_handle *th, | |||
| 533 | else | 533 | else |
| 534 | chunk = buffer_size - buffer_pos; | 534 | chunk = buffer_size - buffer_pos; |
| 535 | 535 | ||
| 536 | page = reiserfs_get_page(dentry->d_inode, file_pos); | 536 | page = reiserfs_get_page(d_inode(dentry), file_pos); |
| 537 | if (IS_ERR(page)) { | 537 | if (IS_ERR(page)) { |
| 538 | err = PTR_ERR(page); | 538 | err = PTR_ERR(page); |
| 539 | goto out_unlock; | 539 | goto out_unlock; |
| @@ -573,18 +573,18 @@ reiserfs_xattr_set_handle(struct reiserfs_transaction_handle *th, | |||
| 573 | } | 573 | } |
| 574 | 574 | ||
| 575 | new_size = buffer_size + sizeof(struct reiserfs_xattr_header); | 575 | new_size = buffer_size + sizeof(struct reiserfs_xattr_header); |
| 576 | if (!err && new_size < i_size_read(dentry->d_inode)) { | 576 | if (!err && new_size < i_size_read(d_inode(dentry))) { |
| 577 | struct iattr newattrs = { | 577 | struct iattr newattrs = { |
| 578 | .ia_ctime = current_fs_time(inode->i_sb), | 578 | .ia_ctime = current_fs_time(inode->i_sb), |
| 579 | .ia_size = new_size, | 579 | .ia_size = new_size, |
| 580 | .ia_valid = ATTR_SIZE | ATTR_CTIME, | 580 | .ia_valid = ATTR_SIZE | ATTR_CTIME, |
| 581 | }; | 581 | }; |
| 582 | 582 | ||
| 583 | mutex_lock_nested(&dentry->d_inode->i_mutex, I_MUTEX_XATTR); | 583 | mutex_lock_nested(&d_inode(dentry)->i_mutex, I_MUTEX_XATTR); |
| 584 | inode_dio_wait(dentry->d_inode); | 584 | inode_dio_wait(d_inode(dentry)); |
| 585 | 585 | ||
| 586 | err = reiserfs_setattr(dentry, &newattrs); | 586 | err = reiserfs_setattr(dentry, &newattrs); |
| 587 | mutex_unlock(&dentry->d_inode->i_mutex); | 587 | mutex_unlock(&d_inode(dentry)->i_mutex); |
| 588 | } else | 588 | } else |
| 589 | update_ctime(inode); | 589 | update_ctime(inode); |
| 590 | out_unlock: | 590 | out_unlock: |
| @@ -657,7 +657,7 @@ reiserfs_xattr_get(struct inode *inode, const char *name, void *buffer, | |||
| 657 | 657 | ||
| 658 | down_read(&REISERFS_I(inode)->i_xattr_sem); | 658 | down_read(&REISERFS_I(inode)->i_xattr_sem); |
| 659 | 659 | ||
| 660 | isize = i_size_read(dentry->d_inode); | 660 | isize = i_size_read(d_inode(dentry)); |
| 661 | 661 | ||
| 662 | /* Just return the size needed */ | 662 | /* Just return the size needed */ |
| 663 | if (buffer == NULL) { | 663 | if (buffer == NULL) { |
| @@ -680,7 +680,7 @@ reiserfs_xattr_get(struct inode *inode, const char *name, void *buffer, | |||
| 680 | else | 680 | else |
| 681 | chunk = isize - file_pos; | 681 | chunk = isize - file_pos; |
| 682 | 682 | ||
| 683 | page = reiserfs_get_page(dentry->d_inode, file_pos); | 683 | page = reiserfs_get_page(d_inode(dentry), file_pos); |
| 684 | if (IS_ERR(page)) { | 684 | if (IS_ERR(page)) { |
| 685 | err = PTR_ERR(page); | 685 | err = PTR_ERR(page); |
| 686 | goto out_unlock; | 686 | goto out_unlock; |
| @@ -775,7 +775,7 @@ reiserfs_getxattr(struct dentry * dentry, const char *name, void *buffer, | |||
| 775 | 775 | ||
| 776 | handler = find_xattr_handler_prefix(dentry->d_sb->s_xattr, name); | 776 | handler = find_xattr_handler_prefix(dentry->d_sb->s_xattr, name); |
| 777 | 777 | ||
| 778 | if (!handler || get_inode_sd_version(dentry->d_inode) == STAT_DATA_V1) | 778 | if (!handler || get_inode_sd_version(d_inode(dentry)) == STAT_DATA_V1) |
| 779 | return -EOPNOTSUPP; | 779 | return -EOPNOTSUPP; |
| 780 | 780 | ||
| 781 | return handler->get(dentry, name, buffer, size, handler->flags); | 781 | return handler->get(dentry, name, buffer, size, handler->flags); |
| @@ -784,7 +784,7 @@ reiserfs_getxattr(struct dentry * dentry, const char *name, void *buffer, | |||
| 784 | /* | 784 | /* |
| 785 | * Inode operation setxattr() | 785 | * Inode operation setxattr() |
| 786 | * | 786 | * |
| 787 | * dentry->d_inode->i_mutex down | 787 | * d_inode(dentry)->i_mutex down |
| 788 | */ | 788 | */ |
| 789 | int | 789 | int |
| 790 | reiserfs_setxattr(struct dentry *dentry, const char *name, const void *value, | 790 | reiserfs_setxattr(struct dentry *dentry, const char *name, const void *value, |
| @@ -794,7 +794,7 @@ reiserfs_setxattr(struct dentry *dentry, const char *name, const void *value, | |||
| 794 | 794 | ||
| 795 | handler = find_xattr_handler_prefix(dentry->d_sb->s_xattr, name); | 795 | handler = find_xattr_handler_prefix(dentry->d_sb->s_xattr, name); |
| 796 | 796 | ||
| 797 | if (!handler || get_inode_sd_version(dentry->d_inode) == STAT_DATA_V1) | 797 | if (!handler || get_inode_sd_version(d_inode(dentry)) == STAT_DATA_V1) |
| 798 | return -EOPNOTSUPP; | 798 | return -EOPNOTSUPP; |
| 799 | 799 | ||
| 800 | return handler->set(dentry, name, value, size, flags, handler->flags); | 800 | return handler->set(dentry, name, value, size, flags, handler->flags); |
| @@ -803,7 +803,7 @@ reiserfs_setxattr(struct dentry *dentry, const char *name, const void *value, | |||
| 803 | /* | 803 | /* |
| 804 | * Inode operation removexattr() | 804 | * Inode operation removexattr() |
| 805 | * | 805 | * |
| 806 | * dentry->d_inode->i_mutex down | 806 | * d_inode(dentry)->i_mutex down |
| 807 | */ | 807 | */ |
| 808 | int reiserfs_removexattr(struct dentry *dentry, const char *name) | 808 | int reiserfs_removexattr(struct dentry *dentry, const char *name) |
| 809 | { | 809 | { |
| @@ -811,7 +811,7 @@ int reiserfs_removexattr(struct dentry *dentry, const char *name) | |||
| 811 | 811 | ||
| 812 | handler = find_xattr_handler_prefix(dentry->d_sb->s_xattr, name); | 812 | handler = find_xattr_handler_prefix(dentry->d_sb->s_xattr, name); |
| 813 | 813 | ||
| 814 | if (!handler || get_inode_sd_version(dentry->d_inode) == STAT_DATA_V1) | 814 | if (!handler || get_inode_sd_version(d_inode(dentry)) == STAT_DATA_V1) |
| 815 | return -EOPNOTSUPP; | 815 | return -EOPNOTSUPP; |
| 816 | 816 | ||
| 817 | return handler->set(dentry, name, NULL, 0, XATTR_REPLACE, handler->flags); | 817 | return handler->set(dentry, name, NULL, 0, XATTR_REPLACE, handler->flags); |
| @@ -875,14 +875,14 @@ ssize_t reiserfs_listxattr(struct dentry * dentry, char *buffer, size_t size) | |||
| 875 | .size = buffer ? size : 0, | 875 | .size = buffer ? size : 0, |
| 876 | }; | 876 | }; |
| 877 | 877 | ||
| 878 | if (!dentry->d_inode) | 878 | if (d_really_is_negative(dentry)) |
| 879 | return -EINVAL; | 879 | return -EINVAL; |
| 880 | 880 | ||
| 881 | if (!dentry->d_sb->s_xattr || | 881 | if (!dentry->d_sb->s_xattr || |
| 882 | get_inode_sd_version(dentry->d_inode) == STAT_DATA_V1) | 882 | get_inode_sd_version(d_inode(dentry)) == STAT_DATA_V1) |
| 883 | return -EOPNOTSUPP; | 883 | return -EOPNOTSUPP; |
| 884 | 884 | ||
| 885 | dir = open_xa_dir(dentry->d_inode, XATTR_REPLACE); | 885 | dir = open_xa_dir(d_inode(dentry), XATTR_REPLACE); |
| 886 | if (IS_ERR(dir)) { | 886 | if (IS_ERR(dir)) { |
| 887 | err = PTR_ERR(dir); | 887 | err = PTR_ERR(dir); |
| 888 | if (err == -ENODATA) | 888 | if (err == -ENODATA) |
| @@ -890,9 +890,9 @@ ssize_t reiserfs_listxattr(struct dentry * dentry, char *buffer, size_t size) | |||
| 890 | goto out; | 890 | goto out; |
| 891 | } | 891 | } |
| 892 | 892 | ||
| 893 | mutex_lock_nested(&dir->d_inode->i_mutex, I_MUTEX_XATTR); | 893 | mutex_lock_nested(&d_inode(dir)->i_mutex, I_MUTEX_XATTR); |
| 894 | err = reiserfs_readdir_inode(dir->d_inode, &buf.ctx); | 894 | err = reiserfs_readdir_inode(d_inode(dir), &buf.ctx); |
| 895 | mutex_unlock(&dir->d_inode->i_mutex); | 895 | mutex_unlock(&d_inode(dir)->i_mutex); |
| 896 | 896 | ||
| 897 | if (!err) | 897 | if (!err) |
| 898 | err = buf.pos; | 898 | err = buf.pos; |
| @@ -905,12 +905,12 @@ out: | |||
| 905 | static int create_privroot(struct dentry *dentry) | 905 | static int create_privroot(struct dentry *dentry) |
| 906 | { | 906 | { |
| 907 | int err; | 907 | int err; |
| 908 | struct inode *inode = dentry->d_parent->d_inode; | 908 | struct inode *inode = d_inode(dentry->d_parent); |
| 909 | 909 | ||
| 910 | WARN_ON_ONCE(!mutex_is_locked(&inode->i_mutex)); | 910 | WARN_ON_ONCE(!mutex_is_locked(&inode->i_mutex)); |
| 911 | 911 | ||
| 912 | err = xattr_mkdir(inode, dentry, 0700); | 912 | err = xattr_mkdir(inode, dentry, 0700); |
| 913 | if (err || !dentry->d_inode) { | 913 | if (err || d_really_is_negative(dentry)) { |
| 914 | reiserfs_warning(dentry->d_sb, "jdm-20006", | 914 | reiserfs_warning(dentry->d_sb, "jdm-20006", |
| 915 | "xattrs/ACLs enabled and couldn't " | 915 | "xattrs/ACLs enabled and couldn't " |
| 916 | "find/create .reiserfs_priv. " | 916 | "find/create .reiserfs_priv. " |
| @@ -918,7 +918,7 @@ static int create_privroot(struct dentry *dentry) | |||
| 918 | return -EOPNOTSUPP; | 918 | return -EOPNOTSUPP; |
| 919 | } | 919 | } |
| 920 | 920 | ||
| 921 | dentry->d_inode->i_flags |= S_PRIVATE; | 921 | d_inode(dentry)->i_flags |= S_PRIVATE; |
| 922 | reiserfs_info(dentry->d_sb, "Created %s - reserved for xattr " | 922 | reiserfs_info(dentry->d_sb, "Created %s - reserved for xattr " |
| 923 | "storage.\n", PRIVROOT_NAME); | 923 | "storage.\n", PRIVROOT_NAME); |
| 924 | 924 | ||
| @@ -997,17 +997,17 @@ int reiserfs_lookup_privroot(struct super_block *s) | |||
| 997 | int err = 0; | 997 | int err = 0; |
| 998 | 998 | ||
| 999 | /* If we don't have the privroot located yet - go find it */ | 999 | /* If we don't have the privroot located yet - go find it */ |
| 1000 | mutex_lock(&s->s_root->d_inode->i_mutex); | 1000 | mutex_lock(&d_inode(s->s_root)->i_mutex); |
| 1001 | dentry = lookup_one_len(PRIVROOT_NAME, s->s_root, | 1001 | dentry = lookup_one_len(PRIVROOT_NAME, s->s_root, |
| 1002 | strlen(PRIVROOT_NAME)); | 1002 | strlen(PRIVROOT_NAME)); |
| 1003 | if (!IS_ERR(dentry)) { | 1003 | if (!IS_ERR(dentry)) { |
| 1004 | REISERFS_SB(s)->priv_root = dentry; | 1004 | REISERFS_SB(s)->priv_root = dentry; |
| 1005 | d_set_d_op(dentry, &xattr_lookup_poison_ops); | 1005 | d_set_d_op(dentry, &xattr_lookup_poison_ops); |
| 1006 | if (dentry->d_inode) | 1006 | if (d_really_is_positive(dentry)) |
| 1007 | dentry->d_inode->i_flags |= S_PRIVATE; | 1007 | d_inode(dentry)->i_flags |= S_PRIVATE; |
| 1008 | } else | 1008 | } else |
| 1009 | err = PTR_ERR(dentry); | 1009 | err = PTR_ERR(dentry); |
| 1010 | mutex_unlock(&s->s_root->d_inode->i_mutex); | 1010 | mutex_unlock(&d_inode(s->s_root)->i_mutex); |
| 1011 | 1011 | ||
| 1012 | return err; | 1012 | return err; |
| 1013 | } | 1013 | } |
| @@ -1026,15 +1026,15 @@ int reiserfs_xattr_init(struct super_block *s, int mount_flags) | |||
| 1026 | if (err) | 1026 | if (err) |
| 1027 | goto error; | 1027 | goto error; |
| 1028 | 1028 | ||
| 1029 | if (!privroot->d_inode && !(mount_flags & MS_RDONLY)) { | 1029 | if (d_really_is_negative(privroot) && !(mount_flags & MS_RDONLY)) { |
| 1030 | mutex_lock(&s->s_root->d_inode->i_mutex); | 1030 | mutex_lock(&d_inode(s->s_root)->i_mutex); |
| 1031 | err = create_privroot(REISERFS_SB(s)->priv_root); | 1031 | err = create_privroot(REISERFS_SB(s)->priv_root); |
| 1032 | mutex_unlock(&s->s_root->d_inode->i_mutex); | 1032 | mutex_unlock(&d_inode(s->s_root)->i_mutex); |
| 1033 | } | 1033 | } |
| 1034 | 1034 | ||
| 1035 | if (privroot->d_inode) { | 1035 | if (d_really_is_positive(privroot)) { |
| 1036 | s->s_xattr = reiserfs_xattr_handlers; | 1036 | s->s_xattr = reiserfs_xattr_handlers; |
| 1037 | mutex_lock(&privroot->d_inode->i_mutex); | 1037 | mutex_lock(&d_inode(privroot)->i_mutex); |
| 1038 | if (!REISERFS_SB(s)->xattr_root) { | 1038 | if (!REISERFS_SB(s)->xattr_root) { |
| 1039 | struct dentry *dentry; | 1039 | struct dentry *dentry; |
| 1040 | 1040 | ||
| @@ -1045,7 +1045,7 @@ int reiserfs_xattr_init(struct super_block *s, int mount_flags) | |||
| 1045 | else | 1045 | else |
| 1046 | err = PTR_ERR(dentry); | 1046 | err = PTR_ERR(dentry); |
| 1047 | } | 1047 | } |
| 1048 | mutex_unlock(&privroot->d_inode->i_mutex); | 1048 | mutex_unlock(&d_inode(privroot)->i_mutex); |
| 1049 | } | 1049 | } |
| 1050 | 1050 | ||
| 1051 | error: | 1051 | error: |
diff --git a/fs/reiserfs/xattr.h b/fs/reiserfs/xattr.h index f620e9678dd5..15dde6262c00 100644 --- a/fs/reiserfs/xattr.h +++ b/fs/reiserfs/xattr.h | |||
| @@ -78,7 +78,7 @@ static inline size_t reiserfs_xattr_jcreate_nblocks(struct inode *inode) | |||
| 78 | 78 | ||
| 79 | if ((REISERFS_I(inode)->i_flags & i_has_xattr_dir) == 0) { | 79 | if ((REISERFS_I(inode)->i_flags & i_has_xattr_dir) == 0) { |
| 80 | nblocks += JOURNAL_BLOCKS_PER_OBJECT(inode->i_sb); | 80 | nblocks += JOURNAL_BLOCKS_PER_OBJECT(inode->i_sb); |
| 81 | if (!REISERFS_SB(inode->i_sb)->xattr_root->d_inode) | 81 | if (d_really_is_negative(REISERFS_SB(inode->i_sb)->xattr_root)) |
| 82 | nblocks += JOURNAL_BLOCKS_PER_OBJECT(inode->i_sb); | 82 | nblocks += JOURNAL_BLOCKS_PER_OBJECT(inode->i_sb); |
| 83 | } | 83 | } |
| 84 | 84 | ||
diff --git a/fs/reiserfs/xattr_security.c b/fs/reiserfs/xattr_security.c index e7f8939a4cb5..9a3b0616f283 100644 --- a/fs/reiserfs/xattr_security.c +++ b/fs/reiserfs/xattr_security.c | |||
| @@ -15,10 +15,10 @@ security_get(struct dentry *dentry, const char *name, void *buffer, size_t size, | |||
| 15 | if (strlen(name) < sizeof(XATTR_SECURITY_PREFIX)) | 15 | if (strlen(name) < sizeof(XATTR_SECURITY_PREFIX)) |
| 16 | return -EINVAL; | 16 | return -EINVAL; |
| 17 | 17 | ||
| 18 | if (IS_PRIVATE(dentry->d_inode)) | 18 | if (IS_PRIVATE(d_inode(dentry))) |
| 19 | return -EPERM; | 19 | return -EPERM; |
| 20 | 20 | ||
| 21 | return reiserfs_xattr_get(dentry->d_inode, name, buffer, size); | 21 | return reiserfs_xattr_get(d_inode(dentry), name, buffer, size); |
| 22 | } | 22 | } |
| 23 | 23 | ||
| 24 | static int | 24 | static int |
| @@ -28,10 +28,10 @@ security_set(struct dentry *dentry, const char *name, const void *buffer, | |||
| 28 | if (strlen(name) < sizeof(XATTR_SECURITY_PREFIX)) | 28 | if (strlen(name) < sizeof(XATTR_SECURITY_PREFIX)) |
| 29 | return -EINVAL; | 29 | return -EINVAL; |
| 30 | 30 | ||
| 31 | if (IS_PRIVATE(dentry->d_inode)) | 31 | if (IS_PRIVATE(d_inode(dentry))) |
| 32 | return -EPERM; | 32 | return -EPERM; |
| 33 | 33 | ||
| 34 | return reiserfs_xattr_set(dentry->d_inode, name, buffer, size, flags); | 34 | return reiserfs_xattr_set(d_inode(dentry), name, buffer, size, flags); |
| 35 | } | 35 | } |
| 36 | 36 | ||
| 37 | static size_t security_list(struct dentry *dentry, char *list, size_t list_len, | 37 | static size_t security_list(struct dentry *dentry, char *list, size_t list_len, |
| @@ -39,7 +39,7 @@ static size_t security_list(struct dentry *dentry, char *list, size_t list_len, | |||
| 39 | { | 39 | { |
| 40 | const size_t len = namelen + 1; | 40 | const size_t len = namelen + 1; |
| 41 | 41 | ||
| 42 | if (IS_PRIVATE(dentry->d_inode)) | 42 | if (IS_PRIVATE(d_inode(dentry))) |
| 43 | return 0; | 43 | return 0; |
| 44 | 44 | ||
| 45 | if (list && len <= list_len) { | 45 | if (list && len <= list_len) { |
diff --git a/fs/reiserfs/xattr_trusted.c b/fs/reiserfs/xattr_trusted.c index 5eeb0c48ba46..e4f1343714e0 100644 --- a/fs/reiserfs/xattr_trusted.c +++ b/fs/reiserfs/xattr_trusted.c | |||
| @@ -14,10 +14,10 @@ trusted_get(struct dentry *dentry, const char *name, void *buffer, size_t size, | |||
| 14 | if (strlen(name) < sizeof(XATTR_TRUSTED_PREFIX)) | 14 | if (strlen(name) < sizeof(XATTR_TRUSTED_PREFIX)) |
| 15 | return -EINVAL; | 15 | return -EINVAL; |
| 16 | 16 | ||
| 17 | if (!capable(CAP_SYS_ADMIN) || IS_PRIVATE(dentry->d_inode)) | 17 | if (!capable(CAP_SYS_ADMIN) || IS_PRIVATE(d_inode(dentry))) |
| 18 | return -EPERM; | 18 | return -EPERM; |
| 19 | 19 | ||
| 20 | return reiserfs_xattr_get(dentry->d_inode, name, buffer, size); | 20 | return reiserfs_xattr_get(d_inode(dentry), name, buffer, size); |
| 21 | } | 21 | } |
| 22 | 22 | ||
| 23 | static int | 23 | static int |
| @@ -27,10 +27,10 @@ trusted_set(struct dentry *dentry, const char *name, const void *buffer, | |||
| 27 | if (strlen(name) < sizeof(XATTR_TRUSTED_PREFIX)) | 27 | if (strlen(name) < sizeof(XATTR_TRUSTED_PREFIX)) |
| 28 | return -EINVAL; | 28 | return -EINVAL; |
| 29 | 29 | ||
| 30 | if (!capable(CAP_SYS_ADMIN) || IS_PRIVATE(dentry->d_inode)) | 30 | if (!capable(CAP_SYS_ADMIN) || IS_PRIVATE(d_inode(dentry))) |
| 31 | return -EPERM; | 31 | return -EPERM; |
| 32 | 32 | ||
| 33 | return reiserfs_xattr_set(dentry->d_inode, name, buffer, size, flags); | 33 | return reiserfs_xattr_set(d_inode(dentry), name, buffer, size, flags); |
| 34 | } | 34 | } |
| 35 | 35 | ||
| 36 | static size_t trusted_list(struct dentry *dentry, char *list, size_t list_size, | 36 | static size_t trusted_list(struct dentry *dentry, char *list, size_t list_size, |
| @@ -38,7 +38,7 @@ static size_t trusted_list(struct dentry *dentry, char *list, size_t list_size, | |||
| 38 | { | 38 | { |
| 39 | const size_t len = name_len + 1; | 39 | const size_t len = name_len + 1; |
| 40 | 40 | ||
| 41 | if (!capable(CAP_SYS_ADMIN) || IS_PRIVATE(dentry->d_inode)) | 41 | if (!capable(CAP_SYS_ADMIN) || IS_PRIVATE(d_inode(dentry))) |
| 42 | return 0; | 42 | return 0; |
| 43 | 43 | ||
| 44 | if (list && len <= list_size) { | 44 | if (list && len <= list_size) { |
diff --git a/fs/reiserfs/xattr_user.c b/fs/reiserfs/xattr_user.c index e50eab046471..d0b08d3e5689 100644 --- a/fs/reiserfs/xattr_user.c +++ b/fs/reiserfs/xattr_user.c | |||
| @@ -15,7 +15,7 @@ user_get(struct dentry *dentry, const char *name, void *buffer, size_t size, | |||
| 15 | return -EINVAL; | 15 | return -EINVAL; |
| 16 | if (!reiserfs_xattrs_user(dentry->d_sb)) | 16 | if (!reiserfs_xattrs_user(dentry->d_sb)) |
| 17 | return -EOPNOTSUPP; | 17 | return -EOPNOTSUPP; |
| 18 | return reiserfs_xattr_get(dentry->d_inode, name, buffer, size); | 18 | return reiserfs_xattr_get(d_inode(dentry), name, buffer, size); |
| 19 | } | 19 | } |
| 20 | 20 | ||
| 21 | static int | 21 | static int |
| @@ -27,7 +27,7 @@ user_set(struct dentry *dentry, const char *name, const void *buffer, | |||
| 27 | 27 | ||
| 28 | if (!reiserfs_xattrs_user(dentry->d_sb)) | 28 | if (!reiserfs_xattrs_user(dentry->d_sb)) |
| 29 | return -EOPNOTSUPP; | 29 | return -EOPNOTSUPP; |
| 30 | return reiserfs_xattr_set(dentry->d_inode, name, buffer, size, flags); | 30 | return reiserfs_xattr_set(d_inode(dentry), name, buffer, size, flags); |
| 31 | } | 31 | } |
| 32 | 32 | ||
| 33 | static size_t user_list(struct dentry *dentry, char *list, size_t list_size, | 33 | static size_t user_list(struct dentry *dentry, char *list, size_t list_size, |
diff --git a/fs/squashfs/export.c b/fs/squashfs/export.c index 5e1101ff276f..8073b6532cf0 100644 --- a/fs/squashfs/export.c +++ b/fs/squashfs/export.c | |||
| @@ -110,7 +110,7 @@ static struct dentry *squashfs_fh_to_parent(struct super_block *sb, | |||
| 110 | 110 | ||
| 111 | static struct dentry *squashfs_get_parent(struct dentry *child) | 111 | static struct dentry *squashfs_get_parent(struct dentry *child) |
| 112 | { | 112 | { |
| 113 | struct inode *inode = child->d_inode; | 113 | struct inode *inode = d_inode(child); |
| 114 | unsigned int parent_ino = squashfs_i(inode)->parent; | 114 | unsigned int parent_ino = squashfs_i(inode)->parent; |
| 115 | 115 | ||
| 116 | return squashfs_export_iget(inode->i_sb, parent_ino); | 116 | return squashfs_export_iget(inode->i_sb, parent_ino); |
diff --git a/fs/squashfs/xattr.c b/fs/squashfs/xattr.c index 92fcde7b4d61..e5e0ddf5b143 100644 --- a/fs/squashfs/xattr.c +++ b/fs/squashfs/xattr.c | |||
| @@ -39,7 +39,7 @@ static const struct xattr_handler *squashfs_xattr_handler(int); | |||
| 39 | ssize_t squashfs_listxattr(struct dentry *d, char *buffer, | 39 | ssize_t squashfs_listxattr(struct dentry *d, char *buffer, |
| 40 | size_t buffer_size) | 40 | size_t buffer_size) |
| 41 | { | 41 | { |
| 42 | struct inode *inode = d->d_inode; | 42 | struct inode *inode = d_inode(d); |
| 43 | struct super_block *sb = inode->i_sb; | 43 | struct super_block *sb = inode->i_sb; |
| 44 | struct squashfs_sb_info *msblk = sb->s_fs_info; | 44 | struct squashfs_sb_info *msblk = sb->s_fs_info; |
| 45 | u64 start = SQUASHFS_XATTR_BLK(squashfs_i(inode)->xattr) | 45 | u64 start = SQUASHFS_XATTR_BLK(squashfs_i(inode)->xattr) |
| @@ -229,7 +229,7 @@ static int squashfs_user_get(struct dentry *d, const char *name, void *buffer, | |||
| 229 | if (name[0] == '\0') | 229 | if (name[0] == '\0') |
| 230 | return -EINVAL; | 230 | return -EINVAL; |
| 231 | 231 | ||
| 232 | return squashfs_xattr_get(d->d_inode, SQUASHFS_XATTR_USER, name, | 232 | return squashfs_xattr_get(d_inode(d), SQUASHFS_XATTR_USER, name, |
| 233 | buffer, size); | 233 | buffer, size); |
| 234 | } | 234 | } |
| 235 | 235 | ||
| @@ -259,7 +259,7 @@ static int squashfs_trusted_get(struct dentry *d, const char *name, | |||
| 259 | if (name[0] == '\0') | 259 | if (name[0] == '\0') |
| 260 | return -EINVAL; | 260 | return -EINVAL; |
| 261 | 261 | ||
| 262 | return squashfs_xattr_get(d->d_inode, SQUASHFS_XATTR_TRUSTED, name, | 262 | return squashfs_xattr_get(d_inode(d), SQUASHFS_XATTR_TRUSTED, name, |
| 263 | buffer, size); | 263 | buffer, size); |
| 264 | } | 264 | } |
| 265 | 265 | ||
| @@ -286,7 +286,7 @@ static int squashfs_security_get(struct dentry *d, const char *name, | |||
| 286 | if (name[0] == '\0') | 286 | if (name[0] == '\0') |
| 287 | return -EINVAL; | 287 | return -EINVAL; |
| 288 | 288 | ||
| 289 | return squashfs_xattr_get(d->d_inode, SQUASHFS_XATTR_SECURITY, name, | 289 | return squashfs_xattr_get(d_inode(d), SQUASHFS_XATTR_SECURITY, name, |
| 290 | buffer, size); | 290 | buffer, size); |
| 291 | } | 291 | } |
| 292 | 292 | ||
| @@ -51,7 +51,7 @@ EXPORT_SYMBOL(generic_fillattr); | |||
| 51 | */ | 51 | */ |
| 52 | int vfs_getattr_nosec(struct path *path, struct kstat *stat) | 52 | int vfs_getattr_nosec(struct path *path, struct kstat *stat) |
| 53 | { | 53 | { |
| 54 | struct inode *inode = path->dentry->d_inode; | 54 | struct inode *inode = d_backing_inode(path->dentry); |
| 55 | 55 | ||
| 56 | if (inode->i_op->getattr) | 56 | if (inode->i_op->getattr) |
| 57 | return inode->i_op->getattr(path->mnt, path->dentry, stat); | 57 | return inode->i_op->getattr(path->mnt, path->dentry, stat); |
| @@ -326,7 +326,7 @@ SYSCALL_DEFINE4(readlinkat, int, dfd, const char __user *, pathname, | |||
| 326 | retry: | 326 | retry: |
| 327 | error = user_path_at_empty(dfd, pathname, lookup_flags, &path, &empty); | 327 | error = user_path_at_empty(dfd, pathname, lookup_flags, &path, &empty); |
| 328 | if (!error) { | 328 | if (!error) { |
| 329 | struct inode *inode = path.dentry->d_inode; | 329 | struct inode *inode = d_backing_inode(path.dentry); |
| 330 | 330 | ||
| 331 | error = empty ? -ENOENT : -EINVAL; | 331 | error = empty ? -ENOENT : -EINVAL; |
| 332 | if (inode->i_op->readlink) { | 332 | if (inode->i_op->readlink) { |
diff --git a/fs/sysv/dir.c b/fs/sysv/dir.c index d42291d08215..8f3555f00c54 100644 --- a/fs/sysv/dir.c +++ b/fs/sysv/dir.c | |||
| @@ -132,7 +132,7 @@ struct sysv_dir_entry *sysv_find_entry(struct dentry *dentry, struct page **res_ | |||
| 132 | { | 132 | { |
| 133 | const char * name = dentry->d_name.name; | 133 | const char * name = dentry->d_name.name; |
| 134 | int namelen = dentry->d_name.len; | 134 | int namelen = dentry->d_name.len; |
| 135 | struct inode * dir = dentry->d_parent->d_inode; | 135 | struct inode * dir = d_inode(dentry->d_parent); |
| 136 | unsigned long start, n; | 136 | unsigned long start, n; |
| 137 | unsigned long npages = dir_pages(dir); | 137 | unsigned long npages = dir_pages(dir); |
| 138 | struct page *page = NULL; | 138 | struct page *page = NULL; |
| @@ -176,7 +176,7 @@ found: | |||
| 176 | 176 | ||
| 177 | int sysv_add_link(struct dentry *dentry, struct inode *inode) | 177 | int sysv_add_link(struct dentry *dentry, struct inode *inode) |
| 178 | { | 178 | { |
| 179 | struct inode *dir = dentry->d_parent->d_inode; | 179 | struct inode *dir = d_inode(dentry->d_parent); |
| 180 | const char * name = dentry->d_name.name; | 180 | const char * name = dentry->d_name.name; |
| 181 | int namelen = dentry->d_name.len; | 181 | int namelen = dentry->d_name.len; |
| 182 | struct page *page = NULL; | 182 | struct page *page = NULL; |
diff --git a/fs/sysv/file.c b/fs/sysv/file.c index a48e30410ad1..82ddc09061e2 100644 --- a/fs/sysv/file.c +++ b/fs/sysv/file.c | |||
| @@ -30,7 +30,7 @@ const struct file_operations sysv_file_operations = { | |||
| 30 | 30 | ||
| 31 | static int sysv_setattr(struct dentry *dentry, struct iattr *attr) | 31 | static int sysv_setattr(struct dentry *dentry, struct iattr *attr) |
| 32 | { | 32 | { |
| 33 | struct inode *inode = dentry->d_inode; | 33 | struct inode *inode = d_inode(dentry); |
| 34 | int error; | 34 | int error; |
| 35 | 35 | ||
| 36 | error = inode_change_ok(inode, attr); | 36 | error = inode_change_ok(inode, attr); |
diff --git a/fs/sysv/itree.c b/fs/sysv/itree.c index 66bc316927e8..2fde40acf024 100644 --- a/fs/sysv/itree.c +++ b/fs/sysv/itree.c | |||
| @@ -443,7 +443,7 @@ static unsigned sysv_nblocks(struct super_block *s, loff_t size) | |||
| 443 | int sysv_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat) | 443 | int sysv_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat) |
| 444 | { | 444 | { |
| 445 | struct super_block *s = dentry->d_sb; | 445 | struct super_block *s = dentry->d_sb; |
| 446 | generic_fillattr(dentry->d_inode, stat); | 446 | generic_fillattr(d_inode(dentry), stat); |
| 447 | stat->blocks = (s->s_blocksize / 512) * sysv_nblocks(s, stat->size); | 447 | stat->blocks = (s->s_blocksize / 512) * sysv_nblocks(s, stat->size); |
| 448 | stat->blksize = s->s_blocksize; | 448 | stat->blksize = s->s_blocksize; |
| 449 | return 0; | 449 | return 0; |
diff --git a/fs/sysv/namei.c b/fs/sysv/namei.c index 731b2bbcaab3..11e83ed0b4bf 100644 --- a/fs/sysv/namei.c +++ b/fs/sysv/namei.c | |||
| @@ -118,7 +118,7 @@ out_fail: | |||
| 118 | static int sysv_link(struct dentry * old_dentry, struct inode * dir, | 118 | static int sysv_link(struct dentry * old_dentry, struct inode * dir, |
| 119 | struct dentry * dentry) | 119 | struct dentry * dentry) |
| 120 | { | 120 | { |
| 121 | struct inode *inode = old_dentry->d_inode; | 121 | struct inode *inode = d_inode(old_dentry); |
| 122 | 122 | ||
| 123 | inode->i_ctime = CURRENT_TIME_SEC; | 123 | inode->i_ctime = CURRENT_TIME_SEC; |
| 124 | inode_inc_link_count(inode); | 124 | inode_inc_link_count(inode); |
| @@ -166,7 +166,7 @@ out_dir: | |||
| 166 | 166 | ||
| 167 | static int sysv_unlink(struct inode * dir, struct dentry * dentry) | 167 | static int sysv_unlink(struct inode * dir, struct dentry * dentry) |
| 168 | { | 168 | { |
| 169 | struct inode * inode = dentry->d_inode; | 169 | struct inode * inode = d_inode(dentry); |
| 170 | struct page * page; | 170 | struct page * page; |
| 171 | struct sysv_dir_entry * de; | 171 | struct sysv_dir_entry * de; |
| 172 | int err = -ENOENT; | 172 | int err = -ENOENT; |
| @@ -187,7 +187,7 @@ out: | |||
| 187 | 187 | ||
| 188 | static int sysv_rmdir(struct inode * dir, struct dentry * dentry) | 188 | static int sysv_rmdir(struct inode * dir, struct dentry * dentry) |
| 189 | { | 189 | { |
| 190 | struct inode *inode = dentry->d_inode; | 190 | struct inode *inode = d_inode(dentry); |
| 191 | int err = -ENOTEMPTY; | 191 | int err = -ENOTEMPTY; |
| 192 | 192 | ||
| 193 | if (sysv_empty_dir(inode)) { | 193 | if (sysv_empty_dir(inode)) { |
| @@ -208,8 +208,8 @@ static int sysv_rmdir(struct inode * dir, struct dentry * dentry) | |||
| 208 | static int sysv_rename(struct inode * old_dir, struct dentry * old_dentry, | 208 | static int sysv_rename(struct inode * old_dir, struct dentry * old_dentry, |
| 209 | struct inode * new_dir, struct dentry * new_dentry) | 209 | struct inode * new_dir, struct dentry * new_dentry) |
| 210 | { | 210 | { |
| 211 | struct inode * old_inode = old_dentry->d_inode; | 211 | struct inode * old_inode = d_inode(old_dentry); |
| 212 | struct inode * new_inode = new_dentry->d_inode; | 212 | struct inode * new_inode = d_inode(new_dentry); |
| 213 | struct page * dir_page = NULL; | 213 | struct page * dir_page = NULL; |
| 214 | struct sysv_dir_entry * dir_de = NULL; | 214 | struct sysv_dir_entry * dir_de = NULL; |
| 215 | struct page * old_page; | 215 | struct page * old_page; |
diff --git a/fs/sysv/symlink.c b/fs/sysv/symlink.c index 00d2f8a43e4e..d3fa0d703314 100644 --- a/fs/sysv/symlink.c +++ b/fs/sysv/symlink.c | |||
| @@ -10,7 +10,7 @@ | |||
| 10 | 10 | ||
| 11 | static void *sysv_follow_link(struct dentry *dentry, struct nameidata *nd) | 11 | static void *sysv_follow_link(struct dentry *dentry, struct nameidata *nd) |
| 12 | { | 12 | { |
| 13 | nd_set_link(nd, (char *)SYSV_I(dentry->d_inode)->i_data); | 13 | nd_set_link(nd, (char *)SYSV_I(d_inode(dentry))->i_data); |
| 14 | return NULL; | 14 | return NULL; |
| 15 | } | 15 | } |
| 16 | 16 | ||
diff --git a/fs/ubifs/dir.c b/fs/ubifs/dir.c index 02d1ee778df0..27060fc855d4 100644 --- a/fs/ubifs/dir.c +++ b/fs/ubifs/dir.c | |||
| @@ -499,7 +499,7 @@ static int ubifs_link(struct dentry *old_dentry, struct inode *dir, | |||
| 499 | struct dentry *dentry) | 499 | struct dentry *dentry) |
| 500 | { | 500 | { |
| 501 | struct ubifs_info *c = dir->i_sb->s_fs_info; | 501 | struct ubifs_info *c = dir->i_sb->s_fs_info; |
| 502 | struct inode *inode = old_dentry->d_inode; | 502 | struct inode *inode = d_inode(old_dentry); |
| 503 | struct ubifs_inode *ui = ubifs_inode(inode); | 503 | struct ubifs_inode *ui = ubifs_inode(inode); |
| 504 | struct ubifs_inode *dir_ui = ubifs_inode(dir); | 504 | struct ubifs_inode *dir_ui = ubifs_inode(dir); |
| 505 | int err, sz_change = CALC_DENT_SIZE(dentry->d_name.len); | 505 | int err, sz_change = CALC_DENT_SIZE(dentry->d_name.len); |
| @@ -554,7 +554,7 @@ out_cancel: | |||
| 554 | static int ubifs_unlink(struct inode *dir, struct dentry *dentry) | 554 | static int ubifs_unlink(struct inode *dir, struct dentry *dentry) |
| 555 | { | 555 | { |
| 556 | struct ubifs_info *c = dir->i_sb->s_fs_info; | 556 | struct ubifs_info *c = dir->i_sb->s_fs_info; |
| 557 | struct inode *inode = dentry->d_inode; | 557 | struct inode *inode = d_inode(dentry); |
| 558 | struct ubifs_inode *dir_ui = ubifs_inode(dir); | 558 | struct ubifs_inode *dir_ui = ubifs_inode(dir); |
| 559 | int sz_change = CALC_DENT_SIZE(dentry->d_name.len); | 559 | int sz_change = CALC_DENT_SIZE(dentry->d_name.len); |
| 560 | int err, budgeted = 1; | 560 | int err, budgeted = 1; |
| @@ -646,7 +646,7 @@ static int check_dir_empty(struct ubifs_info *c, struct inode *dir) | |||
| 646 | static int ubifs_rmdir(struct inode *dir, struct dentry *dentry) | 646 | static int ubifs_rmdir(struct inode *dir, struct dentry *dentry) |
| 647 | { | 647 | { |
| 648 | struct ubifs_info *c = dir->i_sb->s_fs_info; | 648 | struct ubifs_info *c = dir->i_sb->s_fs_info; |
| 649 | struct inode *inode = dentry->d_inode; | 649 | struct inode *inode = d_inode(dentry); |
| 650 | int sz_change = CALC_DENT_SIZE(dentry->d_name.len); | 650 | int sz_change = CALC_DENT_SIZE(dentry->d_name.len); |
| 651 | int err, budgeted = 1; | 651 | int err, budgeted = 1; |
| 652 | struct ubifs_inode *dir_ui = ubifs_inode(dir); | 652 | struct ubifs_inode *dir_ui = ubifs_inode(dir); |
| @@ -662,7 +662,7 @@ static int ubifs_rmdir(struct inode *dir, struct dentry *dentry) | |||
| 662 | inode->i_ino, dir->i_ino); | 662 | inode->i_ino, dir->i_ino); |
| 663 | ubifs_assert(mutex_is_locked(&dir->i_mutex)); | 663 | ubifs_assert(mutex_is_locked(&dir->i_mutex)); |
| 664 | ubifs_assert(mutex_is_locked(&inode->i_mutex)); | 664 | ubifs_assert(mutex_is_locked(&inode->i_mutex)); |
| 665 | err = check_dir_empty(c, dentry->d_inode); | 665 | err = check_dir_empty(c, d_inode(dentry)); |
| 666 | if (err) | 666 | if (err) |
| 667 | return err; | 667 | return err; |
| 668 | 668 | ||
| @@ -970,8 +970,8 @@ static int ubifs_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
| 970 | struct inode *new_dir, struct dentry *new_dentry) | 970 | struct inode *new_dir, struct dentry *new_dentry) |
| 971 | { | 971 | { |
| 972 | struct ubifs_info *c = old_dir->i_sb->s_fs_info; | 972 | struct ubifs_info *c = old_dir->i_sb->s_fs_info; |
| 973 | struct inode *old_inode = old_dentry->d_inode; | 973 | struct inode *old_inode = d_inode(old_dentry); |
| 974 | struct inode *new_inode = new_dentry->d_inode; | 974 | struct inode *new_inode = d_inode(new_dentry); |
| 975 | struct ubifs_inode *old_inode_ui = ubifs_inode(old_inode); | 975 | struct ubifs_inode *old_inode_ui = ubifs_inode(old_inode); |
| 976 | int err, release, sync = 0, move = (new_dir != old_dir); | 976 | int err, release, sync = 0, move = (new_dir != old_dir); |
| 977 | int is_dir = S_ISDIR(old_inode->i_mode); | 977 | int is_dir = S_ISDIR(old_inode->i_mode); |
| @@ -1136,7 +1136,7 @@ int ubifs_getattr(struct vfsmount *mnt, struct dentry *dentry, | |||
| 1136 | struct kstat *stat) | 1136 | struct kstat *stat) |
| 1137 | { | 1137 | { |
| 1138 | loff_t size; | 1138 | loff_t size; |
| 1139 | struct inode *inode = dentry->d_inode; | 1139 | struct inode *inode = d_inode(dentry); |
| 1140 | struct ubifs_inode *ui = ubifs_inode(inode); | 1140 | struct ubifs_inode *ui = ubifs_inode(inode); |
| 1141 | 1141 | ||
| 1142 | mutex_lock(&ui->ui_mutex); | 1142 | mutex_lock(&ui->ui_mutex); |
diff --git a/fs/ubifs/file.c b/fs/ubifs/file.c index 3ba3fef64e9e..35efc103c39c 100644 --- a/fs/ubifs/file.c +++ b/fs/ubifs/file.c | |||
| @@ -1257,7 +1257,7 @@ static int do_setattr(struct ubifs_info *c, struct inode *inode, | |||
| 1257 | int ubifs_setattr(struct dentry *dentry, struct iattr *attr) | 1257 | int ubifs_setattr(struct dentry *dentry, struct iattr *attr) |
| 1258 | { | 1258 | { |
| 1259 | int err; | 1259 | int err; |
| 1260 | struct inode *inode = dentry->d_inode; | 1260 | struct inode *inode = d_inode(dentry); |
| 1261 | struct ubifs_info *c = inode->i_sb->s_fs_info; | 1261 | struct ubifs_info *c = inode->i_sb->s_fs_info; |
| 1262 | 1262 | ||
| 1263 | dbg_gen("ino %lu, mode %#x, ia_valid %#x", | 1263 | dbg_gen("ino %lu, mode %#x, ia_valid %#x", |
| @@ -1302,7 +1302,7 @@ static void ubifs_invalidatepage(struct page *page, unsigned int offset, | |||
| 1302 | 1302 | ||
| 1303 | static void *ubifs_follow_link(struct dentry *dentry, struct nameidata *nd) | 1303 | static void *ubifs_follow_link(struct dentry *dentry, struct nameidata *nd) |
| 1304 | { | 1304 | { |
| 1305 | struct ubifs_inode *ui = ubifs_inode(dentry->d_inode); | 1305 | struct ubifs_inode *ui = ubifs_inode(d_inode(dentry)); |
| 1306 | 1306 | ||
| 1307 | nd_set_link(nd, ui->data); | 1307 | nd_set_link(nd, ui->data); |
| 1308 | return NULL; | 1308 | return NULL; |
diff --git a/fs/ubifs/journal.c b/fs/ubifs/journal.c index 90ae1a8439d9..0b9da5b6e0f9 100644 --- a/fs/ubifs/journal.c +++ b/fs/ubifs/journal.c | |||
| @@ -930,8 +930,8 @@ int ubifs_jnl_rename(struct ubifs_info *c, const struct inode *old_dir, | |||
| 930 | union ubifs_key key; | 930 | union ubifs_key key; |
| 931 | struct ubifs_dent_node *dent, *dent2; | 931 | struct ubifs_dent_node *dent, *dent2; |
| 932 | int err, dlen1, dlen2, ilen, lnum, offs, len; | 932 | int err, dlen1, dlen2, ilen, lnum, offs, len; |
| 933 | const struct inode *old_inode = old_dentry->d_inode; | 933 | const struct inode *old_inode = d_inode(old_dentry); |
| 934 | const struct inode *new_inode = new_dentry->d_inode; | 934 | const struct inode *new_inode = d_inode(new_dentry); |
| 935 | int aligned_dlen1, aligned_dlen2, plen = UBIFS_INO_NODE_SZ; | 935 | int aligned_dlen1, aligned_dlen2, plen = UBIFS_INO_NODE_SZ; |
| 936 | int last_reference = !!(new_inode && new_inode->i_nlink == 0); | 936 | int last_reference = !!(new_inode && new_inode->i_nlink == 0); |
| 937 | int move = (old_dir != new_dir); | 937 | int move = (old_dir != new_dir); |
diff --git a/fs/ubifs/xattr.c b/fs/ubifs/xattr.c index 3659b1934500..96f3448b6eb4 100644 --- a/fs/ubifs/xattr.c +++ b/fs/ubifs/xattr.c | |||
| @@ -364,15 +364,15 @@ int ubifs_setxattr(struct dentry *dentry, const char *name, | |||
| 364 | const void *value, size_t size, int flags) | 364 | const void *value, size_t size, int flags) |
| 365 | { | 365 | { |
| 366 | dbg_gen("xattr '%s', host ino %lu ('%pd'), size %zd", | 366 | dbg_gen("xattr '%s', host ino %lu ('%pd'), size %zd", |
| 367 | name, dentry->d_inode->i_ino, dentry, size); | 367 | name, d_inode(dentry)->i_ino, dentry, size); |
| 368 | 368 | ||
| 369 | return setxattr(dentry->d_inode, name, value, size, flags); | 369 | return setxattr(d_inode(dentry), name, value, size, flags); |
| 370 | } | 370 | } |
| 371 | 371 | ||
| 372 | ssize_t ubifs_getxattr(struct dentry *dentry, const char *name, void *buf, | 372 | ssize_t ubifs_getxattr(struct dentry *dentry, const char *name, void *buf, |
| 373 | size_t size) | 373 | size_t size) |
| 374 | { | 374 | { |
| 375 | struct inode *inode, *host = dentry->d_inode; | 375 | struct inode *inode, *host = d_inode(dentry); |
| 376 | struct ubifs_info *c = host->i_sb->s_fs_info; | 376 | struct ubifs_info *c = host->i_sb->s_fs_info; |
| 377 | struct qstr nm = QSTR_INIT(name, strlen(name)); | 377 | struct qstr nm = QSTR_INIT(name, strlen(name)); |
| 378 | struct ubifs_inode *ui; | 378 | struct ubifs_inode *ui; |
| @@ -432,7 +432,7 @@ out_unlock: | |||
| 432 | ssize_t ubifs_listxattr(struct dentry *dentry, char *buffer, size_t size) | 432 | ssize_t ubifs_listxattr(struct dentry *dentry, char *buffer, size_t size) |
| 433 | { | 433 | { |
| 434 | union ubifs_key key; | 434 | union ubifs_key key; |
| 435 | struct inode *host = dentry->d_inode; | 435 | struct inode *host = d_inode(dentry); |
| 436 | struct ubifs_info *c = host->i_sb->s_fs_info; | 436 | struct ubifs_info *c = host->i_sb->s_fs_info; |
| 437 | struct ubifs_inode *host_ui = ubifs_inode(host); | 437 | struct ubifs_inode *host_ui = ubifs_inode(host); |
| 438 | struct ubifs_dent_node *xent, *pxent = NULL; | 438 | struct ubifs_dent_node *xent, *pxent = NULL; |
| @@ -535,7 +535,7 @@ out_cancel: | |||
| 535 | 535 | ||
| 536 | int ubifs_removexattr(struct dentry *dentry, const char *name) | 536 | int ubifs_removexattr(struct dentry *dentry, const char *name) |
| 537 | { | 537 | { |
| 538 | struct inode *inode, *host = dentry->d_inode; | 538 | struct inode *inode, *host = d_inode(dentry); |
| 539 | struct ubifs_info *c = host->i_sb->s_fs_info; | 539 | struct ubifs_info *c = host->i_sb->s_fs_info; |
| 540 | struct qstr nm = QSTR_INIT(name, strlen(name)); | 540 | struct qstr nm = QSTR_INIT(name, strlen(name)); |
| 541 | struct ubifs_dent_node *xent; | 541 | struct ubifs_dent_node *xent; |
diff --git a/fs/udf/file.c b/fs/udf/file.c index 5dadad9960b9..7a95b8fed302 100644 --- a/fs/udf/file.c +++ b/fs/udf/file.c | |||
| @@ -249,7 +249,7 @@ const struct file_operations udf_file_operations = { | |||
| 249 | 249 | ||
| 250 | static int udf_setattr(struct dentry *dentry, struct iattr *attr) | 250 | static int udf_setattr(struct dentry *dentry, struct iattr *attr) |
| 251 | { | 251 | { |
| 252 | struct inode *inode = dentry->d_inode; | 252 | struct inode *inode = d_inode(dentry); |
| 253 | int error; | 253 | int error; |
| 254 | 254 | ||
| 255 | error = inode_change_ok(inode, attr); | 255 | error = inode_change_ok(inode, attr); |
diff --git a/fs/udf/namei.c b/fs/udf/namei.c index 39661977c89c..5c03f0dfb98b 100644 --- a/fs/udf/namei.c +++ b/fs/udf/namei.c | |||
| @@ -551,7 +551,7 @@ static int udf_delete_entry(struct inode *inode, struct fileIdentDesc *fi, | |||
| 551 | static int udf_add_nondir(struct dentry *dentry, struct inode *inode) | 551 | static int udf_add_nondir(struct dentry *dentry, struct inode *inode) |
| 552 | { | 552 | { |
| 553 | struct udf_inode_info *iinfo = UDF_I(inode); | 553 | struct udf_inode_info *iinfo = UDF_I(inode); |
| 554 | struct inode *dir = dentry->d_parent->d_inode; | 554 | struct inode *dir = d_inode(dentry->d_parent); |
| 555 | struct udf_fileident_bh fibh; | 555 | struct udf_fileident_bh fibh; |
| 556 | struct fileIdentDesc cfi, *fi; | 556 | struct fileIdentDesc cfi, *fi; |
| 557 | int err; | 557 | int err; |
| @@ -767,7 +767,7 @@ static int empty_dir(struct inode *dir) | |||
| 767 | static int udf_rmdir(struct inode *dir, struct dentry *dentry) | 767 | static int udf_rmdir(struct inode *dir, struct dentry *dentry) |
| 768 | { | 768 | { |
| 769 | int retval; | 769 | int retval; |
| 770 | struct inode *inode = dentry->d_inode; | 770 | struct inode *inode = d_inode(dentry); |
| 771 | struct udf_fileident_bh fibh; | 771 | struct udf_fileident_bh fibh; |
| 772 | struct fileIdentDesc *fi, cfi; | 772 | struct fileIdentDesc *fi, cfi; |
| 773 | struct kernel_lb_addr tloc; | 773 | struct kernel_lb_addr tloc; |
| @@ -809,7 +809,7 @@ out: | |||
| 809 | static int udf_unlink(struct inode *dir, struct dentry *dentry) | 809 | static int udf_unlink(struct inode *dir, struct dentry *dentry) |
| 810 | { | 810 | { |
| 811 | int retval; | 811 | int retval; |
| 812 | struct inode *inode = dentry->d_inode; | 812 | struct inode *inode = d_inode(dentry); |
| 813 | struct udf_fileident_bh fibh; | 813 | struct udf_fileident_bh fibh; |
| 814 | struct fileIdentDesc *fi; | 814 | struct fileIdentDesc *fi; |
| 815 | struct fileIdentDesc cfi; | 815 | struct fileIdentDesc cfi; |
| @@ -999,7 +999,7 @@ out_no_entry: | |||
| 999 | static int udf_link(struct dentry *old_dentry, struct inode *dir, | 999 | static int udf_link(struct dentry *old_dentry, struct inode *dir, |
| 1000 | struct dentry *dentry) | 1000 | struct dentry *dentry) |
| 1001 | { | 1001 | { |
| 1002 | struct inode *inode = old_dentry->d_inode; | 1002 | struct inode *inode = d_inode(old_dentry); |
| 1003 | struct udf_fileident_bh fibh; | 1003 | struct udf_fileident_bh fibh; |
| 1004 | struct fileIdentDesc cfi, *fi; | 1004 | struct fileIdentDesc cfi, *fi; |
| 1005 | int err; | 1005 | int err; |
| @@ -1038,8 +1038,8 @@ static int udf_link(struct dentry *old_dentry, struct inode *dir, | |||
| 1038 | static int udf_rename(struct inode *old_dir, struct dentry *old_dentry, | 1038 | static int udf_rename(struct inode *old_dir, struct dentry *old_dentry, |
| 1039 | struct inode *new_dir, struct dentry *new_dentry) | 1039 | struct inode *new_dir, struct dentry *new_dentry) |
| 1040 | { | 1040 | { |
| 1041 | struct inode *old_inode = old_dentry->d_inode; | 1041 | struct inode *old_inode = d_inode(old_dentry); |
| 1042 | struct inode *new_inode = new_dentry->d_inode; | 1042 | struct inode *new_inode = d_inode(new_dentry); |
| 1043 | struct udf_fileident_bh ofibh, nfibh; | 1043 | struct udf_fileident_bh ofibh, nfibh; |
| 1044 | struct fileIdentDesc *ofi = NULL, *nfi = NULL, *dir_fi = NULL; | 1044 | struct fileIdentDesc *ofi = NULL, *nfi = NULL, *dir_fi = NULL; |
| 1045 | struct fileIdentDesc ocfi, ncfi; | 1045 | struct fileIdentDesc ocfi, ncfi; |
| @@ -1179,7 +1179,7 @@ static struct dentry *udf_get_parent(struct dentry *child) | |||
| 1179 | struct fileIdentDesc cfi; | 1179 | struct fileIdentDesc cfi; |
| 1180 | struct udf_fileident_bh fibh; | 1180 | struct udf_fileident_bh fibh; |
| 1181 | 1181 | ||
| 1182 | if (!udf_find_entry(child->d_inode, &dotdot, &fibh, &cfi)) | 1182 | if (!udf_find_entry(d_inode(child), &dotdot, &fibh, &cfi)) |
| 1183 | return ERR_PTR(-EACCES); | 1183 | return ERR_PTR(-EACCES); |
| 1184 | 1184 | ||
| 1185 | if (fibh.sbh != fibh.ebh) | 1185 | if (fibh.sbh != fibh.ebh) |
| @@ -1187,7 +1187,7 @@ static struct dentry *udf_get_parent(struct dentry *child) | |||
| 1187 | brelse(fibh.sbh); | 1187 | brelse(fibh.sbh); |
| 1188 | 1188 | ||
| 1189 | tloc = lelb_to_cpu(cfi.icb.extLocation); | 1189 | tloc = lelb_to_cpu(cfi.icb.extLocation); |
| 1190 | inode = udf_iget(child->d_inode->i_sb, &tloc); | 1190 | inode = udf_iget(d_inode(child)->i_sb, &tloc); |
| 1191 | if (IS_ERR(inode)) | 1191 | if (IS_ERR(inode)) |
| 1192 | return ERR_CAST(inode); | 1192 | return ERR_CAST(inode); |
| 1193 | 1193 | ||
diff --git a/fs/ufs/dir.c b/fs/ufs/dir.c index 0ecc2cebed8f..1bfe8cabff0f 100644 --- a/fs/ufs/dir.c +++ b/fs/ufs/dir.c | |||
| @@ -311,7 +311,7 @@ found: | |||
| 311 | */ | 311 | */ |
| 312 | int ufs_add_link(struct dentry *dentry, struct inode *inode) | 312 | int ufs_add_link(struct dentry *dentry, struct inode *inode) |
| 313 | { | 313 | { |
| 314 | struct inode *dir = dentry->d_parent->d_inode; | 314 | struct inode *dir = d_inode(dentry->d_parent); |
| 315 | const unsigned char *name = dentry->d_name.name; | 315 | const unsigned char *name = dentry->d_name.name; |
| 316 | int namelen = dentry->d_name.len; | 316 | int namelen = dentry->d_name.len; |
| 317 | struct super_block *sb = dir->i_sb; | 317 | struct super_block *sb = dir->i_sb; |
diff --git a/fs/ufs/namei.c b/fs/ufs/namei.c index fd65deb4b5f0..e491a93a7e9a 100644 --- a/fs/ufs/namei.c +++ b/fs/ufs/namei.c | |||
| @@ -165,7 +165,7 @@ out_fail: | |||
| 165 | static int ufs_link (struct dentry * old_dentry, struct inode * dir, | 165 | static int ufs_link (struct dentry * old_dentry, struct inode * dir, |
| 166 | struct dentry *dentry) | 166 | struct dentry *dentry) |
| 167 | { | 167 | { |
| 168 | struct inode *inode = old_dentry->d_inode; | 168 | struct inode *inode = d_inode(old_dentry); |
| 169 | int error; | 169 | int error; |
| 170 | 170 | ||
| 171 | lock_ufs(dir->i_sb); | 171 | lock_ufs(dir->i_sb); |
| @@ -222,7 +222,7 @@ out_fail: | |||
| 222 | 222 | ||
| 223 | static int ufs_unlink(struct inode *dir, struct dentry *dentry) | 223 | static int ufs_unlink(struct inode *dir, struct dentry *dentry) |
| 224 | { | 224 | { |
| 225 | struct inode * inode = dentry->d_inode; | 225 | struct inode * inode = d_inode(dentry); |
| 226 | struct ufs_dir_entry *de; | 226 | struct ufs_dir_entry *de; |
| 227 | struct page *page; | 227 | struct page *page; |
| 228 | int err = -ENOENT; | 228 | int err = -ENOENT; |
| @@ -244,7 +244,7 @@ out: | |||
| 244 | 244 | ||
| 245 | static int ufs_rmdir (struct inode * dir, struct dentry *dentry) | 245 | static int ufs_rmdir (struct inode * dir, struct dentry *dentry) |
| 246 | { | 246 | { |
| 247 | struct inode * inode = dentry->d_inode; | 247 | struct inode * inode = d_inode(dentry); |
| 248 | int err= -ENOTEMPTY; | 248 | int err= -ENOTEMPTY; |
| 249 | 249 | ||
| 250 | lock_ufs(dir->i_sb); | 250 | lock_ufs(dir->i_sb); |
| @@ -263,8 +263,8 @@ static int ufs_rmdir (struct inode * dir, struct dentry *dentry) | |||
| 263 | static int ufs_rename(struct inode *old_dir, struct dentry *old_dentry, | 263 | static int ufs_rename(struct inode *old_dir, struct dentry *old_dentry, |
| 264 | struct inode *new_dir, struct dentry *new_dentry) | 264 | struct inode *new_dir, struct dentry *new_dentry) |
| 265 | { | 265 | { |
| 266 | struct inode *old_inode = old_dentry->d_inode; | 266 | struct inode *old_inode = d_inode(old_dentry); |
| 267 | struct inode *new_inode = new_dentry->d_inode; | 267 | struct inode *new_inode = d_inode(new_dentry); |
| 268 | struct page *dir_page = NULL; | 268 | struct page *dir_page = NULL; |
| 269 | struct ufs_dir_entry * dir_de = NULL; | 269 | struct ufs_dir_entry * dir_de = NULL; |
| 270 | struct page *old_page; | 270 | struct page *old_page; |
diff --git a/fs/ufs/super.c b/fs/ufs/super.c index 8092d3759a5e..b3bc3e7ae79d 100644 --- a/fs/ufs/super.c +++ b/fs/ufs/super.c | |||
| @@ -144,10 +144,10 @@ static struct dentry *ufs_get_parent(struct dentry *child) | |||
| 144 | struct qstr dot_dot = QSTR_INIT("..", 2); | 144 | struct qstr dot_dot = QSTR_INIT("..", 2); |
| 145 | ino_t ino; | 145 | ino_t ino; |
| 146 | 146 | ||
| 147 | ino = ufs_inode_by_name(child->d_inode, &dot_dot); | 147 | ino = ufs_inode_by_name(d_inode(child), &dot_dot); |
| 148 | if (!ino) | 148 | if (!ino) |
| 149 | return ERR_PTR(-ENOENT); | 149 | return ERR_PTR(-ENOENT); |
| 150 | return d_obtain_alias(ufs_iget(child->d_inode->i_sb, ino)); | 150 | return d_obtain_alias(ufs_iget(d_inode(child)->i_sb, ino)); |
| 151 | } | 151 | } |
| 152 | 152 | ||
| 153 | static const struct export_operations ufs_export_ops = { | 153 | static const struct export_operations ufs_export_ops = { |
diff --git a/fs/ufs/symlink.c b/fs/ufs/symlink.c index d283628b4778..5b537e2fdda3 100644 --- a/fs/ufs/symlink.c +++ b/fs/ufs/symlink.c | |||
| @@ -34,7 +34,7 @@ | |||
| 34 | 34 | ||
| 35 | static void *ufs_follow_link(struct dentry *dentry, struct nameidata *nd) | 35 | static void *ufs_follow_link(struct dentry *dentry, struct nameidata *nd) |
| 36 | { | 36 | { |
| 37 | struct ufs_inode_info *p = UFS_I(dentry->d_inode); | 37 | struct ufs_inode_info *p = UFS_I(d_inode(dentry)); |
| 38 | nd_set_link(nd, (char*)p->i_u1.i_symlink); | 38 | nd_set_link(nd, (char*)p->i_u1.i_symlink); |
| 39 | return NULL; | 39 | return NULL; |
| 40 | } | 40 | } |
diff --git a/fs/ufs/truncate.c b/fs/ufs/truncate.c index f04f89fbd4d9..21154704c168 100644 --- a/fs/ufs/truncate.c +++ b/fs/ufs/truncate.c | |||
| @@ -492,7 +492,7 @@ out: | |||
| 492 | 492 | ||
| 493 | int ufs_setattr(struct dentry *dentry, struct iattr *attr) | 493 | int ufs_setattr(struct dentry *dentry, struct iattr *attr) |
| 494 | { | 494 | { |
| 495 | struct inode *inode = dentry->d_inode; | 495 | struct inode *inode = d_inode(dentry); |
| 496 | unsigned int ia_valid = attr->ia_valid; | 496 | unsigned int ia_valid = attr->ia_valid; |
| 497 | int error; | 497 | int error; |
| 498 | 498 | ||
diff --git a/fs/xfs/xfs_export.c b/fs/xfs/xfs_export.c index b97359ba2648..652cd3c5b58c 100644 --- a/fs/xfs/xfs_export.c +++ b/fs/xfs/xfs_export.c | |||
| @@ -215,7 +215,7 @@ xfs_fs_get_parent( | |||
| 215 | int error; | 215 | int error; |
| 216 | struct xfs_inode *cip; | 216 | struct xfs_inode *cip; |
| 217 | 217 | ||
| 218 | error = xfs_lookup(XFS_I(child->d_inode), &xfs_name_dotdot, &cip, NULL); | 218 | error = xfs_lookup(XFS_I(d_inode(child)), &xfs_name_dotdot, &cip, NULL); |
| 219 | if (unlikely(error)) | 219 | if (unlikely(error)) |
| 220 | return ERR_PTR(error); | 220 | return ERR_PTR(error); |
| 221 | 221 | ||
diff --git a/fs/xfs/xfs_filestream.c b/fs/xfs/xfs_filestream.c index 8f9f854376c6..da82f1cb4b9b 100644 --- a/fs/xfs/xfs_filestream.c +++ b/fs/xfs/xfs_filestream.c | |||
| @@ -294,7 +294,7 @@ xfs_filestream_get_parent( | |||
| 294 | if (!parent) | 294 | if (!parent) |
| 295 | goto out_dput; | 295 | goto out_dput; |
| 296 | 296 | ||
| 297 | dir = igrab(parent->d_inode); | 297 | dir = igrab(d_inode(parent)); |
| 298 | dput(parent); | 298 | dput(parent); |
| 299 | 299 | ||
| 300 | out_dput: | 300 | out_dput: |
diff --git a/fs/xfs/xfs_ioctl.c b/fs/xfs/xfs_ioctl.c index 5f4a396f5186..87f67c6b654c 100644 --- a/fs/xfs/xfs_ioctl.c +++ b/fs/xfs/xfs_ioctl.c | |||
| @@ -82,7 +82,7 @@ xfs_find_handle( | |||
| 82 | error = user_lpath((const char __user *)hreq->path, &path); | 82 | error = user_lpath((const char __user *)hreq->path, &path); |
| 83 | if (error) | 83 | if (error) |
| 84 | return error; | 84 | return error; |
| 85 | inode = path.dentry->d_inode; | 85 | inode = d_inode(path.dentry); |
| 86 | } | 86 | } |
| 87 | ip = XFS_I(inode); | 87 | ip = XFS_I(inode); |
| 88 | 88 | ||
| @@ -210,7 +210,7 @@ xfs_open_by_handle( | |||
| 210 | dentry = xfs_handlereq_to_dentry(parfilp, hreq); | 210 | dentry = xfs_handlereq_to_dentry(parfilp, hreq); |
| 211 | if (IS_ERR(dentry)) | 211 | if (IS_ERR(dentry)) |
| 212 | return PTR_ERR(dentry); | 212 | return PTR_ERR(dentry); |
| 213 | inode = dentry->d_inode; | 213 | inode = d_inode(dentry); |
| 214 | 214 | ||
| 215 | /* Restrict xfs_open_by_handle to directories & regular files. */ | 215 | /* Restrict xfs_open_by_handle to directories & regular files. */ |
| 216 | if (!(S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode))) { | 216 | if (!(S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode))) { |
| @@ -303,7 +303,7 @@ xfs_readlink_by_handle( | |||
| 303 | goto out_dput; | 303 | goto out_dput; |
| 304 | } | 304 | } |
| 305 | 305 | ||
| 306 | error = xfs_readlink(XFS_I(dentry->d_inode), link); | 306 | error = xfs_readlink(XFS_I(d_inode(dentry)), link); |
| 307 | if (error) | 307 | if (error) |
| 308 | goto out_kfree; | 308 | goto out_kfree; |
| 309 | error = readlink_copy(hreq->ohandle, olen, link); | 309 | error = readlink_copy(hreq->ohandle, olen, link); |
| @@ -376,7 +376,7 @@ xfs_fssetdm_by_handle( | |||
| 376 | return PTR_ERR(dentry); | 376 | return PTR_ERR(dentry); |
| 377 | } | 377 | } |
| 378 | 378 | ||
| 379 | if (IS_IMMUTABLE(dentry->d_inode) || IS_APPEND(dentry->d_inode)) { | 379 | if (IS_IMMUTABLE(d_inode(dentry)) || IS_APPEND(d_inode(dentry))) { |
| 380 | error = -EPERM; | 380 | error = -EPERM; |
| 381 | goto out; | 381 | goto out; |
| 382 | } | 382 | } |
| @@ -386,7 +386,7 @@ xfs_fssetdm_by_handle( | |||
| 386 | goto out; | 386 | goto out; |
| 387 | } | 387 | } |
| 388 | 388 | ||
| 389 | error = xfs_set_dmattrs(XFS_I(dentry->d_inode), fsd.fsd_dmevmask, | 389 | error = xfs_set_dmattrs(XFS_I(d_inode(dentry)), fsd.fsd_dmevmask, |
| 390 | fsd.fsd_dmstate); | 390 | fsd.fsd_dmstate); |
| 391 | 391 | ||
| 392 | out: | 392 | out: |
| @@ -429,7 +429,7 @@ xfs_attrlist_by_handle( | |||
| 429 | goto out_dput; | 429 | goto out_dput; |
| 430 | 430 | ||
| 431 | cursor = (attrlist_cursor_kern_t *)&al_hreq.pos; | 431 | cursor = (attrlist_cursor_kern_t *)&al_hreq.pos; |
| 432 | error = xfs_attr_list(XFS_I(dentry->d_inode), kbuf, al_hreq.buflen, | 432 | error = xfs_attr_list(XFS_I(d_inode(dentry)), kbuf, al_hreq.buflen, |
| 433 | al_hreq.flags, cursor); | 433 | al_hreq.flags, cursor); |
| 434 | if (error) | 434 | if (error) |
| 435 | goto out_kfree; | 435 | goto out_kfree; |
| @@ -559,7 +559,7 @@ xfs_attrmulti_by_handle( | |||
| 559 | switch (ops[i].am_opcode) { | 559 | switch (ops[i].am_opcode) { |
| 560 | case ATTR_OP_GET: | 560 | case ATTR_OP_GET: |
| 561 | ops[i].am_error = xfs_attrmulti_attr_get( | 561 | ops[i].am_error = xfs_attrmulti_attr_get( |
| 562 | dentry->d_inode, attr_name, | 562 | d_inode(dentry), attr_name, |
| 563 | ops[i].am_attrvalue, &ops[i].am_length, | 563 | ops[i].am_attrvalue, &ops[i].am_length, |
| 564 | ops[i].am_flags); | 564 | ops[i].am_flags); |
| 565 | break; | 565 | break; |
| @@ -568,7 +568,7 @@ xfs_attrmulti_by_handle( | |||
| 568 | if (ops[i].am_error) | 568 | if (ops[i].am_error) |
| 569 | break; | 569 | break; |
| 570 | ops[i].am_error = xfs_attrmulti_attr_set( | 570 | ops[i].am_error = xfs_attrmulti_attr_set( |
| 571 | dentry->d_inode, attr_name, | 571 | d_inode(dentry), attr_name, |
| 572 | ops[i].am_attrvalue, ops[i].am_length, | 572 | ops[i].am_attrvalue, ops[i].am_length, |
| 573 | ops[i].am_flags); | 573 | ops[i].am_flags); |
| 574 | mnt_drop_write_file(parfilp); | 574 | mnt_drop_write_file(parfilp); |
| @@ -578,7 +578,7 @@ xfs_attrmulti_by_handle( | |||
| 578 | if (ops[i].am_error) | 578 | if (ops[i].am_error) |
| 579 | break; | 579 | break; |
| 580 | ops[i].am_error = xfs_attrmulti_attr_remove( | 580 | ops[i].am_error = xfs_attrmulti_attr_remove( |
| 581 | dentry->d_inode, attr_name, | 581 | d_inode(dentry), attr_name, |
| 582 | ops[i].am_flags); | 582 | ops[i].am_flags); |
| 583 | mnt_drop_write_file(parfilp); | 583 | mnt_drop_write_file(parfilp); |
| 584 | break; | 584 | break; |
diff --git a/fs/xfs/xfs_ioctl32.c b/fs/xfs/xfs_ioctl32.c index bfc7c7c8a0c8..b88bdc85dd3d 100644 --- a/fs/xfs/xfs_ioctl32.c +++ b/fs/xfs/xfs_ioctl32.c | |||
| @@ -375,7 +375,7 @@ xfs_compat_attrlist_by_handle( | |||
| 375 | goto out_dput; | 375 | goto out_dput; |
| 376 | 376 | ||
| 377 | cursor = (attrlist_cursor_kern_t *)&al_hreq.pos; | 377 | cursor = (attrlist_cursor_kern_t *)&al_hreq.pos; |
| 378 | error = xfs_attr_list(XFS_I(dentry->d_inode), kbuf, al_hreq.buflen, | 378 | error = xfs_attr_list(XFS_I(d_inode(dentry)), kbuf, al_hreq.buflen, |
| 379 | al_hreq.flags, cursor); | 379 | al_hreq.flags, cursor); |
| 380 | if (error) | 380 | if (error) |
| 381 | goto out_kfree; | 381 | goto out_kfree; |
| @@ -445,7 +445,7 @@ xfs_compat_attrmulti_by_handle( | |||
| 445 | switch (ops[i].am_opcode) { | 445 | switch (ops[i].am_opcode) { |
| 446 | case ATTR_OP_GET: | 446 | case ATTR_OP_GET: |
| 447 | ops[i].am_error = xfs_attrmulti_attr_get( | 447 | ops[i].am_error = xfs_attrmulti_attr_get( |
| 448 | dentry->d_inode, attr_name, | 448 | d_inode(dentry), attr_name, |
| 449 | compat_ptr(ops[i].am_attrvalue), | 449 | compat_ptr(ops[i].am_attrvalue), |
| 450 | &ops[i].am_length, ops[i].am_flags); | 450 | &ops[i].am_length, ops[i].am_flags); |
| 451 | break; | 451 | break; |
| @@ -454,7 +454,7 @@ xfs_compat_attrmulti_by_handle( | |||
| 454 | if (ops[i].am_error) | 454 | if (ops[i].am_error) |
| 455 | break; | 455 | break; |
| 456 | ops[i].am_error = xfs_attrmulti_attr_set( | 456 | ops[i].am_error = xfs_attrmulti_attr_set( |
| 457 | dentry->d_inode, attr_name, | 457 | d_inode(dentry), attr_name, |
| 458 | compat_ptr(ops[i].am_attrvalue), | 458 | compat_ptr(ops[i].am_attrvalue), |
| 459 | ops[i].am_length, ops[i].am_flags); | 459 | ops[i].am_length, ops[i].am_flags); |
| 460 | mnt_drop_write_file(parfilp); | 460 | mnt_drop_write_file(parfilp); |
| @@ -464,7 +464,7 @@ xfs_compat_attrmulti_by_handle( | |||
| 464 | if (ops[i].am_error) | 464 | if (ops[i].am_error) |
| 465 | break; | 465 | break; |
| 466 | ops[i].am_error = xfs_attrmulti_attr_remove( | 466 | ops[i].am_error = xfs_attrmulti_attr_remove( |
| 467 | dentry->d_inode, attr_name, | 467 | d_inode(dentry), attr_name, |
| 468 | ops[i].am_flags); | 468 | ops[i].am_flags); |
| 469 | mnt_drop_write_file(parfilp); | 469 | mnt_drop_write_file(parfilp); |
| 470 | break; | 470 | break; |
| @@ -504,7 +504,7 @@ xfs_compat_fssetdm_by_handle( | |||
| 504 | if (IS_ERR(dentry)) | 504 | if (IS_ERR(dentry)) |
| 505 | return PTR_ERR(dentry); | 505 | return PTR_ERR(dentry); |
| 506 | 506 | ||
| 507 | if (IS_IMMUTABLE(dentry->d_inode) || IS_APPEND(dentry->d_inode)) { | 507 | if (IS_IMMUTABLE(d_inode(dentry)) || IS_APPEND(d_inode(dentry))) { |
| 508 | error = -EPERM; | 508 | error = -EPERM; |
| 509 | goto out; | 509 | goto out; |
| 510 | } | 510 | } |
| @@ -514,7 +514,7 @@ xfs_compat_fssetdm_by_handle( | |||
| 514 | goto out; | 514 | goto out; |
| 515 | } | 515 | } |
| 516 | 516 | ||
| 517 | error = xfs_set_dmattrs(XFS_I(dentry->d_inode), fsd.fsd_dmevmask, | 517 | error = xfs_set_dmattrs(XFS_I(d_inode(dentry)), fsd.fsd_dmevmask, |
| 518 | fsd.fsd_dmstate); | 518 | fsd.fsd_dmstate); |
| 519 | 519 | ||
| 520 | out: | 520 | out: |
diff --git a/fs/xfs/xfs_iops.c b/fs/xfs/xfs_iops.c index 2f1839e4dd1b..f4cd7204e236 100644 --- a/fs/xfs/xfs_iops.c +++ b/fs/xfs/xfs_iops.c | |||
| @@ -304,7 +304,7 @@ xfs_vn_link( | |||
| 304 | struct inode *dir, | 304 | struct inode *dir, |
| 305 | struct dentry *dentry) | 305 | struct dentry *dentry) |
| 306 | { | 306 | { |
| 307 | struct inode *inode = old_dentry->d_inode; | 307 | struct inode *inode = d_inode(old_dentry); |
| 308 | struct xfs_name name; | 308 | struct xfs_name name; |
| 309 | int error; | 309 | int error; |
| 310 | 310 | ||
| @@ -329,7 +329,7 @@ xfs_vn_unlink( | |||
| 329 | 329 | ||
| 330 | xfs_dentry_to_name(&name, dentry, 0); | 330 | xfs_dentry_to_name(&name, dentry, 0); |
| 331 | 331 | ||
| 332 | error = xfs_remove(XFS_I(dir), &name, XFS_I(dentry->d_inode)); | 332 | error = xfs_remove(XFS_I(dir), &name, XFS_I(d_inode(dentry))); |
| 333 | if (error) | 333 | if (error) |
| 334 | return error; | 334 | return error; |
| 335 | 335 | ||
| @@ -389,7 +389,7 @@ xfs_vn_rename( | |||
| 389 | struct dentry *ndentry, | 389 | struct dentry *ndentry, |
| 390 | unsigned int flags) | 390 | unsigned int flags) |
| 391 | { | 391 | { |
| 392 | struct inode *new_inode = ndentry->d_inode; | 392 | struct inode *new_inode = d_inode(ndentry); |
| 393 | int omode = 0; | 393 | int omode = 0; |
| 394 | struct xfs_name oname; | 394 | struct xfs_name oname; |
| 395 | struct xfs_name nname; | 395 | struct xfs_name nname; |
| @@ -399,12 +399,12 @@ xfs_vn_rename( | |||
| 399 | 399 | ||
| 400 | /* if we are exchanging files, we need to set i_mode of both files */ | 400 | /* if we are exchanging files, we need to set i_mode of both files */ |
| 401 | if (flags & RENAME_EXCHANGE) | 401 | if (flags & RENAME_EXCHANGE) |
| 402 | omode = ndentry->d_inode->i_mode; | 402 | omode = d_inode(ndentry)->i_mode; |
| 403 | 403 | ||
| 404 | xfs_dentry_to_name(&oname, odentry, omode); | 404 | xfs_dentry_to_name(&oname, odentry, omode); |
| 405 | xfs_dentry_to_name(&nname, ndentry, odentry->d_inode->i_mode); | 405 | xfs_dentry_to_name(&nname, ndentry, d_inode(odentry)->i_mode); |
| 406 | 406 | ||
| 407 | return xfs_rename(XFS_I(odir), &oname, XFS_I(odentry->d_inode), | 407 | return xfs_rename(XFS_I(odir), &oname, XFS_I(d_inode(odentry)), |
| 408 | XFS_I(ndir), &nname, | 408 | XFS_I(ndir), &nname, |
| 409 | new_inode ? XFS_I(new_inode) : NULL, flags); | 409 | new_inode ? XFS_I(new_inode) : NULL, flags); |
| 410 | } | 410 | } |
| @@ -426,7 +426,7 @@ xfs_vn_follow_link( | |||
| 426 | if (!link) | 426 | if (!link) |
| 427 | goto out_err; | 427 | goto out_err; |
| 428 | 428 | ||
| 429 | error = xfs_readlink(XFS_I(dentry->d_inode), link); | 429 | error = xfs_readlink(XFS_I(d_inode(dentry)), link); |
| 430 | if (unlikely(error)) | 430 | if (unlikely(error)) |
| 431 | goto out_kfree; | 431 | goto out_kfree; |
| 432 | 432 | ||
| @@ -446,7 +446,7 @@ xfs_vn_getattr( | |||
| 446 | struct dentry *dentry, | 446 | struct dentry *dentry, |
| 447 | struct kstat *stat) | 447 | struct kstat *stat) |
| 448 | { | 448 | { |
| 449 | struct inode *inode = dentry->d_inode; | 449 | struct inode *inode = d_inode(dentry); |
| 450 | struct xfs_inode *ip = XFS_I(inode); | 450 | struct xfs_inode *ip = XFS_I(inode); |
| 451 | struct xfs_mount *mp = ip->i_mount; | 451 | struct xfs_mount *mp = ip->i_mount; |
| 452 | 452 | ||
| @@ -946,14 +946,14 @@ xfs_vn_setattr( | |||
| 946 | struct dentry *dentry, | 946 | struct dentry *dentry, |
| 947 | struct iattr *iattr) | 947 | struct iattr *iattr) |
| 948 | { | 948 | { |
| 949 | struct xfs_inode *ip = XFS_I(dentry->d_inode); | 949 | struct xfs_inode *ip = XFS_I(d_inode(dentry)); |
| 950 | int error; | 950 | int error; |
| 951 | 951 | ||
| 952 | if (iattr->ia_valid & ATTR_SIZE) { | 952 | if (iattr->ia_valid & ATTR_SIZE) { |
| 953 | uint iolock = XFS_IOLOCK_EXCL; | 953 | uint iolock = XFS_IOLOCK_EXCL; |
| 954 | 954 | ||
| 955 | xfs_ilock(ip, iolock); | 955 | xfs_ilock(ip, iolock); |
| 956 | error = xfs_break_layouts(dentry->d_inode, &iolock, true); | 956 | error = xfs_break_layouts(d_inode(dentry), &iolock, true); |
| 957 | if (!error) { | 957 | if (!error) { |
| 958 | xfs_ilock(ip, XFS_MMAPLOCK_EXCL); | 958 | xfs_ilock(ip, XFS_MMAPLOCK_EXCL); |
| 959 | iolock |= XFS_MMAPLOCK_EXCL; | 959 | iolock |= XFS_MMAPLOCK_EXCL; |
diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c index 5f357ca97e76..858e1e62bbaa 100644 --- a/fs/xfs/xfs_super.c +++ b/fs/xfs/xfs_super.c | |||
| @@ -1048,7 +1048,7 @@ xfs_fs_statfs( | |||
| 1048 | { | 1048 | { |
| 1049 | struct xfs_mount *mp = XFS_M(dentry->d_sb); | 1049 | struct xfs_mount *mp = XFS_M(dentry->d_sb); |
| 1050 | xfs_sb_t *sbp = &mp->m_sb; | 1050 | xfs_sb_t *sbp = &mp->m_sb; |
| 1051 | struct xfs_inode *ip = XFS_I(dentry->d_inode); | 1051 | struct xfs_inode *ip = XFS_I(d_inode(dentry)); |
| 1052 | __uint64_t fakeinos, id; | 1052 | __uint64_t fakeinos, id; |
| 1053 | __uint64_t icount; | 1053 | __uint64_t icount; |
| 1054 | __uint64_t ifree; | 1054 | __uint64_t ifree; |
diff --git a/fs/xfs/xfs_xattr.c b/fs/xfs/xfs_xattr.c index 69f6e475de97..c036815183cb 100644 --- a/fs/xfs/xfs_xattr.c +++ b/fs/xfs/xfs_xattr.c | |||
| @@ -35,7 +35,7 @@ static int | |||
| 35 | xfs_xattr_get(struct dentry *dentry, const char *name, | 35 | xfs_xattr_get(struct dentry *dentry, const char *name, |
| 36 | void *value, size_t size, int xflags) | 36 | void *value, size_t size, int xflags) |
| 37 | { | 37 | { |
| 38 | struct xfs_inode *ip = XFS_I(dentry->d_inode); | 38 | struct xfs_inode *ip = XFS_I(d_inode(dentry)); |
| 39 | int error, asize = size; | 39 | int error, asize = size; |
| 40 | 40 | ||
| 41 | if (strcmp(name, "") == 0) | 41 | if (strcmp(name, "") == 0) |
| @@ -57,7 +57,7 @@ static int | |||
| 57 | xfs_xattr_set(struct dentry *dentry, const char *name, const void *value, | 57 | xfs_xattr_set(struct dentry *dentry, const char *name, const void *value, |
| 58 | size_t size, int flags, int xflags) | 58 | size_t size, int flags, int xflags) |
| 59 | { | 59 | { |
| 60 | struct xfs_inode *ip = XFS_I(dentry->d_inode); | 60 | struct xfs_inode *ip = XFS_I(d_inode(dentry)); |
| 61 | 61 | ||
| 62 | if (strcmp(name, "") == 0) | 62 | if (strcmp(name, "") == 0) |
| 63 | return -EINVAL; | 63 | return -EINVAL; |
| @@ -197,7 +197,7 @@ xfs_vn_listxattr(struct dentry *dentry, char *data, size_t size) | |||
| 197 | { | 197 | { |
| 198 | struct xfs_attr_list_context context; | 198 | struct xfs_attr_list_context context; |
| 199 | struct attrlist_cursor_kern cursor = { 0 }; | 199 | struct attrlist_cursor_kern cursor = { 0 }; |
| 200 | struct inode *inode = dentry->d_inode; | 200 | struct inode *inode = d_inode(dentry); |
| 201 | int error; | 201 | int error; |
| 202 | 202 | ||
| 203 | /* | 203 | /* |
diff --git a/include/linux/fs.h b/include/linux/fs.h index c7496f263860..35ec87e490b1 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
| @@ -1820,7 +1820,7 @@ struct super_operations { | |||
| 1820 | #define I_SYNC (1 << __I_SYNC) | 1820 | #define I_SYNC (1 << __I_SYNC) |
| 1821 | #define I_REFERENCED (1 << 8) | 1821 | #define I_REFERENCED (1 << 8) |
| 1822 | #define __I_DIO_WAKEUP 9 | 1822 | #define __I_DIO_WAKEUP 9 |
| 1823 | #define I_DIO_WAKEUP (1 << I_DIO_WAKEUP) | 1823 | #define I_DIO_WAKEUP (1 << __I_DIO_WAKEUP) |
| 1824 | #define I_LINKABLE (1 << 10) | 1824 | #define I_LINKABLE (1 << 10) |
| 1825 | #define I_DIRTY_TIME (1 << 11) | 1825 | #define I_DIRTY_TIME (1 << 11) |
| 1826 | #define __I_DIRTY_TIME_EXPIRED 12 | 1826 | #define __I_DIRTY_TIME_EXPIRED 12 |
| @@ -2644,6 +2644,9 @@ enum { | |||
| 2644 | 2644 | ||
| 2645 | /* filesystem can handle aio writes beyond i_size */ | 2645 | /* filesystem can handle aio writes beyond i_size */ |
| 2646 | DIO_ASYNC_EXTEND = 0x04, | 2646 | DIO_ASYNC_EXTEND = 0x04, |
| 2647 | |||
| 2648 | /* inode/fs/bdev does not need truncate protection */ | ||
| 2649 | DIO_SKIP_DIO_COUNT = 0x08, | ||
| 2647 | }; | 2650 | }; |
| 2648 | 2651 | ||
| 2649 | void dio_end_io(struct bio *bio, int error); | 2652 | void dio_end_io(struct bio *bio, int error); |
| @@ -2666,7 +2669,31 @@ static inline ssize_t blockdev_direct_IO(struct kiocb *iocb, | |||
| 2666 | #endif | 2669 | #endif |
| 2667 | 2670 | ||
| 2668 | void inode_dio_wait(struct inode *inode); | 2671 | void inode_dio_wait(struct inode *inode); |
| 2669 | void inode_dio_done(struct inode *inode); | 2672 | |
| 2673 | /* | ||
| 2674 | * inode_dio_begin - signal start of a direct I/O requests | ||
| 2675 | * @inode: inode the direct I/O happens on | ||
| 2676 | * | ||
| 2677 | * This is called once we've finished processing a direct I/O request, | ||
| 2678 | * and is used to wake up callers waiting for direct I/O to be quiesced. | ||
| 2679 | */ | ||
| 2680 | static inline void inode_dio_begin(struct inode *inode) | ||
| 2681 | { | ||
| 2682 | atomic_inc(&inode->i_dio_count); | ||
| 2683 | } | ||
| 2684 | |||
| 2685 | /* | ||
| 2686 | * inode_dio_end - signal finish of a direct I/O requests | ||
| 2687 | * @inode: inode the direct I/O happens on | ||
| 2688 | * | ||
| 2689 | * This is called once we've finished processing a direct I/O request, | ||
| 2690 | * and is used to wake up callers waiting for direct I/O to be quiesced. | ||
| 2691 | */ | ||
| 2692 | static inline void inode_dio_end(struct inode *inode) | ||
| 2693 | { | ||
| 2694 | if (atomic_dec_and_test(&inode->i_dio_count)) | ||
| 2695 | wake_up_bit(&inode->i_state, __I_DIO_WAKEUP); | ||
| 2696 | } | ||
| 2670 | 2697 | ||
| 2671 | extern void inode_set_flags(struct inode *inode, unsigned int flags, | 2698 | extern void inode_set_flags(struct inode *inode, unsigned int flags, |
| 2672 | unsigned int mask); | 2699 | unsigned int mask); |
diff --git a/include/linux/intel-iommu.h b/include/linux/intel-iommu.h index a65208a8fe18..796ef9645827 100644 --- a/include/linux/intel-iommu.h +++ b/include/linux/intel-iommu.h | |||
| @@ -115,10 +115,19 @@ static inline void dmar_writeq(void __iomem *addr, u64 val) | |||
| 115 | * Extended Capability Register | 115 | * Extended Capability Register |
| 116 | */ | 116 | */ |
| 117 | 117 | ||
| 118 | #define ecap_niotlb_iunits(e) ((((e) >> 24) & 0xff) + 1) | 118 | #define ecap_pss(e) ((e >> 35) & 0x1f) |
| 119 | #define ecap_eafs(e) ((e >> 34) & 0x1) | ||
| 120 | #define ecap_nwfs(e) ((e >> 33) & 0x1) | ||
| 121 | #define ecap_srs(e) ((e >> 31) & 0x1) | ||
| 122 | #define ecap_ers(e) ((e >> 30) & 0x1) | ||
| 123 | #define ecap_prs(e) ((e >> 29) & 0x1) | ||
| 124 | #define ecap_pasid(e) ((e >> 28) & 0x1) | ||
| 125 | #define ecap_dis(e) ((e >> 27) & 0x1) | ||
| 126 | #define ecap_nest(e) ((e >> 26) & 0x1) | ||
| 127 | #define ecap_mts(e) ((e >> 25) & 0x1) | ||
| 128 | #define ecap_ecs(e) ((e >> 24) & 0x1) | ||
| 119 | #define ecap_iotlb_offset(e) ((((e) >> 8) & 0x3ff) * 16) | 129 | #define ecap_iotlb_offset(e) ((((e) >> 8) & 0x3ff) * 16) |
| 120 | #define ecap_max_iotlb_offset(e) \ | 130 | #define ecap_max_iotlb_offset(e) (ecap_iotlb_offset(e) + 16) |
| 121 | (ecap_iotlb_offset(e) + ecap_niotlb_iunits(e) * 16) | ||
| 122 | #define ecap_coherent(e) ((e) & 0x1) | 131 | #define ecap_coherent(e) ((e) & 0x1) |
| 123 | #define ecap_qis(e) ((e) & 0x2) | 132 | #define ecap_qis(e) ((e) & 0x2) |
| 124 | #define ecap_pass_through(e) ((e >> 6) & 0x1) | 133 | #define ecap_pass_through(e) ((e >> 6) & 0x1) |
| @@ -180,6 +189,9 @@ static inline void dmar_writeq(void __iomem *addr, u64 val) | |||
| 180 | #define DMA_GSTS_IRES (((u32)1) << 25) | 189 | #define DMA_GSTS_IRES (((u32)1) << 25) |
| 181 | #define DMA_GSTS_CFIS (((u32)1) << 23) | 190 | #define DMA_GSTS_CFIS (((u32)1) << 23) |
| 182 | 191 | ||
| 192 | /* DMA_RTADDR_REG */ | ||
| 193 | #define DMA_RTADDR_RTT (((u64)1) << 11) | ||
| 194 | |||
| 183 | /* CCMD_REG */ | 195 | /* CCMD_REG */ |
| 184 | #define DMA_CCMD_ICC (((u64)1) << 63) | 196 | #define DMA_CCMD_ICC (((u64)1) << 63) |
| 185 | #define DMA_CCMD_GLOBAL_INVL (((u64)1) << 61) | 197 | #define DMA_CCMD_GLOBAL_INVL (((u64)1) << 61) |
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h index 410abd172feb..b95f914ce083 100644 --- a/include/linux/nfs_fs.h +++ b/include/linux/nfs_fs.h | |||
| @@ -511,6 +511,7 @@ extern int nfs_updatepage(struct file *, struct page *, unsigned int, unsigned | |||
| 511 | * Try to write back everything synchronously (but check the | 511 | * Try to write back everything synchronously (but check the |
| 512 | * return value!) | 512 | * return value!) |
| 513 | */ | 513 | */ |
| 514 | extern int nfs_sync_inode(struct inode *inode); | ||
| 514 | extern int nfs_wb_all(struct inode *inode); | 515 | extern int nfs_wb_all(struct inode *inode); |
| 515 | extern int nfs_wb_page(struct inode *inode, struct page* page); | 516 | extern int nfs_wb_page(struct inode *inode, struct page* page); |
| 516 | extern int nfs_wb_page_cancel(struct inode *inode, struct page* page); | 517 | extern int nfs_wb_page_cancel(struct inode *inode, struct page* page); |
diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h index 4cb3eaa89cf7..93ab6071bbe9 100644 --- a/include/linux/nfs_xdr.h +++ b/include/linux/nfs_xdr.h | |||
| @@ -255,11 +255,13 @@ struct nfs4_layoutget { | |||
| 255 | struct nfs4_getdeviceinfo_args { | 255 | struct nfs4_getdeviceinfo_args { |
| 256 | struct nfs4_sequence_args seq_args; | 256 | struct nfs4_sequence_args seq_args; |
| 257 | struct pnfs_device *pdev; | 257 | struct pnfs_device *pdev; |
| 258 | __u32 notify_types; | ||
| 258 | }; | 259 | }; |
| 259 | 260 | ||
| 260 | struct nfs4_getdeviceinfo_res { | 261 | struct nfs4_getdeviceinfo_res { |
| 261 | struct nfs4_sequence_res seq_res; | 262 | struct nfs4_sequence_res seq_res; |
| 262 | struct pnfs_device *pdev; | 263 | struct pnfs_device *pdev; |
| 264 | __u32 notification; | ||
| 263 | }; | 265 | }; |
| 264 | 266 | ||
| 265 | struct nfs4_layoutcommit_args { | 267 | struct nfs4_layoutcommit_args { |
| @@ -1271,11 +1273,15 @@ struct nfs42_falloc_args { | |||
| 1271 | nfs4_stateid falloc_stateid; | 1273 | nfs4_stateid falloc_stateid; |
| 1272 | u64 falloc_offset; | 1274 | u64 falloc_offset; |
| 1273 | u64 falloc_length; | 1275 | u64 falloc_length; |
| 1276 | const u32 *falloc_bitmask; | ||
| 1274 | }; | 1277 | }; |
| 1275 | 1278 | ||
| 1276 | struct nfs42_falloc_res { | 1279 | struct nfs42_falloc_res { |
| 1277 | struct nfs4_sequence_res seq_res; | 1280 | struct nfs4_sequence_res seq_res; |
| 1278 | unsigned int status; | 1281 | unsigned int status; |
| 1282 | |||
| 1283 | struct nfs_fattr *falloc_fattr; | ||
| 1284 | const struct nfs_server *falloc_server; | ||
| 1279 | }; | 1285 | }; |
| 1280 | 1286 | ||
| 1281 | struct nfs42_seek_args { | 1287 | struct nfs42_seek_args { |
diff --git a/include/linux/sunrpc/msg_prot.h b/include/linux/sunrpc/msg_prot.h index aadc6a04e1ac..807371357160 100644 --- a/include/linux/sunrpc/msg_prot.h +++ b/include/linux/sunrpc/msg_prot.h | |||
| @@ -142,12 +142,18 @@ typedef __be32 rpc_fraghdr; | |||
| 142 | (RPC_REPHDRSIZE + (2 + RPC_MAX_AUTH_SIZE/4)) | 142 | (RPC_REPHDRSIZE + (2 + RPC_MAX_AUTH_SIZE/4)) |
| 143 | 143 | ||
| 144 | /* | 144 | /* |
| 145 | * RFC1833/RFC3530 rpcbind (v3+) well-known netid's. | 145 | * Well-known netids. See: |
| 146 | * | ||
| 147 | * http://www.iana.org/assignments/rpc-netids/rpc-netids.xhtml | ||
| 146 | */ | 148 | */ |
| 147 | #define RPCBIND_NETID_UDP "udp" | 149 | #define RPCBIND_NETID_UDP "udp" |
| 148 | #define RPCBIND_NETID_TCP "tcp" | 150 | #define RPCBIND_NETID_TCP "tcp" |
| 151 | #define RPCBIND_NETID_RDMA "rdma" | ||
| 152 | #define RPCBIND_NETID_SCTP "sctp" | ||
| 149 | #define RPCBIND_NETID_UDP6 "udp6" | 153 | #define RPCBIND_NETID_UDP6 "udp6" |
| 150 | #define RPCBIND_NETID_TCP6 "tcp6" | 154 | #define RPCBIND_NETID_TCP6 "tcp6" |
| 155 | #define RPCBIND_NETID_RDMA6 "rdma6" | ||
| 156 | #define RPCBIND_NETID_SCTP6 "sctp6" | ||
| 151 | #define RPCBIND_NETID_LOCAL "local" | 157 | #define RPCBIND_NETID_LOCAL "local" |
| 152 | 158 | ||
| 153 | /* | 159 | /* |
diff --git a/include/linux/sunrpc/xprtrdma.h b/include/linux/sunrpc/xprtrdma.h index 64a0a0a97b23..c984c85981ea 100644 --- a/include/linux/sunrpc/xprtrdma.h +++ b/include/linux/sunrpc/xprtrdma.h | |||
| @@ -41,11 +41,6 @@ | |||
| 41 | #define _LINUX_SUNRPC_XPRTRDMA_H | 41 | #define _LINUX_SUNRPC_XPRTRDMA_H |
| 42 | 42 | ||
| 43 | /* | 43 | /* |
| 44 | * rpcbind (v3+) RDMA netid. | ||
| 45 | */ | ||
| 46 | #define RPCBIND_NETID_RDMA "rdma" | ||
| 47 | |||
| 48 | /* | ||
| 49 | * Constants. Max RPC/NFS header is big enough to account for | 44 | * Constants. Max RPC/NFS header is big enough to account for |
| 50 | * additional marshaling buffers passed down by Linux client. | 45 | * additional marshaling buffers passed down by Linux client. |
| 51 | * | 46 | * |
diff --git a/include/trace/events/btrfs.h b/include/trace/events/btrfs.h index 572e6503394a..7f79cf459591 100644 --- a/include/trace/events/btrfs.h +++ b/include/trace/events/btrfs.h | |||
| @@ -407,10 +407,10 @@ TRACE_EVENT(btrfs_sync_file, | |||
| 407 | 407 | ||
| 408 | TP_fast_assign( | 408 | TP_fast_assign( |
| 409 | struct dentry *dentry = file->f_path.dentry; | 409 | struct dentry *dentry = file->f_path.dentry; |
| 410 | struct inode *inode = dentry->d_inode; | 410 | struct inode *inode = d_inode(dentry); |
| 411 | 411 | ||
| 412 | __entry->ino = inode->i_ino; | 412 | __entry->ino = inode->i_ino; |
| 413 | __entry->parent = dentry->d_parent->d_inode->i_ino; | 413 | __entry->parent = d_inode(dentry->d_parent)->i_ino; |
| 414 | __entry->datasync = datasync; | 414 | __entry->datasync = datasync; |
| 415 | __entry->root_objectid = | 415 | __entry->root_objectid = |
| 416 | BTRFS_I(inode)->root->root_key.objectid; | 416 | BTRFS_I(inode)->root->root_key.objectid; |
diff --git a/include/trace/events/ext3.h b/include/trace/events/ext3.h index 7f20707849bb..fc733d28117a 100644 --- a/include/trace/events/ext3.h +++ b/include/trace/events/ext3.h | |||
| @@ -439,10 +439,10 @@ TRACE_EVENT(ext3_sync_file_enter, | |||
| 439 | TP_fast_assign( | 439 | TP_fast_assign( |
| 440 | struct dentry *dentry = file->f_path.dentry; | 440 | struct dentry *dentry = file->f_path.dentry; |
| 441 | 441 | ||
| 442 | __entry->dev = dentry->d_inode->i_sb->s_dev; | 442 | __entry->dev = d_inode(dentry)->i_sb->s_dev; |
| 443 | __entry->ino = dentry->d_inode->i_ino; | 443 | __entry->ino = d_inode(dentry)->i_ino; |
| 444 | __entry->datasync = datasync; | 444 | __entry->datasync = datasync; |
| 445 | __entry->parent = dentry->d_parent->d_inode->i_ino; | 445 | __entry->parent = d_inode(dentry->d_parent)->i_ino; |
| 446 | ), | 446 | ), |
| 447 | 447 | ||
| 448 | TP_printk("dev %d,%d ino %lu parent %ld datasync %d ", | 448 | TP_printk("dev %d,%d ino %lu parent %ld datasync %d ", |
| @@ -710,9 +710,9 @@ TRACE_EVENT(ext3_unlink_enter, | |||
| 710 | 710 | ||
| 711 | TP_fast_assign( | 711 | TP_fast_assign( |
| 712 | __entry->parent = parent->i_ino; | 712 | __entry->parent = parent->i_ino; |
| 713 | __entry->ino = dentry->d_inode->i_ino; | 713 | __entry->ino = d_inode(dentry)->i_ino; |
| 714 | __entry->size = dentry->d_inode->i_size; | 714 | __entry->size = d_inode(dentry)->i_size; |
| 715 | __entry->dev = dentry->d_inode->i_sb->s_dev; | 715 | __entry->dev = d_inode(dentry)->i_sb->s_dev; |
| 716 | ), | 716 | ), |
| 717 | 717 | ||
| 718 | TP_printk("dev %d,%d ino %lu size %lld parent %ld", | 718 | TP_printk("dev %d,%d ino %lu size %lld parent %ld", |
| @@ -734,8 +734,8 @@ TRACE_EVENT(ext3_unlink_exit, | |||
| 734 | ), | 734 | ), |
| 735 | 735 | ||
| 736 | TP_fast_assign( | 736 | TP_fast_assign( |
| 737 | __entry->ino = dentry->d_inode->i_ino; | 737 | __entry->ino = d_inode(dentry)->i_ino; |
| 738 | __entry->dev = dentry->d_inode->i_sb->s_dev; | 738 | __entry->dev = d_inode(dentry)->i_sb->s_dev; |
| 739 | __entry->ret = ret; | 739 | __entry->ret = ret; |
| 740 | ), | 740 | ), |
| 741 | 741 | ||
diff --git a/include/trace/events/ext4.h b/include/trace/events/ext4.h index 47fca36ee426..08ec3dd27630 100644 --- a/include/trace/events/ext4.h +++ b/include/trace/events/ext4.h | |||
| @@ -872,10 +872,10 @@ TRACE_EVENT(ext4_sync_file_enter, | |||
| 872 | TP_fast_assign( | 872 | TP_fast_assign( |
| 873 | struct dentry *dentry = file->f_path.dentry; | 873 | struct dentry *dentry = file->f_path.dentry; |
| 874 | 874 | ||
| 875 | __entry->dev = dentry->d_inode->i_sb->s_dev; | 875 | __entry->dev = d_inode(dentry)->i_sb->s_dev; |
| 876 | __entry->ino = dentry->d_inode->i_ino; | 876 | __entry->ino = d_inode(dentry)->i_ino; |
| 877 | __entry->datasync = datasync; | 877 | __entry->datasync = datasync; |
| 878 | __entry->parent = dentry->d_parent->d_inode->i_ino; | 878 | __entry->parent = d_inode(dentry->d_parent)->i_ino; |
| 879 | ), | 879 | ), |
| 880 | 880 | ||
| 881 | TP_printk("dev %d,%d ino %lu parent %lu datasync %d ", | 881 | TP_printk("dev %d,%d ino %lu parent %lu datasync %d ", |
| @@ -1453,10 +1453,10 @@ TRACE_EVENT(ext4_unlink_enter, | |||
| 1453 | ), | 1453 | ), |
| 1454 | 1454 | ||
| 1455 | TP_fast_assign( | 1455 | TP_fast_assign( |
| 1456 | __entry->dev = dentry->d_inode->i_sb->s_dev; | 1456 | __entry->dev = d_inode(dentry)->i_sb->s_dev; |
| 1457 | __entry->ino = dentry->d_inode->i_ino; | 1457 | __entry->ino = d_inode(dentry)->i_ino; |
| 1458 | __entry->parent = parent->i_ino; | 1458 | __entry->parent = parent->i_ino; |
| 1459 | __entry->size = dentry->d_inode->i_size; | 1459 | __entry->size = d_inode(dentry)->i_size; |
| 1460 | ), | 1460 | ), |
| 1461 | 1461 | ||
| 1462 | TP_printk("dev %d,%d ino %lu size %lld parent %lu", | 1462 | TP_printk("dev %d,%d ino %lu size %lld parent %lu", |
| @@ -1477,8 +1477,8 @@ TRACE_EVENT(ext4_unlink_exit, | |||
| 1477 | ), | 1477 | ), |
| 1478 | 1478 | ||
| 1479 | TP_fast_assign( | 1479 | TP_fast_assign( |
| 1480 | __entry->dev = dentry->d_inode->i_sb->s_dev; | 1480 | __entry->dev = d_inode(dentry)->i_sb->s_dev; |
| 1481 | __entry->ino = dentry->d_inode->i_ino; | 1481 | __entry->ino = d_inode(dentry)->i_ino; |
| 1482 | __entry->ret = ret; | 1482 | __entry->ret = ret; |
| 1483 | ), | 1483 | ), |
| 1484 | 1484 | ||
diff --git a/include/uapi/linux/nfs_idmap.h b/include/uapi/linux/nfs_idmap.h index 8d4b1c7b24d4..038e36c96669 100644 --- a/include/uapi/linux/nfs_idmap.h +++ b/include/uapi/linux/nfs_idmap.h | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * include/linux/nfs_idmap.h | 2 | * include/uapi/linux/nfs_idmap.h |
| 3 | * | 3 | * |
| 4 | * UID and GID to name mapping for clients. | 4 | * UID and GID to name mapping for clients. |
| 5 | * | 5 | * |
diff --git a/ipc/mqueue.c b/ipc/mqueue.c index 7635a1cf99f3..3aaea7ffd077 100644 --- a/ipc/mqueue.c +++ b/ipc/mqueue.c | |||
| @@ -466,7 +466,7 @@ out_unlock: | |||
| 466 | 466 | ||
| 467 | static int mqueue_unlink(struct inode *dir, struct dentry *dentry) | 467 | static int mqueue_unlink(struct inode *dir, struct dentry *dentry) |
| 468 | { | 468 | { |
| 469 | struct inode *inode = dentry->d_inode; | 469 | struct inode *inode = d_inode(dentry); |
| 470 | 470 | ||
| 471 | dir->i_ctime = dir->i_mtime = dir->i_atime = CURRENT_TIME; | 471 | dir->i_ctime = dir->i_mtime = dir->i_atime = CURRENT_TIME; |
| 472 | dir->i_size -= DIRENT_SIZE; | 472 | dir->i_size -= DIRENT_SIZE; |
| @@ -770,7 +770,7 @@ static struct file *do_open(struct path *path, int oflag) | |||
| 770 | if ((oflag & O_ACCMODE) == (O_RDWR | O_WRONLY)) | 770 | if ((oflag & O_ACCMODE) == (O_RDWR | O_WRONLY)) |
| 771 | return ERR_PTR(-EINVAL); | 771 | return ERR_PTR(-EINVAL); |
| 772 | acc = oflag2acc[oflag & O_ACCMODE]; | 772 | acc = oflag2acc[oflag & O_ACCMODE]; |
| 773 | if (inode_permission(path->dentry->d_inode, acc)) | 773 | if (inode_permission(d_inode(path->dentry), acc)) |
| 774 | return ERR_PTR(-EACCES); | 774 | return ERR_PTR(-EACCES); |
| 775 | return dentry_open(path, oflag, current_cred()); | 775 | return dentry_open(path, oflag, current_cred()); |
| 776 | } | 776 | } |
| @@ -802,7 +802,7 @@ SYSCALL_DEFINE4(mq_open, const char __user *, u_name, int, oflag, umode_t, mode, | |||
| 802 | 802 | ||
| 803 | ro = mnt_want_write(mnt); /* we'll drop it in any case */ | 803 | ro = mnt_want_write(mnt); /* we'll drop it in any case */ |
| 804 | error = 0; | 804 | error = 0; |
| 805 | mutex_lock(&root->d_inode->i_mutex); | 805 | mutex_lock(&d_inode(root)->i_mutex); |
| 806 | path.dentry = lookup_one_len(name->name, root, strlen(name->name)); | 806 | path.dentry = lookup_one_len(name->name, root, strlen(name->name)); |
| 807 | if (IS_ERR(path.dentry)) { | 807 | if (IS_ERR(path.dentry)) { |
| 808 | error = PTR_ERR(path.dentry); | 808 | error = PTR_ERR(path.dentry); |
| @@ -811,7 +811,7 @@ SYSCALL_DEFINE4(mq_open, const char __user *, u_name, int, oflag, umode_t, mode, | |||
| 811 | path.mnt = mntget(mnt); | 811 | path.mnt = mntget(mnt); |
| 812 | 812 | ||
| 813 | if (oflag & O_CREAT) { | 813 | if (oflag & O_CREAT) { |
| 814 | if (path.dentry->d_inode) { /* entry already exists */ | 814 | if (d_really_is_positive(path.dentry)) { /* entry already exists */ |
| 815 | audit_inode(name, path.dentry, 0); | 815 | audit_inode(name, path.dentry, 0); |
| 816 | if (oflag & O_EXCL) { | 816 | if (oflag & O_EXCL) { |
| 817 | error = -EEXIST; | 817 | error = -EEXIST; |
| @@ -824,12 +824,12 @@ SYSCALL_DEFINE4(mq_open, const char __user *, u_name, int, oflag, umode_t, mode, | |||
| 824 | goto out; | 824 | goto out; |
| 825 | } | 825 | } |
| 826 | audit_inode_parent_hidden(name, root); | 826 | audit_inode_parent_hidden(name, root); |
| 827 | filp = do_create(ipc_ns, root->d_inode, | 827 | filp = do_create(ipc_ns, d_inode(root), |
| 828 | &path, oflag, mode, | 828 | &path, oflag, mode, |
| 829 | u_attr ? &attr : NULL); | 829 | u_attr ? &attr : NULL); |
| 830 | } | 830 | } |
| 831 | } else { | 831 | } else { |
| 832 | if (!path.dentry->d_inode) { | 832 | if (d_really_is_negative(path.dentry)) { |
| 833 | error = -ENOENT; | 833 | error = -ENOENT; |
| 834 | goto out; | 834 | goto out; |
| 835 | } | 835 | } |
| @@ -848,7 +848,7 @@ out_putfd: | |||
| 848 | put_unused_fd(fd); | 848 | put_unused_fd(fd); |
| 849 | fd = error; | 849 | fd = error; |
| 850 | } | 850 | } |
| 851 | mutex_unlock(&root->d_inode->i_mutex); | 851 | mutex_unlock(&d_inode(root)->i_mutex); |
| 852 | if (!ro) | 852 | if (!ro) |
| 853 | mnt_drop_write(mnt); | 853 | mnt_drop_write(mnt); |
| 854 | out_putname: | 854 | out_putname: |
| @@ -873,7 +873,7 @@ SYSCALL_DEFINE1(mq_unlink, const char __user *, u_name) | |||
| 873 | err = mnt_want_write(mnt); | 873 | err = mnt_want_write(mnt); |
| 874 | if (err) | 874 | if (err) |
| 875 | goto out_name; | 875 | goto out_name; |
| 876 | mutex_lock_nested(&mnt->mnt_root->d_inode->i_mutex, I_MUTEX_PARENT); | 876 | mutex_lock_nested(&d_inode(mnt->mnt_root)->i_mutex, I_MUTEX_PARENT); |
| 877 | dentry = lookup_one_len(name->name, mnt->mnt_root, | 877 | dentry = lookup_one_len(name->name, mnt->mnt_root, |
| 878 | strlen(name->name)); | 878 | strlen(name->name)); |
| 879 | if (IS_ERR(dentry)) { | 879 | if (IS_ERR(dentry)) { |
| @@ -881,17 +881,17 @@ SYSCALL_DEFINE1(mq_unlink, const char __user *, u_name) | |||
| 881 | goto out_unlock; | 881 | goto out_unlock; |
| 882 | } | 882 | } |
| 883 | 883 | ||
| 884 | inode = dentry->d_inode; | 884 | inode = d_inode(dentry); |
| 885 | if (!inode) { | 885 | if (!inode) { |
| 886 | err = -ENOENT; | 886 | err = -ENOENT; |
| 887 | } else { | 887 | } else { |
| 888 | ihold(inode); | 888 | ihold(inode); |
| 889 | err = vfs_unlink(dentry->d_parent->d_inode, dentry, NULL); | 889 | err = vfs_unlink(d_inode(dentry->d_parent), dentry, NULL); |
| 890 | } | 890 | } |
| 891 | dput(dentry); | 891 | dput(dentry); |
| 892 | 892 | ||
| 893 | out_unlock: | 893 | out_unlock: |
| 894 | mutex_unlock(&mnt->mnt_root->d_inode->i_mutex); | 894 | mutex_unlock(&d_inode(mnt->mnt_root)->i_mutex); |
| 895 | if (inode) | 895 | if (inode) |
| 896 | iput(inode); | 896 | iput(inode); |
| 897 | mnt_drop_write(mnt); | 897 | mnt_drop_write(mnt); |
| @@ -1132,7 +1132,7 @@ long do_shmat(int shmid, char __user *shmaddr, int shmflg, ulong *raddr, | |||
| 1132 | path = shp->shm_file->f_path; | 1132 | path = shp->shm_file->f_path; |
| 1133 | path_get(&path); | 1133 | path_get(&path); |
| 1134 | shp->shm_nattch++; | 1134 | shp->shm_nattch++; |
| 1135 | size = i_size_read(path.dentry->d_inode); | 1135 | size = i_size_read(d_inode(path.dentry)); |
| 1136 | ipc_unlock_object(&shp->shm_perm); | 1136 | ipc_unlock_object(&shp->shm_perm); |
| 1137 | rcu_read_unlock(); | 1137 | rcu_read_unlock(); |
| 1138 | 1138 | ||
diff --git a/kernel/audit.c b/kernel/audit.c index ab5745ddf962..1c13e4267de6 100644 --- a/kernel/audit.c +++ b/kernel/audit.c | |||
| @@ -1928,7 +1928,7 @@ void audit_log_link_denied(const char *operation, struct path *link) | |||
| 1928 | 1928 | ||
| 1929 | /* Generate AUDIT_PATH record with object. */ | 1929 | /* Generate AUDIT_PATH record with object. */ |
| 1930 | name->type = AUDIT_TYPE_NORMAL; | 1930 | name->type = AUDIT_TYPE_NORMAL; |
| 1931 | audit_copy_inode(name, link->dentry, link->dentry->d_inode); | 1931 | audit_copy_inode(name, link->dentry, d_backing_inode(link->dentry)); |
| 1932 | audit_log_name(current->audit_context, name, link, 0, NULL); | 1932 | audit_log_name(current->audit_context, name, link, 0, NULL); |
| 1933 | out: | 1933 | out: |
| 1934 | kfree(name); | 1934 | kfree(name); |
diff --git a/kernel/audit_tree.c b/kernel/audit_tree.c index 71fd1f289885..b0f9877273fc 100644 --- a/kernel/audit_tree.c +++ b/kernel/audit_tree.c | |||
| @@ -577,7 +577,7 @@ int audit_remove_tree_rule(struct audit_krule *rule) | |||
| 577 | 577 | ||
| 578 | static int compare_root(struct vfsmount *mnt, void *arg) | 578 | static int compare_root(struct vfsmount *mnt, void *arg) |
| 579 | { | 579 | { |
| 580 | return mnt->mnt_root->d_inode == arg; | 580 | return d_backing_inode(mnt->mnt_root) == arg; |
| 581 | } | 581 | } |
| 582 | 582 | ||
| 583 | void audit_trim_trees(void) | 583 | void audit_trim_trees(void) |
| @@ -649,7 +649,7 @@ void audit_put_tree(struct audit_tree *tree) | |||
| 649 | 649 | ||
| 650 | static int tag_mount(struct vfsmount *mnt, void *arg) | 650 | static int tag_mount(struct vfsmount *mnt, void *arg) |
| 651 | { | 651 | { |
| 652 | return tag_chunk(mnt->mnt_root->d_inode, arg); | 652 | return tag_chunk(d_backing_inode(mnt->mnt_root), arg); |
| 653 | } | 653 | } |
| 654 | 654 | ||
| 655 | /* | 655 | /* |
diff --git a/kernel/audit_watch.c b/kernel/audit_watch.c index ad9c1682f616..6e30024d9aac 100644 --- a/kernel/audit_watch.c +++ b/kernel/audit_watch.c | |||
| @@ -146,7 +146,7 @@ int audit_watch_compare(struct audit_watch *watch, unsigned long ino, dev_t dev) | |||
| 146 | /* Initialize a parent watch entry. */ | 146 | /* Initialize a parent watch entry. */ |
| 147 | static struct audit_parent *audit_init_parent(struct path *path) | 147 | static struct audit_parent *audit_init_parent(struct path *path) |
| 148 | { | 148 | { |
| 149 | struct inode *inode = path->dentry->d_inode; | 149 | struct inode *inode = d_backing_inode(path->dentry); |
| 150 | struct audit_parent *parent; | 150 | struct audit_parent *parent; |
| 151 | int ret; | 151 | int ret; |
| 152 | 152 | ||
| @@ -361,11 +361,11 @@ static int audit_get_nd(struct audit_watch *watch, struct path *parent) | |||
| 361 | struct dentry *d = kern_path_locked(watch->path, parent); | 361 | struct dentry *d = kern_path_locked(watch->path, parent); |
| 362 | if (IS_ERR(d)) | 362 | if (IS_ERR(d)) |
| 363 | return PTR_ERR(d); | 363 | return PTR_ERR(d); |
| 364 | mutex_unlock(&parent->dentry->d_inode->i_mutex); | 364 | mutex_unlock(&d_backing_inode(parent->dentry)->i_mutex); |
| 365 | if (d->d_inode) { | 365 | if (d_is_positive(d)) { |
| 366 | /* update watch filter fields */ | 366 | /* update watch filter fields */ |
| 367 | watch->dev = d->d_inode->i_sb->s_dev; | 367 | watch->dev = d_backing_inode(d)->i_sb->s_dev; |
| 368 | watch->ino = d->d_inode->i_ino; | 368 | watch->ino = d_backing_inode(d)->i_ino; |
| 369 | } | 369 | } |
| 370 | dput(d); | 370 | dput(d); |
| 371 | return 0; | 371 | return 0; |
| @@ -426,7 +426,7 @@ int audit_add_watch(struct audit_krule *krule, struct list_head **list) | |||
| 426 | return ret; | 426 | return ret; |
| 427 | 427 | ||
| 428 | /* either find an old parent or attach a new one */ | 428 | /* either find an old parent or attach a new one */ |
| 429 | parent = audit_find_parent(parent_path.dentry->d_inode); | 429 | parent = audit_find_parent(d_backing_inode(parent_path.dentry)); |
| 430 | if (!parent) { | 430 | if (!parent) { |
| 431 | parent = audit_init_parent(&parent_path); | 431 | parent = audit_init_parent(&parent_path); |
| 432 | if (IS_ERR(parent)) { | 432 | if (IS_ERR(parent)) { |
| @@ -482,7 +482,7 @@ static int audit_watch_handle_event(struct fsnotify_group *group, | |||
| 482 | 482 | ||
| 483 | switch (data_type) { | 483 | switch (data_type) { |
| 484 | case (FSNOTIFY_EVENT_PATH): | 484 | case (FSNOTIFY_EVENT_PATH): |
| 485 | inode = ((struct path *)data)->dentry->d_inode; | 485 | inode = d_backing_inode(((struct path *)data)->dentry); |
| 486 | break; | 486 | break; |
| 487 | case (FSNOTIFY_EVENT_INODE): | 487 | case (FSNOTIFY_EVENT_INODE): |
| 488 | inode = (struct inode *)data; | 488 | inode = (struct inode *)data; |
diff --git a/kernel/auditsc.c b/kernel/auditsc.c index 84c74d08c62b..9fb9d1cb83ce 100644 --- a/kernel/auditsc.c +++ b/kernel/auditsc.c | |||
| @@ -1629,7 +1629,7 @@ retry: | |||
| 1629 | rcu_read_lock(); | 1629 | rcu_read_lock(); |
| 1630 | seq = read_seqbegin(&rename_lock); | 1630 | seq = read_seqbegin(&rename_lock); |
| 1631 | for(;;) { | 1631 | for(;;) { |
| 1632 | struct inode *inode = d->d_inode; | 1632 | struct inode *inode = d_backing_inode(d); |
| 1633 | if (inode && unlikely(!hlist_empty(&inode->i_fsnotify_marks))) { | 1633 | if (inode && unlikely(!hlist_empty(&inode->i_fsnotify_marks))) { |
| 1634 | struct audit_chunk *chunk; | 1634 | struct audit_chunk *chunk; |
| 1635 | chunk = audit_tree_lookup(inode); | 1635 | chunk = audit_tree_lookup(inode); |
| @@ -1754,7 +1754,7 @@ void __audit_inode(struct filename *name, const struct dentry *dentry, | |||
| 1754 | unsigned int flags) | 1754 | unsigned int flags) |
| 1755 | { | 1755 | { |
| 1756 | struct audit_context *context = current->audit_context; | 1756 | struct audit_context *context = current->audit_context; |
| 1757 | const struct inode *inode = dentry->d_inode; | 1757 | const struct inode *inode = d_backing_inode(dentry); |
| 1758 | struct audit_names *n; | 1758 | struct audit_names *n; |
| 1759 | bool parent = flags & AUDIT_INODE_PARENT; | 1759 | bool parent = flags & AUDIT_INODE_PARENT; |
| 1760 | 1760 | ||
| @@ -1853,7 +1853,7 @@ void __audit_inode_child(const struct inode *parent, | |||
| 1853 | const unsigned char type) | 1853 | const unsigned char type) |
| 1854 | { | 1854 | { |
| 1855 | struct audit_context *context = current->audit_context; | 1855 | struct audit_context *context = current->audit_context; |
| 1856 | const struct inode *inode = dentry->d_inode; | 1856 | const struct inode *inode = d_backing_inode(dentry); |
| 1857 | const char *dname = dentry->d_name.name; | 1857 | const char *dname = dentry->d_name.name; |
| 1858 | struct audit_names *n, *found_parent = NULL, *found_child = NULL; | 1858 | struct audit_names *n, *found_parent = NULL, *found_child = NULL; |
| 1859 | 1859 | ||
diff --git a/kernel/relay.c b/kernel/relay.c index 5a56d3c8dc03..e9dbaeb8fd65 100644 --- a/kernel/relay.c +++ b/kernel/relay.c | |||
| @@ -407,7 +407,7 @@ static inline void relay_set_buf_dentry(struct rchan_buf *buf, | |||
| 407 | struct dentry *dentry) | 407 | struct dentry *dentry) |
| 408 | { | 408 | { |
| 409 | buf->dentry = dentry; | 409 | buf->dentry = dentry; |
| 410 | buf->dentry->d_inode->i_size = buf->early_bytes; | 410 | d_inode(buf->dentry)->i_size = buf->early_bytes; |
| 411 | } | 411 | } |
| 412 | 412 | ||
| 413 | static struct dentry *relay_create_buf_file(struct rchan *chan, | 413 | static struct dentry *relay_create_buf_file(struct rchan *chan, |
| @@ -733,7 +733,7 @@ size_t relay_switch_subbuf(struct rchan_buf *buf, size_t length) | |||
| 733 | buf->padding[old_subbuf] = buf->prev_padding; | 733 | buf->padding[old_subbuf] = buf->prev_padding; |
| 734 | buf->subbufs_produced++; | 734 | buf->subbufs_produced++; |
| 735 | if (buf->dentry) | 735 | if (buf->dentry) |
| 736 | buf->dentry->d_inode->i_size += | 736 | d_inode(buf->dentry)->i_size += |
| 737 | buf->chan->subbuf_size - | 737 | buf->chan->subbuf_size - |
| 738 | buf->padding[old_subbuf]; | 738 | buf->padding[old_subbuf]; |
| 739 | else | 739 | else |
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index 91eecaaa43e0..05330494a0df 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c | |||
| @@ -6079,7 +6079,7 @@ trace_create_cpu_file(const char *name, umode_t mode, struct dentry *parent, | |||
| 6079 | struct dentry *ret = trace_create_file(name, mode, parent, data, fops); | 6079 | struct dentry *ret = trace_create_file(name, mode, parent, data, fops); |
| 6080 | 6080 | ||
| 6081 | if (ret) /* See tracing_get_cpu() */ | 6081 | if (ret) /* See tracing_get_cpu() */ |
| 6082 | ret->d_inode->i_cdev = (void *)(cpu + 1); | 6082 | d_inode(ret)->i_cdev = (void *)(cpu + 1); |
| 6083 | return ret; | 6083 | return ret; |
| 6084 | } | 6084 | } |
| 6085 | 6085 | ||
diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c index 3ab69fb72b85..c4de47fc5cca 100644 --- a/kernel/trace/trace_events.c +++ b/kernel/trace/trace_events.c | |||
| @@ -494,8 +494,8 @@ static void remove_event_file_dir(struct ftrace_event_file *file) | |||
| 494 | if (dir) { | 494 | if (dir) { |
| 495 | spin_lock(&dir->d_lock); /* probably unneeded */ | 495 | spin_lock(&dir->d_lock); /* probably unneeded */ |
| 496 | list_for_each_entry(child, &dir->d_subdirs, d_child) { | 496 | list_for_each_entry(child, &dir->d_subdirs, d_child) { |
| 497 | if (child->d_inode) /* probably unneeded */ | 497 | if (d_really_is_positive(child)) /* probably unneeded */ |
| 498 | child->d_inode->i_private = NULL; | 498 | d_inode(child)->i_private = NULL; |
| 499 | } | 499 | } |
| 500 | spin_unlock(&dir->d_lock); | 500 | spin_unlock(&dir->d_lock); |
| 501 | 501 | ||
diff --git a/kernel/trace/trace_uprobe.c b/kernel/trace/trace_uprobe.c index d60fe62ec4fa..6dd022c7b5bc 100644 --- a/kernel/trace/trace_uprobe.c +++ b/kernel/trace/trace_uprobe.c | |||
| @@ -443,7 +443,7 @@ static int create_trace_uprobe(int argc, char **argv) | |||
| 443 | if (ret) | 443 | if (ret) |
| 444 | goto fail_address_parse; | 444 | goto fail_address_parse; |
| 445 | 445 | ||
| 446 | inode = igrab(path.dentry->d_inode); | 446 | inode = igrab(d_inode(path.dentry)); |
| 447 | path_put(&path); | 447 | path_put(&path); |
| 448 | 448 | ||
| 449 | if (!inode || !S_ISREG(inode->i_mode)) { | 449 | if (!inode || !S_ISREG(inode->i_mode)) { |
diff --git a/mm/shmem.c b/mm/shmem.c index 1ea2400b5245..de981370fbc5 100644 --- a/mm/shmem.c +++ b/mm/shmem.c | |||
| @@ -544,7 +544,7 @@ EXPORT_SYMBOL_GPL(shmem_truncate_range); | |||
| 544 | 544 | ||
| 545 | static int shmem_setattr(struct dentry *dentry, struct iattr *attr) | 545 | static int shmem_setattr(struct dentry *dentry, struct iattr *attr) |
| 546 | { | 546 | { |
| 547 | struct inode *inode = dentry->d_inode; | 547 | struct inode *inode = d_inode(dentry); |
| 548 | struct shmem_inode_info *info = SHMEM_I(inode); | 548 | struct shmem_inode_info *info = SHMEM_I(inode); |
| 549 | int error; | 549 | int error; |
| 550 | 550 | ||
| @@ -2274,7 +2274,7 @@ static int shmem_create(struct inode *dir, struct dentry *dentry, umode_t mode, | |||
| 2274 | */ | 2274 | */ |
| 2275 | static int shmem_link(struct dentry *old_dentry, struct inode *dir, struct dentry *dentry) | 2275 | static int shmem_link(struct dentry *old_dentry, struct inode *dir, struct dentry *dentry) |
| 2276 | { | 2276 | { |
| 2277 | struct inode *inode = old_dentry->d_inode; | 2277 | struct inode *inode = d_inode(old_dentry); |
| 2278 | int ret; | 2278 | int ret; |
| 2279 | 2279 | ||
| 2280 | /* | 2280 | /* |
| @@ -2298,7 +2298,7 @@ out: | |||
| 2298 | 2298 | ||
| 2299 | static int shmem_unlink(struct inode *dir, struct dentry *dentry) | 2299 | static int shmem_unlink(struct inode *dir, struct dentry *dentry) |
| 2300 | { | 2300 | { |
| 2301 | struct inode *inode = dentry->d_inode; | 2301 | struct inode *inode = d_inode(dentry); |
| 2302 | 2302 | ||
| 2303 | if (inode->i_nlink > 1 && !S_ISDIR(inode->i_mode)) | 2303 | if (inode->i_nlink > 1 && !S_ISDIR(inode->i_mode)) |
| 2304 | shmem_free_inode(inode->i_sb); | 2304 | shmem_free_inode(inode->i_sb); |
| @@ -2315,7 +2315,7 @@ static int shmem_rmdir(struct inode *dir, struct dentry *dentry) | |||
| 2315 | if (!simple_empty(dentry)) | 2315 | if (!simple_empty(dentry)) |
| 2316 | return -ENOTEMPTY; | 2316 | return -ENOTEMPTY; |
| 2317 | 2317 | ||
| 2318 | drop_nlink(dentry->d_inode); | 2318 | drop_nlink(d_inode(dentry)); |
| 2319 | drop_nlink(dir); | 2319 | drop_nlink(dir); |
| 2320 | return shmem_unlink(dir, dentry); | 2320 | return shmem_unlink(dir, dentry); |
| 2321 | } | 2321 | } |
| @@ -2336,8 +2336,8 @@ static int shmem_exchange(struct inode *old_dir, struct dentry *old_dentry, stru | |||
| 2336 | } | 2336 | } |
| 2337 | old_dir->i_ctime = old_dir->i_mtime = | 2337 | old_dir->i_ctime = old_dir->i_mtime = |
| 2338 | new_dir->i_ctime = new_dir->i_mtime = | 2338 | new_dir->i_ctime = new_dir->i_mtime = |
| 2339 | old_dentry->d_inode->i_ctime = | 2339 | d_inode(old_dentry)->i_ctime = |
| 2340 | new_dentry->d_inode->i_ctime = CURRENT_TIME; | 2340 | d_inode(new_dentry)->i_ctime = CURRENT_TIME; |
| 2341 | 2341 | ||
| 2342 | return 0; | 2342 | return 0; |
| 2343 | } | 2343 | } |
| @@ -2376,7 +2376,7 @@ static int shmem_whiteout(struct inode *old_dir, struct dentry *old_dentry) | |||
| 2376 | */ | 2376 | */ |
| 2377 | static int shmem_rename2(struct inode *old_dir, struct dentry *old_dentry, struct inode *new_dir, struct dentry *new_dentry, unsigned int flags) | 2377 | static int shmem_rename2(struct inode *old_dir, struct dentry *old_dentry, struct inode *new_dir, struct dentry *new_dentry, unsigned int flags) |
| 2378 | { | 2378 | { |
| 2379 | struct inode *inode = old_dentry->d_inode; | 2379 | struct inode *inode = d_inode(old_dentry); |
| 2380 | int they_are_dirs = S_ISDIR(inode->i_mode); | 2380 | int they_are_dirs = S_ISDIR(inode->i_mode); |
| 2381 | 2381 | ||
| 2382 | if (flags & ~(RENAME_NOREPLACE | RENAME_EXCHANGE | RENAME_WHITEOUT)) | 2382 | if (flags & ~(RENAME_NOREPLACE | RENAME_EXCHANGE | RENAME_WHITEOUT)) |
| @@ -2396,10 +2396,10 @@ static int shmem_rename2(struct inode *old_dir, struct dentry *old_dentry, struc | |||
| 2396 | return error; | 2396 | return error; |
| 2397 | } | 2397 | } |
| 2398 | 2398 | ||
| 2399 | if (new_dentry->d_inode) { | 2399 | if (d_really_is_positive(new_dentry)) { |
| 2400 | (void) shmem_unlink(new_dir, new_dentry); | 2400 | (void) shmem_unlink(new_dir, new_dentry); |
| 2401 | if (they_are_dirs) { | 2401 | if (they_are_dirs) { |
| 2402 | drop_nlink(new_dentry->d_inode); | 2402 | drop_nlink(d_inode(new_dentry)); |
| 2403 | drop_nlink(old_dir); | 2403 | drop_nlink(old_dir); |
| 2404 | } | 2404 | } |
| 2405 | } else if (they_are_dirs) { | 2405 | } else if (they_are_dirs) { |
| @@ -2476,14 +2476,14 @@ static int shmem_symlink(struct inode *dir, struct dentry *dentry, const char *s | |||
| 2476 | 2476 | ||
| 2477 | static void *shmem_follow_short_symlink(struct dentry *dentry, struct nameidata *nd) | 2477 | static void *shmem_follow_short_symlink(struct dentry *dentry, struct nameidata *nd) |
| 2478 | { | 2478 | { |
| 2479 | nd_set_link(nd, SHMEM_I(dentry->d_inode)->symlink); | 2479 | nd_set_link(nd, SHMEM_I(d_inode(dentry))->symlink); |
| 2480 | return NULL; | 2480 | return NULL; |
| 2481 | } | 2481 | } |
| 2482 | 2482 | ||
| 2483 | static void *shmem_follow_link(struct dentry *dentry, struct nameidata *nd) | 2483 | static void *shmem_follow_link(struct dentry *dentry, struct nameidata *nd) |
| 2484 | { | 2484 | { |
| 2485 | struct page *page = NULL; | 2485 | struct page *page = NULL; |
| 2486 | int error = shmem_getpage(dentry->d_inode, 0, &page, SGP_READ, NULL); | 2486 | int error = shmem_getpage(d_inode(dentry), 0, &page, SGP_READ, NULL); |
| 2487 | nd_set_link(nd, error ? ERR_PTR(error) : kmap(page)); | 2487 | nd_set_link(nd, error ? ERR_PTR(error) : kmap(page)); |
| 2488 | if (page) | 2488 | if (page) |
| 2489 | unlock_page(page); | 2489 | unlock_page(page); |
| @@ -2574,7 +2574,7 @@ static int shmem_xattr_validate(const char *name) | |||
| 2574 | static ssize_t shmem_getxattr(struct dentry *dentry, const char *name, | 2574 | static ssize_t shmem_getxattr(struct dentry *dentry, const char *name, |
| 2575 | void *buffer, size_t size) | 2575 | void *buffer, size_t size) |
| 2576 | { | 2576 | { |
| 2577 | struct shmem_inode_info *info = SHMEM_I(dentry->d_inode); | 2577 | struct shmem_inode_info *info = SHMEM_I(d_inode(dentry)); |
| 2578 | int err; | 2578 | int err; |
| 2579 | 2579 | ||
| 2580 | /* | 2580 | /* |
| @@ -2595,7 +2595,7 @@ static ssize_t shmem_getxattr(struct dentry *dentry, const char *name, | |||
| 2595 | static int shmem_setxattr(struct dentry *dentry, const char *name, | 2595 | static int shmem_setxattr(struct dentry *dentry, const char *name, |
| 2596 | const void *value, size_t size, int flags) | 2596 | const void *value, size_t size, int flags) |
| 2597 | { | 2597 | { |
| 2598 | struct shmem_inode_info *info = SHMEM_I(dentry->d_inode); | 2598 | struct shmem_inode_info *info = SHMEM_I(d_inode(dentry)); |
| 2599 | int err; | 2599 | int err; |
| 2600 | 2600 | ||
| 2601 | /* | 2601 | /* |
| @@ -2615,7 +2615,7 @@ static int shmem_setxattr(struct dentry *dentry, const char *name, | |||
| 2615 | 2615 | ||
| 2616 | static int shmem_removexattr(struct dentry *dentry, const char *name) | 2616 | static int shmem_removexattr(struct dentry *dentry, const char *name) |
| 2617 | { | 2617 | { |
| 2618 | struct shmem_inode_info *info = SHMEM_I(dentry->d_inode); | 2618 | struct shmem_inode_info *info = SHMEM_I(d_inode(dentry)); |
| 2619 | int err; | 2619 | int err; |
| 2620 | 2620 | ||
| 2621 | /* | 2621 | /* |
| @@ -2635,7 +2635,7 @@ static int shmem_removexattr(struct dentry *dentry, const char *name) | |||
| 2635 | 2635 | ||
| 2636 | static ssize_t shmem_listxattr(struct dentry *dentry, char *buffer, size_t size) | 2636 | static ssize_t shmem_listxattr(struct dentry *dentry, char *buffer, size_t size) |
| 2637 | { | 2637 | { |
| 2638 | struct shmem_inode_info *info = SHMEM_I(dentry->d_inode); | 2638 | struct shmem_inode_info *info = SHMEM_I(d_inode(dentry)); |
| 2639 | return simple_xattr_list(&info->xattrs, buffer, size); | 2639 | return simple_xattr_list(&info->xattrs, buffer, size); |
| 2640 | } | 2640 | } |
| 2641 | #endif /* CONFIG_TMPFS_XATTR */ | 2641 | #endif /* CONFIG_TMPFS_XATTR */ |
diff --git a/net/socket.c b/net/socket.c index 3e33959f3ce5..884e32997698 100644 --- a/net/socket.c +++ b/net/socket.c | |||
| @@ -312,7 +312,7 @@ static const struct super_operations sockfs_ops = { | |||
| 312 | static char *sockfs_dname(struct dentry *dentry, char *buffer, int buflen) | 312 | static char *sockfs_dname(struct dentry *dentry, char *buffer, int buflen) |
| 313 | { | 313 | { |
| 314 | return dynamic_dname(dentry, buffer, buflen, "socket:[%lu]", | 314 | return dynamic_dname(dentry, buffer, buflen, "socket:[%lu]", |
| 315 | dentry->d_inode->i_ino); | 315 | d_inode(dentry)->i_ino); |
| 316 | } | 316 | } |
| 317 | 317 | ||
| 318 | static const struct dentry_operations sockfs_dentry_operations = { | 318 | static const struct dentry_operations sockfs_dentry_operations = { |
| @@ -375,7 +375,7 @@ struct file *sock_alloc_file(struct socket *sock, int flags, const char *dname) | |||
| 375 | &socket_file_ops); | 375 | &socket_file_ops); |
| 376 | if (unlikely(IS_ERR(file))) { | 376 | if (unlikely(IS_ERR(file))) { |
| 377 | /* drop dentry, keep inode */ | 377 | /* drop dentry, keep inode */ |
| 378 | ihold(path.dentry->d_inode); | 378 | ihold(d_inode(path.dentry)); |
| 379 | path_put(&path); | 379 | path_put(&path); |
| 380 | return file; | 380 | return file; |
| 381 | } | 381 | } |
| @@ -497,7 +497,7 @@ static ssize_t sockfs_listxattr(struct dentry *dentry, char *buffer, | |||
| 497 | ssize_t len; | 497 | ssize_t len; |
| 498 | ssize_t used = 0; | 498 | ssize_t used = 0; |
| 499 | 499 | ||
| 500 | len = security_inode_listsecurity(dentry->d_inode, buffer, size); | 500 | len = security_inode_listsecurity(d_inode(dentry), buffer, size); |
| 501 | if (len < 0) | 501 | if (len < 0) |
| 502 | return len; | 502 | return len; |
| 503 | used += len; | 503 | used += len; |
diff --git a/net/sunrpc/rpc_pipe.c b/net/sunrpc/rpc_pipe.c index 2d12b76b5a64..d81186d34558 100644 --- a/net/sunrpc/rpc_pipe.c +++ b/net/sunrpc/rpc_pipe.c | |||
| @@ -94,7 +94,7 @@ rpc_timeout_upcall_queue(struct work_struct *work) | |||
| 94 | } | 94 | } |
| 95 | dentry = dget(pipe->dentry); | 95 | dentry = dget(pipe->dentry); |
| 96 | spin_unlock(&pipe->lock); | 96 | spin_unlock(&pipe->lock); |
| 97 | rpc_purge_list(dentry ? &RPC_I(dentry->d_inode)->waitq : NULL, | 97 | rpc_purge_list(dentry ? &RPC_I(d_inode(dentry))->waitq : NULL, |
| 98 | &free_list, destroy_msg, -ETIMEDOUT); | 98 | &free_list, destroy_msg, -ETIMEDOUT); |
| 99 | dput(dentry); | 99 | dput(dentry); |
| 100 | } | 100 | } |
| @@ -152,7 +152,7 @@ rpc_queue_upcall(struct rpc_pipe *pipe, struct rpc_pipe_msg *msg) | |||
| 152 | dentry = dget(pipe->dentry); | 152 | dentry = dget(pipe->dentry); |
| 153 | spin_unlock(&pipe->lock); | 153 | spin_unlock(&pipe->lock); |
| 154 | if (dentry) { | 154 | if (dentry) { |
| 155 | wake_up(&RPC_I(dentry->d_inode)->waitq); | 155 | wake_up(&RPC_I(d_inode(dentry))->waitq); |
| 156 | dput(dentry); | 156 | dput(dentry); |
| 157 | } | 157 | } |
| 158 | return res; | 158 | return res; |
| @@ -591,7 +591,7 @@ static int __rpc_mkpipe_dentry(struct inode *dir, struct dentry *dentry, | |||
| 591 | err = __rpc_create_common(dir, dentry, S_IFIFO | mode, i_fop, private); | 591 | err = __rpc_create_common(dir, dentry, S_IFIFO | mode, i_fop, private); |
| 592 | if (err) | 592 | if (err) |
| 593 | return err; | 593 | return err; |
| 594 | rpci = RPC_I(dentry->d_inode); | 594 | rpci = RPC_I(d_inode(dentry)); |
| 595 | rpci->private = private; | 595 | rpci->private = private; |
| 596 | rpci->pipe = pipe; | 596 | rpci->pipe = pipe; |
| 597 | fsnotify_create(dir, dentry); | 597 | fsnotify_create(dir, dentry); |
| @@ -616,7 +616,7 @@ int rpc_rmdir(struct dentry *dentry) | |||
| 616 | int error; | 616 | int error; |
| 617 | 617 | ||
| 618 | parent = dget_parent(dentry); | 618 | parent = dget_parent(dentry); |
| 619 | dir = parent->d_inode; | 619 | dir = d_inode(parent); |
| 620 | mutex_lock_nested(&dir->i_mutex, I_MUTEX_PARENT); | 620 | mutex_lock_nested(&dir->i_mutex, I_MUTEX_PARENT); |
| 621 | error = __rpc_rmdir(dir, dentry); | 621 | error = __rpc_rmdir(dir, dentry); |
| 622 | mutex_unlock(&dir->i_mutex); | 622 | mutex_unlock(&dir->i_mutex); |
| @@ -638,7 +638,7 @@ static int __rpc_unlink(struct inode *dir, struct dentry *dentry) | |||
| 638 | 638 | ||
| 639 | static int __rpc_rmpipe(struct inode *dir, struct dentry *dentry) | 639 | static int __rpc_rmpipe(struct inode *dir, struct dentry *dentry) |
| 640 | { | 640 | { |
| 641 | struct inode *inode = dentry->d_inode; | 641 | struct inode *inode = d_inode(dentry); |
| 642 | 642 | ||
| 643 | rpc_close_pipes(inode); | 643 | rpc_close_pipes(inode); |
| 644 | return __rpc_unlink(dir, dentry); | 644 | return __rpc_unlink(dir, dentry); |
| @@ -654,7 +654,7 @@ static struct dentry *__rpc_lookup_create_exclusive(struct dentry *parent, | |||
| 654 | if (!dentry) | 654 | if (!dentry) |
| 655 | return ERR_PTR(-ENOMEM); | 655 | return ERR_PTR(-ENOMEM); |
| 656 | } | 656 | } |
| 657 | if (dentry->d_inode == NULL) | 657 | if (d_really_is_negative(dentry)) |
| 658 | return dentry; | 658 | return dentry; |
| 659 | dput(dentry); | 659 | dput(dentry); |
| 660 | return ERR_PTR(-EEXIST); | 660 | return ERR_PTR(-EEXIST); |
| @@ -667,7 +667,7 @@ static void __rpc_depopulate(struct dentry *parent, | |||
| 667 | const struct rpc_filelist *files, | 667 | const struct rpc_filelist *files, |
| 668 | int start, int eof) | 668 | int start, int eof) |
| 669 | { | 669 | { |
| 670 | struct inode *dir = parent->d_inode; | 670 | struct inode *dir = d_inode(parent); |
| 671 | struct dentry *dentry; | 671 | struct dentry *dentry; |
| 672 | struct qstr name; | 672 | struct qstr name; |
| 673 | int i; | 673 | int i; |
| @@ -679,9 +679,9 @@ static void __rpc_depopulate(struct dentry *parent, | |||
| 679 | 679 | ||
| 680 | if (dentry == NULL) | 680 | if (dentry == NULL) |
| 681 | continue; | 681 | continue; |
| 682 | if (dentry->d_inode == NULL) | 682 | if (d_really_is_negative(dentry)) |
| 683 | goto next; | 683 | goto next; |
| 684 | switch (dentry->d_inode->i_mode & S_IFMT) { | 684 | switch (d_inode(dentry)->i_mode & S_IFMT) { |
| 685 | default: | 685 | default: |
| 686 | BUG(); | 686 | BUG(); |
| 687 | case S_IFREG: | 687 | case S_IFREG: |
| @@ -699,7 +699,7 @@ static void rpc_depopulate(struct dentry *parent, | |||
| 699 | const struct rpc_filelist *files, | 699 | const struct rpc_filelist *files, |
| 700 | int start, int eof) | 700 | int start, int eof) |
| 701 | { | 701 | { |
| 702 | struct inode *dir = parent->d_inode; | 702 | struct inode *dir = d_inode(parent); |
| 703 | 703 | ||
| 704 | mutex_lock_nested(&dir->i_mutex, I_MUTEX_CHILD); | 704 | mutex_lock_nested(&dir->i_mutex, I_MUTEX_CHILD); |
| 705 | __rpc_depopulate(parent, files, start, eof); | 705 | __rpc_depopulate(parent, files, start, eof); |
| @@ -711,7 +711,7 @@ static int rpc_populate(struct dentry *parent, | |||
| 711 | int start, int eof, | 711 | int start, int eof, |
| 712 | void *private) | 712 | void *private) |
| 713 | { | 713 | { |
| 714 | struct inode *dir = parent->d_inode; | 714 | struct inode *dir = d_inode(parent); |
| 715 | struct dentry *dentry; | 715 | struct dentry *dentry; |
| 716 | int i, err; | 716 | int i, err; |
| 717 | 717 | ||
| @@ -754,7 +754,7 @@ static struct dentry *rpc_mkdir_populate(struct dentry *parent, | |||
| 754 | int (*populate)(struct dentry *, void *), void *args_populate) | 754 | int (*populate)(struct dentry *, void *), void *args_populate) |
| 755 | { | 755 | { |
| 756 | struct dentry *dentry; | 756 | struct dentry *dentry; |
| 757 | struct inode *dir = parent->d_inode; | 757 | struct inode *dir = d_inode(parent); |
| 758 | int error; | 758 | int error; |
| 759 | 759 | ||
| 760 | mutex_lock_nested(&dir->i_mutex, I_MUTEX_PARENT); | 760 | mutex_lock_nested(&dir->i_mutex, I_MUTEX_PARENT); |
| @@ -787,7 +787,7 @@ static int rpc_rmdir_depopulate(struct dentry *dentry, | |||
| 787 | int error; | 787 | int error; |
| 788 | 788 | ||
| 789 | parent = dget_parent(dentry); | 789 | parent = dget_parent(dentry); |
| 790 | dir = parent->d_inode; | 790 | dir = d_inode(parent); |
| 791 | mutex_lock_nested(&dir->i_mutex, I_MUTEX_PARENT); | 791 | mutex_lock_nested(&dir->i_mutex, I_MUTEX_PARENT); |
| 792 | if (depopulate != NULL) | 792 | if (depopulate != NULL) |
| 793 | depopulate(dentry); | 793 | depopulate(dentry); |
| @@ -819,7 +819,7 @@ struct dentry *rpc_mkpipe_dentry(struct dentry *parent, const char *name, | |||
| 819 | void *private, struct rpc_pipe *pipe) | 819 | void *private, struct rpc_pipe *pipe) |
| 820 | { | 820 | { |
| 821 | struct dentry *dentry; | 821 | struct dentry *dentry; |
| 822 | struct inode *dir = parent->d_inode; | 822 | struct inode *dir = d_inode(parent); |
| 823 | umode_t umode = S_IFIFO | S_IRUSR | S_IWUSR; | 823 | umode_t umode = S_IFIFO | S_IRUSR | S_IWUSR; |
| 824 | int err; | 824 | int err; |
| 825 | 825 | ||
| @@ -864,7 +864,7 @@ rpc_unlink(struct dentry *dentry) | |||
| 864 | int error = 0; | 864 | int error = 0; |
| 865 | 865 | ||
| 866 | parent = dget_parent(dentry); | 866 | parent = dget_parent(dentry); |
| 867 | dir = parent->d_inode; | 867 | dir = d_inode(parent); |
| 868 | mutex_lock_nested(&dir->i_mutex, I_MUTEX_PARENT); | 868 | mutex_lock_nested(&dir->i_mutex, I_MUTEX_PARENT); |
| 869 | error = __rpc_rmpipe(dir, dentry); | 869 | error = __rpc_rmpipe(dir, dentry); |
| 870 | mutex_unlock(&dir->i_mutex); | 870 | mutex_unlock(&dir->i_mutex); |
| @@ -1375,7 +1375,7 @@ rpc_gssd_dummy_depopulate(struct dentry *pipe_dentry) | |||
| 1375 | struct dentry *clnt_dir = pipe_dentry->d_parent; | 1375 | struct dentry *clnt_dir = pipe_dentry->d_parent; |
| 1376 | struct dentry *gssd_dir = clnt_dir->d_parent; | 1376 | struct dentry *gssd_dir = clnt_dir->d_parent; |
| 1377 | 1377 | ||
| 1378 | __rpc_rmpipe(clnt_dir->d_inode, pipe_dentry); | 1378 | __rpc_rmpipe(d_inode(clnt_dir), pipe_dentry); |
| 1379 | __rpc_depopulate(clnt_dir, gssd_dummy_info_file, 0, 1); | 1379 | __rpc_depopulate(clnt_dir, gssd_dummy_info_file, 0, 1); |
| 1380 | __rpc_depopulate(gssd_dir, gssd_dummy_clnt_dir, 0, 1); | 1380 | __rpc_depopulate(gssd_dir, gssd_dummy_clnt_dir, 0, 1); |
| 1381 | dput(pipe_dentry); | 1381 | dput(pipe_dentry); |
diff --git a/net/sunrpc/sched.c b/net/sunrpc/sched.c index b91fd9c597b4..337ca851a350 100644 --- a/net/sunrpc/sched.c +++ b/net/sunrpc/sched.c | |||
| @@ -89,8 +89,8 @@ __rpc_add_timer(struct rpc_wait_queue *queue, struct rpc_task *task) | |||
| 89 | if (!task->tk_timeout) | 89 | if (!task->tk_timeout) |
| 90 | return; | 90 | return; |
| 91 | 91 | ||
| 92 | dprintk("RPC: %5u setting alarm for %lu ms\n", | 92 | dprintk("RPC: %5u setting alarm for %u ms\n", |
| 93 | task->tk_pid, task->tk_timeout * 1000 / HZ); | 93 | task->tk_pid, jiffies_to_msecs(task->tk_timeout)); |
| 94 | 94 | ||
| 95 | task->u.tk_wait.expires = jiffies + task->tk_timeout; | 95 | task->u.tk_wait.expires = jiffies + task->tk_timeout; |
| 96 | if (list_empty(&queue->timer_list.list) || time_before(task->u.tk_wait.expires, queue->timer_list.expires)) | 96 | if (list_empty(&queue->timer_list.list) || time_before(task->u.tk_wait.expires, queue->timer_list.expires)) |
diff --git a/net/sunrpc/xprt.c b/net/sunrpc/xprt.c index 9949722d99ce..1d4fe24af06a 100644 --- a/net/sunrpc/xprt.c +++ b/net/sunrpc/xprt.c | |||
| @@ -326,6 +326,15 @@ out_unlock: | |||
| 326 | xprt_clear_locked(xprt); | 326 | xprt_clear_locked(xprt); |
| 327 | } | 327 | } |
| 328 | 328 | ||
| 329 | static void xprt_task_clear_bytes_sent(struct rpc_task *task) | ||
| 330 | { | ||
| 331 | if (task != NULL) { | ||
| 332 | struct rpc_rqst *req = task->tk_rqstp; | ||
| 333 | if (req != NULL) | ||
| 334 | req->rq_bytes_sent = 0; | ||
| 335 | } | ||
| 336 | } | ||
| 337 | |||
| 329 | /** | 338 | /** |
| 330 | * xprt_release_xprt - allow other requests to use a transport | 339 | * xprt_release_xprt - allow other requests to use a transport |
| 331 | * @xprt: transport with other tasks potentially waiting | 340 | * @xprt: transport with other tasks potentially waiting |
| @@ -336,11 +345,7 @@ out_unlock: | |||
| 336 | void xprt_release_xprt(struct rpc_xprt *xprt, struct rpc_task *task) | 345 | void xprt_release_xprt(struct rpc_xprt *xprt, struct rpc_task *task) |
| 337 | { | 346 | { |
| 338 | if (xprt->snd_task == task) { | 347 | if (xprt->snd_task == task) { |
| 339 | if (task != NULL) { | 348 | xprt_task_clear_bytes_sent(task); |
| 340 | struct rpc_rqst *req = task->tk_rqstp; | ||
| 341 | if (req != NULL) | ||
| 342 | req->rq_bytes_sent = 0; | ||
| 343 | } | ||
| 344 | xprt_clear_locked(xprt); | 349 | xprt_clear_locked(xprt); |
| 345 | __xprt_lock_write_next(xprt); | 350 | __xprt_lock_write_next(xprt); |
| 346 | } | 351 | } |
| @@ -358,11 +363,7 @@ EXPORT_SYMBOL_GPL(xprt_release_xprt); | |||
| 358 | void xprt_release_xprt_cong(struct rpc_xprt *xprt, struct rpc_task *task) | 363 | void xprt_release_xprt_cong(struct rpc_xprt *xprt, struct rpc_task *task) |
| 359 | { | 364 | { |
| 360 | if (xprt->snd_task == task) { | 365 | if (xprt->snd_task == task) { |
| 361 | if (task != NULL) { | 366 | xprt_task_clear_bytes_sent(task); |
| 362 | struct rpc_rqst *req = task->tk_rqstp; | ||
| 363 | if (req != NULL) | ||
| 364 | req->rq_bytes_sent = 0; | ||
| 365 | } | ||
| 366 | xprt_clear_locked(xprt); | 367 | xprt_clear_locked(xprt); |
| 367 | __xprt_lock_write_next_cong(xprt); | 368 | __xprt_lock_write_next_cong(xprt); |
| 368 | } | 369 | } |
| @@ -700,6 +701,7 @@ bool xprt_lock_connect(struct rpc_xprt *xprt, | |||
| 700 | goto out; | 701 | goto out; |
| 701 | if (xprt->snd_task != task) | 702 | if (xprt->snd_task != task) |
| 702 | goto out; | 703 | goto out; |
| 704 | xprt_task_clear_bytes_sent(task); | ||
| 703 | xprt->snd_task = cookie; | 705 | xprt->snd_task = cookie; |
| 704 | ret = true; | 706 | ret = true; |
| 705 | out: | 707 | out: |
diff --git a/net/sunrpc/xprtrdma/Makefile b/net/sunrpc/xprtrdma/Makefile index da5136fd5694..579f72bbcf4b 100644 --- a/net/sunrpc/xprtrdma/Makefile +++ b/net/sunrpc/xprtrdma/Makefile | |||
| @@ -1,6 +1,7 @@ | |||
| 1 | obj-$(CONFIG_SUNRPC_XPRT_RDMA_CLIENT) += xprtrdma.o | 1 | obj-$(CONFIG_SUNRPC_XPRT_RDMA_CLIENT) += xprtrdma.o |
| 2 | 2 | ||
| 3 | xprtrdma-y := transport.o rpc_rdma.o verbs.o | 3 | xprtrdma-y := transport.o rpc_rdma.o verbs.o \ |
| 4 | fmr_ops.o frwr_ops.o physical_ops.o | ||
| 4 | 5 | ||
| 5 | obj-$(CONFIG_SUNRPC_XPRT_RDMA_SERVER) += svcrdma.o | 6 | obj-$(CONFIG_SUNRPC_XPRT_RDMA_SERVER) += svcrdma.o |
| 6 | 7 | ||
diff --git a/net/sunrpc/xprtrdma/fmr_ops.c b/net/sunrpc/xprtrdma/fmr_ops.c new file mode 100644 index 000000000000..302d4ebf6fbf --- /dev/null +++ b/net/sunrpc/xprtrdma/fmr_ops.c | |||
| @@ -0,0 +1,208 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (c) 2015 Oracle. All rights reserved. | ||
| 3 | * Copyright (c) 2003-2007 Network Appliance, Inc. All rights reserved. | ||
| 4 | */ | ||
| 5 | |||
| 6 | /* Lightweight memory registration using Fast Memory Regions (FMR). | ||
| 7 | * Referred to sometimes as MTHCAFMR mode. | ||
| 8 | * | ||
| 9 | * FMR uses synchronous memory registration and deregistration. | ||
| 10 | * FMR registration is known to be fast, but FMR deregistration | ||
| 11 | * can take tens of usecs to complete. | ||
| 12 | */ | ||
| 13 | |||
| 14 | #include "xprt_rdma.h" | ||
| 15 | |||
| 16 | #if IS_ENABLED(CONFIG_SUNRPC_DEBUG) | ||
| 17 | # define RPCDBG_FACILITY RPCDBG_TRANS | ||
| 18 | #endif | ||
| 19 | |||
| 20 | /* Maximum scatter/gather per FMR */ | ||
| 21 | #define RPCRDMA_MAX_FMR_SGES (64) | ||
| 22 | |||
| 23 | static int | ||
| 24 | fmr_op_open(struct rpcrdma_ia *ia, struct rpcrdma_ep *ep, | ||
| 25 | struct rpcrdma_create_data_internal *cdata) | ||
| 26 | { | ||
| 27 | return 0; | ||
| 28 | } | ||
| 29 | |||
| 30 | /* FMR mode conveys up to 64 pages of payload per chunk segment. | ||
| 31 | */ | ||
| 32 | static size_t | ||
| 33 | fmr_op_maxpages(struct rpcrdma_xprt *r_xprt) | ||
| 34 | { | ||
| 35 | return min_t(unsigned int, RPCRDMA_MAX_DATA_SEGS, | ||
| 36 | rpcrdma_max_segments(r_xprt) * RPCRDMA_MAX_FMR_SGES); | ||
| 37 | } | ||
| 38 | |||
| 39 | static int | ||
| 40 | fmr_op_init(struct rpcrdma_xprt *r_xprt) | ||
| 41 | { | ||
| 42 | struct rpcrdma_buffer *buf = &r_xprt->rx_buf; | ||
| 43 | int mr_access_flags = IB_ACCESS_REMOTE_WRITE | IB_ACCESS_REMOTE_READ; | ||
| 44 | struct ib_fmr_attr fmr_attr = { | ||
| 45 | .max_pages = RPCRDMA_MAX_FMR_SGES, | ||
| 46 | .max_maps = 1, | ||
| 47 | .page_shift = PAGE_SHIFT | ||
| 48 | }; | ||
| 49 | struct ib_pd *pd = r_xprt->rx_ia.ri_pd; | ||
| 50 | struct rpcrdma_mw *r; | ||
| 51 | int i, rc; | ||
| 52 | |||
| 53 | INIT_LIST_HEAD(&buf->rb_mws); | ||
| 54 | INIT_LIST_HEAD(&buf->rb_all); | ||
| 55 | |||
| 56 | i = (buf->rb_max_requests + 1) * RPCRDMA_MAX_SEGS; | ||
| 57 | dprintk("RPC: %s: initializing %d FMRs\n", __func__, i); | ||
| 58 | |||
| 59 | while (i--) { | ||
| 60 | r = kzalloc(sizeof(*r), GFP_KERNEL); | ||
| 61 | if (!r) | ||
| 62 | return -ENOMEM; | ||
| 63 | |||
| 64 | r->r.fmr = ib_alloc_fmr(pd, mr_access_flags, &fmr_attr); | ||
| 65 | if (IS_ERR(r->r.fmr)) | ||
| 66 | goto out_fmr_err; | ||
| 67 | |||
| 68 | list_add(&r->mw_list, &buf->rb_mws); | ||
| 69 | list_add(&r->mw_all, &buf->rb_all); | ||
| 70 | } | ||
| 71 | return 0; | ||
| 72 | |||
| 73 | out_fmr_err: | ||
| 74 | rc = PTR_ERR(r->r.fmr); | ||
| 75 | dprintk("RPC: %s: ib_alloc_fmr status %i\n", __func__, rc); | ||
| 76 | kfree(r); | ||
| 77 | return rc; | ||
| 78 | } | ||
| 79 | |||
| 80 | /* Use the ib_map_phys_fmr() verb to register a memory region | ||
| 81 | * for remote access via RDMA READ or RDMA WRITE. | ||
| 82 | */ | ||
| 83 | static int | ||
| 84 | fmr_op_map(struct rpcrdma_xprt *r_xprt, struct rpcrdma_mr_seg *seg, | ||
| 85 | int nsegs, bool writing) | ||
| 86 | { | ||
| 87 | struct rpcrdma_ia *ia = &r_xprt->rx_ia; | ||
| 88 | struct ib_device *device = ia->ri_id->device; | ||
| 89 | enum dma_data_direction direction = rpcrdma_data_dir(writing); | ||
| 90 | struct rpcrdma_mr_seg *seg1 = seg; | ||
| 91 | struct rpcrdma_mw *mw = seg1->rl_mw; | ||
| 92 | u64 physaddrs[RPCRDMA_MAX_DATA_SEGS]; | ||
| 93 | int len, pageoff, i, rc; | ||
| 94 | |||
| 95 | pageoff = offset_in_page(seg1->mr_offset); | ||
| 96 | seg1->mr_offset -= pageoff; /* start of page */ | ||
| 97 | seg1->mr_len += pageoff; | ||
| 98 | len = -pageoff; | ||
| 99 | if (nsegs > RPCRDMA_MAX_FMR_SGES) | ||
| 100 | nsegs = RPCRDMA_MAX_FMR_SGES; | ||
| 101 | for (i = 0; i < nsegs;) { | ||
| 102 | rpcrdma_map_one(device, seg, direction); | ||
| 103 | physaddrs[i] = seg->mr_dma; | ||
| 104 | len += seg->mr_len; | ||
| 105 | ++seg; | ||
| 106 | ++i; | ||
| 107 | /* Check for holes */ | ||
| 108 | if ((i < nsegs && offset_in_page(seg->mr_offset)) || | ||
| 109 | offset_in_page((seg-1)->mr_offset + (seg-1)->mr_len)) | ||
| 110 | break; | ||
| 111 | } | ||
| 112 | |||
| 113 | rc = ib_map_phys_fmr(mw->r.fmr, physaddrs, i, seg1->mr_dma); | ||
| 114 | if (rc) | ||
| 115 | goto out_maperr; | ||
| 116 | |||
| 117 | seg1->mr_rkey = mw->r.fmr->rkey; | ||
| 118 | seg1->mr_base = seg1->mr_dma + pageoff; | ||
| 119 | seg1->mr_nsegs = i; | ||
| 120 | seg1->mr_len = len; | ||
| 121 | return i; | ||
| 122 | |||
| 123 | out_maperr: | ||
| 124 | dprintk("RPC: %s: ib_map_phys_fmr %u@0x%llx+%i (%d) status %i\n", | ||
| 125 | __func__, len, (unsigned long long)seg1->mr_dma, | ||
| 126 | pageoff, i, rc); | ||
| 127 | while (i--) | ||
| 128 | rpcrdma_unmap_one(device, --seg); | ||
| 129 | return rc; | ||
| 130 | } | ||
| 131 | |||
| 132 | /* Use the ib_unmap_fmr() verb to prevent further remote | ||
| 133 | * access via RDMA READ or RDMA WRITE. | ||
| 134 | */ | ||
| 135 | static int | ||
| 136 | fmr_op_unmap(struct rpcrdma_xprt *r_xprt, struct rpcrdma_mr_seg *seg) | ||
| 137 | { | ||
| 138 | struct rpcrdma_ia *ia = &r_xprt->rx_ia; | ||
| 139 | struct rpcrdma_mr_seg *seg1 = seg; | ||
| 140 | struct ib_device *device; | ||
| 141 | int rc, nsegs = seg->mr_nsegs; | ||
| 142 | LIST_HEAD(l); | ||
| 143 | |||
| 144 | list_add(&seg1->rl_mw->r.fmr->list, &l); | ||
| 145 | rc = ib_unmap_fmr(&l); | ||
| 146 | read_lock(&ia->ri_qplock); | ||
| 147 | device = ia->ri_id->device; | ||
| 148 | while (seg1->mr_nsegs--) | ||
| 149 | rpcrdma_unmap_one(device, seg++); | ||
| 150 | read_unlock(&ia->ri_qplock); | ||
| 151 | if (rc) | ||
| 152 | goto out_err; | ||
| 153 | return nsegs; | ||
| 154 | |||
| 155 | out_err: | ||
| 156 | dprintk("RPC: %s: ib_unmap_fmr status %i\n", __func__, rc); | ||
| 157 | return nsegs; | ||
| 158 | } | ||
| 159 | |||
| 160 | /* After a disconnect, unmap all FMRs. | ||
| 161 | * | ||
| 162 | * This is invoked only in the transport connect worker in order | ||
| 163 | * to serialize with rpcrdma_register_fmr_external(). | ||
| 164 | */ | ||
| 165 | static void | ||
| 166 | fmr_op_reset(struct rpcrdma_xprt *r_xprt) | ||
| 167 | { | ||
| 168 | struct rpcrdma_buffer *buf = &r_xprt->rx_buf; | ||
| 169 | struct rpcrdma_mw *r; | ||
| 170 | LIST_HEAD(list); | ||
| 171 | int rc; | ||
| 172 | |||
| 173 | list_for_each_entry(r, &buf->rb_all, mw_all) | ||
| 174 | list_add(&r->r.fmr->list, &list); | ||
| 175 | |||
| 176 | rc = ib_unmap_fmr(&list); | ||
| 177 | if (rc) | ||
| 178 | dprintk("RPC: %s: ib_unmap_fmr failed %i\n", | ||
| 179 | __func__, rc); | ||
| 180 | } | ||
| 181 | |||
| 182 | static void | ||
| 183 | fmr_op_destroy(struct rpcrdma_buffer *buf) | ||
| 184 | { | ||
| 185 | struct rpcrdma_mw *r; | ||
| 186 | int rc; | ||
| 187 | |||
| 188 | while (!list_empty(&buf->rb_all)) { | ||
| 189 | r = list_entry(buf->rb_all.next, struct rpcrdma_mw, mw_all); | ||
| 190 | list_del(&r->mw_all); | ||
| 191 | rc = ib_dealloc_fmr(r->r.fmr); | ||
| 192 | if (rc) | ||
| 193 | dprintk("RPC: %s: ib_dealloc_fmr failed %i\n", | ||
| 194 | __func__, rc); | ||
| 195 | kfree(r); | ||
| 196 | } | ||
| 197 | } | ||
| 198 | |||
| 199 | const struct rpcrdma_memreg_ops rpcrdma_fmr_memreg_ops = { | ||
| 200 | .ro_map = fmr_op_map, | ||
| 201 | .ro_unmap = fmr_op_unmap, | ||
| 202 | .ro_open = fmr_op_open, | ||
| 203 | .ro_maxpages = fmr_op_maxpages, | ||
| 204 | .ro_init = fmr_op_init, | ||
| 205 | .ro_reset = fmr_op_reset, | ||
| 206 | .ro_destroy = fmr_op_destroy, | ||
| 207 | .ro_displayname = "fmr", | ||
| 208 | }; | ||
diff --git a/net/sunrpc/xprtrdma/frwr_ops.c b/net/sunrpc/xprtrdma/frwr_ops.c new file mode 100644 index 000000000000..dff0481dbcf8 --- /dev/null +++ b/net/sunrpc/xprtrdma/frwr_ops.c | |||
| @@ -0,0 +1,353 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (c) 2015 Oracle. All rights reserved. | ||
| 3 | * Copyright (c) 2003-2007 Network Appliance, Inc. All rights reserved. | ||
| 4 | */ | ||
| 5 | |||
| 6 | /* Lightweight memory registration using Fast Registration Work | ||
| 7 | * Requests (FRWR). Also referred to sometimes as FRMR mode. | ||
| 8 | * | ||
| 9 | * FRWR features ordered asynchronous registration and deregistration | ||
| 10 | * of arbitrarily sized memory regions. This is the fastest and safest | ||
| 11 | * but most complex memory registration mode. | ||
| 12 | */ | ||
| 13 | |||
| 14 | #include "xprt_rdma.h" | ||
| 15 | |||
| 16 | #if IS_ENABLED(CONFIG_SUNRPC_DEBUG) | ||
| 17 | # define RPCDBG_FACILITY RPCDBG_TRANS | ||
| 18 | #endif | ||
| 19 | |||
| 20 | static int | ||
| 21 | __frwr_init(struct rpcrdma_mw *r, struct ib_pd *pd, struct ib_device *device, | ||
| 22 | unsigned int depth) | ||
| 23 | { | ||
| 24 | struct rpcrdma_frmr *f = &r->r.frmr; | ||
| 25 | int rc; | ||
| 26 | |||
| 27 | f->fr_mr = ib_alloc_fast_reg_mr(pd, depth); | ||
| 28 | if (IS_ERR(f->fr_mr)) | ||
| 29 | goto out_mr_err; | ||
| 30 | f->fr_pgl = ib_alloc_fast_reg_page_list(device, depth); | ||
| 31 | if (IS_ERR(f->fr_pgl)) | ||
| 32 | goto out_list_err; | ||
| 33 | return 0; | ||
| 34 | |||
| 35 | out_mr_err: | ||
| 36 | rc = PTR_ERR(f->fr_mr); | ||
| 37 | dprintk("RPC: %s: ib_alloc_fast_reg_mr status %i\n", | ||
| 38 | __func__, rc); | ||
| 39 | return rc; | ||
| 40 | |||
| 41 | out_list_err: | ||
| 42 | rc = PTR_ERR(f->fr_pgl); | ||
| 43 | dprintk("RPC: %s: ib_alloc_fast_reg_page_list status %i\n", | ||
| 44 | __func__, rc); | ||
| 45 | ib_dereg_mr(f->fr_mr); | ||
| 46 | return rc; | ||
| 47 | } | ||
| 48 | |||
| 49 | static void | ||
| 50 | __frwr_release(struct rpcrdma_mw *r) | ||
| 51 | { | ||
| 52 | int rc; | ||
| 53 | |||
| 54 | rc = ib_dereg_mr(r->r.frmr.fr_mr); | ||
| 55 | if (rc) | ||
| 56 | dprintk("RPC: %s: ib_dereg_mr status %i\n", | ||
| 57 | __func__, rc); | ||
| 58 | ib_free_fast_reg_page_list(r->r.frmr.fr_pgl); | ||
| 59 | } | ||
| 60 | |||
| 61 | static int | ||
| 62 | frwr_op_open(struct rpcrdma_ia *ia, struct rpcrdma_ep *ep, | ||
| 63 | struct rpcrdma_create_data_internal *cdata) | ||
| 64 | { | ||
| 65 | struct ib_device_attr *devattr = &ia->ri_devattr; | ||
| 66 | int depth, delta; | ||
| 67 | |||
| 68 | ia->ri_max_frmr_depth = | ||
| 69 | min_t(unsigned int, RPCRDMA_MAX_DATA_SEGS, | ||
| 70 | devattr->max_fast_reg_page_list_len); | ||
| 71 | dprintk("RPC: %s: device's max FR page list len = %u\n", | ||
| 72 | __func__, ia->ri_max_frmr_depth); | ||
| 73 | |||
| 74 | /* Add room for frmr register and invalidate WRs. | ||
| 75 | * 1. FRMR reg WR for head | ||
| 76 | * 2. FRMR invalidate WR for head | ||
| 77 | * 3. N FRMR reg WRs for pagelist | ||
| 78 | * 4. N FRMR invalidate WRs for pagelist | ||
| 79 | * 5. FRMR reg WR for tail | ||
| 80 | * 6. FRMR invalidate WR for tail | ||
| 81 | * 7. The RDMA_SEND WR | ||
| 82 | */ | ||
| 83 | depth = 7; | ||
| 84 | |||
| 85 | /* Calculate N if the device max FRMR depth is smaller than | ||
| 86 | * RPCRDMA_MAX_DATA_SEGS. | ||
| 87 | */ | ||
| 88 | if (ia->ri_max_frmr_depth < RPCRDMA_MAX_DATA_SEGS) { | ||
| 89 | delta = RPCRDMA_MAX_DATA_SEGS - ia->ri_max_frmr_depth; | ||
| 90 | do { | ||
| 91 | depth += 2; /* FRMR reg + invalidate */ | ||
| 92 | delta -= ia->ri_max_frmr_depth; | ||
| 93 | } while (delta > 0); | ||
| 94 | } | ||
| 95 | |||
| 96 | ep->rep_attr.cap.max_send_wr *= depth; | ||
| 97 | if (ep->rep_attr.cap.max_send_wr > devattr->max_qp_wr) { | ||
| 98 | cdata->max_requests = devattr->max_qp_wr / depth; | ||
| 99 | if (!cdata->max_requests) | ||
| 100 | return -EINVAL; | ||
| 101 | ep->rep_attr.cap.max_send_wr = cdata->max_requests * | ||
| 102 | depth; | ||
| 103 | } | ||
| 104 | |||
| 105 | return 0; | ||
| 106 | } | ||
| 107 | |||
| 108 | /* FRWR mode conveys a list of pages per chunk segment. The | ||
| 109 | * maximum length of that list is the FRWR page list depth. | ||
| 110 | */ | ||
| 111 | static size_t | ||
| 112 | frwr_op_maxpages(struct rpcrdma_xprt *r_xprt) | ||
| 113 | { | ||
| 114 | struct rpcrdma_ia *ia = &r_xprt->rx_ia; | ||
| 115 | |||
| 116 | return min_t(unsigned int, RPCRDMA_MAX_DATA_SEGS, | ||
| 117 | rpcrdma_max_segments(r_xprt) * ia->ri_max_frmr_depth); | ||
| 118 | } | ||
| 119 | |||
| 120 | /* If FAST_REG or LOCAL_INV failed, indicate the frmr needs to be reset. */ | ||
| 121 | static void | ||
| 122 | frwr_sendcompletion(struct ib_wc *wc) | ||
| 123 | { | ||
| 124 | struct rpcrdma_mw *r; | ||
| 125 | |||
| 126 | if (likely(wc->status == IB_WC_SUCCESS)) | ||
| 127 | return; | ||
| 128 | |||
| 129 | /* WARNING: Only wr_id and status are reliable at this point */ | ||
| 130 | r = (struct rpcrdma_mw *)(unsigned long)wc->wr_id; | ||
| 131 | dprintk("RPC: %s: frmr %p (stale), status %d\n", | ||
| 132 | __func__, r, wc->status); | ||
| 133 | r->r.frmr.fr_state = FRMR_IS_STALE; | ||
| 134 | } | ||
| 135 | |||
| 136 | static int | ||
| 137 | frwr_op_init(struct rpcrdma_xprt *r_xprt) | ||
| 138 | { | ||
| 139 | struct rpcrdma_buffer *buf = &r_xprt->rx_buf; | ||
| 140 | struct ib_device *device = r_xprt->rx_ia.ri_id->device; | ||
| 141 | unsigned int depth = r_xprt->rx_ia.ri_max_frmr_depth; | ||
| 142 | struct ib_pd *pd = r_xprt->rx_ia.ri_pd; | ||
| 143 | int i; | ||
| 144 | |||
| 145 | INIT_LIST_HEAD(&buf->rb_mws); | ||
| 146 | INIT_LIST_HEAD(&buf->rb_all); | ||
| 147 | |||
| 148 | i = (buf->rb_max_requests + 1) * RPCRDMA_MAX_SEGS; | ||
| 149 | dprintk("RPC: %s: initializing %d FRMRs\n", __func__, i); | ||
| 150 | |||
| 151 | while (i--) { | ||
| 152 | struct rpcrdma_mw *r; | ||
| 153 | int rc; | ||
| 154 | |||
| 155 | r = kzalloc(sizeof(*r), GFP_KERNEL); | ||
| 156 | if (!r) | ||
| 157 | return -ENOMEM; | ||
| 158 | |||
| 159 | rc = __frwr_init(r, pd, device, depth); | ||
| 160 | if (rc) { | ||
| 161 | kfree(r); | ||
| 162 | return rc; | ||
| 163 | } | ||
| 164 | |||
| 165 | list_add(&r->mw_list, &buf->rb_mws); | ||
| 166 | list_add(&r->mw_all, &buf->rb_all); | ||
| 167 | r->mw_sendcompletion = frwr_sendcompletion; | ||
| 168 | } | ||
| 169 | |||
| 170 | return 0; | ||
| 171 | } | ||
| 172 | |||
| 173 | /* Post a FAST_REG Work Request to register a memory region | ||
| 174 | * for remote access via RDMA READ or RDMA WRITE. | ||
| 175 | */ | ||
| 176 | static int | ||
| 177 | frwr_op_map(struct rpcrdma_xprt *r_xprt, struct rpcrdma_mr_seg *seg, | ||
| 178 | int nsegs, bool writing) | ||
| 179 | { | ||
| 180 | struct rpcrdma_ia *ia = &r_xprt->rx_ia; | ||
| 181 | struct ib_device *device = ia->ri_id->device; | ||
| 182 | enum dma_data_direction direction = rpcrdma_data_dir(writing); | ||
| 183 | struct rpcrdma_mr_seg *seg1 = seg; | ||
| 184 | struct rpcrdma_mw *mw = seg1->rl_mw; | ||
| 185 | struct rpcrdma_frmr *frmr = &mw->r.frmr; | ||
| 186 | struct ib_mr *mr = frmr->fr_mr; | ||
| 187 | struct ib_send_wr fastreg_wr, *bad_wr; | ||
| 188 | u8 key; | ||
| 189 | int len, pageoff; | ||
| 190 | int i, rc; | ||
| 191 | int seg_len; | ||
| 192 | u64 pa; | ||
| 193 | int page_no; | ||
| 194 | |||
| 195 | pageoff = offset_in_page(seg1->mr_offset); | ||
| 196 | seg1->mr_offset -= pageoff; /* start of page */ | ||
| 197 | seg1->mr_len += pageoff; | ||
| 198 | len = -pageoff; | ||
| 199 | if (nsegs > ia->ri_max_frmr_depth) | ||
| 200 | nsegs = ia->ri_max_frmr_depth; | ||
| 201 | for (page_no = i = 0; i < nsegs;) { | ||
| 202 | rpcrdma_map_one(device, seg, direction); | ||
| 203 | pa = seg->mr_dma; | ||
| 204 | for (seg_len = seg->mr_len; seg_len > 0; seg_len -= PAGE_SIZE) { | ||
| 205 | frmr->fr_pgl->page_list[page_no++] = pa; | ||
| 206 | pa += PAGE_SIZE; | ||
| 207 | } | ||
| 208 | len += seg->mr_len; | ||
| 209 | ++seg; | ||
| 210 | ++i; | ||
| 211 | /* Check for holes */ | ||
| 212 | if ((i < nsegs && offset_in_page(seg->mr_offset)) || | ||
| 213 | offset_in_page((seg-1)->mr_offset + (seg-1)->mr_len)) | ||
| 214 | break; | ||
| 215 | } | ||
| 216 | dprintk("RPC: %s: Using frmr %p to map %d segments (%d bytes)\n", | ||
| 217 | __func__, mw, i, len); | ||
| 218 | |||
| 219 | frmr->fr_state = FRMR_IS_VALID; | ||
| 220 | |||
| 221 | memset(&fastreg_wr, 0, sizeof(fastreg_wr)); | ||
| 222 | fastreg_wr.wr_id = (unsigned long)(void *)mw; | ||
| 223 | fastreg_wr.opcode = IB_WR_FAST_REG_MR; | ||
| 224 | fastreg_wr.wr.fast_reg.iova_start = seg1->mr_dma + pageoff; | ||
| 225 | fastreg_wr.wr.fast_reg.page_list = frmr->fr_pgl; | ||
| 226 | fastreg_wr.wr.fast_reg.page_shift = PAGE_SHIFT; | ||
| 227 | fastreg_wr.wr.fast_reg.page_list_len = page_no; | ||
| 228 | fastreg_wr.wr.fast_reg.length = len; | ||
| 229 | fastreg_wr.wr.fast_reg.access_flags = writing ? | ||
| 230 | IB_ACCESS_REMOTE_WRITE | IB_ACCESS_LOCAL_WRITE : | ||
| 231 | IB_ACCESS_REMOTE_READ; | ||
| 232 | key = (u8)(mr->rkey & 0x000000FF); | ||
| 233 | ib_update_fast_reg_key(mr, ++key); | ||
| 234 | fastreg_wr.wr.fast_reg.rkey = mr->rkey; | ||
| 235 | |||
| 236 | DECR_CQCOUNT(&r_xprt->rx_ep); | ||
| 237 | rc = ib_post_send(ia->ri_id->qp, &fastreg_wr, &bad_wr); | ||
| 238 | if (rc) | ||
| 239 | goto out_senderr; | ||
| 240 | |||
| 241 | seg1->mr_rkey = mr->rkey; | ||
| 242 | seg1->mr_base = seg1->mr_dma + pageoff; | ||
| 243 | seg1->mr_nsegs = i; | ||
| 244 | seg1->mr_len = len; | ||
| 245 | return i; | ||
| 246 | |||
| 247 | out_senderr: | ||
| 248 | dprintk("RPC: %s: ib_post_send status %i\n", __func__, rc); | ||
| 249 | ib_update_fast_reg_key(mr, --key); | ||
| 250 | frmr->fr_state = FRMR_IS_INVALID; | ||
| 251 | while (i--) | ||
| 252 | rpcrdma_unmap_one(device, --seg); | ||
| 253 | return rc; | ||
| 254 | } | ||
| 255 | |||
| 256 | /* Post a LOCAL_INV Work Request to prevent further remote access | ||
| 257 | * via RDMA READ or RDMA WRITE. | ||
| 258 | */ | ||
| 259 | static int | ||
| 260 | frwr_op_unmap(struct rpcrdma_xprt *r_xprt, struct rpcrdma_mr_seg *seg) | ||
| 261 | { | ||
| 262 | struct rpcrdma_mr_seg *seg1 = seg; | ||
| 263 | struct rpcrdma_ia *ia = &r_xprt->rx_ia; | ||
| 264 | struct ib_send_wr invalidate_wr, *bad_wr; | ||
| 265 | int rc, nsegs = seg->mr_nsegs; | ||
| 266 | struct ib_device *device; | ||
| 267 | |||
| 268 | seg1->rl_mw->r.frmr.fr_state = FRMR_IS_INVALID; | ||
| 269 | |||
| 270 | memset(&invalidate_wr, 0, sizeof(invalidate_wr)); | ||
| 271 | invalidate_wr.wr_id = (unsigned long)(void *)seg1->rl_mw; | ||
| 272 | invalidate_wr.opcode = IB_WR_LOCAL_INV; | ||
| 273 | invalidate_wr.ex.invalidate_rkey = seg1->rl_mw->r.frmr.fr_mr->rkey; | ||
| 274 | DECR_CQCOUNT(&r_xprt->rx_ep); | ||
| 275 | |||
| 276 | read_lock(&ia->ri_qplock); | ||
| 277 | device = ia->ri_id->device; | ||
| 278 | while (seg1->mr_nsegs--) | ||
| 279 | rpcrdma_unmap_one(device, seg++); | ||
| 280 | rc = ib_post_send(ia->ri_id->qp, &invalidate_wr, &bad_wr); | ||
| 281 | read_unlock(&ia->ri_qplock); | ||
| 282 | if (rc) | ||
| 283 | goto out_err; | ||
| 284 | return nsegs; | ||
| 285 | |||
| 286 | out_err: | ||
| 287 | /* Force rpcrdma_buffer_get() to retry */ | ||
| 288 | seg1->rl_mw->r.frmr.fr_state = FRMR_IS_STALE; | ||
| 289 | dprintk("RPC: %s: ib_post_send status %i\n", __func__, rc); | ||
| 290 | return nsegs; | ||
| 291 | } | ||
| 292 | |||
| 293 | /* After a disconnect, a flushed FAST_REG_MR can leave an FRMR in | ||
| 294 | * an unusable state. Find FRMRs in this state and dereg / reg | ||
| 295 | * each. FRMRs that are VALID and attached to an rpcrdma_req are | ||
| 296 | * also torn down. | ||
| 297 | * | ||
| 298 | * This gives all in-use FRMRs a fresh rkey and leaves them INVALID. | ||
| 299 | * | ||
| 300 | * This is invoked only in the transport connect worker in order | ||
| 301 | * to serialize with rpcrdma_register_frmr_external(). | ||
| 302 | */ | ||
| 303 | static void | ||
| 304 | frwr_op_reset(struct rpcrdma_xprt *r_xprt) | ||
| 305 | { | ||
| 306 | struct rpcrdma_buffer *buf = &r_xprt->rx_buf; | ||
| 307 | struct ib_device *device = r_xprt->rx_ia.ri_id->device; | ||
| 308 | unsigned int depth = r_xprt->rx_ia.ri_max_frmr_depth; | ||
| 309 | struct ib_pd *pd = r_xprt->rx_ia.ri_pd; | ||
| 310 | struct rpcrdma_mw *r; | ||
| 311 | int rc; | ||
| 312 | |||
| 313 | list_for_each_entry(r, &buf->rb_all, mw_all) { | ||
| 314 | if (r->r.frmr.fr_state == FRMR_IS_INVALID) | ||
| 315 | continue; | ||
| 316 | |||
| 317 | __frwr_release(r); | ||
| 318 | rc = __frwr_init(r, pd, device, depth); | ||
| 319 | if (rc) { | ||
| 320 | dprintk("RPC: %s: mw %p left %s\n", | ||
| 321 | __func__, r, | ||
| 322 | (r->r.frmr.fr_state == FRMR_IS_STALE ? | ||
| 323 | "stale" : "valid")); | ||
| 324 | continue; | ||
| 325 | } | ||
| 326 | |||
| 327 | r->r.frmr.fr_state = FRMR_IS_INVALID; | ||
| 328 | } | ||
| 329 | } | ||
| 330 | |||
| 331 | static void | ||
| 332 | frwr_op_destroy(struct rpcrdma_buffer *buf) | ||
| 333 | { | ||
| 334 | struct rpcrdma_mw *r; | ||
| 335 | |||
| 336 | while (!list_empty(&buf->rb_all)) { | ||
| 337 | r = list_entry(buf->rb_all.next, struct rpcrdma_mw, mw_all); | ||
| 338 | list_del(&r->mw_all); | ||
| 339 | __frwr_release(r); | ||
| 340 | kfree(r); | ||
| 341 | } | ||
| 342 | } | ||
| 343 | |||
| 344 | const struct rpcrdma_memreg_ops rpcrdma_frwr_memreg_ops = { | ||
| 345 | .ro_map = frwr_op_map, | ||
| 346 | .ro_unmap = frwr_op_unmap, | ||
| 347 | .ro_open = frwr_op_open, | ||
| 348 | .ro_maxpages = frwr_op_maxpages, | ||
| 349 | .ro_init = frwr_op_init, | ||
| 350 | .ro_reset = frwr_op_reset, | ||
| 351 | .ro_destroy = frwr_op_destroy, | ||
| 352 | .ro_displayname = "frwr", | ||
| 353 | }; | ||
diff --git a/net/sunrpc/xprtrdma/physical_ops.c b/net/sunrpc/xprtrdma/physical_ops.c new file mode 100644 index 000000000000..ba518af16787 --- /dev/null +++ b/net/sunrpc/xprtrdma/physical_ops.c | |||
| @@ -0,0 +1,94 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (c) 2015 Oracle. All rights reserved. | ||
| 3 | * Copyright (c) 2003-2007 Network Appliance, Inc. All rights reserved. | ||
| 4 | */ | ||
| 5 | |||
| 6 | /* No-op chunk preparation. All client memory is pre-registered. | ||
| 7 | * Sometimes referred to as ALLPHYSICAL mode. | ||
| 8 | * | ||
| 9 | * Physical registration is simple because all client memory is | ||
| 10 | * pre-registered and never deregistered. This mode is good for | ||
| 11 | * adapter bring up, but is considered not safe: the server is | ||
| 12 | * trusted not to abuse its access to client memory not involved | ||
| 13 | * in RDMA I/O. | ||
| 14 | */ | ||
| 15 | |||
| 16 | #include "xprt_rdma.h" | ||
| 17 | |||
| 18 | #if IS_ENABLED(CONFIG_SUNRPC_DEBUG) | ||
| 19 | # define RPCDBG_FACILITY RPCDBG_TRANS | ||
| 20 | #endif | ||
| 21 | |||
| 22 | static int | ||
| 23 | physical_op_open(struct rpcrdma_ia *ia, struct rpcrdma_ep *ep, | ||
| 24 | struct rpcrdma_create_data_internal *cdata) | ||
| 25 | { | ||
| 26 | return 0; | ||
| 27 | } | ||
| 28 | |||
| 29 | /* PHYSICAL memory registration conveys one page per chunk segment. | ||
| 30 | */ | ||
| 31 | static size_t | ||
| 32 | physical_op_maxpages(struct rpcrdma_xprt *r_xprt) | ||
| 33 | { | ||
| 34 | return min_t(unsigned int, RPCRDMA_MAX_DATA_SEGS, | ||
| 35 | rpcrdma_max_segments(r_xprt)); | ||
| 36 | } | ||
| 37 | |||
| 38 | static int | ||
| 39 | physical_op_init(struct rpcrdma_xprt *r_xprt) | ||
| 40 | { | ||
| 41 | return 0; | ||
| 42 | } | ||
| 43 | |||
| 44 | /* The client's physical memory is already exposed for | ||
| 45 | * remote access via RDMA READ or RDMA WRITE. | ||
| 46 | */ | ||
| 47 | static int | ||
| 48 | physical_op_map(struct rpcrdma_xprt *r_xprt, struct rpcrdma_mr_seg *seg, | ||
| 49 | int nsegs, bool writing) | ||
| 50 | { | ||
| 51 | struct rpcrdma_ia *ia = &r_xprt->rx_ia; | ||
| 52 | |||
| 53 | rpcrdma_map_one(ia->ri_id->device, seg, | ||
| 54 | rpcrdma_data_dir(writing)); | ||
| 55 | seg->mr_rkey = ia->ri_bind_mem->rkey; | ||
| 56 | seg->mr_base = seg->mr_dma; | ||
| 57 | seg->mr_nsegs = 1; | ||
| 58 | return 1; | ||
| 59 | } | ||
| 60 | |||
| 61 | /* Unmap a memory region, but leave it registered. | ||
| 62 | */ | ||
| 63 | static int | ||
| 64 | physical_op_unmap(struct rpcrdma_xprt *r_xprt, struct rpcrdma_mr_seg *seg) | ||
| 65 | { | ||
| 66 | struct rpcrdma_ia *ia = &r_xprt->rx_ia; | ||
| 67 | |||
| 68 | read_lock(&ia->ri_qplock); | ||
| 69 | rpcrdma_unmap_one(ia->ri_id->device, seg); | ||
| 70 | read_unlock(&ia->ri_qplock); | ||
| 71 | |||
| 72 | return 1; | ||
| 73 | } | ||
| 74 | |||
| 75 | static void | ||
| 76 | physical_op_reset(struct rpcrdma_xprt *r_xprt) | ||
| 77 | { | ||
| 78 | } | ||
| 79 | |||
| 80 | static void | ||
| 81 | physical_op_destroy(struct rpcrdma_buffer *buf) | ||
| 82 | { | ||
| 83 | } | ||
| 84 | |||
| 85 | const struct rpcrdma_memreg_ops rpcrdma_physical_memreg_ops = { | ||
| 86 | .ro_map = physical_op_map, | ||
| 87 | .ro_unmap = physical_op_unmap, | ||
| 88 | .ro_open = physical_op_open, | ||
| 89 | .ro_maxpages = physical_op_maxpages, | ||
| 90 | .ro_init = physical_op_init, | ||
| 91 | .ro_reset = physical_op_reset, | ||
| 92 | .ro_destroy = physical_op_destroy, | ||
| 93 | .ro_displayname = "physical", | ||
| 94 | }; | ||
diff --git a/net/sunrpc/xprtrdma/rpc_rdma.c b/net/sunrpc/xprtrdma/rpc_rdma.c index 91ffde82fa0c..2c53ea9e1b83 100644 --- a/net/sunrpc/xprtrdma/rpc_rdma.c +++ b/net/sunrpc/xprtrdma/rpc_rdma.c | |||
| @@ -53,6 +53,14 @@ | |||
| 53 | # define RPCDBG_FACILITY RPCDBG_TRANS | 53 | # define RPCDBG_FACILITY RPCDBG_TRANS |
| 54 | #endif | 54 | #endif |
| 55 | 55 | ||
| 56 | enum rpcrdma_chunktype { | ||
| 57 | rpcrdma_noch = 0, | ||
| 58 | rpcrdma_readch, | ||
| 59 | rpcrdma_areadch, | ||
| 60 | rpcrdma_writech, | ||
| 61 | rpcrdma_replych | ||
| 62 | }; | ||
| 63 | |||
| 56 | #if IS_ENABLED(CONFIG_SUNRPC_DEBUG) | 64 | #if IS_ENABLED(CONFIG_SUNRPC_DEBUG) |
| 57 | static const char transfertypes[][12] = { | 65 | static const char transfertypes[][12] = { |
| 58 | "pure inline", /* no chunks */ | 66 | "pure inline", /* no chunks */ |
| @@ -179,6 +187,7 @@ rpcrdma_create_chunks(struct rpc_rqst *rqst, struct xdr_buf *target, | |||
| 179 | struct rpcrdma_write_array *warray = NULL; | 187 | struct rpcrdma_write_array *warray = NULL; |
| 180 | struct rpcrdma_write_chunk *cur_wchunk = NULL; | 188 | struct rpcrdma_write_chunk *cur_wchunk = NULL; |
| 181 | __be32 *iptr = headerp->rm_body.rm_chunks; | 189 | __be32 *iptr = headerp->rm_body.rm_chunks; |
| 190 | int (*map)(struct rpcrdma_xprt *, struct rpcrdma_mr_seg *, int, bool); | ||
| 182 | 191 | ||
| 183 | if (type == rpcrdma_readch || type == rpcrdma_areadch) { | 192 | if (type == rpcrdma_readch || type == rpcrdma_areadch) { |
| 184 | /* a read chunk - server will RDMA Read our memory */ | 193 | /* a read chunk - server will RDMA Read our memory */ |
| @@ -201,9 +210,9 @@ rpcrdma_create_chunks(struct rpc_rqst *rqst, struct xdr_buf *target, | |||
| 201 | if (nsegs < 0) | 210 | if (nsegs < 0) |
| 202 | return nsegs; | 211 | return nsegs; |
| 203 | 212 | ||
| 213 | map = r_xprt->rx_ia.ri_ops->ro_map; | ||
| 204 | do { | 214 | do { |
| 205 | n = rpcrdma_register_external(seg, nsegs, | 215 | n = map(r_xprt, seg, nsegs, cur_wchunk != NULL); |
| 206 | cur_wchunk != NULL, r_xprt); | ||
| 207 | if (n <= 0) | 216 | if (n <= 0) |
| 208 | goto out; | 217 | goto out; |
| 209 | if (cur_rchunk) { /* read */ | 218 | if (cur_rchunk) { /* read */ |
| @@ -275,34 +284,13 @@ rpcrdma_create_chunks(struct rpc_rqst *rqst, struct xdr_buf *target, | |||
| 275 | return (unsigned char *)iptr - (unsigned char *)headerp; | 284 | return (unsigned char *)iptr - (unsigned char *)headerp; |
| 276 | 285 | ||
| 277 | out: | 286 | out: |
| 278 | if (r_xprt->rx_ia.ri_memreg_strategy != RPCRDMA_FRMR) { | 287 | if (r_xprt->rx_ia.ri_memreg_strategy == RPCRDMA_FRMR) |
| 279 | for (pos = 0; nchunks--;) | 288 | return n; |
| 280 | pos += rpcrdma_deregister_external( | ||
| 281 | &req->rl_segments[pos], r_xprt); | ||
| 282 | } | ||
| 283 | return n; | ||
| 284 | } | ||
| 285 | 289 | ||
| 286 | /* | 290 | for (pos = 0; nchunks--;) |
| 287 | * Marshal chunks. This routine returns the header length | 291 | pos += r_xprt->rx_ia.ri_ops->ro_unmap(r_xprt, |
| 288 | * consumed by marshaling. | 292 | &req->rl_segments[pos]); |
| 289 | * | 293 | return n; |
| 290 | * Returns positive RPC/RDMA header size, or negative errno. | ||
| 291 | */ | ||
| 292 | |||
| 293 | ssize_t | ||
| 294 | rpcrdma_marshal_chunks(struct rpc_rqst *rqst, ssize_t result) | ||
| 295 | { | ||
| 296 | struct rpcrdma_req *req = rpcr_to_rdmar(rqst); | ||
| 297 | struct rpcrdma_msg *headerp = rdmab_to_msg(req->rl_rdmabuf); | ||
| 298 | |||
| 299 | if (req->rl_rtype != rpcrdma_noch) | ||
| 300 | result = rpcrdma_create_chunks(rqst, &rqst->rq_snd_buf, | ||
| 301 | headerp, req->rl_rtype); | ||
| 302 | else if (req->rl_wtype != rpcrdma_noch) | ||
| 303 | result = rpcrdma_create_chunks(rqst, &rqst->rq_rcv_buf, | ||
| 304 | headerp, req->rl_wtype); | ||
| 305 | return result; | ||
| 306 | } | 294 | } |
| 307 | 295 | ||
| 308 | /* | 296 | /* |
| @@ -397,6 +385,7 @@ rpcrdma_marshal_req(struct rpc_rqst *rqst) | |||
| 397 | char *base; | 385 | char *base; |
| 398 | size_t rpclen, padlen; | 386 | size_t rpclen, padlen; |
| 399 | ssize_t hdrlen; | 387 | ssize_t hdrlen; |
| 388 | enum rpcrdma_chunktype rtype, wtype; | ||
| 400 | struct rpcrdma_msg *headerp; | 389 | struct rpcrdma_msg *headerp; |
| 401 | 390 | ||
| 402 | /* | 391 | /* |
| @@ -433,13 +422,13 @@ rpcrdma_marshal_req(struct rpc_rqst *rqst) | |||
| 433 | * into pages; otherwise use reply chunks. | 422 | * into pages; otherwise use reply chunks. |
| 434 | */ | 423 | */ |
| 435 | if (rqst->rq_rcv_buf.buflen <= RPCRDMA_INLINE_READ_THRESHOLD(rqst)) | 424 | if (rqst->rq_rcv_buf.buflen <= RPCRDMA_INLINE_READ_THRESHOLD(rqst)) |
| 436 | req->rl_wtype = rpcrdma_noch; | 425 | wtype = rpcrdma_noch; |
| 437 | else if (rqst->rq_rcv_buf.page_len == 0) | 426 | else if (rqst->rq_rcv_buf.page_len == 0) |
| 438 | req->rl_wtype = rpcrdma_replych; | 427 | wtype = rpcrdma_replych; |
| 439 | else if (rqst->rq_rcv_buf.flags & XDRBUF_READ) | 428 | else if (rqst->rq_rcv_buf.flags & XDRBUF_READ) |
| 440 | req->rl_wtype = rpcrdma_writech; | 429 | wtype = rpcrdma_writech; |
| 441 | else | 430 | else |
| 442 | req->rl_wtype = rpcrdma_replych; | 431 | wtype = rpcrdma_replych; |
| 443 | 432 | ||
| 444 | /* | 433 | /* |
| 445 | * Chunks needed for arguments? | 434 | * Chunks needed for arguments? |
| @@ -456,16 +445,16 @@ rpcrdma_marshal_req(struct rpc_rqst *rqst) | |||
| 456 | * TBD check NFSv4 setacl | 445 | * TBD check NFSv4 setacl |
| 457 | */ | 446 | */ |
| 458 | if (rqst->rq_snd_buf.len <= RPCRDMA_INLINE_WRITE_THRESHOLD(rqst)) | 447 | if (rqst->rq_snd_buf.len <= RPCRDMA_INLINE_WRITE_THRESHOLD(rqst)) |
| 459 | req->rl_rtype = rpcrdma_noch; | 448 | rtype = rpcrdma_noch; |
| 460 | else if (rqst->rq_snd_buf.page_len == 0) | 449 | else if (rqst->rq_snd_buf.page_len == 0) |
| 461 | req->rl_rtype = rpcrdma_areadch; | 450 | rtype = rpcrdma_areadch; |
| 462 | else | 451 | else |
| 463 | req->rl_rtype = rpcrdma_readch; | 452 | rtype = rpcrdma_readch; |
| 464 | 453 | ||
| 465 | /* The following simplification is not true forever */ | 454 | /* The following simplification is not true forever */ |
| 466 | if (req->rl_rtype != rpcrdma_noch && req->rl_wtype == rpcrdma_replych) | 455 | if (rtype != rpcrdma_noch && wtype == rpcrdma_replych) |
| 467 | req->rl_wtype = rpcrdma_noch; | 456 | wtype = rpcrdma_noch; |
| 468 | if (req->rl_rtype != rpcrdma_noch && req->rl_wtype != rpcrdma_noch) { | 457 | if (rtype != rpcrdma_noch && wtype != rpcrdma_noch) { |
| 469 | dprintk("RPC: %s: cannot marshal multiple chunk lists\n", | 458 | dprintk("RPC: %s: cannot marshal multiple chunk lists\n", |
| 470 | __func__); | 459 | __func__); |
| 471 | return -EIO; | 460 | return -EIO; |
| @@ -479,7 +468,7 @@ rpcrdma_marshal_req(struct rpc_rqst *rqst) | |||
| 479 | * When padding is in use and applies to the transfer, insert | 468 | * When padding is in use and applies to the transfer, insert |
| 480 | * it and change the message type. | 469 | * it and change the message type. |
| 481 | */ | 470 | */ |
| 482 | if (req->rl_rtype == rpcrdma_noch) { | 471 | if (rtype == rpcrdma_noch) { |
| 483 | 472 | ||
| 484 | padlen = rpcrdma_inline_pullup(rqst, | 473 | padlen = rpcrdma_inline_pullup(rqst, |
| 485 | RPCRDMA_INLINE_PAD_VALUE(rqst)); | 474 | RPCRDMA_INLINE_PAD_VALUE(rqst)); |
| @@ -494,7 +483,7 @@ rpcrdma_marshal_req(struct rpc_rqst *rqst) | |||
| 494 | headerp->rm_body.rm_padded.rm_pempty[1] = xdr_zero; | 483 | headerp->rm_body.rm_padded.rm_pempty[1] = xdr_zero; |
| 495 | headerp->rm_body.rm_padded.rm_pempty[2] = xdr_zero; | 484 | headerp->rm_body.rm_padded.rm_pempty[2] = xdr_zero; |
| 496 | hdrlen += 2 * sizeof(u32); /* extra words in padhdr */ | 485 | hdrlen += 2 * sizeof(u32); /* extra words in padhdr */ |
| 497 | if (req->rl_wtype != rpcrdma_noch) { | 486 | if (wtype != rpcrdma_noch) { |
| 498 | dprintk("RPC: %s: invalid chunk list\n", | 487 | dprintk("RPC: %s: invalid chunk list\n", |
| 499 | __func__); | 488 | __func__); |
| 500 | return -EIO; | 489 | return -EIO; |
| @@ -515,18 +504,26 @@ rpcrdma_marshal_req(struct rpc_rqst *rqst) | |||
| 515 | * on receive. Therefore, we request a reply chunk | 504 | * on receive. Therefore, we request a reply chunk |
| 516 | * for non-writes wherever feasible and efficient. | 505 | * for non-writes wherever feasible and efficient. |
| 517 | */ | 506 | */ |
| 518 | if (req->rl_wtype == rpcrdma_noch) | 507 | if (wtype == rpcrdma_noch) |
| 519 | req->rl_wtype = rpcrdma_replych; | 508 | wtype = rpcrdma_replych; |
| 520 | } | 509 | } |
| 521 | } | 510 | } |
| 522 | 511 | ||
| 523 | hdrlen = rpcrdma_marshal_chunks(rqst, hdrlen); | 512 | if (rtype != rpcrdma_noch) { |
| 513 | hdrlen = rpcrdma_create_chunks(rqst, &rqst->rq_snd_buf, | ||
| 514 | headerp, rtype); | ||
| 515 | wtype = rtype; /* simplify dprintk */ | ||
| 516 | |||
| 517 | } else if (wtype != rpcrdma_noch) { | ||
| 518 | hdrlen = rpcrdma_create_chunks(rqst, &rqst->rq_rcv_buf, | ||
| 519 | headerp, wtype); | ||
| 520 | } | ||
| 524 | if (hdrlen < 0) | 521 | if (hdrlen < 0) |
| 525 | return hdrlen; | 522 | return hdrlen; |
| 526 | 523 | ||
| 527 | dprintk("RPC: %s: %s: hdrlen %zd rpclen %zd padlen %zd" | 524 | dprintk("RPC: %s: %s: hdrlen %zd rpclen %zd padlen %zd" |
| 528 | " headerp 0x%p base 0x%p lkey 0x%x\n", | 525 | " headerp 0x%p base 0x%p lkey 0x%x\n", |
| 529 | __func__, transfertypes[req->rl_wtype], hdrlen, rpclen, padlen, | 526 | __func__, transfertypes[wtype], hdrlen, rpclen, padlen, |
| 530 | headerp, base, rdmab_lkey(req->rl_rdmabuf)); | 527 | headerp, base, rdmab_lkey(req->rl_rdmabuf)); |
| 531 | 528 | ||
| 532 | /* | 529 | /* |
diff --git a/net/sunrpc/xprtrdma/transport.c b/net/sunrpc/xprtrdma/transport.c index 2e192baa59f3..54f23b1be986 100644 --- a/net/sunrpc/xprtrdma/transport.c +++ b/net/sunrpc/xprtrdma/transport.c | |||
| @@ -157,12 +157,47 @@ static struct ctl_table sunrpc_table[] = { | |||
| 157 | static struct rpc_xprt_ops xprt_rdma_procs; /* forward reference */ | 157 | static struct rpc_xprt_ops xprt_rdma_procs; /* forward reference */ |
| 158 | 158 | ||
| 159 | static void | 159 | static void |
| 160 | xprt_rdma_format_addresses4(struct rpc_xprt *xprt, struct sockaddr *sap) | ||
| 161 | { | ||
| 162 | struct sockaddr_in *sin = (struct sockaddr_in *)sap; | ||
| 163 | char buf[20]; | ||
| 164 | |||
| 165 | snprintf(buf, sizeof(buf), "%08x", ntohl(sin->sin_addr.s_addr)); | ||
| 166 | xprt->address_strings[RPC_DISPLAY_HEX_ADDR] = kstrdup(buf, GFP_KERNEL); | ||
| 167 | |||
| 168 | xprt->address_strings[RPC_DISPLAY_NETID] = RPCBIND_NETID_RDMA; | ||
| 169 | } | ||
| 170 | |||
| 171 | static void | ||
| 172 | xprt_rdma_format_addresses6(struct rpc_xprt *xprt, struct sockaddr *sap) | ||
| 173 | { | ||
| 174 | struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)sap; | ||
| 175 | char buf[40]; | ||
| 176 | |||
| 177 | snprintf(buf, sizeof(buf), "%pi6", &sin6->sin6_addr); | ||
| 178 | xprt->address_strings[RPC_DISPLAY_HEX_ADDR] = kstrdup(buf, GFP_KERNEL); | ||
| 179 | |||
| 180 | xprt->address_strings[RPC_DISPLAY_NETID] = RPCBIND_NETID_RDMA6; | ||
| 181 | } | ||
| 182 | |||
| 183 | static void | ||
| 160 | xprt_rdma_format_addresses(struct rpc_xprt *xprt) | 184 | xprt_rdma_format_addresses(struct rpc_xprt *xprt) |
| 161 | { | 185 | { |
| 162 | struct sockaddr *sap = (struct sockaddr *) | 186 | struct sockaddr *sap = (struct sockaddr *) |
| 163 | &rpcx_to_rdmad(xprt).addr; | 187 | &rpcx_to_rdmad(xprt).addr; |
| 164 | struct sockaddr_in *sin = (struct sockaddr_in *)sap; | 188 | char buf[128]; |
| 165 | char buf[64]; | 189 | |
| 190 | switch (sap->sa_family) { | ||
| 191 | case AF_INET: | ||
| 192 | xprt_rdma_format_addresses4(xprt, sap); | ||
| 193 | break; | ||
| 194 | case AF_INET6: | ||
| 195 | xprt_rdma_format_addresses6(xprt, sap); | ||
| 196 | break; | ||
| 197 | default: | ||
| 198 | pr_err("rpcrdma: Unrecognized address family\n"); | ||
| 199 | return; | ||
| 200 | } | ||
| 166 | 201 | ||
| 167 | (void)rpc_ntop(sap, buf, sizeof(buf)); | 202 | (void)rpc_ntop(sap, buf, sizeof(buf)); |
| 168 | xprt->address_strings[RPC_DISPLAY_ADDR] = kstrdup(buf, GFP_KERNEL); | 203 | xprt->address_strings[RPC_DISPLAY_ADDR] = kstrdup(buf, GFP_KERNEL); |
| @@ -170,16 +205,10 @@ xprt_rdma_format_addresses(struct rpc_xprt *xprt) | |||
| 170 | snprintf(buf, sizeof(buf), "%u", rpc_get_port(sap)); | 205 | snprintf(buf, sizeof(buf), "%u", rpc_get_port(sap)); |
| 171 | xprt->address_strings[RPC_DISPLAY_PORT] = kstrdup(buf, GFP_KERNEL); | 206 | xprt->address_strings[RPC_DISPLAY_PORT] = kstrdup(buf, GFP_KERNEL); |
| 172 | 207 | ||
| 173 | xprt->address_strings[RPC_DISPLAY_PROTO] = "rdma"; | ||
| 174 | |||
| 175 | snprintf(buf, sizeof(buf), "%08x", ntohl(sin->sin_addr.s_addr)); | ||
| 176 | xprt->address_strings[RPC_DISPLAY_HEX_ADDR] = kstrdup(buf, GFP_KERNEL); | ||
| 177 | |||
| 178 | snprintf(buf, sizeof(buf), "%4hx", rpc_get_port(sap)); | 208 | snprintf(buf, sizeof(buf), "%4hx", rpc_get_port(sap)); |
| 179 | xprt->address_strings[RPC_DISPLAY_HEX_PORT] = kstrdup(buf, GFP_KERNEL); | 209 | xprt->address_strings[RPC_DISPLAY_HEX_PORT] = kstrdup(buf, GFP_KERNEL); |
| 180 | 210 | ||
| 181 | /* netid */ | 211 | xprt->address_strings[RPC_DISPLAY_PROTO] = "rdma"; |
| 182 | xprt->address_strings[RPC_DISPLAY_NETID] = "rdma"; | ||
| 183 | } | 212 | } |
| 184 | 213 | ||
| 185 | static void | 214 | static void |
| @@ -377,7 +406,10 @@ xprt_setup_rdma(struct xprt_create *args) | |||
| 377 | xprt_rdma_connect_worker); | 406 | xprt_rdma_connect_worker); |
| 378 | 407 | ||
| 379 | xprt_rdma_format_addresses(xprt); | 408 | xprt_rdma_format_addresses(xprt); |
| 380 | xprt->max_payload = rpcrdma_max_payload(new_xprt); | 409 | xprt->max_payload = new_xprt->rx_ia.ri_ops->ro_maxpages(new_xprt); |
| 410 | if (xprt->max_payload == 0) | ||
| 411 | goto out4; | ||
| 412 | xprt->max_payload <<= PAGE_SHIFT; | ||
| 381 | dprintk("RPC: %s: transport data payload maximum: %zu bytes\n", | 413 | dprintk("RPC: %s: transport data payload maximum: %zu bytes\n", |
| 382 | __func__, xprt->max_payload); | 414 | __func__, xprt->max_payload); |
| 383 | 415 | ||
| @@ -552,8 +584,8 @@ xprt_rdma_free(void *buffer) | |||
| 552 | 584 | ||
| 553 | for (i = 0; req->rl_nchunks;) { | 585 | for (i = 0; req->rl_nchunks;) { |
| 554 | --req->rl_nchunks; | 586 | --req->rl_nchunks; |
| 555 | i += rpcrdma_deregister_external( | 587 | i += r_xprt->rx_ia.ri_ops->ro_unmap(r_xprt, |
| 556 | &req->rl_segments[i], r_xprt); | 588 | &req->rl_segments[i]); |
| 557 | } | 589 | } |
| 558 | 590 | ||
| 559 | rpcrdma_buffer_put(req); | 591 | rpcrdma_buffer_put(req); |
| @@ -579,10 +611,7 @@ xprt_rdma_send_request(struct rpc_task *task) | |||
| 579 | struct rpcrdma_xprt *r_xprt = rpcx_to_rdmax(xprt); | 611 | struct rpcrdma_xprt *r_xprt = rpcx_to_rdmax(xprt); |
| 580 | int rc = 0; | 612 | int rc = 0; |
| 581 | 613 | ||
| 582 | if (req->rl_niovs == 0) | 614 | rc = rpcrdma_marshal_req(rqst); |
| 583 | rc = rpcrdma_marshal_req(rqst); | ||
| 584 | else if (r_xprt->rx_ia.ri_memreg_strategy != RPCRDMA_ALLPHYSICAL) | ||
| 585 | rc = rpcrdma_marshal_chunks(rqst, 0); | ||
| 586 | if (rc < 0) | 615 | if (rc < 0) |
| 587 | goto failed_marshal; | 616 | goto failed_marshal; |
| 588 | 617 | ||
diff --git a/net/sunrpc/xprtrdma/verbs.c b/net/sunrpc/xprtrdma/verbs.c index e28909fddd30..4870d272e006 100644 --- a/net/sunrpc/xprtrdma/verbs.c +++ b/net/sunrpc/xprtrdma/verbs.c | |||
| @@ -50,6 +50,7 @@ | |||
| 50 | #include <linux/interrupt.h> | 50 | #include <linux/interrupt.h> |
| 51 | #include <linux/slab.h> | 51 | #include <linux/slab.h> |
| 52 | #include <linux/prefetch.h> | 52 | #include <linux/prefetch.h> |
| 53 | #include <linux/sunrpc/addr.h> | ||
| 53 | #include <asm/bitops.h> | 54 | #include <asm/bitops.h> |
| 54 | 55 | ||
| 55 | #include "xprt_rdma.h" | 56 | #include "xprt_rdma.h" |
| @@ -62,9 +63,6 @@ | |||
| 62 | # define RPCDBG_FACILITY RPCDBG_TRANS | 63 | # define RPCDBG_FACILITY RPCDBG_TRANS |
| 63 | #endif | 64 | #endif |
| 64 | 65 | ||
| 65 | static void rpcrdma_reset_frmrs(struct rpcrdma_ia *); | ||
| 66 | static void rpcrdma_reset_fmrs(struct rpcrdma_ia *); | ||
| 67 | |||
| 68 | /* | 66 | /* |
| 69 | * internal functions | 67 | * internal functions |
| 70 | */ | 68 | */ |
| @@ -188,7 +186,7 @@ static const char * const wc_status[] = { | |||
| 188 | "remote access error", | 186 | "remote access error", |
| 189 | "remote operation error", | 187 | "remote operation error", |
| 190 | "transport retry counter exceeded", | 188 | "transport retry counter exceeded", |
| 191 | "RNR retrycounter exceeded", | 189 | "RNR retry counter exceeded", |
| 192 | "local RDD violation error", | 190 | "local RDD violation error", |
| 193 | "remove invalid RD request", | 191 | "remove invalid RD request", |
| 194 | "operation aborted", | 192 | "operation aborted", |
| @@ -206,21 +204,17 @@ static const char * const wc_status[] = { | |||
| 206 | static void | 204 | static void |
| 207 | rpcrdma_sendcq_process_wc(struct ib_wc *wc) | 205 | rpcrdma_sendcq_process_wc(struct ib_wc *wc) |
| 208 | { | 206 | { |
| 209 | if (likely(wc->status == IB_WC_SUCCESS)) | ||
| 210 | return; | ||
| 211 | |||
| 212 | /* WARNING: Only wr_id and status are reliable at this point */ | 207 | /* WARNING: Only wr_id and status are reliable at this point */ |
| 213 | if (wc->wr_id == 0ULL) { | 208 | if (wc->wr_id == RPCRDMA_IGNORE_COMPLETION) { |
| 214 | if (wc->status != IB_WC_WR_FLUSH_ERR) | 209 | if (wc->status != IB_WC_SUCCESS && |
| 210 | wc->status != IB_WC_WR_FLUSH_ERR) | ||
| 215 | pr_err("RPC: %s: SEND: %s\n", | 211 | pr_err("RPC: %s: SEND: %s\n", |
| 216 | __func__, COMPLETION_MSG(wc->status)); | 212 | __func__, COMPLETION_MSG(wc->status)); |
| 217 | } else { | 213 | } else { |
| 218 | struct rpcrdma_mw *r; | 214 | struct rpcrdma_mw *r; |
| 219 | 215 | ||
| 220 | r = (struct rpcrdma_mw *)(unsigned long)wc->wr_id; | 216 | r = (struct rpcrdma_mw *)(unsigned long)wc->wr_id; |
| 221 | r->r.frmr.fr_state = FRMR_IS_STALE; | 217 | r->mw_sendcompletion(wc); |
| 222 | pr_err("RPC: %s: frmr %p (stale): %s\n", | ||
| 223 | __func__, r, COMPLETION_MSG(wc->status)); | ||
| 224 | } | 218 | } |
| 225 | } | 219 | } |
| 226 | 220 | ||
| @@ -424,7 +418,7 @@ rpcrdma_conn_upcall(struct rdma_cm_id *id, struct rdma_cm_event *event) | |||
| 424 | struct rpcrdma_ia *ia = &xprt->rx_ia; | 418 | struct rpcrdma_ia *ia = &xprt->rx_ia; |
| 425 | struct rpcrdma_ep *ep = &xprt->rx_ep; | 419 | struct rpcrdma_ep *ep = &xprt->rx_ep; |
| 426 | #if IS_ENABLED(CONFIG_SUNRPC_DEBUG) | 420 | #if IS_ENABLED(CONFIG_SUNRPC_DEBUG) |
| 427 | struct sockaddr_in *addr = (struct sockaddr_in *) &ep->rep_remote_addr; | 421 | struct sockaddr *sap = (struct sockaddr *)&ep->rep_remote_addr; |
| 428 | #endif | 422 | #endif |
| 429 | struct ib_qp_attr *attr = &ia->ri_qp_attr; | 423 | struct ib_qp_attr *attr = &ia->ri_qp_attr; |
| 430 | struct ib_qp_init_attr *iattr = &ia->ri_qp_init_attr; | 424 | struct ib_qp_init_attr *iattr = &ia->ri_qp_init_attr; |
| @@ -480,9 +474,8 @@ connected: | |||
| 480 | wake_up_all(&ep->rep_connect_wait); | 474 | wake_up_all(&ep->rep_connect_wait); |
| 481 | /*FALLTHROUGH*/ | 475 | /*FALLTHROUGH*/ |
| 482 | default: | 476 | default: |
| 483 | dprintk("RPC: %s: %pI4:%u (ep 0x%p): %s\n", | 477 | dprintk("RPC: %s: %pIS:%u (ep 0x%p): %s\n", |
| 484 | __func__, &addr->sin_addr.s_addr, | 478 | __func__, sap, rpc_get_port(sap), ep, |
| 485 | ntohs(addr->sin_port), ep, | ||
| 486 | CONNECTION_MSG(event->event)); | 479 | CONNECTION_MSG(event->event)); |
| 487 | break; | 480 | break; |
| 488 | } | 481 | } |
| @@ -491,19 +484,16 @@ connected: | |||
| 491 | if (connstate == 1) { | 484 | if (connstate == 1) { |
| 492 | int ird = attr->max_dest_rd_atomic; | 485 | int ird = attr->max_dest_rd_atomic; |
| 493 | int tird = ep->rep_remote_cma.responder_resources; | 486 | int tird = ep->rep_remote_cma.responder_resources; |
| 494 | printk(KERN_INFO "rpcrdma: connection to %pI4:%u " | 487 | |
| 495 | "on %s, memreg %d slots %d ird %d%s\n", | 488 | pr_info("rpcrdma: connection to %pIS:%u on %s, memreg '%s', %d credits, %d responders%s\n", |
| 496 | &addr->sin_addr.s_addr, | 489 | sap, rpc_get_port(sap), |
| 497 | ntohs(addr->sin_port), | ||
| 498 | ia->ri_id->device->name, | 490 | ia->ri_id->device->name, |
| 499 | ia->ri_memreg_strategy, | 491 | ia->ri_ops->ro_displayname, |
| 500 | xprt->rx_buf.rb_max_requests, | 492 | xprt->rx_buf.rb_max_requests, |
| 501 | ird, ird < 4 && ird < tird / 2 ? " (low!)" : ""); | 493 | ird, ird < 4 && ird < tird / 2 ? " (low!)" : ""); |
| 502 | } else if (connstate < 0) { | 494 | } else if (connstate < 0) { |
| 503 | printk(KERN_INFO "rpcrdma: connection to %pI4:%u closed (%d)\n", | 495 | pr_info("rpcrdma: connection to %pIS:%u closed (%d)\n", |
| 504 | &addr->sin_addr.s_addr, | 496 | sap, rpc_get_port(sap), connstate); |
| 505 | ntohs(addr->sin_port), | ||
| 506 | connstate); | ||
| 507 | } | 497 | } |
| 508 | #endif | 498 | #endif |
| 509 | 499 | ||
| @@ -621,17 +611,13 @@ rpcrdma_ia_open(struct rpcrdma_xprt *xprt, struct sockaddr *addr, int memreg) | |||
| 621 | 611 | ||
| 622 | if (memreg == RPCRDMA_FRMR) { | 612 | if (memreg == RPCRDMA_FRMR) { |
| 623 | /* Requires both frmr reg and local dma lkey */ | 613 | /* Requires both frmr reg and local dma lkey */ |
| 624 | if ((devattr->device_cap_flags & | 614 | if (((devattr->device_cap_flags & |
| 625 | (IB_DEVICE_MEM_MGT_EXTENSIONS|IB_DEVICE_LOCAL_DMA_LKEY)) != | 615 | (IB_DEVICE_MEM_MGT_EXTENSIONS|IB_DEVICE_LOCAL_DMA_LKEY)) != |
| 626 | (IB_DEVICE_MEM_MGT_EXTENSIONS|IB_DEVICE_LOCAL_DMA_LKEY)) { | 616 | (IB_DEVICE_MEM_MGT_EXTENSIONS|IB_DEVICE_LOCAL_DMA_LKEY)) || |
| 617 | (devattr->max_fast_reg_page_list_len == 0)) { | ||
| 627 | dprintk("RPC: %s: FRMR registration " | 618 | dprintk("RPC: %s: FRMR registration " |
| 628 | "not supported by HCA\n", __func__); | 619 | "not supported by HCA\n", __func__); |
| 629 | memreg = RPCRDMA_MTHCAFMR; | 620 | memreg = RPCRDMA_MTHCAFMR; |
| 630 | } else { | ||
| 631 | /* Mind the ia limit on FRMR page list depth */ | ||
| 632 | ia->ri_max_frmr_depth = min_t(unsigned int, | ||
| 633 | RPCRDMA_MAX_DATA_SEGS, | ||
| 634 | devattr->max_fast_reg_page_list_len); | ||
| 635 | } | 621 | } |
| 636 | } | 622 | } |
| 637 | if (memreg == RPCRDMA_MTHCAFMR) { | 623 | if (memreg == RPCRDMA_MTHCAFMR) { |
| @@ -652,13 +638,16 @@ rpcrdma_ia_open(struct rpcrdma_xprt *xprt, struct sockaddr *addr, int memreg) | |||
| 652 | */ | 638 | */ |
| 653 | switch (memreg) { | 639 | switch (memreg) { |
| 654 | case RPCRDMA_FRMR: | 640 | case RPCRDMA_FRMR: |
| 641 | ia->ri_ops = &rpcrdma_frwr_memreg_ops; | ||
| 655 | break; | 642 | break; |
| 656 | case RPCRDMA_ALLPHYSICAL: | 643 | case RPCRDMA_ALLPHYSICAL: |
| 644 | ia->ri_ops = &rpcrdma_physical_memreg_ops; | ||
| 657 | mem_priv = IB_ACCESS_LOCAL_WRITE | | 645 | mem_priv = IB_ACCESS_LOCAL_WRITE | |
| 658 | IB_ACCESS_REMOTE_WRITE | | 646 | IB_ACCESS_REMOTE_WRITE | |
| 659 | IB_ACCESS_REMOTE_READ; | 647 | IB_ACCESS_REMOTE_READ; |
| 660 | goto register_setup; | 648 | goto register_setup; |
| 661 | case RPCRDMA_MTHCAFMR: | 649 | case RPCRDMA_MTHCAFMR: |
| 650 | ia->ri_ops = &rpcrdma_fmr_memreg_ops; | ||
| 662 | if (ia->ri_have_dma_lkey) | 651 | if (ia->ri_have_dma_lkey) |
| 663 | break; | 652 | break; |
| 664 | mem_priv = IB_ACCESS_LOCAL_WRITE; | 653 | mem_priv = IB_ACCESS_LOCAL_WRITE; |
| @@ -678,8 +667,8 @@ rpcrdma_ia_open(struct rpcrdma_xprt *xprt, struct sockaddr *addr, int memreg) | |||
| 678 | rc = -ENOMEM; | 667 | rc = -ENOMEM; |
| 679 | goto out3; | 668 | goto out3; |
| 680 | } | 669 | } |
| 681 | dprintk("RPC: %s: memory registration strategy is %d\n", | 670 | dprintk("RPC: %s: memory registration strategy is '%s'\n", |
| 682 | __func__, memreg); | 671 | __func__, ia->ri_ops->ro_displayname); |
| 683 | 672 | ||
| 684 | /* Else will do memory reg/dereg for each chunk */ | 673 | /* Else will do memory reg/dereg for each chunk */ |
| 685 | ia->ri_memreg_strategy = memreg; | 674 | ia->ri_memreg_strategy = memreg; |
| @@ -743,49 +732,11 @@ rpcrdma_ep_create(struct rpcrdma_ep *ep, struct rpcrdma_ia *ia, | |||
| 743 | 732 | ||
| 744 | ep->rep_attr.event_handler = rpcrdma_qp_async_error_upcall; | 733 | ep->rep_attr.event_handler = rpcrdma_qp_async_error_upcall; |
| 745 | ep->rep_attr.qp_context = ep; | 734 | ep->rep_attr.qp_context = ep; |
| 746 | /* send_cq and recv_cq initialized below */ | ||
| 747 | ep->rep_attr.srq = NULL; | 735 | ep->rep_attr.srq = NULL; |
| 748 | ep->rep_attr.cap.max_send_wr = cdata->max_requests; | 736 | ep->rep_attr.cap.max_send_wr = cdata->max_requests; |
| 749 | switch (ia->ri_memreg_strategy) { | 737 | rc = ia->ri_ops->ro_open(ia, ep, cdata); |
| 750 | case RPCRDMA_FRMR: { | 738 | if (rc) |
| 751 | int depth = 7; | 739 | return rc; |
| 752 | |||
| 753 | /* Add room for frmr register and invalidate WRs. | ||
| 754 | * 1. FRMR reg WR for head | ||
| 755 | * 2. FRMR invalidate WR for head | ||
| 756 | * 3. N FRMR reg WRs for pagelist | ||
| 757 | * 4. N FRMR invalidate WRs for pagelist | ||
| 758 | * 5. FRMR reg WR for tail | ||
| 759 | * 6. FRMR invalidate WR for tail | ||
| 760 | * 7. The RDMA_SEND WR | ||
| 761 | */ | ||
| 762 | |||
| 763 | /* Calculate N if the device max FRMR depth is smaller than | ||
| 764 | * RPCRDMA_MAX_DATA_SEGS. | ||
| 765 | */ | ||
| 766 | if (ia->ri_max_frmr_depth < RPCRDMA_MAX_DATA_SEGS) { | ||
| 767 | int delta = RPCRDMA_MAX_DATA_SEGS - | ||
| 768 | ia->ri_max_frmr_depth; | ||
| 769 | |||
| 770 | do { | ||
| 771 | depth += 2; /* FRMR reg + invalidate */ | ||
| 772 | delta -= ia->ri_max_frmr_depth; | ||
| 773 | } while (delta > 0); | ||
| 774 | |||
| 775 | } | ||
| 776 | ep->rep_attr.cap.max_send_wr *= depth; | ||
| 777 | if (ep->rep_attr.cap.max_send_wr > devattr->max_qp_wr) { | ||
| 778 | cdata->max_requests = devattr->max_qp_wr / depth; | ||
| 779 | if (!cdata->max_requests) | ||
| 780 | return -EINVAL; | ||
| 781 | ep->rep_attr.cap.max_send_wr = cdata->max_requests * | ||
| 782 | depth; | ||
| 783 | } | ||
| 784 | break; | ||
| 785 | } | ||
| 786 | default: | ||
| 787 | break; | ||
| 788 | } | ||
| 789 | ep->rep_attr.cap.max_recv_wr = cdata->max_requests; | 740 | ep->rep_attr.cap.max_recv_wr = cdata->max_requests; |
| 790 | ep->rep_attr.cap.max_send_sge = (cdata->padding ? 4 : 2); | 741 | ep->rep_attr.cap.max_send_sge = (cdata->padding ? 4 : 2); |
| 791 | ep->rep_attr.cap.max_recv_sge = 1; | 742 | ep->rep_attr.cap.max_recv_sge = 1; |
| @@ -944,21 +895,9 @@ retry: | |||
| 944 | rpcrdma_ep_disconnect(ep, ia); | 895 | rpcrdma_ep_disconnect(ep, ia); |
| 945 | rpcrdma_flush_cqs(ep); | 896 | rpcrdma_flush_cqs(ep); |
| 946 | 897 | ||
| 947 | switch (ia->ri_memreg_strategy) { | ||
| 948 | case RPCRDMA_FRMR: | ||
| 949 | rpcrdma_reset_frmrs(ia); | ||
| 950 | break; | ||
| 951 | case RPCRDMA_MTHCAFMR: | ||
| 952 | rpcrdma_reset_fmrs(ia); | ||
| 953 | break; | ||
| 954 | case RPCRDMA_ALLPHYSICAL: | ||
| 955 | break; | ||
| 956 | default: | ||
| 957 | rc = -EIO; | ||
| 958 | goto out; | ||
| 959 | } | ||
| 960 | |||
| 961 | xprt = container_of(ia, struct rpcrdma_xprt, rx_ia); | 898 | xprt = container_of(ia, struct rpcrdma_xprt, rx_ia); |
| 899 | ia->ri_ops->ro_reset(xprt); | ||
| 900 | |||
| 962 | id = rpcrdma_create_id(xprt, ia, | 901 | id = rpcrdma_create_id(xprt, ia, |
| 963 | (struct sockaddr *)&xprt->rx_data.addr); | 902 | (struct sockaddr *)&xprt->rx_data.addr); |
| 964 | if (IS_ERR(id)) { | 903 | if (IS_ERR(id)) { |
| @@ -1123,91 +1062,6 @@ out: | |||
| 1123 | return ERR_PTR(rc); | 1062 | return ERR_PTR(rc); |
| 1124 | } | 1063 | } |
| 1125 | 1064 | ||
| 1126 | static int | ||
| 1127 | rpcrdma_init_fmrs(struct rpcrdma_ia *ia, struct rpcrdma_buffer *buf) | ||
| 1128 | { | ||
| 1129 | int mr_access_flags = IB_ACCESS_REMOTE_WRITE | IB_ACCESS_REMOTE_READ; | ||
| 1130 | struct ib_fmr_attr fmr_attr = { | ||
| 1131 | .max_pages = RPCRDMA_MAX_DATA_SEGS, | ||
| 1132 | .max_maps = 1, | ||
| 1133 | .page_shift = PAGE_SHIFT | ||
| 1134 | }; | ||
| 1135 | struct rpcrdma_mw *r; | ||
| 1136 | int i, rc; | ||
| 1137 | |||
| 1138 | i = (buf->rb_max_requests + 1) * RPCRDMA_MAX_SEGS; | ||
| 1139 | dprintk("RPC: %s: initializing %d FMRs\n", __func__, i); | ||
| 1140 | |||
| 1141 | while (i--) { | ||
| 1142 | r = kzalloc(sizeof(*r), GFP_KERNEL); | ||
| 1143 | if (r == NULL) | ||
| 1144 | return -ENOMEM; | ||
| 1145 | |||
| 1146 | r->r.fmr = ib_alloc_fmr(ia->ri_pd, mr_access_flags, &fmr_attr); | ||
| 1147 | if (IS_ERR(r->r.fmr)) { | ||
| 1148 | rc = PTR_ERR(r->r.fmr); | ||
| 1149 | dprintk("RPC: %s: ib_alloc_fmr failed %i\n", | ||
| 1150 | __func__, rc); | ||
| 1151 | goto out_free; | ||
| 1152 | } | ||
| 1153 | |||
| 1154 | list_add(&r->mw_list, &buf->rb_mws); | ||
| 1155 | list_add(&r->mw_all, &buf->rb_all); | ||
| 1156 | } | ||
| 1157 | return 0; | ||
| 1158 | |||
| 1159 | out_free: | ||
| 1160 | kfree(r); | ||
| 1161 | return rc; | ||
| 1162 | } | ||
| 1163 | |||
| 1164 | static int | ||
| 1165 | rpcrdma_init_frmrs(struct rpcrdma_ia *ia, struct rpcrdma_buffer *buf) | ||
| 1166 | { | ||
| 1167 | struct rpcrdma_frmr *f; | ||
| 1168 | struct rpcrdma_mw *r; | ||
| 1169 | int i, rc; | ||
| 1170 | |||
| 1171 | i = (buf->rb_max_requests + 1) * RPCRDMA_MAX_SEGS; | ||
| 1172 | dprintk("RPC: %s: initializing %d FRMRs\n", __func__, i); | ||
| 1173 | |||
| 1174 | while (i--) { | ||
| 1175 | r = kzalloc(sizeof(*r), GFP_KERNEL); | ||
| 1176 | if (r == NULL) | ||
| 1177 | return -ENOMEM; | ||
| 1178 | f = &r->r.frmr; | ||
| 1179 | |||
| 1180 | f->fr_mr = ib_alloc_fast_reg_mr(ia->ri_pd, | ||
| 1181 | ia->ri_max_frmr_depth); | ||
| 1182 | if (IS_ERR(f->fr_mr)) { | ||
| 1183 | rc = PTR_ERR(f->fr_mr); | ||
| 1184 | dprintk("RPC: %s: ib_alloc_fast_reg_mr " | ||
| 1185 | "failed %i\n", __func__, rc); | ||
| 1186 | goto out_free; | ||
| 1187 | } | ||
| 1188 | |||
| 1189 | f->fr_pgl = ib_alloc_fast_reg_page_list(ia->ri_id->device, | ||
| 1190 | ia->ri_max_frmr_depth); | ||
| 1191 | if (IS_ERR(f->fr_pgl)) { | ||
| 1192 | rc = PTR_ERR(f->fr_pgl); | ||
| 1193 | dprintk("RPC: %s: ib_alloc_fast_reg_page_list " | ||
| 1194 | "failed %i\n", __func__, rc); | ||
| 1195 | |||
| 1196 | ib_dereg_mr(f->fr_mr); | ||
| 1197 | goto out_free; | ||
| 1198 | } | ||
| 1199 | |||
| 1200 | list_add(&r->mw_list, &buf->rb_mws); | ||
| 1201 | list_add(&r->mw_all, &buf->rb_all); | ||
| 1202 | } | ||
| 1203 | |||
| 1204 | return 0; | ||
| 1205 | |||
| 1206 | out_free: | ||
| 1207 | kfree(r); | ||
| 1208 | return rc; | ||
| 1209 | } | ||
| 1210 | |||
| 1211 | int | 1065 | int |
| 1212 | rpcrdma_buffer_create(struct rpcrdma_xprt *r_xprt) | 1066 | rpcrdma_buffer_create(struct rpcrdma_xprt *r_xprt) |
| 1213 | { | 1067 | { |
| @@ -1244,22 +1098,9 @@ rpcrdma_buffer_create(struct rpcrdma_xprt *r_xprt) | |||
| 1244 | buf->rb_recv_bufs = (struct rpcrdma_rep **) p; | 1098 | buf->rb_recv_bufs = (struct rpcrdma_rep **) p; |
| 1245 | p = (char *) &buf->rb_recv_bufs[buf->rb_max_requests]; | 1099 | p = (char *) &buf->rb_recv_bufs[buf->rb_max_requests]; |
| 1246 | 1100 | ||
| 1247 | INIT_LIST_HEAD(&buf->rb_mws); | 1101 | rc = ia->ri_ops->ro_init(r_xprt); |
| 1248 | INIT_LIST_HEAD(&buf->rb_all); | 1102 | if (rc) |
| 1249 | switch (ia->ri_memreg_strategy) { | 1103 | goto out; |
| 1250 | case RPCRDMA_FRMR: | ||
| 1251 | rc = rpcrdma_init_frmrs(ia, buf); | ||
| 1252 | if (rc) | ||
| 1253 | goto out; | ||
| 1254 | break; | ||
| 1255 | case RPCRDMA_MTHCAFMR: | ||
| 1256 | rc = rpcrdma_init_fmrs(ia, buf); | ||
| 1257 | if (rc) | ||
| 1258 | goto out; | ||
| 1259 | break; | ||
| 1260 | default: | ||
| 1261 | break; | ||
| 1262 | } | ||
| 1263 | 1104 | ||
| 1264 | for (i = 0; i < buf->rb_max_requests; i++) { | 1105 | for (i = 0; i < buf->rb_max_requests; i++) { |
| 1265 | struct rpcrdma_req *req; | 1106 | struct rpcrdma_req *req; |
| @@ -1311,47 +1152,6 @@ rpcrdma_destroy_req(struct rpcrdma_ia *ia, struct rpcrdma_req *req) | |||
| 1311 | kfree(req); | 1152 | kfree(req); |
| 1312 | } | 1153 | } |
| 1313 | 1154 | ||
| 1314 | static void | ||
| 1315 | rpcrdma_destroy_fmrs(struct rpcrdma_buffer *buf) | ||
| 1316 | { | ||
| 1317 | struct rpcrdma_mw *r; | ||
| 1318 | int rc; | ||
| 1319 | |||
| 1320 | while (!list_empty(&buf->rb_all)) { | ||
| 1321 | r = list_entry(buf->rb_all.next, struct rpcrdma_mw, mw_all); | ||
| 1322 | list_del(&r->mw_all); | ||
| 1323 | list_del(&r->mw_list); | ||
| 1324 | |||
| 1325 | rc = ib_dealloc_fmr(r->r.fmr); | ||
| 1326 | if (rc) | ||
| 1327 | dprintk("RPC: %s: ib_dealloc_fmr failed %i\n", | ||
| 1328 | __func__, rc); | ||
| 1329 | |||
| 1330 | kfree(r); | ||
| 1331 | } | ||
| 1332 | } | ||
| 1333 | |||
| 1334 | static void | ||
| 1335 | rpcrdma_destroy_frmrs(struct rpcrdma_buffer *buf) | ||
| 1336 | { | ||
| 1337 | struct rpcrdma_mw *r; | ||
| 1338 | int rc; | ||
| 1339 | |||
| 1340 | while (!list_empty(&buf->rb_all)) { | ||
| 1341 | r = list_entry(buf->rb_all.next, struct rpcrdma_mw, mw_all); | ||
| 1342 | list_del(&r->mw_all); | ||
| 1343 | list_del(&r->mw_list); | ||
| 1344 | |||
| 1345 | rc = ib_dereg_mr(r->r.frmr.fr_mr); | ||
| 1346 | if (rc) | ||
| 1347 | dprintk("RPC: %s: ib_dereg_mr failed %i\n", | ||
| 1348 | __func__, rc); | ||
| 1349 | ib_free_fast_reg_page_list(r->r.frmr.fr_pgl); | ||
| 1350 | |||
| 1351 | kfree(r); | ||
| 1352 | } | ||
| 1353 | } | ||
| 1354 | |||
| 1355 | void | 1155 | void |
| 1356 | rpcrdma_buffer_destroy(struct rpcrdma_buffer *buf) | 1156 | rpcrdma_buffer_destroy(struct rpcrdma_buffer *buf) |
| 1357 | { | 1157 | { |
| @@ -1372,104 +1172,11 @@ rpcrdma_buffer_destroy(struct rpcrdma_buffer *buf) | |||
| 1372 | rpcrdma_destroy_req(ia, buf->rb_send_bufs[i]); | 1172 | rpcrdma_destroy_req(ia, buf->rb_send_bufs[i]); |
| 1373 | } | 1173 | } |
| 1374 | 1174 | ||
| 1375 | switch (ia->ri_memreg_strategy) { | 1175 | ia->ri_ops->ro_destroy(buf); |
| 1376 | case RPCRDMA_FRMR: | ||
| 1377 | rpcrdma_destroy_frmrs(buf); | ||
| 1378 | break; | ||
| 1379 | case RPCRDMA_MTHCAFMR: | ||
| 1380 | rpcrdma_destroy_fmrs(buf); | ||
| 1381 | break; | ||
| 1382 | default: | ||
| 1383 | break; | ||
| 1384 | } | ||
| 1385 | 1176 | ||
| 1386 | kfree(buf->rb_pool); | 1177 | kfree(buf->rb_pool); |
| 1387 | } | 1178 | } |
| 1388 | 1179 | ||
| 1389 | /* After a disconnect, unmap all FMRs. | ||
| 1390 | * | ||
| 1391 | * This is invoked only in the transport connect worker in order | ||
| 1392 | * to serialize with rpcrdma_register_fmr_external(). | ||
| 1393 | */ | ||
| 1394 | static void | ||
| 1395 | rpcrdma_reset_fmrs(struct rpcrdma_ia *ia) | ||
| 1396 | { | ||
| 1397 | struct rpcrdma_xprt *r_xprt = | ||
| 1398 | container_of(ia, struct rpcrdma_xprt, rx_ia); | ||
| 1399 | struct rpcrdma_buffer *buf = &r_xprt->rx_buf; | ||
| 1400 | struct list_head *pos; | ||
| 1401 | struct rpcrdma_mw *r; | ||
| 1402 | LIST_HEAD(l); | ||
| 1403 | int rc; | ||
| 1404 | |||
| 1405 | list_for_each(pos, &buf->rb_all) { | ||
| 1406 | r = list_entry(pos, struct rpcrdma_mw, mw_all); | ||
| 1407 | |||
| 1408 | INIT_LIST_HEAD(&l); | ||
| 1409 | list_add(&r->r.fmr->list, &l); | ||
| 1410 | rc = ib_unmap_fmr(&l); | ||
| 1411 | if (rc) | ||
| 1412 | dprintk("RPC: %s: ib_unmap_fmr failed %i\n", | ||
| 1413 | __func__, rc); | ||
| 1414 | } | ||
| 1415 | } | ||
| 1416 | |||
| 1417 | /* After a disconnect, a flushed FAST_REG_MR can leave an FRMR in | ||
| 1418 | * an unusable state. Find FRMRs in this state and dereg / reg | ||
| 1419 | * each. FRMRs that are VALID and attached to an rpcrdma_req are | ||
| 1420 | * also torn down. | ||
| 1421 | * | ||
| 1422 | * This gives all in-use FRMRs a fresh rkey and leaves them INVALID. | ||
| 1423 | * | ||
| 1424 | * This is invoked only in the transport connect worker in order | ||
| 1425 | * to serialize with rpcrdma_register_frmr_external(). | ||
| 1426 | */ | ||
| 1427 | static void | ||
| 1428 | rpcrdma_reset_frmrs(struct rpcrdma_ia *ia) | ||
| 1429 | { | ||
| 1430 | struct rpcrdma_xprt *r_xprt = | ||
| 1431 | container_of(ia, struct rpcrdma_xprt, rx_ia); | ||
| 1432 | struct rpcrdma_buffer *buf = &r_xprt->rx_buf; | ||
| 1433 | struct list_head *pos; | ||
| 1434 | struct rpcrdma_mw *r; | ||
| 1435 | int rc; | ||
| 1436 | |||
| 1437 | list_for_each(pos, &buf->rb_all) { | ||
| 1438 | r = list_entry(pos, struct rpcrdma_mw, mw_all); | ||
| 1439 | |||
| 1440 | if (r->r.frmr.fr_state == FRMR_IS_INVALID) | ||
| 1441 | continue; | ||
| 1442 | |||
| 1443 | rc = ib_dereg_mr(r->r.frmr.fr_mr); | ||
| 1444 | if (rc) | ||
| 1445 | dprintk("RPC: %s: ib_dereg_mr failed %i\n", | ||
| 1446 | __func__, rc); | ||
| 1447 | ib_free_fast_reg_page_list(r->r.frmr.fr_pgl); | ||
| 1448 | |||
| 1449 | r->r.frmr.fr_mr = ib_alloc_fast_reg_mr(ia->ri_pd, | ||
| 1450 | ia->ri_max_frmr_depth); | ||
| 1451 | if (IS_ERR(r->r.frmr.fr_mr)) { | ||
| 1452 | rc = PTR_ERR(r->r.frmr.fr_mr); | ||
| 1453 | dprintk("RPC: %s: ib_alloc_fast_reg_mr" | ||
| 1454 | " failed %i\n", __func__, rc); | ||
| 1455 | continue; | ||
| 1456 | } | ||
| 1457 | r->r.frmr.fr_pgl = ib_alloc_fast_reg_page_list( | ||
| 1458 | ia->ri_id->device, | ||
| 1459 | ia->ri_max_frmr_depth); | ||
| 1460 | if (IS_ERR(r->r.frmr.fr_pgl)) { | ||
| 1461 | rc = PTR_ERR(r->r.frmr.fr_pgl); | ||
| 1462 | dprintk("RPC: %s: " | ||
| 1463 | "ib_alloc_fast_reg_page_list " | ||
| 1464 | "failed %i\n", __func__, rc); | ||
| 1465 | |||
| 1466 | ib_dereg_mr(r->r.frmr.fr_mr); | ||
| 1467 | continue; | ||
| 1468 | } | ||
| 1469 | r->r.frmr.fr_state = FRMR_IS_INVALID; | ||
| 1470 | } | ||
| 1471 | } | ||
| 1472 | |||
| 1473 | /* "*mw" can be NULL when rpcrdma_buffer_get_mrs() fails, leaving | 1180 | /* "*mw" can be NULL when rpcrdma_buffer_get_mrs() fails, leaving |
| 1474 | * some req segments uninitialized. | 1181 | * some req segments uninitialized. |
| 1475 | */ | 1182 | */ |
| @@ -1509,7 +1216,7 @@ rpcrdma_buffer_put_sendbuf(struct rpcrdma_req *req, struct rpcrdma_buffer *buf) | |||
| 1509 | } | 1216 | } |
| 1510 | } | 1217 | } |
| 1511 | 1218 | ||
| 1512 | /* rpcrdma_unmap_one() was already done by rpcrdma_deregister_frmr_external(). | 1219 | /* rpcrdma_unmap_one() was already done during deregistration. |
| 1513 | * Redo only the ib_post_send(). | 1220 | * Redo only the ib_post_send(). |
| 1514 | */ | 1221 | */ |
| 1515 | static void | 1222 | static void |
| @@ -1729,6 +1436,14 @@ rpcrdma_recv_buffer_put(struct rpcrdma_rep *rep) | |||
| 1729 | * Wrappers for internal-use kmalloc memory registration, used by buffer code. | 1436 | * Wrappers for internal-use kmalloc memory registration, used by buffer code. |
| 1730 | */ | 1437 | */ |
| 1731 | 1438 | ||
| 1439 | void | ||
| 1440 | rpcrdma_mapping_error(struct rpcrdma_mr_seg *seg) | ||
| 1441 | { | ||
| 1442 | dprintk("RPC: map_one: offset %p iova %llx len %zu\n", | ||
| 1443 | seg->mr_offset, | ||
| 1444 | (unsigned long long)seg->mr_dma, seg->mr_dmalen); | ||
| 1445 | } | ||
| 1446 | |||
| 1732 | static int | 1447 | static int |
| 1733 | rpcrdma_register_internal(struct rpcrdma_ia *ia, void *va, int len, | 1448 | rpcrdma_register_internal(struct rpcrdma_ia *ia, void *va, int len, |
| 1734 | struct ib_mr **mrp, struct ib_sge *iov) | 1449 | struct ib_mr **mrp, struct ib_sge *iov) |
| @@ -1854,287 +1569,6 @@ rpcrdma_free_regbuf(struct rpcrdma_ia *ia, struct rpcrdma_regbuf *rb) | |||
| 1854 | } | 1569 | } |
| 1855 | 1570 | ||
| 1856 | /* | 1571 | /* |
| 1857 | * Wrappers for chunk registration, shared by read/write chunk code. | ||
| 1858 | */ | ||
| 1859 | |||
| 1860 | static void | ||
| 1861 | rpcrdma_map_one(struct rpcrdma_ia *ia, struct rpcrdma_mr_seg *seg, int writing) | ||
| 1862 | { | ||
| 1863 | seg->mr_dir = writing ? DMA_FROM_DEVICE : DMA_TO_DEVICE; | ||
| 1864 | seg->mr_dmalen = seg->mr_len; | ||
| 1865 | if (seg->mr_page) | ||
| 1866 | seg->mr_dma = ib_dma_map_page(ia->ri_id->device, | ||
| 1867 | seg->mr_page, offset_in_page(seg->mr_offset), | ||
| 1868 | seg->mr_dmalen, seg->mr_dir); | ||
| 1869 | else | ||
| 1870 | seg->mr_dma = ib_dma_map_single(ia->ri_id->device, | ||
| 1871 | seg->mr_offset, | ||
| 1872 | seg->mr_dmalen, seg->mr_dir); | ||
| 1873 | if (ib_dma_mapping_error(ia->ri_id->device, seg->mr_dma)) { | ||
| 1874 | dprintk("RPC: %s: mr_dma %llx mr_offset %p mr_dma_len %zu\n", | ||
| 1875 | __func__, | ||
| 1876 | (unsigned long long)seg->mr_dma, | ||
| 1877 | seg->mr_offset, seg->mr_dmalen); | ||
| 1878 | } | ||
| 1879 | } | ||
| 1880 | |||
| 1881 | static void | ||
| 1882 | rpcrdma_unmap_one(struct rpcrdma_ia *ia, struct rpcrdma_mr_seg *seg) | ||
| 1883 | { | ||
| 1884 | if (seg->mr_page) | ||
| 1885 | ib_dma_unmap_page(ia->ri_id->device, | ||
| 1886 | seg->mr_dma, seg->mr_dmalen, seg->mr_dir); | ||
| 1887 | else | ||
| 1888 | ib_dma_unmap_single(ia->ri_id->device, | ||
| 1889 | seg->mr_dma, seg->mr_dmalen, seg->mr_dir); | ||
| 1890 | } | ||
| 1891 | |||
| 1892 | static int | ||
| 1893 | rpcrdma_register_frmr_external(struct rpcrdma_mr_seg *seg, | ||
| 1894 | int *nsegs, int writing, struct rpcrdma_ia *ia, | ||
| 1895 | struct rpcrdma_xprt *r_xprt) | ||
| 1896 | { | ||
| 1897 | struct rpcrdma_mr_seg *seg1 = seg; | ||
| 1898 | struct rpcrdma_mw *mw = seg1->rl_mw; | ||
| 1899 | struct rpcrdma_frmr *frmr = &mw->r.frmr; | ||
| 1900 | struct ib_mr *mr = frmr->fr_mr; | ||
| 1901 | struct ib_send_wr fastreg_wr, *bad_wr; | ||
| 1902 | u8 key; | ||
| 1903 | int len, pageoff; | ||
| 1904 | int i, rc; | ||
| 1905 | int seg_len; | ||
| 1906 | u64 pa; | ||
| 1907 | int page_no; | ||
| 1908 | |||
| 1909 | pageoff = offset_in_page(seg1->mr_offset); | ||
| 1910 | seg1->mr_offset -= pageoff; /* start of page */ | ||
| 1911 | seg1->mr_len += pageoff; | ||
| 1912 | len = -pageoff; | ||
| 1913 | if (*nsegs > ia->ri_max_frmr_depth) | ||
| 1914 | *nsegs = ia->ri_max_frmr_depth; | ||
| 1915 | for (page_no = i = 0; i < *nsegs;) { | ||
| 1916 | rpcrdma_map_one(ia, seg, writing); | ||
| 1917 | pa = seg->mr_dma; | ||
| 1918 | for (seg_len = seg->mr_len; seg_len > 0; seg_len -= PAGE_SIZE) { | ||
| 1919 | frmr->fr_pgl->page_list[page_no++] = pa; | ||
| 1920 | pa += PAGE_SIZE; | ||
| 1921 | } | ||
| 1922 | len += seg->mr_len; | ||
| 1923 | ++seg; | ||
| 1924 | ++i; | ||
| 1925 | /* Check for holes */ | ||
| 1926 | if ((i < *nsegs && offset_in_page(seg->mr_offset)) || | ||
| 1927 | offset_in_page((seg-1)->mr_offset + (seg-1)->mr_len)) | ||
| 1928 | break; | ||
| 1929 | } | ||
| 1930 | dprintk("RPC: %s: Using frmr %p to map %d segments\n", | ||
| 1931 | __func__, mw, i); | ||
| 1932 | |||
| 1933 | frmr->fr_state = FRMR_IS_VALID; | ||
| 1934 | |||
| 1935 | memset(&fastreg_wr, 0, sizeof(fastreg_wr)); | ||
| 1936 | fastreg_wr.wr_id = (unsigned long)(void *)mw; | ||
| 1937 | fastreg_wr.opcode = IB_WR_FAST_REG_MR; | ||
| 1938 | fastreg_wr.wr.fast_reg.iova_start = seg1->mr_dma; | ||
| 1939 | fastreg_wr.wr.fast_reg.page_list = frmr->fr_pgl; | ||
| 1940 | fastreg_wr.wr.fast_reg.page_list_len = page_no; | ||
| 1941 | fastreg_wr.wr.fast_reg.page_shift = PAGE_SHIFT; | ||
| 1942 | fastreg_wr.wr.fast_reg.length = page_no << PAGE_SHIFT; | ||
| 1943 | if (fastreg_wr.wr.fast_reg.length < len) { | ||
| 1944 | rc = -EIO; | ||
| 1945 | goto out_err; | ||
| 1946 | } | ||
| 1947 | |||
| 1948 | /* Bump the key */ | ||
| 1949 | key = (u8)(mr->rkey & 0x000000FF); | ||
| 1950 | ib_update_fast_reg_key(mr, ++key); | ||
| 1951 | |||
| 1952 | fastreg_wr.wr.fast_reg.access_flags = (writing ? | ||
| 1953 | IB_ACCESS_REMOTE_WRITE | IB_ACCESS_LOCAL_WRITE : | ||
| 1954 | IB_ACCESS_REMOTE_READ); | ||
| 1955 | fastreg_wr.wr.fast_reg.rkey = mr->rkey; | ||
| 1956 | DECR_CQCOUNT(&r_xprt->rx_ep); | ||
| 1957 | |||
| 1958 | rc = ib_post_send(ia->ri_id->qp, &fastreg_wr, &bad_wr); | ||
| 1959 | if (rc) { | ||
| 1960 | dprintk("RPC: %s: failed ib_post_send for register," | ||
| 1961 | " status %i\n", __func__, rc); | ||
| 1962 | ib_update_fast_reg_key(mr, --key); | ||
| 1963 | goto out_err; | ||
| 1964 | } else { | ||
| 1965 | seg1->mr_rkey = mr->rkey; | ||
| 1966 | seg1->mr_base = seg1->mr_dma + pageoff; | ||
| 1967 | seg1->mr_nsegs = i; | ||
| 1968 | seg1->mr_len = len; | ||
| 1969 | } | ||
| 1970 | *nsegs = i; | ||
| 1971 | return 0; | ||
| 1972 | out_err: | ||
| 1973 | frmr->fr_state = FRMR_IS_INVALID; | ||
| 1974 | while (i--) | ||
| 1975 | rpcrdma_unmap_one(ia, --seg); | ||
| 1976 | return rc; | ||
| 1977 | } | ||
| 1978 | |||
| 1979 | static int | ||
| 1980 | rpcrdma_deregister_frmr_external(struct rpcrdma_mr_seg *seg, | ||
| 1981 | struct rpcrdma_ia *ia, struct rpcrdma_xprt *r_xprt) | ||
| 1982 | { | ||
| 1983 | struct rpcrdma_mr_seg *seg1 = seg; | ||
| 1984 | struct ib_send_wr invalidate_wr, *bad_wr; | ||
| 1985 | int rc; | ||
| 1986 | |||
| 1987 | seg1->rl_mw->r.frmr.fr_state = FRMR_IS_INVALID; | ||
| 1988 | |||
| 1989 | memset(&invalidate_wr, 0, sizeof invalidate_wr); | ||
| 1990 | invalidate_wr.wr_id = (unsigned long)(void *)seg1->rl_mw; | ||
| 1991 | invalidate_wr.opcode = IB_WR_LOCAL_INV; | ||
| 1992 | invalidate_wr.ex.invalidate_rkey = seg1->rl_mw->r.frmr.fr_mr->rkey; | ||
| 1993 | DECR_CQCOUNT(&r_xprt->rx_ep); | ||
| 1994 | |||
| 1995 | read_lock(&ia->ri_qplock); | ||
| 1996 | while (seg1->mr_nsegs--) | ||
| 1997 | rpcrdma_unmap_one(ia, seg++); | ||
| 1998 | rc = ib_post_send(ia->ri_id->qp, &invalidate_wr, &bad_wr); | ||
| 1999 | read_unlock(&ia->ri_qplock); | ||
| 2000 | if (rc) { | ||
| 2001 | /* Force rpcrdma_buffer_get() to retry */ | ||
| 2002 | seg1->rl_mw->r.frmr.fr_state = FRMR_IS_STALE; | ||
| 2003 | dprintk("RPC: %s: failed ib_post_send for invalidate," | ||
| 2004 | " status %i\n", __func__, rc); | ||
| 2005 | } | ||
| 2006 | return rc; | ||
| 2007 | } | ||
| 2008 | |||
| 2009 | static int | ||
| 2010 | rpcrdma_register_fmr_external(struct rpcrdma_mr_seg *seg, | ||
| 2011 | int *nsegs, int writing, struct rpcrdma_ia *ia) | ||
| 2012 | { | ||
| 2013 | struct rpcrdma_mr_seg *seg1 = seg; | ||
| 2014 | u64 physaddrs[RPCRDMA_MAX_DATA_SEGS]; | ||
| 2015 | int len, pageoff, i, rc; | ||
| 2016 | |||
| 2017 | pageoff = offset_in_page(seg1->mr_offset); | ||
| 2018 | seg1->mr_offset -= pageoff; /* start of page */ | ||
| 2019 | seg1->mr_len += pageoff; | ||
| 2020 | len = -pageoff; | ||
| 2021 | if (*nsegs > RPCRDMA_MAX_DATA_SEGS) | ||
| 2022 | *nsegs = RPCRDMA_MAX_DATA_SEGS; | ||
| 2023 | for (i = 0; i < *nsegs;) { | ||
| 2024 | rpcrdma_map_one(ia, seg, writing); | ||
| 2025 | physaddrs[i] = seg->mr_dma; | ||
| 2026 | len += seg->mr_len; | ||
| 2027 | ++seg; | ||
| 2028 | ++i; | ||
| 2029 | /* Check for holes */ | ||
| 2030 | if ((i < *nsegs && offset_in_page(seg->mr_offset)) || | ||
| 2031 | offset_in_page((seg-1)->mr_offset + (seg-1)->mr_len)) | ||
| 2032 | break; | ||
| 2033 | } | ||
| 2034 | rc = ib_map_phys_fmr(seg1->rl_mw->r.fmr, physaddrs, i, seg1->mr_dma); | ||
| 2035 | if (rc) { | ||
| 2036 | dprintk("RPC: %s: failed ib_map_phys_fmr " | ||
| 2037 | "%u@0x%llx+%i (%d)... status %i\n", __func__, | ||
| 2038 | len, (unsigned long long)seg1->mr_dma, | ||
| 2039 | pageoff, i, rc); | ||
| 2040 | while (i--) | ||
| 2041 | rpcrdma_unmap_one(ia, --seg); | ||
| 2042 | } else { | ||
| 2043 | seg1->mr_rkey = seg1->rl_mw->r.fmr->rkey; | ||
| 2044 | seg1->mr_base = seg1->mr_dma + pageoff; | ||
| 2045 | seg1->mr_nsegs = i; | ||
| 2046 | seg1->mr_len = len; | ||
| 2047 | } | ||
| 2048 | *nsegs = i; | ||
| 2049 | return rc; | ||
| 2050 | } | ||
| 2051 | |||
| 2052 | static int | ||
| 2053 | rpcrdma_deregister_fmr_external(struct rpcrdma_mr_seg *seg, | ||
| 2054 | struct rpcrdma_ia *ia) | ||
| 2055 | { | ||
| 2056 | struct rpcrdma_mr_seg *seg1 = seg; | ||
| 2057 | LIST_HEAD(l); | ||
| 2058 | int rc; | ||
| 2059 | |||
| 2060 | list_add(&seg1->rl_mw->r.fmr->list, &l); | ||
| 2061 | rc = ib_unmap_fmr(&l); | ||
| 2062 | read_lock(&ia->ri_qplock); | ||
| 2063 | while (seg1->mr_nsegs--) | ||
| 2064 | rpcrdma_unmap_one(ia, seg++); | ||
| 2065 | read_unlock(&ia->ri_qplock); | ||
| 2066 | if (rc) | ||
| 2067 | dprintk("RPC: %s: failed ib_unmap_fmr," | ||
| 2068 | " status %i\n", __func__, rc); | ||
| 2069 | return rc; | ||
| 2070 | } | ||
| 2071 | |||
| 2072 | int | ||
| 2073 | rpcrdma_register_external(struct rpcrdma_mr_seg *seg, | ||
| 2074 | int nsegs, int writing, struct rpcrdma_xprt *r_xprt) | ||
| 2075 | { | ||
| 2076 | struct rpcrdma_ia *ia = &r_xprt->rx_ia; | ||
| 2077 | int rc = 0; | ||
| 2078 | |||
| 2079 | switch (ia->ri_memreg_strategy) { | ||
| 2080 | |||
| 2081 | case RPCRDMA_ALLPHYSICAL: | ||
| 2082 | rpcrdma_map_one(ia, seg, writing); | ||
| 2083 | seg->mr_rkey = ia->ri_bind_mem->rkey; | ||
| 2084 | seg->mr_base = seg->mr_dma; | ||
| 2085 | seg->mr_nsegs = 1; | ||
| 2086 | nsegs = 1; | ||
| 2087 | break; | ||
| 2088 | |||
| 2089 | /* Registration using frmr registration */ | ||
| 2090 | case RPCRDMA_FRMR: | ||
| 2091 | rc = rpcrdma_register_frmr_external(seg, &nsegs, writing, ia, r_xprt); | ||
| 2092 | break; | ||
| 2093 | |||
| 2094 | /* Registration using fmr memory registration */ | ||
| 2095 | case RPCRDMA_MTHCAFMR: | ||
| 2096 | rc = rpcrdma_register_fmr_external(seg, &nsegs, writing, ia); | ||
| 2097 | break; | ||
| 2098 | |||
| 2099 | default: | ||
| 2100 | return -EIO; | ||
| 2101 | } | ||
| 2102 | if (rc) | ||
| 2103 | return rc; | ||
| 2104 | |||
| 2105 | return nsegs; | ||
| 2106 | } | ||
| 2107 | |||
| 2108 | int | ||
| 2109 | rpcrdma_deregister_external(struct rpcrdma_mr_seg *seg, | ||
| 2110 | struct rpcrdma_xprt *r_xprt) | ||
| 2111 | { | ||
| 2112 | struct rpcrdma_ia *ia = &r_xprt->rx_ia; | ||
| 2113 | int nsegs = seg->mr_nsegs, rc; | ||
| 2114 | |||
| 2115 | switch (ia->ri_memreg_strategy) { | ||
| 2116 | |||
| 2117 | case RPCRDMA_ALLPHYSICAL: | ||
| 2118 | read_lock(&ia->ri_qplock); | ||
| 2119 | rpcrdma_unmap_one(ia, seg); | ||
| 2120 | read_unlock(&ia->ri_qplock); | ||
| 2121 | break; | ||
| 2122 | |||
| 2123 | case RPCRDMA_FRMR: | ||
| 2124 | rc = rpcrdma_deregister_frmr_external(seg, ia, r_xprt); | ||
| 2125 | break; | ||
| 2126 | |||
| 2127 | case RPCRDMA_MTHCAFMR: | ||
| 2128 | rc = rpcrdma_deregister_fmr_external(seg, ia); | ||
| 2129 | break; | ||
| 2130 | |||
| 2131 | default: | ||
| 2132 | break; | ||
| 2133 | } | ||
| 2134 | return nsegs; | ||
| 2135 | } | ||
| 2136 | |||
| 2137 | /* | ||
| 2138 | * Prepost any receive buffer, then post send. | 1572 | * Prepost any receive buffer, then post send. |
| 2139 | * | 1573 | * |
| 2140 | * Receive buffer is donated to hardware, reclaimed upon recv completion. | 1574 | * Receive buffer is donated to hardware, reclaimed upon recv completion. |
| @@ -2156,7 +1590,7 @@ rpcrdma_ep_post(struct rpcrdma_ia *ia, | |||
| 2156 | } | 1590 | } |
| 2157 | 1591 | ||
| 2158 | send_wr.next = NULL; | 1592 | send_wr.next = NULL; |
| 2159 | send_wr.wr_id = 0ULL; /* no send cookie */ | 1593 | send_wr.wr_id = RPCRDMA_IGNORE_COMPLETION; |
| 2160 | send_wr.sg_list = req->rl_send_iov; | 1594 | send_wr.sg_list = req->rl_send_iov; |
| 2161 | send_wr.num_sge = req->rl_niovs; | 1595 | send_wr.num_sge = req->rl_niovs; |
| 2162 | send_wr.opcode = IB_WR_SEND; | 1596 | send_wr.opcode = IB_WR_SEND; |
| @@ -2215,43 +1649,24 @@ rpcrdma_ep_post_recv(struct rpcrdma_ia *ia, | |||
| 2215 | return rc; | 1649 | return rc; |
| 2216 | } | 1650 | } |
| 2217 | 1651 | ||
| 2218 | /* Physical mapping means one Read/Write list entry per-page. | 1652 | /* How many chunk list items fit within our inline buffers? |
| 2219 | * All list entries must fit within an inline buffer | ||
| 2220 | * | ||
| 2221 | * NB: The server must return a Write list for NFS READ, | ||
| 2222 | * which has the same constraint. Factor in the inline | ||
| 2223 | * rsize as well. | ||
| 2224 | */ | 1653 | */ |
| 2225 | static size_t | 1654 | unsigned int |
| 2226 | rpcrdma_physical_max_payload(struct rpcrdma_xprt *r_xprt) | 1655 | rpcrdma_max_segments(struct rpcrdma_xprt *r_xprt) |
| 2227 | { | 1656 | { |
| 2228 | struct rpcrdma_create_data_internal *cdata = &r_xprt->rx_data; | 1657 | struct rpcrdma_create_data_internal *cdata = &r_xprt->rx_data; |
| 2229 | unsigned int inline_size, pages; | 1658 | int bytes, segments; |
| 2230 | 1659 | ||
| 2231 | inline_size = min_t(unsigned int, | 1660 | bytes = min_t(unsigned int, cdata->inline_wsize, cdata->inline_rsize); |
| 2232 | cdata->inline_wsize, cdata->inline_rsize); | 1661 | bytes -= RPCRDMA_HDRLEN_MIN; |
| 2233 | inline_size -= RPCRDMA_HDRLEN_MIN; | 1662 | if (bytes < sizeof(struct rpcrdma_segment) * 2) { |
| 2234 | pages = inline_size / sizeof(struct rpcrdma_segment); | 1663 | pr_warn("RPC: %s: inline threshold too small\n", |
| 2235 | return pages << PAGE_SHIFT; | 1664 | __func__); |
| 2236 | } | 1665 | return 0; |
| 2237 | |||
| 2238 | static size_t | ||
| 2239 | rpcrdma_mr_max_payload(struct rpcrdma_xprt *r_xprt) | ||
| 2240 | { | ||
| 2241 | return RPCRDMA_MAX_DATA_SEGS << PAGE_SHIFT; | ||
| 2242 | } | ||
| 2243 | |||
| 2244 | size_t | ||
| 2245 | rpcrdma_max_payload(struct rpcrdma_xprt *r_xprt) | ||
| 2246 | { | ||
| 2247 | size_t result; | ||
| 2248 | |||
| 2249 | switch (r_xprt->rx_ia.ri_memreg_strategy) { | ||
| 2250 | case RPCRDMA_ALLPHYSICAL: | ||
| 2251 | result = rpcrdma_physical_max_payload(r_xprt); | ||
| 2252 | break; | ||
| 2253 | default: | ||
| 2254 | result = rpcrdma_mr_max_payload(r_xprt); | ||
| 2255 | } | 1666 | } |
| 2256 | return result; | 1667 | |
| 1668 | segments = 1 << (fls(bytes / sizeof(struct rpcrdma_segment)) - 1); | ||
| 1669 | dprintk("RPC: %s: max chunk list size = %d segments\n", | ||
| 1670 | __func__, segments); | ||
| 1671 | return segments; | ||
| 2257 | } | 1672 | } |
diff --git a/net/sunrpc/xprtrdma/xprt_rdma.h b/net/sunrpc/xprtrdma/xprt_rdma.h index 0a16fb6f0885..78e0b8beaa36 100644 --- a/net/sunrpc/xprtrdma/xprt_rdma.h +++ b/net/sunrpc/xprtrdma/xprt_rdma.h | |||
| @@ -60,6 +60,7 @@ | |||
| 60 | * Interface Adapter -- one per transport instance | 60 | * Interface Adapter -- one per transport instance |
| 61 | */ | 61 | */ |
| 62 | struct rpcrdma_ia { | 62 | struct rpcrdma_ia { |
| 63 | const struct rpcrdma_memreg_ops *ri_ops; | ||
| 63 | rwlock_t ri_qplock; | 64 | rwlock_t ri_qplock; |
| 64 | struct rdma_cm_id *ri_id; | 65 | struct rdma_cm_id *ri_id; |
| 65 | struct ib_pd *ri_pd; | 66 | struct ib_pd *ri_pd; |
| @@ -105,6 +106,10 @@ struct rpcrdma_ep { | |||
| 105 | #define INIT_CQCOUNT(ep) atomic_set(&(ep)->rep_cqcount, (ep)->rep_cqinit) | 106 | #define INIT_CQCOUNT(ep) atomic_set(&(ep)->rep_cqcount, (ep)->rep_cqinit) |
| 106 | #define DECR_CQCOUNT(ep) atomic_sub_return(1, &(ep)->rep_cqcount) | 107 | #define DECR_CQCOUNT(ep) atomic_sub_return(1, &(ep)->rep_cqcount) |
| 107 | 108 | ||
| 109 | /* Force completion handler to ignore the signal | ||
| 110 | */ | ||
| 111 | #define RPCRDMA_IGNORE_COMPLETION (0ULL) | ||
| 112 | |||
| 108 | /* Registered buffer -- registered kmalloc'd memory for RDMA SEND/RECV | 113 | /* Registered buffer -- registered kmalloc'd memory for RDMA SEND/RECV |
| 109 | * | 114 | * |
| 110 | * The below structure appears at the front of a large region of kmalloc'd | 115 | * The below structure appears at the front of a large region of kmalloc'd |
| @@ -143,14 +148,6 @@ rdmab_to_msg(struct rpcrdma_regbuf *rb) | |||
| 143 | return (struct rpcrdma_msg *)rb->rg_base; | 148 | return (struct rpcrdma_msg *)rb->rg_base; |
| 144 | } | 149 | } |
| 145 | 150 | ||
| 146 | enum rpcrdma_chunktype { | ||
| 147 | rpcrdma_noch = 0, | ||
| 148 | rpcrdma_readch, | ||
| 149 | rpcrdma_areadch, | ||
| 150 | rpcrdma_writech, | ||
| 151 | rpcrdma_replych | ||
| 152 | }; | ||
| 153 | |||
| 154 | /* | 151 | /* |
| 155 | * struct rpcrdma_rep -- this structure encapsulates state required to recv | 152 | * struct rpcrdma_rep -- this structure encapsulates state required to recv |
| 156 | * and complete a reply, asychronously. It needs several pieces of | 153 | * and complete a reply, asychronously. It needs several pieces of |
| @@ -213,6 +210,7 @@ struct rpcrdma_mw { | |||
| 213 | struct ib_fmr *fmr; | 210 | struct ib_fmr *fmr; |
| 214 | struct rpcrdma_frmr frmr; | 211 | struct rpcrdma_frmr frmr; |
| 215 | } r; | 212 | } r; |
| 213 | void (*mw_sendcompletion)(struct ib_wc *); | ||
| 216 | struct list_head mw_list; | 214 | struct list_head mw_list; |
| 217 | struct list_head mw_all; | 215 | struct list_head mw_all; |
| 218 | }; | 216 | }; |
| @@ -258,7 +256,6 @@ struct rpcrdma_req { | |||
| 258 | unsigned int rl_niovs; /* 0, 2 or 4 */ | 256 | unsigned int rl_niovs; /* 0, 2 or 4 */ |
| 259 | unsigned int rl_nchunks; /* non-zero if chunks */ | 257 | unsigned int rl_nchunks; /* non-zero if chunks */ |
| 260 | unsigned int rl_connect_cookie; /* retry detection */ | 258 | unsigned int rl_connect_cookie; /* retry detection */ |
| 261 | enum rpcrdma_chunktype rl_rtype, rl_wtype; | ||
| 262 | struct rpcrdma_buffer *rl_buffer; /* home base for this structure */ | 259 | struct rpcrdma_buffer *rl_buffer; /* home base for this structure */ |
| 263 | struct rpcrdma_rep *rl_reply;/* holder for reply buffer */ | 260 | struct rpcrdma_rep *rl_reply;/* holder for reply buffer */ |
| 264 | struct ib_sge rl_send_iov[4]; /* for active requests */ | 261 | struct ib_sge rl_send_iov[4]; /* for active requests */ |
| @@ -340,6 +337,29 @@ struct rpcrdma_stats { | |||
| 340 | }; | 337 | }; |
| 341 | 338 | ||
| 342 | /* | 339 | /* |
| 340 | * Per-registration mode operations | ||
| 341 | */ | ||
| 342 | struct rpcrdma_xprt; | ||
| 343 | struct rpcrdma_memreg_ops { | ||
| 344 | int (*ro_map)(struct rpcrdma_xprt *, | ||
| 345 | struct rpcrdma_mr_seg *, int, bool); | ||
| 346 | int (*ro_unmap)(struct rpcrdma_xprt *, | ||
| 347 | struct rpcrdma_mr_seg *); | ||
| 348 | int (*ro_open)(struct rpcrdma_ia *, | ||
| 349 | struct rpcrdma_ep *, | ||
| 350 | struct rpcrdma_create_data_internal *); | ||
| 351 | size_t (*ro_maxpages)(struct rpcrdma_xprt *); | ||
| 352 | int (*ro_init)(struct rpcrdma_xprt *); | ||
| 353 | void (*ro_reset)(struct rpcrdma_xprt *); | ||
| 354 | void (*ro_destroy)(struct rpcrdma_buffer *); | ||
| 355 | const char *ro_displayname; | ||
| 356 | }; | ||
| 357 | |||
| 358 | extern const struct rpcrdma_memreg_ops rpcrdma_fmr_memreg_ops; | ||
| 359 | extern const struct rpcrdma_memreg_ops rpcrdma_frwr_memreg_ops; | ||
| 360 | extern const struct rpcrdma_memreg_ops rpcrdma_physical_memreg_ops; | ||
| 361 | |||
| 362 | /* | ||
| 343 | * RPCRDMA transport -- encapsulates the structures above for | 363 | * RPCRDMA transport -- encapsulates the structures above for |
| 344 | * integration with RPC. | 364 | * integration with RPC. |
| 345 | * | 365 | * |
| @@ -398,16 +418,56 @@ void rpcrdma_buffer_put(struct rpcrdma_req *); | |||
| 398 | void rpcrdma_recv_buffer_get(struct rpcrdma_req *); | 418 | void rpcrdma_recv_buffer_get(struct rpcrdma_req *); |
| 399 | void rpcrdma_recv_buffer_put(struct rpcrdma_rep *); | 419 | void rpcrdma_recv_buffer_put(struct rpcrdma_rep *); |
| 400 | 420 | ||
| 401 | int rpcrdma_register_external(struct rpcrdma_mr_seg *, | ||
| 402 | int, int, struct rpcrdma_xprt *); | ||
| 403 | int rpcrdma_deregister_external(struct rpcrdma_mr_seg *, | ||
| 404 | struct rpcrdma_xprt *); | ||
| 405 | |||
| 406 | struct rpcrdma_regbuf *rpcrdma_alloc_regbuf(struct rpcrdma_ia *, | 421 | struct rpcrdma_regbuf *rpcrdma_alloc_regbuf(struct rpcrdma_ia *, |
| 407 | size_t, gfp_t); | 422 | size_t, gfp_t); |
| 408 | void rpcrdma_free_regbuf(struct rpcrdma_ia *, | 423 | void rpcrdma_free_regbuf(struct rpcrdma_ia *, |
| 409 | struct rpcrdma_regbuf *); | 424 | struct rpcrdma_regbuf *); |
| 410 | 425 | ||
| 426 | unsigned int rpcrdma_max_segments(struct rpcrdma_xprt *); | ||
| 427 | |||
| 428 | /* | ||
| 429 | * Wrappers for chunk registration, shared by read/write chunk code. | ||
| 430 | */ | ||
| 431 | |||
| 432 | void rpcrdma_mapping_error(struct rpcrdma_mr_seg *); | ||
| 433 | |||
| 434 | static inline enum dma_data_direction | ||
| 435 | rpcrdma_data_dir(bool writing) | ||
| 436 | { | ||
| 437 | return writing ? DMA_FROM_DEVICE : DMA_TO_DEVICE; | ||
| 438 | } | ||
| 439 | |||
| 440 | static inline void | ||
| 441 | rpcrdma_map_one(struct ib_device *device, struct rpcrdma_mr_seg *seg, | ||
| 442 | enum dma_data_direction direction) | ||
| 443 | { | ||
| 444 | seg->mr_dir = direction; | ||
| 445 | seg->mr_dmalen = seg->mr_len; | ||
| 446 | |||
| 447 | if (seg->mr_page) | ||
| 448 | seg->mr_dma = ib_dma_map_page(device, | ||
| 449 | seg->mr_page, offset_in_page(seg->mr_offset), | ||
| 450 | seg->mr_dmalen, seg->mr_dir); | ||
| 451 | else | ||
| 452 | seg->mr_dma = ib_dma_map_single(device, | ||
| 453 | seg->mr_offset, | ||
| 454 | seg->mr_dmalen, seg->mr_dir); | ||
| 455 | |||
| 456 | if (ib_dma_mapping_error(device, seg->mr_dma)) | ||
| 457 | rpcrdma_mapping_error(seg); | ||
| 458 | } | ||
| 459 | |||
| 460 | static inline void | ||
| 461 | rpcrdma_unmap_one(struct ib_device *device, struct rpcrdma_mr_seg *seg) | ||
| 462 | { | ||
| 463 | if (seg->mr_page) | ||
| 464 | ib_dma_unmap_page(device, | ||
| 465 | seg->mr_dma, seg->mr_dmalen, seg->mr_dir); | ||
| 466 | else | ||
| 467 | ib_dma_unmap_single(device, | ||
| 468 | seg->mr_dma, seg->mr_dmalen, seg->mr_dir); | ||
| 469 | } | ||
| 470 | |||
| 411 | /* | 471 | /* |
| 412 | * RPC/RDMA connection management calls - xprtrdma/rpc_rdma.c | 472 | * RPC/RDMA connection management calls - xprtrdma/rpc_rdma.c |
| 413 | */ | 473 | */ |
| @@ -418,9 +478,7 @@ void rpcrdma_reply_handler(struct rpcrdma_rep *); | |||
| 418 | /* | 478 | /* |
| 419 | * RPC/RDMA protocol calls - xprtrdma/rpc_rdma.c | 479 | * RPC/RDMA protocol calls - xprtrdma/rpc_rdma.c |
| 420 | */ | 480 | */ |
| 421 | ssize_t rpcrdma_marshal_chunks(struct rpc_rqst *, ssize_t); | ||
| 422 | int rpcrdma_marshal_req(struct rpc_rqst *); | 481 | int rpcrdma_marshal_req(struct rpc_rqst *); |
| 423 | size_t rpcrdma_max_payload(struct rpcrdma_xprt *); | ||
| 424 | 482 | ||
| 425 | /* Temporary NFS request map cache. Created in svc_rdma.c */ | 483 | /* Temporary NFS request map cache. Created in svc_rdma.c */ |
| 426 | extern struct kmem_cache *svc_rdma_map_cachep; | 484 | extern struct kmem_cache *svc_rdma_map_cachep; |
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c index 433f287ee548..5266ea7b922b 100644 --- a/net/unix/af_unix.c +++ b/net/unix/af_unix.c | |||
| @@ -305,7 +305,7 @@ static struct sock *unix_find_socket_byinode(struct inode *i) | |||
| 305 | &unix_socket_table[i->i_ino & (UNIX_HASH_SIZE - 1)]) { | 305 | &unix_socket_table[i->i_ino & (UNIX_HASH_SIZE - 1)]) { |
| 306 | struct dentry *dentry = unix_sk(s)->path.dentry; | 306 | struct dentry *dentry = unix_sk(s)->path.dentry; |
| 307 | 307 | ||
| 308 | if (dentry && dentry->d_inode == i) { | 308 | if (dentry && d_backing_inode(dentry) == i) { |
| 309 | sock_hold(s); | 309 | sock_hold(s); |
| 310 | goto found; | 310 | goto found; |
| 311 | } | 311 | } |
| @@ -778,7 +778,7 @@ static struct sock *unix_find_other(struct net *net, | |||
| 778 | err = kern_path(sunname->sun_path, LOOKUP_FOLLOW, &path); | 778 | err = kern_path(sunname->sun_path, LOOKUP_FOLLOW, &path); |
| 779 | if (err) | 779 | if (err) |
| 780 | goto fail; | 780 | goto fail; |
| 781 | inode = path.dentry->d_inode; | 781 | inode = d_backing_inode(path.dentry); |
| 782 | err = inode_permission(inode, MAY_WRITE); | 782 | err = inode_permission(inode, MAY_WRITE); |
| 783 | if (err) | 783 | if (err) |
| 784 | goto put_fail; | 784 | goto put_fail; |
| @@ -839,7 +839,7 @@ static int unix_mknod(const char *sun_path, umode_t mode, struct path *res) | |||
| 839 | */ | 839 | */ |
| 840 | err = security_path_mknod(&path, dentry, mode, 0); | 840 | err = security_path_mknod(&path, dentry, mode, 0); |
| 841 | if (!err) { | 841 | if (!err) { |
| 842 | err = vfs_mknod(path.dentry->d_inode, dentry, mode, 0); | 842 | err = vfs_mknod(d_inode(path.dentry), dentry, mode, 0); |
| 843 | if (!err) { | 843 | if (!err) { |
| 844 | res->mnt = mntget(path.mnt); | 844 | res->mnt = mntget(path.mnt); |
| 845 | res->dentry = dget(dentry); | 845 | res->dentry = dget(dentry); |
| @@ -905,7 +905,7 @@ static int unix_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) | |||
| 905 | goto out_up; | 905 | goto out_up; |
| 906 | } | 906 | } |
| 907 | addr->hash = UNIX_HASH_SIZE; | 907 | addr->hash = UNIX_HASH_SIZE; |
| 908 | hash = path.dentry->d_inode->i_ino & (UNIX_HASH_SIZE-1); | 908 | hash = d_backing_inode(path.dentry)->i_ino & (UNIX_HASH_SIZE-1); |
| 909 | spin_lock(&unix_table_lock); | 909 | spin_lock(&unix_table_lock); |
| 910 | u->path = path; | 910 | u->path = path; |
| 911 | list = &unix_socket_table[hash]; | 911 | list = &unix_socket_table[hash]; |
diff --git a/net/unix/diag.c b/net/unix/diag.c index ef542fbca9fe..c512f64d5287 100644 --- a/net/unix/diag.c +++ b/net/unix/diag.c | |||
| @@ -25,7 +25,7 @@ static int sk_diag_dump_vfs(struct sock *sk, struct sk_buff *nlskb) | |||
| 25 | 25 | ||
| 26 | if (dentry) { | 26 | if (dentry) { |
| 27 | struct unix_diag_vfs uv = { | 27 | struct unix_diag_vfs uv = { |
| 28 | .udiag_vfs_ino = dentry->d_inode->i_ino, | 28 | .udiag_vfs_ino = d_backing_inode(dentry)->i_ino, |
| 29 | .udiag_vfs_dev = dentry->d_sb->s_dev, | 29 | .udiag_vfs_dev = dentry->d_sb->s_dev, |
| 30 | }; | 30 | }; |
| 31 | 31 | ||
diff --git a/security/apparmor/apparmorfs.c b/security/apparmor/apparmorfs.c index 7db9954f1af2..ad4fa49ad1db 100644 --- a/security/apparmor/apparmorfs.c +++ b/security/apparmor/apparmorfs.c | |||
| @@ -365,7 +365,7 @@ void __aa_fs_profile_rmdir(struct aa_profile *profile) | |||
| 365 | if (!profile->dents[i]) | 365 | if (!profile->dents[i]) |
| 366 | continue; | 366 | continue; |
| 367 | 367 | ||
| 368 | r = profile->dents[i]->d_inode->i_private; | 368 | r = d_inode(profile->dents[i])->i_private; |
| 369 | securityfs_remove(profile->dents[i]); | 369 | securityfs_remove(profile->dents[i]); |
| 370 | aa_put_replacedby(r); | 370 | aa_put_replacedby(r); |
| 371 | profile->dents[i] = NULL; | 371 | profile->dents[i] = NULL; |
diff --git a/security/apparmor/file.c b/security/apparmor/file.c index fdaa50cb1876..913f377a038a 100644 --- a/security/apparmor/file.c +++ b/security/apparmor/file.c | |||
| @@ -259,7 +259,7 @@ unsigned int aa_str_perms(struct aa_dfa *dfa, unsigned int start, | |||
| 259 | */ | 259 | */ |
| 260 | static inline bool is_deleted(struct dentry *dentry) | 260 | static inline bool is_deleted(struct dentry *dentry) |
| 261 | { | 261 | { |
| 262 | if (d_unlinked(dentry) && dentry->d_inode->i_nlink == 0) | 262 | if (d_unlinked(dentry) && d_backing_inode(dentry)->i_nlink == 0) |
| 263 | return 1; | 263 | return 1; |
| 264 | return 0; | 264 | return 0; |
| 265 | } | 265 | } |
| @@ -351,8 +351,8 @@ int aa_path_link(struct aa_profile *profile, struct dentry *old_dentry, | |||
| 351 | struct path link = { new_dir->mnt, new_dentry }; | 351 | struct path link = { new_dir->mnt, new_dentry }; |
| 352 | struct path target = { new_dir->mnt, old_dentry }; | 352 | struct path target = { new_dir->mnt, old_dentry }; |
| 353 | struct path_cond cond = { | 353 | struct path_cond cond = { |
| 354 | old_dentry->d_inode->i_uid, | 354 | d_backing_inode(old_dentry)->i_uid, |
| 355 | old_dentry->d_inode->i_mode | 355 | d_backing_inode(old_dentry)->i_mode |
| 356 | }; | 356 | }; |
| 357 | char *buffer = NULL, *buffer2 = NULL; | 357 | char *buffer = NULL, *buffer2 = NULL; |
| 358 | const char *lname, *tname = NULL, *info = NULL; | 358 | const char *lname, *tname = NULL, *info = NULL; |
diff --git a/security/apparmor/lsm.c b/security/apparmor/lsm.c index dd56bffd6500..e5f1561439db 100644 --- a/security/apparmor/lsm.c +++ b/security/apparmor/lsm.c | |||
| @@ -204,8 +204,8 @@ static int common_perm_mnt_dentry(int op, struct vfsmount *mnt, | |||
| 204 | struct dentry *dentry, u32 mask) | 204 | struct dentry *dentry, u32 mask) |
| 205 | { | 205 | { |
| 206 | struct path path = { mnt, dentry }; | 206 | struct path path = { mnt, dentry }; |
| 207 | struct path_cond cond = { dentry->d_inode->i_uid, | 207 | struct path_cond cond = { d_backing_inode(dentry)->i_uid, |
| 208 | dentry->d_inode->i_mode | 208 | d_backing_inode(dentry)->i_mode |
| 209 | }; | 209 | }; |
| 210 | 210 | ||
| 211 | return common_perm(op, &path, mask, &cond); | 211 | return common_perm(op, &path, mask, &cond); |
| @@ -223,7 +223,7 @@ static int common_perm_mnt_dentry(int op, struct vfsmount *mnt, | |||
| 223 | static int common_perm_rm(int op, struct path *dir, | 223 | static int common_perm_rm(int op, struct path *dir, |
| 224 | struct dentry *dentry, u32 mask) | 224 | struct dentry *dentry, u32 mask) |
| 225 | { | 225 | { |
| 226 | struct inode *inode = dentry->d_inode; | 226 | struct inode *inode = d_backing_inode(dentry); |
| 227 | struct path_cond cond = { }; | 227 | struct path_cond cond = { }; |
| 228 | 228 | ||
| 229 | if (!inode || !dir->mnt || !mediated_filesystem(dentry)) | 229 | if (!inode || !dir->mnt || !mediated_filesystem(dentry)) |
| @@ -281,8 +281,8 @@ static int apparmor_path_mknod(struct path *dir, struct dentry *dentry, | |||
| 281 | 281 | ||
| 282 | static int apparmor_path_truncate(struct path *path) | 282 | static int apparmor_path_truncate(struct path *path) |
| 283 | { | 283 | { |
| 284 | struct path_cond cond = { path->dentry->d_inode->i_uid, | 284 | struct path_cond cond = { d_backing_inode(path->dentry)->i_uid, |
| 285 | path->dentry->d_inode->i_mode | 285 | d_backing_inode(path->dentry)->i_mode |
| 286 | }; | 286 | }; |
| 287 | 287 | ||
| 288 | if (!path->mnt || !mediated_filesystem(path->dentry)) | 288 | if (!path->mnt || !mediated_filesystem(path->dentry)) |
| @@ -327,8 +327,8 @@ static int apparmor_path_rename(struct path *old_dir, struct dentry *old_dentry, | |||
| 327 | if (!unconfined(profile)) { | 327 | if (!unconfined(profile)) { |
| 328 | struct path old_path = { old_dir->mnt, old_dentry }; | 328 | struct path old_path = { old_dir->mnt, old_dentry }; |
| 329 | struct path new_path = { new_dir->mnt, new_dentry }; | 329 | struct path new_path = { new_dir->mnt, new_dentry }; |
| 330 | struct path_cond cond = { old_dentry->d_inode->i_uid, | 330 | struct path_cond cond = { d_backing_inode(old_dentry)->i_uid, |
| 331 | old_dentry->d_inode->i_mode | 331 | d_backing_inode(old_dentry)->i_mode |
| 332 | }; | 332 | }; |
| 333 | 333 | ||
| 334 | error = aa_path_perm(OP_RENAME_SRC, profile, &old_path, 0, | 334 | error = aa_path_perm(OP_RENAME_SRC, profile, &old_path, 0, |
| @@ -354,8 +354,8 @@ static int apparmor_path_chmod(struct path *path, umode_t mode) | |||
| 354 | 354 | ||
| 355 | static int apparmor_path_chown(struct path *path, kuid_t uid, kgid_t gid) | 355 | static int apparmor_path_chown(struct path *path, kuid_t uid, kgid_t gid) |
| 356 | { | 356 | { |
| 357 | struct path_cond cond = { path->dentry->d_inode->i_uid, | 357 | struct path_cond cond = { d_backing_inode(path->dentry)->i_uid, |
| 358 | path->dentry->d_inode->i_mode | 358 | d_backing_inode(path->dentry)->i_mode |
| 359 | }; | 359 | }; |
| 360 | 360 | ||
| 361 | if (!mediated_filesystem(path->dentry)) | 361 | if (!mediated_filesystem(path->dentry)) |
diff --git a/security/commoncap.c b/security/commoncap.c index f66713bd7450..f2875cd9f677 100644 --- a/security/commoncap.c +++ b/security/commoncap.c | |||
| @@ -297,7 +297,7 @@ static inline void bprm_clear_caps(struct linux_binprm *bprm) | |||
| 297 | */ | 297 | */ |
| 298 | int cap_inode_need_killpriv(struct dentry *dentry) | 298 | int cap_inode_need_killpriv(struct dentry *dentry) |
| 299 | { | 299 | { |
| 300 | struct inode *inode = dentry->d_inode; | 300 | struct inode *inode = d_backing_inode(dentry); |
| 301 | int error; | 301 | int error; |
| 302 | 302 | ||
| 303 | if (!inode->i_op->getxattr) | 303 | if (!inode->i_op->getxattr) |
| @@ -319,7 +319,7 @@ int cap_inode_need_killpriv(struct dentry *dentry) | |||
| 319 | */ | 319 | */ |
| 320 | int cap_inode_killpriv(struct dentry *dentry) | 320 | int cap_inode_killpriv(struct dentry *dentry) |
| 321 | { | 321 | { |
| 322 | struct inode *inode = dentry->d_inode; | 322 | struct inode *inode = d_backing_inode(dentry); |
| 323 | 323 | ||
| 324 | if (!inode->i_op->removexattr) | 324 | if (!inode->i_op->removexattr) |
| 325 | return 0; | 325 | return 0; |
| @@ -375,7 +375,7 @@ static inline int bprm_caps_from_vfs_caps(struct cpu_vfs_cap_data *caps, | |||
| 375 | */ | 375 | */ |
| 376 | int get_vfs_caps_from_disk(const struct dentry *dentry, struct cpu_vfs_cap_data *cpu_caps) | 376 | int get_vfs_caps_from_disk(const struct dentry *dentry, struct cpu_vfs_cap_data *cpu_caps) |
| 377 | { | 377 | { |
| 378 | struct inode *inode = dentry->d_inode; | 378 | struct inode *inode = d_backing_inode(dentry); |
| 379 | __u32 magic_etc; | 379 | __u32 magic_etc; |
| 380 | unsigned tocopy, i; | 380 | unsigned tocopy, i; |
| 381 | int size; | 381 | int size; |
diff --git a/security/inode.c b/security/inode.c index 131a3c49f766..91503b79c5f8 100644 --- a/security/inode.c +++ b/security/inode.c | |||
| @@ -27,7 +27,7 @@ static int mount_count; | |||
| 27 | 27 | ||
| 28 | static inline int positive(struct dentry *dentry) | 28 | static inline int positive(struct dentry *dentry) |
| 29 | { | 29 | { |
| 30 | return dentry->d_inode && !d_unhashed(dentry); | 30 | return d_really_is_positive(dentry) && !d_unhashed(dentry); |
| 31 | } | 31 | } |
| 32 | 32 | ||
| 33 | static int fill_super(struct super_block *sb, void *data, int silent) | 33 | static int fill_super(struct super_block *sb, void *data, int silent) |
| @@ -102,14 +102,14 @@ struct dentry *securityfs_create_file(const char *name, umode_t mode, | |||
| 102 | if (!parent) | 102 | if (!parent) |
| 103 | parent = mount->mnt_root; | 103 | parent = mount->mnt_root; |
| 104 | 104 | ||
| 105 | dir = parent->d_inode; | 105 | dir = d_inode(parent); |
| 106 | 106 | ||
| 107 | mutex_lock(&dir->i_mutex); | 107 | mutex_lock(&dir->i_mutex); |
| 108 | dentry = lookup_one_len(name, parent, strlen(name)); | 108 | dentry = lookup_one_len(name, parent, strlen(name)); |
| 109 | if (IS_ERR(dentry)) | 109 | if (IS_ERR(dentry)) |
| 110 | goto out; | 110 | goto out; |
| 111 | 111 | ||
| 112 | if (dentry->d_inode) { | 112 | if (d_really_is_positive(dentry)) { |
| 113 | error = -EEXIST; | 113 | error = -EEXIST; |
| 114 | goto out1; | 114 | goto out1; |
| 115 | } | 115 | } |
| @@ -197,20 +197,20 @@ void securityfs_remove(struct dentry *dentry) | |||
| 197 | return; | 197 | return; |
| 198 | 198 | ||
| 199 | parent = dentry->d_parent; | 199 | parent = dentry->d_parent; |
| 200 | if (!parent || !parent->d_inode) | 200 | if (!parent || d_really_is_negative(parent)) |
| 201 | return; | 201 | return; |
| 202 | 202 | ||
| 203 | mutex_lock(&parent->d_inode->i_mutex); | 203 | mutex_lock(&d_inode(parent)->i_mutex); |
| 204 | if (positive(dentry)) { | 204 | if (positive(dentry)) { |
| 205 | if (dentry->d_inode) { | 205 | if (d_really_is_positive(dentry)) { |
| 206 | if (d_is_dir(dentry)) | 206 | if (d_is_dir(dentry)) |
| 207 | simple_rmdir(parent->d_inode, dentry); | 207 | simple_rmdir(d_inode(parent), dentry); |
| 208 | else | 208 | else |
| 209 | simple_unlink(parent->d_inode, dentry); | 209 | simple_unlink(d_inode(parent), dentry); |
| 210 | dput(dentry); | 210 | dput(dentry); |
| 211 | } | 211 | } |
| 212 | } | 212 | } |
| 213 | mutex_unlock(&parent->d_inode->i_mutex); | 213 | mutex_unlock(&d_inode(parent)->i_mutex); |
| 214 | simple_release_fs(&mount, &mount_count); | 214 | simple_release_fs(&mount, &mount_count); |
| 215 | } | 215 | } |
| 216 | EXPORT_SYMBOL_GPL(securityfs_remove); | 216 | EXPORT_SYMBOL_GPL(securityfs_remove); |
diff --git a/security/integrity/evm/evm_crypto.c b/security/integrity/evm/evm_crypto.c index 5e9687f02e1b..159ef3ea4130 100644 --- a/security/integrity/evm/evm_crypto.c +++ b/security/integrity/evm/evm_crypto.c | |||
| @@ -131,7 +131,7 @@ static int evm_calc_hmac_or_hash(struct dentry *dentry, | |||
| 131 | size_t req_xattr_value_len, | 131 | size_t req_xattr_value_len, |
| 132 | char type, char *digest) | 132 | char type, char *digest) |
| 133 | { | 133 | { |
| 134 | struct inode *inode = dentry->d_inode; | 134 | struct inode *inode = d_backing_inode(dentry); |
| 135 | struct shash_desc *desc; | 135 | struct shash_desc *desc; |
| 136 | char **xattrname; | 136 | char **xattrname; |
| 137 | size_t xattr_size = 0; | 137 | size_t xattr_size = 0; |
| @@ -199,7 +199,7 @@ int evm_calc_hash(struct dentry *dentry, const char *req_xattr_name, | |||
| 199 | int evm_update_evmxattr(struct dentry *dentry, const char *xattr_name, | 199 | int evm_update_evmxattr(struct dentry *dentry, const char *xattr_name, |
| 200 | const char *xattr_value, size_t xattr_value_len) | 200 | const char *xattr_value, size_t xattr_value_len) |
| 201 | { | 201 | { |
| 202 | struct inode *inode = dentry->d_inode; | 202 | struct inode *inode = d_backing_inode(dentry); |
| 203 | struct evm_ima_xattr_data xattr_data; | 203 | struct evm_ima_xattr_data xattr_data; |
| 204 | int rc = 0; | 204 | int rc = 0; |
| 205 | 205 | ||
diff --git a/security/integrity/evm/evm_main.c b/security/integrity/evm/evm_main.c index f589c9a05da2..10f994307a04 100644 --- a/security/integrity/evm/evm_main.c +++ b/security/integrity/evm/evm_main.c | |||
| @@ -72,7 +72,7 @@ static void __init evm_init_config(void) | |||
| 72 | 72 | ||
| 73 | static int evm_find_protected_xattrs(struct dentry *dentry) | 73 | static int evm_find_protected_xattrs(struct dentry *dentry) |
| 74 | { | 74 | { |
| 75 | struct inode *inode = dentry->d_inode; | 75 | struct inode *inode = d_backing_inode(dentry); |
| 76 | char **xattr; | 76 | char **xattr; |
| 77 | int error; | 77 | int error; |
| 78 | int count = 0; | 78 | int count = 0; |
| @@ -165,8 +165,8 @@ static enum integrity_status evm_verify_hmac(struct dentry *dentry, | |||
| 165 | /* Replace RSA with HMAC if not mounted readonly and | 165 | /* Replace RSA with HMAC if not mounted readonly and |
| 166 | * not immutable | 166 | * not immutable |
| 167 | */ | 167 | */ |
| 168 | if (!IS_RDONLY(dentry->d_inode) && | 168 | if (!IS_RDONLY(d_backing_inode(dentry)) && |
| 169 | !IS_IMMUTABLE(dentry->d_inode)) | 169 | !IS_IMMUTABLE(d_backing_inode(dentry))) |
| 170 | evm_update_evmxattr(dentry, xattr_name, | 170 | evm_update_evmxattr(dentry, xattr_name, |
| 171 | xattr_value, | 171 | xattr_value, |
| 172 | xattr_value_len); | 172 | xattr_value_len); |
| @@ -235,7 +235,7 @@ enum integrity_status evm_verifyxattr(struct dentry *dentry, | |||
| 235 | return INTEGRITY_UNKNOWN; | 235 | return INTEGRITY_UNKNOWN; |
| 236 | 236 | ||
| 237 | if (!iint) { | 237 | if (!iint) { |
| 238 | iint = integrity_iint_find(dentry->d_inode); | 238 | iint = integrity_iint_find(d_backing_inode(dentry)); |
| 239 | if (!iint) | 239 | if (!iint) |
| 240 | return INTEGRITY_UNKNOWN; | 240 | return INTEGRITY_UNKNOWN; |
| 241 | } | 241 | } |
| @@ -253,7 +253,7 @@ EXPORT_SYMBOL_GPL(evm_verifyxattr); | |||
| 253 | */ | 253 | */ |
| 254 | static enum integrity_status evm_verify_current_integrity(struct dentry *dentry) | 254 | static enum integrity_status evm_verify_current_integrity(struct dentry *dentry) |
| 255 | { | 255 | { |
| 256 | struct inode *inode = dentry->d_inode; | 256 | struct inode *inode = d_backing_inode(dentry); |
| 257 | 257 | ||
| 258 | if (!evm_initialized || !S_ISREG(inode->i_mode) || evm_fixmode) | 258 | if (!evm_initialized || !S_ISREG(inode->i_mode) || evm_fixmode) |
| 259 | return 0; | 259 | return 0; |
| @@ -293,13 +293,13 @@ static int evm_protect_xattr(struct dentry *dentry, const char *xattr_name, | |||
| 293 | if (evm_status == INTEGRITY_NOXATTRS) { | 293 | if (evm_status == INTEGRITY_NOXATTRS) { |
| 294 | struct integrity_iint_cache *iint; | 294 | struct integrity_iint_cache *iint; |
| 295 | 295 | ||
| 296 | iint = integrity_iint_find(dentry->d_inode); | 296 | iint = integrity_iint_find(d_backing_inode(dentry)); |
| 297 | if (iint && (iint->flags & IMA_NEW_FILE)) | 297 | if (iint && (iint->flags & IMA_NEW_FILE)) |
| 298 | return 0; | 298 | return 0; |
| 299 | } | 299 | } |
| 300 | out: | 300 | out: |
| 301 | if (evm_status != INTEGRITY_PASS) | 301 | if (evm_status != INTEGRITY_PASS) |
| 302 | integrity_audit_msg(AUDIT_INTEGRITY_METADATA, dentry->d_inode, | 302 | integrity_audit_msg(AUDIT_INTEGRITY_METADATA, d_backing_inode(dentry), |
| 303 | dentry->d_name.name, "appraise_metadata", | 303 | dentry->d_name.name, "appraise_metadata", |
| 304 | integrity_status_msg[evm_status], | 304 | integrity_status_msg[evm_status], |
| 305 | -EPERM, 0); | 305 | -EPERM, 0); |
| @@ -379,7 +379,7 @@ void evm_inode_post_setxattr(struct dentry *dentry, const char *xattr_name, | |||
| 379 | */ | 379 | */ |
| 380 | void evm_inode_post_removexattr(struct dentry *dentry, const char *xattr_name) | 380 | void evm_inode_post_removexattr(struct dentry *dentry, const char *xattr_name) |
| 381 | { | 381 | { |
| 382 | struct inode *inode = dentry->d_inode; | 382 | struct inode *inode = d_backing_inode(dentry); |
| 383 | 383 | ||
| 384 | if (!evm_initialized || !evm_protected_xattr(xattr_name)) | 384 | if (!evm_initialized || !evm_protected_xattr(xattr_name)) |
| 385 | return; | 385 | return; |
| @@ -404,7 +404,7 @@ int evm_inode_setattr(struct dentry *dentry, struct iattr *attr) | |||
| 404 | if ((evm_status == INTEGRITY_PASS) || | 404 | if ((evm_status == INTEGRITY_PASS) || |
| 405 | (evm_status == INTEGRITY_NOXATTRS)) | 405 | (evm_status == INTEGRITY_NOXATTRS)) |
| 406 | return 0; | 406 | return 0; |
| 407 | integrity_audit_msg(AUDIT_INTEGRITY_METADATA, dentry->d_inode, | 407 | integrity_audit_msg(AUDIT_INTEGRITY_METADATA, d_backing_inode(dentry), |
| 408 | dentry->d_name.name, "appraise_metadata", | 408 | dentry->d_name.name, "appraise_metadata", |
| 409 | integrity_status_msg[evm_status], -EPERM, 0); | 409 | integrity_status_msg[evm_status], -EPERM, 0); |
| 410 | return -EPERM; | 410 | return -EPERM; |
diff --git a/security/integrity/ima/ima_appraise.c b/security/integrity/ima/ima_appraise.c index fffcdb0b31f0..4df493e4b3c9 100644 --- a/security/integrity/ima/ima_appraise.c +++ b/security/integrity/ima/ima_appraise.c | |||
| @@ -165,7 +165,7 @@ void ima_get_hash_algo(struct evm_ima_xattr_data *xattr_value, int xattr_len, | |||
| 165 | int ima_read_xattr(struct dentry *dentry, | 165 | int ima_read_xattr(struct dentry *dentry, |
| 166 | struct evm_ima_xattr_data **xattr_value) | 166 | struct evm_ima_xattr_data **xattr_value) |
| 167 | { | 167 | { |
| 168 | struct inode *inode = dentry->d_inode; | 168 | struct inode *inode = d_backing_inode(dentry); |
| 169 | 169 | ||
| 170 | if (!inode->i_op->getxattr) | 170 | if (!inode->i_op->getxattr) |
| 171 | return 0; | 171 | return 0; |
| @@ -190,7 +190,7 @@ int ima_appraise_measurement(int func, struct integrity_iint_cache *iint, | |||
| 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_path.dentry; | 192 | struct dentry *dentry = file->f_path.dentry; |
| 193 | struct inode *inode = dentry->d_inode; | 193 | struct inode *inode = d_backing_inode(dentry); |
| 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; |
| 196 | 196 | ||
| @@ -314,7 +314,7 @@ void ima_update_xattr(struct integrity_iint_cache *iint, struct file *file) | |||
| 314 | */ | 314 | */ |
| 315 | void ima_inode_post_setattr(struct dentry *dentry) | 315 | void ima_inode_post_setattr(struct dentry *dentry) |
| 316 | { | 316 | { |
| 317 | struct inode *inode = dentry->d_inode; | 317 | struct inode *inode = d_backing_inode(dentry); |
| 318 | struct integrity_iint_cache *iint; | 318 | struct integrity_iint_cache *iint; |
| 319 | int must_appraise, rc; | 319 | int must_appraise, rc; |
| 320 | 320 | ||
| @@ -380,7 +380,7 @@ int ima_inode_setxattr(struct dentry *dentry, const char *xattr_name, | |||
| 380 | if (result == 1) { | 380 | if (result == 1) { |
| 381 | if (!xattr_value_len || (xvalue->type >= IMA_XATTR_LAST)) | 381 | if (!xattr_value_len || (xvalue->type >= IMA_XATTR_LAST)) |
| 382 | return -EINVAL; | 382 | return -EINVAL; |
| 383 | ima_reset_appraise_flags(dentry->d_inode, | 383 | ima_reset_appraise_flags(d_backing_inode(dentry), |
| 384 | (xvalue->type == EVM_IMA_XATTR_DIGSIG) ? 1 : 0); | 384 | (xvalue->type == EVM_IMA_XATTR_DIGSIG) ? 1 : 0); |
| 385 | result = 0; | 385 | result = 0; |
| 386 | } | 386 | } |
| @@ -393,7 +393,7 @@ int ima_inode_removexattr(struct dentry *dentry, const char *xattr_name) | |||
| 393 | 393 | ||
| 394 | result = ima_protect_xattr(dentry, xattr_name, NULL, 0); | 394 | result = ima_protect_xattr(dentry, xattr_name, NULL, 0); |
| 395 | if (result == 1) { | 395 | if (result == 1) { |
| 396 | ima_reset_appraise_flags(dentry->d_inode, 0); | 396 | ima_reset_appraise_flags(d_backing_inode(dentry), 0); |
| 397 | result = 0; | 397 | result = 0; |
| 398 | } | 398 | } |
| 399 | return result; | 399 | return result; |
diff --git a/security/lsm_audit.c b/security/lsm_audit.c index b526ddc3add5..1d34277dc402 100644 --- a/security/lsm_audit.c +++ b/security/lsm_audit.c | |||
| @@ -237,7 +237,7 @@ static void dump_common_audit_data(struct audit_buffer *ab, | |||
| 237 | 237 | ||
| 238 | audit_log_d_path(ab, " path=", &a->u.path); | 238 | audit_log_d_path(ab, " path=", &a->u.path); |
| 239 | 239 | ||
| 240 | inode = a->u.path.dentry->d_inode; | 240 | inode = d_backing_inode(a->u.path.dentry); |
| 241 | if (inode) { | 241 | if (inode) { |
| 242 | audit_log_format(ab, " dev="); | 242 | audit_log_format(ab, " dev="); |
| 243 | audit_log_untrustedstring(ab, inode->i_sb->s_id); | 243 | audit_log_untrustedstring(ab, inode->i_sb->s_id); |
| @@ -251,7 +251,7 @@ static void dump_common_audit_data(struct audit_buffer *ab, | |||
| 251 | audit_log_format(ab, " name="); | 251 | audit_log_format(ab, " name="); |
| 252 | audit_log_untrustedstring(ab, a->u.dentry->d_name.name); | 252 | audit_log_untrustedstring(ab, a->u.dentry->d_name.name); |
| 253 | 253 | ||
| 254 | inode = a->u.dentry->d_inode; | 254 | inode = d_backing_inode(a->u.dentry); |
| 255 | if (inode) { | 255 | if (inode) { |
| 256 | audit_log_format(ab, " dev="); | 256 | audit_log_format(ab, " dev="); |
| 257 | audit_log_untrustedstring(ab, inode->i_sb->s_id); | 257 | audit_log_untrustedstring(ab, inode->i_sb->s_id); |
diff --git a/security/security.c b/security/security.c index 730ac65a5737..8e9b1f4b9b45 100644 --- a/security/security.c +++ b/security/security.c | |||
| @@ -410,7 +410,7 @@ EXPORT_SYMBOL(security_old_inode_init_security); | |||
| 410 | int security_path_mknod(struct path *dir, struct dentry *dentry, umode_t mode, | 410 | int security_path_mknod(struct path *dir, struct dentry *dentry, umode_t mode, |
| 411 | unsigned int dev) | 411 | unsigned int dev) |
| 412 | { | 412 | { |
| 413 | if (unlikely(IS_PRIVATE(dir->dentry->d_inode))) | 413 | if (unlikely(IS_PRIVATE(d_backing_inode(dir->dentry)))) |
| 414 | return 0; | 414 | return 0; |
| 415 | return security_ops->path_mknod(dir, dentry, mode, dev); | 415 | return security_ops->path_mknod(dir, dentry, mode, dev); |
| 416 | } | 416 | } |
| @@ -418,7 +418,7 @@ EXPORT_SYMBOL(security_path_mknod); | |||
| 418 | 418 | ||
| 419 | int security_path_mkdir(struct path *dir, struct dentry *dentry, umode_t mode) | 419 | int security_path_mkdir(struct path *dir, struct dentry *dentry, umode_t mode) |
| 420 | { | 420 | { |
| 421 | if (unlikely(IS_PRIVATE(dir->dentry->d_inode))) | 421 | if (unlikely(IS_PRIVATE(d_backing_inode(dir->dentry)))) |
| 422 | return 0; | 422 | return 0; |
| 423 | return security_ops->path_mkdir(dir, dentry, mode); | 423 | return security_ops->path_mkdir(dir, dentry, mode); |
| 424 | } | 424 | } |
| @@ -426,14 +426,14 @@ EXPORT_SYMBOL(security_path_mkdir); | |||
| 426 | 426 | ||
| 427 | int security_path_rmdir(struct path *dir, struct dentry *dentry) | 427 | int security_path_rmdir(struct path *dir, struct dentry *dentry) |
| 428 | { | 428 | { |
| 429 | if (unlikely(IS_PRIVATE(dir->dentry->d_inode))) | 429 | if (unlikely(IS_PRIVATE(d_backing_inode(dir->dentry)))) |
| 430 | return 0; | 430 | return 0; |
| 431 | return security_ops->path_rmdir(dir, dentry); | 431 | return security_ops->path_rmdir(dir, dentry); |
| 432 | } | 432 | } |
| 433 | 433 | ||
| 434 | int security_path_unlink(struct path *dir, struct dentry *dentry) | 434 | int security_path_unlink(struct path *dir, struct dentry *dentry) |
| 435 | { | 435 | { |
| 436 | if (unlikely(IS_PRIVATE(dir->dentry->d_inode))) | 436 | if (unlikely(IS_PRIVATE(d_backing_inode(dir->dentry)))) |
| 437 | return 0; | 437 | return 0; |
| 438 | return security_ops->path_unlink(dir, dentry); | 438 | return security_ops->path_unlink(dir, dentry); |
| 439 | } | 439 | } |
| @@ -442,7 +442,7 @@ EXPORT_SYMBOL(security_path_unlink); | |||
| 442 | int security_path_symlink(struct path *dir, struct dentry *dentry, | 442 | int security_path_symlink(struct path *dir, struct dentry *dentry, |
| 443 | const char *old_name) | 443 | const char *old_name) |
| 444 | { | 444 | { |
| 445 | if (unlikely(IS_PRIVATE(dir->dentry->d_inode))) | 445 | if (unlikely(IS_PRIVATE(d_backing_inode(dir->dentry)))) |
| 446 | return 0; | 446 | return 0; |
| 447 | return security_ops->path_symlink(dir, dentry, old_name); | 447 | return security_ops->path_symlink(dir, dentry, old_name); |
| 448 | } | 448 | } |
| @@ -450,7 +450,7 @@ int security_path_symlink(struct path *dir, struct dentry *dentry, | |||
| 450 | int security_path_link(struct dentry *old_dentry, struct path *new_dir, | 450 | int security_path_link(struct dentry *old_dentry, struct path *new_dir, |
| 451 | struct dentry *new_dentry) | 451 | struct dentry *new_dentry) |
| 452 | { | 452 | { |
| 453 | if (unlikely(IS_PRIVATE(old_dentry->d_inode))) | 453 | if (unlikely(IS_PRIVATE(d_backing_inode(old_dentry)))) |
| 454 | return 0; | 454 | return 0; |
| 455 | return security_ops->path_link(old_dentry, new_dir, new_dentry); | 455 | return security_ops->path_link(old_dentry, new_dir, new_dentry); |
| 456 | } | 456 | } |
| @@ -459,8 +459,8 @@ int security_path_rename(struct path *old_dir, struct dentry *old_dentry, | |||
| 459 | struct path *new_dir, struct dentry *new_dentry, | 459 | struct path *new_dir, struct dentry *new_dentry, |
| 460 | unsigned int flags) | 460 | unsigned int flags) |
| 461 | { | 461 | { |
| 462 | if (unlikely(IS_PRIVATE(old_dentry->d_inode) || | 462 | if (unlikely(IS_PRIVATE(d_backing_inode(old_dentry)) || |
| 463 | (new_dentry->d_inode && IS_PRIVATE(new_dentry->d_inode)))) | 463 | (d_is_positive(new_dentry) && IS_PRIVATE(d_backing_inode(new_dentry))))) |
| 464 | return 0; | 464 | return 0; |
| 465 | 465 | ||
| 466 | if (flags & RENAME_EXCHANGE) { | 466 | if (flags & RENAME_EXCHANGE) { |
| @@ -477,21 +477,21 @@ EXPORT_SYMBOL(security_path_rename); | |||
| 477 | 477 | ||
| 478 | int security_path_truncate(struct path *path) | 478 | int security_path_truncate(struct path *path) |
| 479 | { | 479 | { |
| 480 | if (unlikely(IS_PRIVATE(path->dentry->d_inode))) | 480 | if (unlikely(IS_PRIVATE(d_backing_inode(path->dentry)))) |
| 481 | return 0; | 481 | return 0; |
| 482 | return security_ops->path_truncate(path); | 482 | return security_ops->path_truncate(path); |
| 483 | } | 483 | } |
| 484 | 484 | ||
| 485 | int security_path_chmod(struct path *path, umode_t mode) | 485 | int security_path_chmod(struct path *path, umode_t mode) |
| 486 | { | 486 | { |
| 487 | if (unlikely(IS_PRIVATE(path->dentry->d_inode))) | 487 | if (unlikely(IS_PRIVATE(d_backing_inode(path->dentry)))) |
| 488 | return 0; | 488 | return 0; |
| 489 | return security_ops->path_chmod(path, mode); | 489 | return security_ops->path_chmod(path, mode); |
| 490 | } | 490 | } |
| 491 | 491 | ||
| 492 | int security_path_chown(struct path *path, kuid_t uid, kgid_t gid) | 492 | int security_path_chown(struct path *path, kuid_t uid, kgid_t gid) |
| 493 | { | 493 | { |
| 494 | if (unlikely(IS_PRIVATE(path->dentry->d_inode))) | 494 | if (unlikely(IS_PRIVATE(d_backing_inode(path->dentry)))) |
| 495 | return 0; | 495 | return 0; |
| 496 | return security_ops->path_chown(path, uid, gid); | 496 | return security_ops->path_chown(path, uid, gid); |
| 497 | } | 497 | } |
| @@ -513,14 +513,14 @@ EXPORT_SYMBOL_GPL(security_inode_create); | |||
| 513 | int security_inode_link(struct dentry *old_dentry, struct inode *dir, | 513 | int security_inode_link(struct dentry *old_dentry, struct inode *dir, |
| 514 | struct dentry *new_dentry) | 514 | struct dentry *new_dentry) |
| 515 | { | 515 | { |
| 516 | if (unlikely(IS_PRIVATE(old_dentry->d_inode))) | 516 | if (unlikely(IS_PRIVATE(d_backing_inode(old_dentry)))) |
| 517 | return 0; | 517 | return 0; |
| 518 | return security_ops->inode_link(old_dentry, dir, new_dentry); | 518 | return security_ops->inode_link(old_dentry, dir, new_dentry); |
| 519 | } | 519 | } |
| 520 | 520 | ||
| 521 | int security_inode_unlink(struct inode *dir, struct dentry *dentry) | 521 | int security_inode_unlink(struct inode *dir, struct dentry *dentry) |
| 522 | { | 522 | { |
| 523 | if (unlikely(IS_PRIVATE(dentry->d_inode))) | 523 | if (unlikely(IS_PRIVATE(d_backing_inode(dentry)))) |
| 524 | return 0; | 524 | return 0; |
| 525 | return security_ops->inode_unlink(dir, dentry); | 525 | return security_ops->inode_unlink(dir, dentry); |
| 526 | } | 526 | } |
| @@ -543,7 +543,7 @@ EXPORT_SYMBOL_GPL(security_inode_mkdir); | |||
| 543 | 543 | ||
| 544 | int security_inode_rmdir(struct inode *dir, struct dentry *dentry) | 544 | int security_inode_rmdir(struct inode *dir, struct dentry *dentry) |
| 545 | { | 545 | { |
| 546 | if (unlikely(IS_PRIVATE(dentry->d_inode))) | 546 | if (unlikely(IS_PRIVATE(d_backing_inode(dentry)))) |
| 547 | return 0; | 547 | return 0; |
| 548 | return security_ops->inode_rmdir(dir, dentry); | 548 | return security_ops->inode_rmdir(dir, dentry); |
| 549 | } | 549 | } |
| @@ -559,8 +559,8 @@ int security_inode_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
| 559 | struct inode *new_dir, struct dentry *new_dentry, | 559 | struct inode *new_dir, struct dentry *new_dentry, |
| 560 | unsigned int flags) | 560 | unsigned int flags) |
| 561 | { | 561 | { |
| 562 | if (unlikely(IS_PRIVATE(old_dentry->d_inode) || | 562 | if (unlikely(IS_PRIVATE(d_backing_inode(old_dentry)) || |
| 563 | (new_dentry->d_inode && IS_PRIVATE(new_dentry->d_inode)))) | 563 | (d_is_positive(new_dentry) && IS_PRIVATE(d_backing_inode(new_dentry))))) |
| 564 | return 0; | 564 | return 0; |
| 565 | 565 | ||
| 566 | if (flags & RENAME_EXCHANGE) { | 566 | if (flags & RENAME_EXCHANGE) { |
| @@ -576,14 +576,14 @@ int security_inode_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
| 576 | 576 | ||
| 577 | int security_inode_readlink(struct dentry *dentry) | 577 | int security_inode_readlink(struct dentry *dentry) |
| 578 | { | 578 | { |
| 579 | if (unlikely(IS_PRIVATE(dentry->d_inode))) | 579 | if (unlikely(IS_PRIVATE(d_backing_inode(dentry)))) |
| 580 | return 0; | 580 | return 0; |
| 581 | return security_ops->inode_readlink(dentry); | 581 | return security_ops->inode_readlink(dentry); |
| 582 | } | 582 | } |
| 583 | 583 | ||
| 584 | int security_inode_follow_link(struct dentry *dentry, struct nameidata *nd) | 584 | int security_inode_follow_link(struct dentry *dentry, struct nameidata *nd) |
| 585 | { | 585 | { |
| 586 | if (unlikely(IS_PRIVATE(dentry->d_inode))) | 586 | if (unlikely(IS_PRIVATE(d_backing_inode(dentry)))) |
| 587 | return 0; | 587 | return 0; |
| 588 | return security_ops->inode_follow_link(dentry, nd); | 588 | return security_ops->inode_follow_link(dentry, nd); |
| 589 | } | 589 | } |
| @@ -599,7 +599,7 @@ int security_inode_setattr(struct dentry *dentry, struct iattr *attr) | |||
| 599 | { | 599 | { |
| 600 | int ret; | 600 | int ret; |
| 601 | 601 | ||
| 602 | if (unlikely(IS_PRIVATE(dentry->d_inode))) | 602 | if (unlikely(IS_PRIVATE(d_backing_inode(dentry)))) |
| 603 | return 0; | 603 | return 0; |
| 604 | ret = security_ops->inode_setattr(dentry, attr); | 604 | ret = security_ops->inode_setattr(dentry, attr); |
| 605 | if (ret) | 605 | if (ret) |
| @@ -610,7 +610,7 @@ EXPORT_SYMBOL_GPL(security_inode_setattr); | |||
| 610 | 610 | ||
| 611 | int security_inode_getattr(const struct path *path) | 611 | int security_inode_getattr(const struct path *path) |
| 612 | { | 612 | { |
| 613 | if (unlikely(IS_PRIVATE(path->dentry->d_inode))) | 613 | if (unlikely(IS_PRIVATE(d_backing_inode(path->dentry)))) |
| 614 | return 0; | 614 | return 0; |
| 615 | return security_ops->inode_getattr(path); | 615 | return security_ops->inode_getattr(path); |
| 616 | } | 616 | } |
| @@ -620,7 +620,7 @@ int security_inode_setxattr(struct dentry *dentry, const char *name, | |||
| 620 | { | 620 | { |
| 621 | int ret; | 621 | int ret; |
| 622 | 622 | ||
| 623 | if (unlikely(IS_PRIVATE(dentry->d_inode))) | 623 | if (unlikely(IS_PRIVATE(d_backing_inode(dentry)))) |
| 624 | return 0; | 624 | return 0; |
| 625 | ret = security_ops->inode_setxattr(dentry, name, value, size, flags); | 625 | ret = security_ops->inode_setxattr(dentry, name, value, size, flags); |
| 626 | if (ret) | 626 | if (ret) |
| @@ -634,7 +634,7 @@ int security_inode_setxattr(struct dentry *dentry, const char *name, | |||
| 634 | void security_inode_post_setxattr(struct dentry *dentry, const char *name, | 634 | void security_inode_post_setxattr(struct dentry *dentry, const char *name, |
| 635 | const void *value, size_t size, int flags) | 635 | const void *value, size_t size, int flags) |
| 636 | { | 636 | { |
| 637 | if (unlikely(IS_PRIVATE(dentry->d_inode))) | 637 | if (unlikely(IS_PRIVATE(d_backing_inode(dentry)))) |
| 638 | return; | 638 | return; |
| 639 | security_ops->inode_post_setxattr(dentry, name, value, size, flags); | 639 | security_ops->inode_post_setxattr(dentry, name, value, size, flags); |
| 640 | evm_inode_post_setxattr(dentry, name, value, size); | 640 | evm_inode_post_setxattr(dentry, name, value, size); |
| @@ -642,14 +642,14 @@ void security_inode_post_setxattr(struct dentry *dentry, const char *name, | |||
| 642 | 642 | ||
| 643 | int security_inode_getxattr(struct dentry *dentry, const char *name) | 643 | int security_inode_getxattr(struct dentry *dentry, const char *name) |
| 644 | { | 644 | { |
| 645 | if (unlikely(IS_PRIVATE(dentry->d_inode))) | 645 | if (unlikely(IS_PRIVATE(d_backing_inode(dentry)))) |
| 646 | return 0; | 646 | return 0; |
| 647 | return security_ops->inode_getxattr(dentry, name); | 647 | return security_ops->inode_getxattr(dentry, name); |
| 648 | } | 648 | } |
| 649 | 649 | ||
| 650 | int security_inode_listxattr(struct dentry *dentry) | 650 | int security_inode_listxattr(struct dentry *dentry) |
| 651 | { | 651 | { |
| 652 | if (unlikely(IS_PRIVATE(dentry->d_inode))) | 652 | if (unlikely(IS_PRIVATE(d_backing_inode(dentry)))) |
| 653 | return 0; | 653 | return 0; |
| 654 | return security_ops->inode_listxattr(dentry); | 654 | return security_ops->inode_listxattr(dentry); |
| 655 | } | 655 | } |
| @@ -658,7 +658,7 @@ int security_inode_removexattr(struct dentry *dentry, const char *name) | |||
| 658 | { | 658 | { |
| 659 | int ret; | 659 | int ret; |
| 660 | 660 | ||
| 661 | if (unlikely(IS_PRIVATE(dentry->d_inode))) | 661 | if (unlikely(IS_PRIVATE(d_backing_inode(dentry)))) |
| 662 | return 0; | 662 | return 0; |
| 663 | ret = security_ops->inode_removexattr(dentry, name); | 663 | ret = security_ops->inode_removexattr(dentry, name); |
| 664 | if (ret) | 664 | if (ret) |
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c index c318b304ee2f..7dade28affba 100644 --- a/security/selinux/hooks.c +++ b/security/selinux/hooks.c | |||
| @@ -414,7 +414,7 @@ static int sb_finish_set_opts(struct super_block *sb) | |||
| 414 | { | 414 | { |
| 415 | struct superblock_security_struct *sbsec = sb->s_security; | 415 | struct superblock_security_struct *sbsec = sb->s_security; |
| 416 | struct dentry *root = sb->s_root; | 416 | struct dentry *root = sb->s_root; |
| 417 | struct inode *root_inode = root->d_inode; | 417 | struct inode *root_inode = d_backing_inode(root); |
| 418 | int rc = 0; | 418 | int rc = 0; |
| 419 | 419 | ||
| 420 | if (sbsec->behavior == SECURITY_FS_USE_XATTR) { | 420 | if (sbsec->behavior == SECURITY_FS_USE_XATTR) { |
| @@ -552,7 +552,7 @@ static int selinux_get_mnt_opts(const struct super_block *sb, | |||
| 552 | opts->mnt_opts_flags[i++] = DEFCONTEXT_MNT; | 552 | opts->mnt_opts_flags[i++] = DEFCONTEXT_MNT; |
| 553 | } | 553 | } |
| 554 | if (sbsec->flags & ROOTCONTEXT_MNT) { | 554 | if (sbsec->flags & ROOTCONTEXT_MNT) { |
| 555 | struct inode *root = sbsec->sb->s_root->d_inode; | 555 | struct inode *root = d_backing_inode(sbsec->sb->s_root); |
| 556 | struct inode_security_struct *isec = root->i_security; | 556 | struct inode_security_struct *isec = root->i_security; |
| 557 | 557 | ||
| 558 | rc = security_sid_to_context(isec->sid, &context, &len); | 558 | rc = security_sid_to_context(isec->sid, &context, &len); |
| @@ -608,7 +608,7 @@ static int selinux_set_mnt_opts(struct super_block *sb, | |||
| 608 | int rc = 0, i; | 608 | int rc = 0, i; |
| 609 | struct superblock_security_struct *sbsec = sb->s_security; | 609 | struct superblock_security_struct *sbsec = sb->s_security; |
| 610 | const char *name = sb->s_type->name; | 610 | const char *name = sb->s_type->name; |
| 611 | struct inode *inode = sbsec->sb->s_root->d_inode; | 611 | struct inode *inode = d_backing_inode(sbsec->sb->s_root); |
| 612 | struct inode_security_struct *root_isec = inode->i_security; | 612 | struct inode_security_struct *root_isec = inode->i_security; |
| 613 | u32 fscontext_sid = 0, context_sid = 0, rootcontext_sid = 0; | 613 | u32 fscontext_sid = 0, context_sid = 0, rootcontext_sid = 0; |
| 614 | u32 defcontext_sid = 0; | 614 | u32 defcontext_sid = 0; |
| @@ -835,8 +835,8 @@ static int selinux_cmp_sb_context(const struct super_block *oldsb, | |||
| 835 | if ((oldflags & DEFCONTEXT_MNT) && old->def_sid != new->def_sid) | 835 | if ((oldflags & DEFCONTEXT_MNT) && old->def_sid != new->def_sid) |
| 836 | goto mismatch; | 836 | goto mismatch; |
| 837 | if (oldflags & ROOTCONTEXT_MNT) { | 837 | if (oldflags & ROOTCONTEXT_MNT) { |
| 838 | struct inode_security_struct *oldroot = oldsb->s_root->d_inode->i_security; | 838 | struct inode_security_struct *oldroot = d_backing_inode(oldsb->s_root)->i_security; |
| 839 | struct inode_security_struct *newroot = newsb->s_root->d_inode->i_security; | 839 | struct inode_security_struct *newroot = d_backing_inode(newsb->s_root)->i_security; |
| 840 | if (oldroot->sid != newroot->sid) | 840 | if (oldroot->sid != newroot->sid) |
| 841 | goto mismatch; | 841 | goto mismatch; |
| 842 | } | 842 | } |
| @@ -886,16 +886,16 @@ static int selinux_sb_clone_mnt_opts(const struct super_block *oldsb, | |||
| 886 | if (!set_fscontext) | 886 | if (!set_fscontext) |
| 887 | newsbsec->sid = sid; | 887 | newsbsec->sid = sid; |
| 888 | if (!set_rootcontext) { | 888 | if (!set_rootcontext) { |
| 889 | struct inode *newinode = newsb->s_root->d_inode; | 889 | struct inode *newinode = d_backing_inode(newsb->s_root); |
| 890 | struct inode_security_struct *newisec = newinode->i_security; | 890 | struct inode_security_struct *newisec = newinode->i_security; |
| 891 | newisec->sid = sid; | 891 | newisec->sid = sid; |
| 892 | } | 892 | } |
| 893 | newsbsec->mntpoint_sid = sid; | 893 | newsbsec->mntpoint_sid = sid; |
| 894 | } | 894 | } |
| 895 | if (set_rootcontext) { | 895 | if (set_rootcontext) { |
| 896 | const struct inode *oldinode = oldsb->s_root->d_inode; | 896 | const struct inode *oldinode = d_backing_inode(oldsb->s_root); |
| 897 | const struct inode_security_struct *oldisec = oldinode->i_security; | 897 | const struct inode_security_struct *oldisec = oldinode->i_security; |
| 898 | struct inode *newinode = newsb->s_root->d_inode; | 898 | struct inode *newinode = d_backing_inode(newsb->s_root); |
| 899 | struct inode_security_struct *newisec = newinode->i_security; | 899 | struct inode_security_struct *newisec = newinode->i_security; |
| 900 | 900 | ||
| 901 | newisec->sid = oldisec->sid; | 901 | newisec->sid = oldisec->sid; |
| @@ -1610,7 +1610,7 @@ static inline int dentry_has_perm(const struct cred *cred, | |||
| 1610 | struct dentry *dentry, | 1610 | struct dentry *dentry, |
| 1611 | u32 av) | 1611 | u32 av) |
| 1612 | { | 1612 | { |
| 1613 | struct inode *inode = dentry->d_inode; | 1613 | struct inode *inode = d_backing_inode(dentry); |
| 1614 | struct common_audit_data ad; | 1614 | struct common_audit_data ad; |
| 1615 | 1615 | ||
| 1616 | ad.type = LSM_AUDIT_DATA_DENTRY; | 1616 | ad.type = LSM_AUDIT_DATA_DENTRY; |
| @@ -1625,7 +1625,7 @@ static inline int path_has_perm(const struct cred *cred, | |||
| 1625 | const struct path *path, | 1625 | const struct path *path, |
| 1626 | u32 av) | 1626 | u32 av) |
| 1627 | { | 1627 | { |
| 1628 | struct inode *inode = path->dentry->d_inode; | 1628 | struct inode *inode = d_backing_inode(path->dentry); |
| 1629 | struct common_audit_data ad; | 1629 | struct common_audit_data ad; |
| 1630 | 1630 | ||
| 1631 | ad.type = LSM_AUDIT_DATA_PATH; | 1631 | ad.type = LSM_AUDIT_DATA_PATH; |
| @@ -1753,7 +1753,7 @@ static int may_link(struct inode *dir, | |||
| 1753 | int rc; | 1753 | int rc; |
| 1754 | 1754 | ||
| 1755 | dsec = dir->i_security; | 1755 | dsec = dir->i_security; |
| 1756 | isec = dentry->d_inode->i_security; | 1756 | isec = d_backing_inode(dentry)->i_security; |
| 1757 | 1757 | ||
| 1758 | ad.type = LSM_AUDIT_DATA_DENTRY; | 1758 | ad.type = LSM_AUDIT_DATA_DENTRY; |
| 1759 | ad.u.dentry = dentry; | 1759 | ad.u.dentry = dentry; |
| @@ -1797,7 +1797,7 @@ static inline int may_rename(struct inode *old_dir, | |||
| 1797 | int rc; | 1797 | int rc; |
| 1798 | 1798 | ||
| 1799 | old_dsec = old_dir->i_security; | 1799 | old_dsec = old_dir->i_security; |
| 1800 | old_isec = old_dentry->d_inode->i_security; | 1800 | old_isec = d_backing_inode(old_dentry)->i_security; |
| 1801 | old_is_dir = d_is_dir(old_dentry); | 1801 | old_is_dir = d_is_dir(old_dentry); |
| 1802 | new_dsec = new_dir->i_security; | 1802 | new_dsec = new_dir->i_security; |
| 1803 | 1803 | ||
| @@ -1827,7 +1827,7 @@ static inline int may_rename(struct inode *old_dir, | |||
| 1827 | if (rc) | 1827 | if (rc) |
| 1828 | return rc; | 1828 | return rc; |
| 1829 | if (d_is_positive(new_dentry)) { | 1829 | if (d_is_positive(new_dentry)) { |
| 1830 | new_isec = new_dentry->d_inode->i_security; | 1830 | new_isec = d_backing_inode(new_dentry)->i_security; |
| 1831 | new_is_dir = d_is_dir(new_dentry); | 1831 | new_is_dir = d_is_dir(new_dentry); |
| 1832 | rc = avc_has_perm(sid, new_isec->sid, | 1832 | rc = avc_has_perm(sid, new_isec->sid, |
| 1833 | new_isec->sclass, | 1833 | new_isec->sclass, |
| @@ -1963,7 +1963,7 @@ static int selinux_binder_transfer_file(struct task_struct *from, | |||
| 1963 | { | 1963 | { |
| 1964 | u32 sid = task_sid(to); | 1964 | u32 sid = task_sid(to); |
| 1965 | struct file_security_struct *fsec = file->f_security; | 1965 | struct file_security_struct *fsec = file->f_security; |
| 1966 | struct inode *inode = file->f_path.dentry->d_inode; | 1966 | struct inode *inode = d_backing_inode(file->f_path.dentry); |
| 1967 | struct inode_security_struct *isec = inode->i_security; | 1967 | struct inode_security_struct *isec = inode->i_security; |
| 1968 | struct common_audit_data ad; | 1968 | struct common_audit_data ad; |
| 1969 | int rc; | 1969 | int rc; |
| @@ -2627,7 +2627,7 @@ static int selinux_sb_remount(struct super_block *sb, void *data) | |||
| 2627 | break; | 2627 | break; |
| 2628 | case ROOTCONTEXT_MNT: { | 2628 | case ROOTCONTEXT_MNT: { |
| 2629 | struct inode_security_struct *root_isec; | 2629 | struct inode_security_struct *root_isec; |
| 2630 | root_isec = sb->s_root->d_inode->i_security; | 2630 | root_isec = d_backing_inode(sb->s_root)->i_security; |
| 2631 | 2631 | ||
| 2632 | if (bad_option(sbsec, ROOTCONTEXT_MNT, root_isec->sid, sid)) | 2632 | if (bad_option(sbsec, ROOTCONTEXT_MNT, root_isec->sid, sid)) |
| 2633 | goto out_bad_option; | 2633 | goto out_bad_option; |
| @@ -2727,7 +2727,7 @@ static int selinux_dentry_init_security(struct dentry *dentry, int mode, | |||
| 2727 | struct task_security_struct *tsec; | 2727 | struct task_security_struct *tsec; |
| 2728 | struct inode_security_struct *dsec; | 2728 | struct inode_security_struct *dsec; |
| 2729 | struct superblock_security_struct *sbsec; | 2729 | struct superblock_security_struct *sbsec; |
| 2730 | struct inode *dir = dentry->d_parent->d_inode; | 2730 | struct inode *dir = d_backing_inode(dentry->d_parent); |
| 2731 | u32 newsid; | 2731 | u32 newsid; |
| 2732 | int rc; | 2732 | int rc; |
| 2733 | 2733 | ||
| @@ -2982,7 +2982,7 @@ static int selinux_inode_setotherxattr(struct dentry *dentry, const char *name) | |||
| 2982 | static int selinux_inode_setxattr(struct dentry *dentry, const char *name, | 2982 | static int selinux_inode_setxattr(struct dentry *dentry, const char *name, |
| 2983 | const void *value, size_t size, int flags) | 2983 | const void *value, size_t size, int flags) |
| 2984 | { | 2984 | { |
| 2985 | struct inode *inode = dentry->d_inode; | 2985 | struct inode *inode = d_backing_inode(dentry); |
| 2986 | struct inode_security_struct *isec = inode->i_security; | 2986 | struct inode_security_struct *isec = inode->i_security; |
| 2987 | struct superblock_security_struct *sbsec; | 2987 | struct superblock_security_struct *sbsec; |
| 2988 | struct common_audit_data ad; | 2988 | struct common_audit_data ad; |
| @@ -3059,7 +3059,7 @@ static void selinux_inode_post_setxattr(struct dentry *dentry, const char *name, | |||
| 3059 | const void *value, size_t size, | 3059 | const void *value, size_t size, |
| 3060 | int flags) | 3060 | int flags) |
| 3061 | { | 3061 | { |
| 3062 | struct inode *inode = dentry->d_inode; | 3062 | struct inode *inode = d_backing_inode(dentry); |
| 3063 | struct inode_security_struct *isec = inode->i_security; | 3063 | struct inode_security_struct *isec = inode->i_security; |
| 3064 | u32 newsid; | 3064 | u32 newsid; |
| 3065 | int rc; | 3065 | int rc; |
diff --git a/security/selinux/selinuxfs.c b/security/selinux/selinuxfs.c index 5fde34326dcf..d2787cca1fcb 100644 --- a/security/selinux/selinuxfs.c +++ b/security/selinux/selinuxfs.c | |||
| @@ -1737,7 +1737,7 @@ static struct dentry *sel_make_dir(struct dentry *dir, const char *name, | |||
| 1737 | inc_nlink(inode); | 1737 | inc_nlink(inode); |
| 1738 | d_add(dentry, inode); | 1738 | d_add(dentry, inode); |
| 1739 | /* bump link count on parent directory, too */ | 1739 | /* bump link count on parent directory, too */ |
| 1740 | inc_nlink(dir->d_inode); | 1740 | inc_nlink(d_inode(dir)); |
| 1741 | 1741 | ||
| 1742 | return dentry; | 1742 | return dentry; |
| 1743 | } | 1743 | } |
diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c index 69fdc384af30..b644757886bc 100644 --- a/security/smack/smack_lsm.c +++ b/security/smack/smack_lsm.c | |||
| @@ -593,7 +593,7 @@ static int smack_sb_copy_data(char *orig, char *smackopts) | |||
| 593 | static int smack_sb_kern_mount(struct super_block *sb, int flags, void *data) | 593 | static int smack_sb_kern_mount(struct super_block *sb, int flags, void *data) |
| 594 | { | 594 | { |
| 595 | struct dentry *root = sb->s_root; | 595 | struct dentry *root = sb->s_root; |
| 596 | struct inode *inode = root->d_inode; | 596 | struct inode *inode = d_backing_inode(root); |
| 597 | struct superblock_smack *sp = sb->s_security; | 597 | struct superblock_smack *sp = sb->s_security; |
| 598 | struct inode_smack *isp; | 598 | struct inode_smack *isp; |
| 599 | struct smack_known *skp; | 599 | struct smack_known *skp; |
| @@ -889,15 +889,15 @@ static int smack_inode_link(struct dentry *old_dentry, struct inode *dir, | |||
| 889 | smk_ad_init(&ad, __func__, LSM_AUDIT_DATA_DENTRY); | 889 | smk_ad_init(&ad, __func__, LSM_AUDIT_DATA_DENTRY); |
| 890 | smk_ad_setfield_u_fs_path_dentry(&ad, old_dentry); | 890 | smk_ad_setfield_u_fs_path_dentry(&ad, old_dentry); |
| 891 | 891 | ||
| 892 | isp = smk_of_inode(old_dentry->d_inode); | 892 | isp = smk_of_inode(d_backing_inode(old_dentry)); |
| 893 | rc = smk_curacc(isp, MAY_WRITE, &ad); | 893 | rc = smk_curacc(isp, MAY_WRITE, &ad); |
| 894 | rc = smk_bu_inode(old_dentry->d_inode, MAY_WRITE, rc); | 894 | rc = smk_bu_inode(d_backing_inode(old_dentry), MAY_WRITE, rc); |
| 895 | 895 | ||
| 896 | if (rc == 0 && d_is_positive(new_dentry)) { | 896 | if (rc == 0 && d_is_positive(new_dentry)) { |
| 897 | isp = smk_of_inode(new_dentry->d_inode); | 897 | isp = smk_of_inode(d_backing_inode(new_dentry)); |
| 898 | smk_ad_setfield_u_fs_path_dentry(&ad, new_dentry); | 898 | smk_ad_setfield_u_fs_path_dentry(&ad, new_dentry); |
| 899 | rc = smk_curacc(isp, MAY_WRITE, &ad); | 899 | rc = smk_curacc(isp, MAY_WRITE, &ad); |
| 900 | rc = smk_bu_inode(new_dentry->d_inode, MAY_WRITE, rc); | 900 | rc = smk_bu_inode(d_backing_inode(new_dentry), MAY_WRITE, rc); |
| 901 | } | 901 | } |
| 902 | 902 | ||
| 903 | return rc; | 903 | return rc; |
| @@ -913,7 +913,7 @@ static int smack_inode_link(struct dentry *old_dentry, struct inode *dir, | |||
| 913 | */ | 913 | */ |
| 914 | static int smack_inode_unlink(struct inode *dir, struct dentry *dentry) | 914 | static int smack_inode_unlink(struct inode *dir, struct dentry *dentry) |
| 915 | { | 915 | { |
| 916 | struct inode *ip = dentry->d_inode; | 916 | struct inode *ip = d_backing_inode(dentry); |
| 917 | struct smk_audit_info ad; | 917 | struct smk_audit_info ad; |
| 918 | int rc; | 918 | int rc; |
| 919 | 919 | ||
| @@ -956,8 +956,8 @@ static int smack_inode_rmdir(struct inode *dir, struct dentry *dentry) | |||
| 956 | /* | 956 | /* |
| 957 | * You need write access to the thing you're removing | 957 | * You need write access to the thing you're removing |
| 958 | */ | 958 | */ |
| 959 | rc = smk_curacc(smk_of_inode(dentry->d_inode), MAY_WRITE, &ad); | 959 | rc = smk_curacc(smk_of_inode(d_backing_inode(dentry)), MAY_WRITE, &ad); |
| 960 | rc = smk_bu_inode(dentry->d_inode, MAY_WRITE, rc); | 960 | rc = smk_bu_inode(d_backing_inode(dentry), MAY_WRITE, rc); |
| 961 | if (rc == 0) { | 961 | if (rc == 0) { |
| 962 | /* | 962 | /* |
| 963 | * You also need write access to the containing directory | 963 | * You also need write access to the containing directory |
| @@ -995,15 +995,15 @@ static int smack_inode_rename(struct inode *old_inode, | |||
| 995 | smk_ad_init(&ad, __func__, LSM_AUDIT_DATA_DENTRY); | 995 | smk_ad_init(&ad, __func__, LSM_AUDIT_DATA_DENTRY); |
| 996 | smk_ad_setfield_u_fs_path_dentry(&ad, old_dentry); | 996 | smk_ad_setfield_u_fs_path_dentry(&ad, old_dentry); |
| 997 | 997 | ||
| 998 | isp = smk_of_inode(old_dentry->d_inode); | 998 | isp = smk_of_inode(d_backing_inode(old_dentry)); |
| 999 | rc = smk_curacc(isp, MAY_READWRITE, &ad); | 999 | rc = smk_curacc(isp, MAY_READWRITE, &ad); |
| 1000 | rc = smk_bu_inode(old_dentry->d_inode, MAY_READWRITE, rc); | 1000 | rc = smk_bu_inode(d_backing_inode(old_dentry), MAY_READWRITE, rc); |
| 1001 | 1001 | ||
| 1002 | if (rc == 0 && d_is_positive(new_dentry)) { | 1002 | if (rc == 0 && d_is_positive(new_dentry)) { |
| 1003 | isp = smk_of_inode(new_dentry->d_inode); | 1003 | isp = smk_of_inode(d_backing_inode(new_dentry)); |
| 1004 | smk_ad_setfield_u_fs_path_dentry(&ad, new_dentry); | 1004 | smk_ad_setfield_u_fs_path_dentry(&ad, new_dentry); |
| 1005 | rc = smk_curacc(isp, MAY_READWRITE, &ad); | 1005 | rc = smk_curacc(isp, MAY_READWRITE, &ad); |
| 1006 | rc = smk_bu_inode(new_dentry->d_inode, MAY_READWRITE, rc); | 1006 | rc = smk_bu_inode(d_backing_inode(new_dentry), MAY_READWRITE, rc); |
| 1007 | } | 1007 | } |
| 1008 | return rc; | 1008 | return rc; |
| 1009 | } | 1009 | } |
| @@ -1060,8 +1060,8 @@ static int smack_inode_setattr(struct dentry *dentry, struct iattr *iattr) | |||
| 1060 | smk_ad_init(&ad, __func__, LSM_AUDIT_DATA_DENTRY); | 1060 | smk_ad_init(&ad, __func__, LSM_AUDIT_DATA_DENTRY); |
| 1061 | smk_ad_setfield_u_fs_path_dentry(&ad, dentry); | 1061 | smk_ad_setfield_u_fs_path_dentry(&ad, dentry); |
| 1062 | 1062 | ||
| 1063 | rc = smk_curacc(smk_of_inode(dentry->d_inode), MAY_WRITE, &ad); | 1063 | rc = smk_curacc(smk_of_inode(d_backing_inode(dentry)), MAY_WRITE, &ad); |
| 1064 | rc = smk_bu_inode(dentry->d_inode, MAY_WRITE, rc); | 1064 | rc = smk_bu_inode(d_backing_inode(dentry), MAY_WRITE, rc); |
| 1065 | return rc; | 1065 | return rc; |
| 1066 | } | 1066 | } |
| 1067 | 1067 | ||
| @@ -1075,7 +1075,7 @@ static int smack_inode_setattr(struct dentry *dentry, struct iattr *iattr) | |||
| 1075 | static int smack_inode_getattr(const struct path *path) | 1075 | static int smack_inode_getattr(const struct path *path) |
| 1076 | { | 1076 | { |
| 1077 | struct smk_audit_info ad; | 1077 | struct smk_audit_info ad; |
| 1078 | struct inode *inode = path->dentry->d_inode; | 1078 | struct inode *inode = d_backing_inode(path->dentry); |
| 1079 | int rc; | 1079 | int rc; |
| 1080 | 1080 | ||
| 1081 | smk_ad_init(&ad, __func__, LSM_AUDIT_DATA_PATH); | 1081 | smk_ad_init(&ad, __func__, LSM_AUDIT_DATA_PATH); |
| @@ -1142,8 +1142,8 @@ static int smack_inode_setxattr(struct dentry *dentry, const char *name, | |||
| 1142 | smk_ad_setfield_u_fs_path_dentry(&ad, dentry); | 1142 | smk_ad_setfield_u_fs_path_dentry(&ad, dentry); |
| 1143 | 1143 | ||
| 1144 | if (rc == 0) { | 1144 | if (rc == 0) { |
| 1145 | rc = smk_curacc(smk_of_inode(dentry->d_inode), MAY_WRITE, &ad); | 1145 | rc = smk_curacc(smk_of_inode(d_backing_inode(dentry)), MAY_WRITE, &ad); |
| 1146 | rc = smk_bu_inode(dentry->d_inode, MAY_WRITE, rc); | 1146 | rc = smk_bu_inode(d_backing_inode(dentry), MAY_WRITE, rc); |
| 1147 | } | 1147 | } |
| 1148 | 1148 | ||
| 1149 | return rc; | 1149 | return rc; |
| @@ -1164,7 +1164,7 @@ static void smack_inode_post_setxattr(struct dentry *dentry, const char *name, | |||
| 1164 | const void *value, size_t size, int flags) | 1164 | const void *value, size_t size, int flags) |
| 1165 | { | 1165 | { |
| 1166 | struct smack_known *skp; | 1166 | struct smack_known *skp; |
| 1167 | struct inode_smack *isp = dentry->d_inode->i_security; | 1167 | struct inode_smack *isp = d_backing_inode(dentry)->i_security; |
| 1168 | 1168 | ||
| 1169 | if (strcmp(name, XATTR_NAME_SMACKTRANSMUTE) == 0) { | 1169 | if (strcmp(name, XATTR_NAME_SMACKTRANSMUTE) == 0) { |
| 1170 | isp->smk_flags |= SMK_INODE_TRANSMUTE; | 1170 | isp->smk_flags |= SMK_INODE_TRANSMUTE; |
| @@ -1209,8 +1209,8 @@ static int smack_inode_getxattr(struct dentry *dentry, const char *name) | |||
| 1209 | smk_ad_init(&ad, __func__, LSM_AUDIT_DATA_DENTRY); | 1209 | smk_ad_init(&ad, __func__, LSM_AUDIT_DATA_DENTRY); |
| 1210 | smk_ad_setfield_u_fs_path_dentry(&ad, dentry); | 1210 | smk_ad_setfield_u_fs_path_dentry(&ad, dentry); |
| 1211 | 1211 | ||
| 1212 | rc = smk_curacc(smk_of_inode(dentry->d_inode), MAY_READ, &ad); | 1212 | rc = smk_curacc(smk_of_inode(d_backing_inode(dentry)), MAY_READ, &ad); |
| 1213 | rc = smk_bu_inode(dentry->d_inode, MAY_READ, rc); | 1213 | rc = smk_bu_inode(d_backing_inode(dentry), MAY_READ, rc); |
| 1214 | return rc; | 1214 | return rc; |
| 1215 | } | 1215 | } |
| 1216 | 1216 | ||
| @@ -1246,12 +1246,12 @@ static int smack_inode_removexattr(struct dentry *dentry, const char *name) | |||
| 1246 | smk_ad_init(&ad, __func__, LSM_AUDIT_DATA_DENTRY); | 1246 | smk_ad_init(&ad, __func__, LSM_AUDIT_DATA_DENTRY); |
| 1247 | smk_ad_setfield_u_fs_path_dentry(&ad, dentry); | 1247 | smk_ad_setfield_u_fs_path_dentry(&ad, dentry); |
| 1248 | 1248 | ||
| 1249 | rc = smk_curacc(smk_of_inode(dentry->d_inode), MAY_WRITE, &ad); | 1249 | rc = smk_curacc(smk_of_inode(d_backing_inode(dentry)), MAY_WRITE, &ad); |
| 1250 | rc = smk_bu_inode(dentry->d_inode, MAY_WRITE, rc); | 1250 | rc = smk_bu_inode(d_backing_inode(dentry), MAY_WRITE, rc); |
| 1251 | if (rc != 0) | 1251 | if (rc != 0) |
| 1252 | return rc; | 1252 | return rc; |
| 1253 | 1253 | ||
| 1254 | isp = dentry->d_inode->i_security; | 1254 | isp = d_backing_inode(dentry)->i_security; |
| 1255 | /* | 1255 | /* |
| 1256 | * Don't do anything special for these. | 1256 | * Don't do anything special for these. |
| 1257 | * XATTR_NAME_SMACKIPIN | 1257 | * XATTR_NAME_SMACKIPIN |
diff --git a/security/smack/smackfs.c b/security/smack/smackfs.c index 06f719ed63c9..d9682985349e 100644 --- a/security/smack/smackfs.c +++ b/security/smack/smackfs.c | |||
| @@ -2490,7 +2490,7 @@ static int smk_fill_super(struct super_block *sb, void *data, int silent) | |||
| 2490 | return rc; | 2490 | return rc; |
| 2491 | } | 2491 | } |
| 2492 | 2492 | ||
| 2493 | root_inode = sb->s_root->d_inode; | 2493 | root_inode = d_inode(sb->s_root); |
| 2494 | 2494 | ||
| 2495 | return 0; | 2495 | return 0; |
| 2496 | } | 2496 | } |
diff --git a/security/tomoyo/condition.c b/security/tomoyo/condition.c index 63681e8be628..6c4528d4b48f 100644 --- a/security/tomoyo/condition.c +++ b/security/tomoyo/condition.c | |||
| @@ -714,7 +714,7 @@ void tomoyo_get_attributes(struct tomoyo_obj_info *obj) | |||
| 714 | dentry = dget_parent(dentry); | 714 | dentry = dget_parent(dentry); |
| 715 | break; | 715 | break; |
| 716 | } | 716 | } |
| 717 | inode = dentry->d_inode; | 717 | inode = d_backing_inode(dentry); |
| 718 | if (inode) { | 718 | if (inode) { |
| 719 | struct tomoyo_mini_stat *stat = &obj->stat[i]; | 719 | struct tomoyo_mini_stat *stat = &obj->stat[i]; |
| 720 | stat->uid = inode->i_uid; | 720 | stat->uid = inode->i_uid; |
diff --git a/security/tomoyo/realpath.c b/security/tomoyo/realpath.c index 1e0d480ff6a6..5077f1968841 100644 --- a/security/tomoyo/realpath.c +++ b/security/tomoyo/realpath.c | |||
| @@ -97,7 +97,7 @@ static char *tomoyo_get_absolute_path(const struct path *path, char * const buff | |||
| 97 | /* go to whatever namespace root we are under */ | 97 | /* go to whatever namespace root we are under */ |
| 98 | pos = d_absolute_path(path, buffer, buflen - 1); | 98 | pos = d_absolute_path(path, buffer, buflen - 1); |
| 99 | if (!IS_ERR(pos) && *pos == '/' && pos[1]) { | 99 | if (!IS_ERR(pos) && *pos == '/' && pos[1]) { |
| 100 | struct inode *inode = path->dentry->d_inode; | 100 | struct inode *inode = d_backing_inode(path->dentry); |
| 101 | if (inode && S_ISDIR(inode->i_mode)) { | 101 | if (inode && S_ISDIR(inode->i_mode)) { |
| 102 | buffer[buflen - 2] = '/'; | 102 | buffer[buflen - 2] = '/'; |
| 103 | buffer[buflen - 1] = '\0'; | 103 | buffer[buflen - 1] = '\0'; |
| @@ -125,7 +125,7 @@ static char *tomoyo_get_dentry_path(struct dentry *dentry, char * const buffer, | |||
| 125 | if (buflen >= 256) { | 125 | if (buflen >= 256) { |
| 126 | pos = dentry_path_raw(dentry, buffer, buflen - 1); | 126 | pos = dentry_path_raw(dentry, buffer, buflen - 1); |
| 127 | if (!IS_ERR(pos) && *pos == '/' && pos[1]) { | 127 | if (!IS_ERR(pos) && *pos == '/' && pos[1]) { |
| 128 | struct inode *inode = dentry->d_inode; | 128 | struct inode *inode = d_backing_inode(dentry); |
| 129 | if (inode && S_ISDIR(inode->i_mode)) { | 129 | if (inode && S_ISDIR(inode->i_mode)) { |
| 130 | buffer[buflen - 2] = '/'; | 130 | buffer[buflen - 2] = '/'; |
| 131 | buffer[buflen - 1] = '\0'; | 131 | buffer[buflen - 1] = '\0'; |
| @@ -168,7 +168,7 @@ static char *tomoyo_get_local_path(struct dentry *dentry, char * const buffer, | |||
| 168 | if (!MAJOR(sb->s_dev)) | 168 | if (!MAJOR(sb->s_dev)) |
| 169 | goto prepend_filesystem_name; | 169 | goto prepend_filesystem_name; |
| 170 | { | 170 | { |
| 171 | struct inode *inode = sb->s_root->d_inode; | 171 | struct inode *inode = d_backing_inode(sb->s_root); |
| 172 | /* | 172 | /* |
| 173 | * Use filesystem name if filesystem does not support rename() | 173 | * Use filesystem name if filesystem does not support rename() |
| 174 | * operation. | 174 | * operation. |
| @@ -219,7 +219,7 @@ out: | |||
| 219 | static char *tomoyo_get_socket_name(const struct path *path, char * const buffer, | 219 | static char *tomoyo_get_socket_name(const struct path *path, char * const buffer, |
| 220 | const int buflen) | 220 | const int buflen) |
| 221 | { | 221 | { |
| 222 | struct inode *inode = path->dentry->d_inode; | 222 | struct inode *inode = d_backing_inode(path->dentry); |
| 223 | struct socket *sock = inode ? SOCKET_I(inode) : NULL; | 223 | struct socket *sock = inode ? SOCKET_I(inode) : NULL; |
| 224 | struct sock *sk = sock ? sock->sk : NULL; | 224 | struct sock *sk = sock ? sock->sk : NULL; |
| 225 | if (sk) { | 225 | if (sk) { |
| @@ -277,7 +277,7 @@ char *tomoyo_realpath_from_path(const struct path *path) | |||
| 277 | pos = dentry->d_op->d_dname(dentry, buf, buf_len - 1); | 277 | pos = dentry->d_op->d_dname(dentry, buf, buf_len - 1); |
| 278 | goto encode; | 278 | goto encode; |
| 279 | } | 279 | } |
| 280 | inode = sb->s_root->d_inode; | 280 | inode = d_backing_inode(sb->s_root); |
| 281 | /* | 281 | /* |
| 282 | * Get local name for filesystems without rename() operation | 282 | * Get local name for filesystems without rename() operation |
| 283 | * or dentry without vfsmount. | 283 | * or dentry without vfsmount. |
