diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2011-01-13 13:27:28 -0500 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-01-13 13:27:28 -0500 |
| commit | b2034d474b7e1e8578bd5c2977024b51693269d9 (patch) | |
| tree | e43969bf7c2ba89884c2580f56978826f1014520 | |
| parent | 27d189c02ba25851973c8582e419c0bded9f7e5b (diff) | |
| parent | 924241575a85249b9d410e38f5b2fcad9035e45c (diff) | |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6: (41 commits)
fs: add documentation on fallocate hole punching
Gfs2: fail if we try to use hole punch
Btrfs: fail if we try to use hole punch
Ext4: fail if we try to use hole punch
Ocfs2: handle hole punching via fallocate properly
XFS: handle hole punching via fallocate properly
fs: add hole punching to fallocate
vfs: pass struct file to do_truncate on O_TRUNC opens (try #2)
fix signedness mess in rw_verify_area() on 64bit architectures
fs: fix kernel-doc for dcache::prepend_path
fs: fix kernel-doc for dcache::d_validate
sanitize ecryptfs ->mount()
switch afs
move internal-only parts of ncpfs headers to fs/ncpfs
switch ncpfs
switch 9p
pass default dentry_operations to mount_pseudo()
switch hostfs
switch affs
switch configfs
...
108 files changed, 424 insertions, 582 deletions
diff --git a/Documentation/filesystems/porting b/Documentation/filesystems/porting index 07a32b42cf9..266d2059b9b 100644 --- a/Documentation/filesystems/porting +++ b/Documentation/filesystems/porting | |||
| @@ -385,3 +385,12 @@ Documentation/filesystems/vfs.txt for more details. | |||
| 385 | on many or all directory inodes on the way down a path walk (to check for | 385 | on many or all directory inodes on the way down a path walk (to check for |
| 386 | exec permission). These must now be rcu-walk aware (flags & IPERM_RCU). See | 386 | exec permission). These must now be rcu-walk aware (flags & IPERM_RCU). See |
| 387 | Documentation/filesystems/vfs.txt for more details. | 387 | Documentation/filesystems/vfs.txt for more details. |
| 388 | |||
| 389 | -- | ||
| 390 | [mandatory] | ||
| 391 | In ->fallocate() you must check the mode option passed in. If your | ||
| 392 | filesystem does not support hole punching (deallocating space in the middle of a | ||
| 393 | file) you must return -EOPNOTSUPP if FALLOC_FL_PUNCH_HOLE is set in mode. | ||
| 394 | Currently you can only have FALLOC_FL_PUNCH_HOLE with FALLOC_FL_KEEP_SIZE set, | ||
| 395 | so the i_size should not change when hole punching, even when puching the end of | ||
| 396 | a file off. | ||
diff --git a/Documentation/magic-number.txt b/Documentation/magic-number.txt index 505f1960754..4b12abcb2ad 100644 --- a/Documentation/magic-number.txt +++ b/Documentation/magic-number.txt | |||
| @@ -150,7 +150,7 @@ NBD_REPLY_MAGIC 0x96744668 nbd_reply include/linux/nbd.h | |||
| 150 | STL_BOARDMAGIC 0xa2267f52 stlbrd include/linux/stallion.h | 150 | STL_BOARDMAGIC 0xa2267f52 stlbrd include/linux/stallion.h |
| 151 | ENI155_MAGIC 0xa54b872d midway_eprom drivers/atm/eni.h | 151 | ENI155_MAGIC 0xa54b872d midway_eprom drivers/atm/eni.h |
| 152 | SCI_MAGIC 0xbabeface gs_port drivers/char/sh-sci.h | 152 | SCI_MAGIC 0xbabeface gs_port drivers/char/sh-sci.h |
| 153 | CODA_MAGIC 0xC0DAC0DA coda_file_info include/linux/coda_fs_i.h | 153 | CODA_MAGIC 0xC0DAC0DA coda_file_info fs/coda/coda_fs_i.h |
| 154 | DPMEM_MAGIC 0xc0ffee11 gdt_pci_sram drivers/scsi/gdth.h | 154 | DPMEM_MAGIC 0xc0ffee11 gdt_pci_sram drivers/scsi/gdth.h |
| 155 | STLI_PORTMAGIC 0xe671c7a1 stliport include/linux/istallion.h | 155 | STLI_PORTMAGIC 0xe671c7a1 stliport include/linux/istallion.h |
| 156 | YAM_MAGIC 0xF10A7654 yam_port drivers/net/hamradio/yam.c | 156 | YAM_MAGIC 0xF10A7654 yam_port drivers/net/hamradio/yam.c |
diff --git a/arch/ia64/kernel/perfmon.c b/arch/ia64/kernel/perfmon.c index d92d5b5161f..ac76da099a6 100644 --- a/arch/ia64/kernel/perfmon.c +++ b/arch/ia64/kernel/perfmon.c | |||
| @@ -617,11 +617,14 @@ pfm_get_unmapped_area(struct file *file, unsigned long addr, unsigned long len, | |||
| 617 | return get_unmapped_area(file, addr, len, pgoff, flags); | 617 | return get_unmapped_area(file, addr, len, pgoff, flags); |
| 618 | } | 618 | } |
| 619 | 619 | ||
| 620 | /* forward declaration */ | ||
| 621 | static static const struct dentry_operations pfmfs_dentry_operations; | ||
| 620 | 622 | ||
| 621 | static struct dentry * | 623 | static struct dentry * |
| 622 | pfmfs_mount(struct file_system_type *fs_type, int flags, const char *dev_name, void *data) | 624 | pfmfs_mount(struct file_system_type *fs_type, int flags, const char *dev_name, void *data) |
| 623 | { | 625 | { |
| 624 | return mount_pseudo(fs_type, "pfm:", NULL, PFMFS_MAGIC); | 626 | return mount_pseudo(fs_type, "pfm:", NULL, &pfmfs_dentry_operations, |
| 627 | PFMFS_MAGIC); | ||
| 625 | } | 628 | } |
| 626 | 629 | ||
| 627 | static struct file_system_type pfm_fs_type = { | 630 | static struct file_system_type pfm_fs_type = { |
| @@ -2232,7 +2235,6 @@ pfm_alloc_file(pfm_context_t *ctx) | |||
| 2232 | } | 2235 | } |
| 2233 | path.mnt = mntget(pfmfs_mnt); | 2236 | path.mnt = mntget(pfmfs_mnt); |
| 2234 | 2237 | ||
| 2235 | d_set_d_op(path.dentry, &pfmfs_dentry_operations); | ||
| 2236 | d_add(path.dentry, inode); | 2238 | d_add(path.dentry, inode); |
| 2237 | 2239 | ||
| 2238 | file = alloc_file(&path, FMODE_READ, &pfm_file_ops); | 2240 | file = alloc_file(&path, FMODE_READ, &pfm_file_ops); |
diff --git a/drivers/mtd/mtdchar.c b/drivers/mtd/mtdchar.c index f511dd15fd3..ee4bb3330bd 100644 --- a/drivers/mtd/mtdchar.c +++ b/drivers/mtd/mtdchar.c | |||
| @@ -1134,7 +1134,7 @@ static const struct file_operations mtd_fops = { | |||
| 1134 | static struct dentry *mtd_inodefs_mount(struct file_system_type *fs_type, | 1134 | static struct dentry *mtd_inodefs_mount(struct file_system_type *fs_type, |
| 1135 | int flags, const char *dev_name, void *data) | 1135 | int flags, const char *dev_name, void *data) |
| 1136 | { | 1136 | { |
| 1137 | return mount_pseudo(fs_type, "mtd_inode:", NULL, MTD_INODE_FS_MAGIC); | 1137 | return mount_pseudo(fs_type, "mtd_inode:", NULL, NULL, MTD_INODE_FS_MAGIC); |
| 1138 | } | 1138 | } |
| 1139 | 1139 | ||
| 1140 | static struct file_system_type mtd_inodefs_type = { | 1140 | static struct file_system_type mtd_inodefs_type = { |
diff --git a/drivers/staging/pohmelfs/net.c b/drivers/staging/pohmelfs/net.c index 9279897ff16..b2e91862208 100644 --- a/drivers/staging/pohmelfs/net.c +++ b/drivers/staging/pohmelfs/net.c | |||
| @@ -413,7 +413,7 @@ static int pohmelfs_readdir_response(struct netfs_state *st) | |||
| 413 | if (dentry) { | 413 | if (dentry) { |
| 414 | alias = d_materialise_unique(dentry, &npi->vfs_inode); | 414 | alias = d_materialise_unique(dentry, &npi->vfs_inode); |
| 415 | if (alias) | 415 | if (alias) |
| 416 | dput(dentry); | 416 | dput(alias); |
| 417 | } | 417 | } |
| 418 | 418 | ||
| 419 | dput(dentry); | 419 | dput(dentry); |
diff --git a/drivers/staging/smbfs/dir.c b/drivers/staging/smbfs/dir.c index dd612f50749..87a3a9bd584 100644 --- a/drivers/staging/smbfs/dir.c +++ b/drivers/staging/smbfs/dir.c | |||
| @@ -403,12 +403,6 @@ smb_delete_dentry(const struct dentry *dentry) | |||
| 403 | void | 403 | void |
| 404 | smb_new_dentry(struct dentry *dentry) | 404 | smb_new_dentry(struct dentry *dentry) |
| 405 | { | 405 | { |
| 406 | struct smb_sb_info *server = server_from_dentry(dentry); | ||
| 407 | |||
| 408 | if (server->mnt->flags & SMB_MOUNT_CASE) | ||
| 409 | d_set_d_op(dentry, &smbfs_dentry_operations_case); | ||
| 410 | else | ||
| 411 | d_set_d_op(dentry, &smbfs_dentry_operations); | ||
| 412 | dentry->d_time = jiffies; | 406 | dentry->d_time = jiffies; |
| 413 | } | 407 | } |
| 414 | 408 | ||
| @@ -440,7 +434,6 @@ smb_lookup(struct inode *dir, struct dentry *dentry, struct nameidata *nd) | |||
| 440 | struct smb_fattr finfo; | 434 | struct smb_fattr finfo; |
| 441 | struct inode *inode; | 435 | struct inode *inode; |
| 442 | int error; | 436 | int error; |
| 443 | struct smb_sb_info *server; | ||
| 444 | 437 | ||
| 445 | error = -ENAMETOOLONG; | 438 | error = -ENAMETOOLONG; |
| 446 | if (dentry->d_name.len > SMB_MAXNAMELEN) | 439 | if (dentry->d_name.len > SMB_MAXNAMELEN) |
| @@ -468,12 +461,6 @@ smb_lookup(struct inode *dir, struct dentry *dentry, struct nameidata *nd) | |||
| 468 | inode = smb_iget(dir->i_sb, &finfo); | 461 | inode = smb_iget(dir->i_sb, &finfo); |
| 469 | if (inode) { | 462 | if (inode) { |
| 470 | add_entry: | 463 | add_entry: |
| 471 | server = server_from_dentry(dentry); | ||
| 472 | if (server->mnt->flags & SMB_MOUNT_CASE) | ||
| 473 | d_set_d_op(dentry, &smbfs_dentry_operations_case); | ||
| 474 | else | ||
| 475 | d_set_d_op(dentry, &smbfs_dentry_operations); | ||
| 476 | |||
| 477 | d_add(dentry, inode); | 464 | d_add(dentry, inode); |
| 478 | smb_renew_times(dentry); | 465 | smb_renew_times(dentry); |
| 479 | error = 0; | 466 | error = 0; |
diff --git a/drivers/staging/smbfs/inode.c b/drivers/staging/smbfs/inode.c index 244319dc970..0778589d9e9 100644 --- a/drivers/staging/smbfs/inode.c +++ b/drivers/staging/smbfs/inode.c | |||
| @@ -614,6 +614,10 @@ static int smb_fill_super(struct super_block *sb, void *raw_data, int silent) | |||
| 614 | printk(KERN_ERR "smbfs: failed to start smbiod\n"); | 614 | printk(KERN_ERR "smbfs: failed to start smbiod\n"); |
| 615 | goto out_no_smbiod; | 615 | goto out_no_smbiod; |
| 616 | } | 616 | } |
| 617 | if (server->mnt->flags & SMB_MOUNT_CASE) | ||
| 618 | sb->s_d_op = &smbfs_dentry_operations_case; | ||
| 619 | else | ||
| 620 | sb->s_d_op = &smbfs_dentry_operations; | ||
| 617 | 621 | ||
| 618 | /* | 622 | /* |
| 619 | * Keep the super block locked while we get the root inode. | 623 | * Keep the super block locked while we get the root inode. |
diff --git a/drivers/staging/smbfs/proto.h b/drivers/staging/smbfs/proto.h index 05939a6f43e..3883cb16a3f 100644 --- a/drivers/staging/smbfs/proto.h +++ b/drivers/staging/smbfs/proto.h | |||
| @@ -38,6 +38,8 @@ extern void smb_install_null_ops(struct smb_ops *ops); | |||
| 38 | extern const struct file_operations smb_dir_operations; | 38 | extern const struct file_operations smb_dir_operations; |
| 39 | extern const struct inode_operations smb_dir_inode_operations; | 39 | extern const struct inode_operations smb_dir_inode_operations; |
| 40 | extern const struct inode_operations smb_dir_inode_operations_unix; | 40 | extern const struct inode_operations smb_dir_inode_operations_unix; |
| 41 | extern const struct dentry_operations smbfs_dentry_operations_case; | ||
| 42 | extern const struct dentry_operations smbfs_dentry_operations; | ||
| 41 | extern void smb_new_dentry(struct dentry *dentry); | 43 | extern void smb_new_dentry(struct dentry *dentry); |
| 42 | extern void smb_renew_times(struct dentry *dentry); | 44 | extern void smb_renew_times(struct dentry *dentry); |
| 43 | /* cache.c */ | 45 | /* cache.c */ |
diff --git a/fs/9p/v9fs_vfs.h b/fs/9p/v9fs_vfs.h index bab0eac873f..b789f8e597e 100644 --- a/fs/9p/v9fs_vfs.h +++ b/fs/9p/v9fs_vfs.h | |||
| @@ -59,7 +59,6 @@ void v9fs_stat2inode_dotl(struct p9_stat_dotl *, struct inode *); | |||
| 59 | int v9fs_dir_release(struct inode *inode, struct file *filp); | 59 | int v9fs_dir_release(struct inode *inode, struct file *filp); |
| 60 | int v9fs_file_open(struct inode *inode, struct file *file); | 60 | int v9fs_file_open(struct inode *inode, struct file *file); |
| 61 | void v9fs_inode2stat(struct inode *inode, struct p9_wstat *stat); | 61 | void v9fs_inode2stat(struct inode *inode, struct p9_wstat *stat); |
| 62 | void v9fs_dentry_release(struct dentry *); | ||
| 63 | int v9fs_uflags2omode(int uflags, int extended); | 62 | int v9fs_uflags2omode(int uflags, int extended); |
| 64 | 63 | ||
| 65 | ssize_t v9fs_file_readn(struct file *, char *, char __user *, u32, u64); | 64 | ssize_t v9fs_file_readn(struct file *, char *, char __user *, u32, u64); |
diff --git a/fs/9p/vfs_dentry.c b/fs/9p/vfs_dentry.c index 466d2a4fc5c..233b7d4ffe5 100644 --- a/fs/9p/vfs_dentry.c +++ b/fs/9p/vfs_dentry.c | |||
| @@ -86,7 +86,7 @@ static int v9fs_cached_dentry_delete(const struct dentry *dentry) | |||
| 86 | * | 86 | * |
| 87 | */ | 87 | */ |
| 88 | 88 | ||
| 89 | void v9fs_dentry_release(struct dentry *dentry) | 89 | static void v9fs_dentry_release(struct dentry *dentry) |
| 90 | { | 90 | { |
| 91 | struct v9fs_dentry *dent; | 91 | struct v9fs_dentry *dent; |
| 92 | struct p9_fid *temp, *current_fid; | 92 | struct p9_fid *temp, *current_fid; |
diff --git a/fs/9p/vfs_inode.c b/fs/9p/vfs_inode.c index 5076eeb9550..b76a40bdf4c 100644 --- a/fs/9p/vfs_inode.c +++ b/fs/9p/vfs_inode.c | |||
| @@ -699,11 +699,6 @@ struct dentry *v9fs_vfs_lookup(struct inode *dir, struct dentry *dentry, | |||
| 699 | goto error_iput; | 699 | goto error_iput; |
| 700 | 700 | ||
| 701 | inst_out: | 701 | inst_out: |
| 702 | if (v9ses->cache) | ||
| 703 | d_set_d_op(dentry, &v9fs_cached_dentry_operations); | ||
| 704 | else | ||
| 705 | d_set_d_op(dentry, &v9fs_dentry_operations); | ||
| 706 | |||
| 707 | d_add(dentry, inode); | 702 | d_add(dentry, inode); |
| 708 | return NULL; | 703 | return NULL; |
| 709 | 704 | ||
diff --git a/fs/9p/vfs_super.c b/fs/9p/vfs_super.c index c55c614500a..dbaabe3b813 100644 --- a/fs/9p/vfs_super.c +++ b/fs/9p/vfs_super.c | |||
| @@ -141,6 +141,11 @@ static struct dentry *v9fs_mount(struct file_system_type *fs_type, int flags, | |||
| 141 | } | 141 | } |
| 142 | v9fs_fill_super(sb, v9ses, flags, data); | 142 | v9fs_fill_super(sb, v9ses, flags, data); |
| 143 | 143 | ||
| 144 | if (v9ses->cache) | ||
| 145 | sb->s_d_op = &v9fs_cached_dentry_operations; | ||
| 146 | else | ||
| 147 | sb->s_d_op = &v9fs_dentry_operations; | ||
| 148 | |||
| 144 | inode = v9fs_get_inode(sb, S_IFDIR | mode); | 149 | inode = v9fs_get_inode(sb, S_IFDIR | mode); |
| 145 | if (IS_ERR(inode)) { | 150 | if (IS_ERR(inode)) { |
| 146 | retval = PTR_ERR(inode); | 151 | retval = PTR_ERR(inode); |
| @@ -217,9 +222,6 @@ static void v9fs_kill_super(struct super_block *s) | |||
| 217 | 222 | ||
| 218 | P9_DPRINTK(P9_DEBUG_VFS, " %p\n", s); | 223 | P9_DPRINTK(P9_DEBUG_VFS, " %p\n", s); |
| 219 | 224 | ||
| 220 | if (s->s_root) | ||
| 221 | v9fs_dentry_release(s->s_root); /* clunk root */ | ||
| 222 | |||
| 223 | kill_anon_super(s); | 225 | kill_anon_super(s); |
| 224 | 226 | ||
| 225 | v9fs_session_cancel(v9ses); | 227 | v9fs_session_cancel(v9ses); |
diff --git a/fs/adfs/dir.c b/fs/adfs/dir.c index bf7693c384f..3b4a764ed78 100644 --- a/fs/adfs/dir.c +++ b/fs/adfs/dir.c | |||
| @@ -276,7 +276,6 @@ adfs_lookup(struct inode *dir, struct dentry *dentry, struct nameidata *nd) | |||
| 276 | struct object_info obj; | 276 | struct object_info obj; |
| 277 | int error; | 277 | int error; |
| 278 | 278 | ||
| 279 | d_set_d_op(dentry, &adfs_dentry_operations); | ||
| 280 | lock_kernel(); | 279 | lock_kernel(); |
| 281 | error = adfs_dir_lookup_byname(dir, &dentry->d_name, &obj); | 280 | error = adfs_dir_lookup_byname(dir, &dentry->d_name, &obj); |
| 282 | if (error == 0) { | 281 | if (error == 0) { |
diff --git a/fs/adfs/super.c b/fs/adfs/super.c index a4041b52fbc..2d7954049fb 100644 --- a/fs/adfs/super.c +++ b/fs/adfs/super.c | |||
| @@ -473,6 +473,7 @@ static int adfs_fill_super(struct super_block *sb, void *data, int silent) | |||
| 473 | asb->s_namelen = ADFS_F_NAME_LEN; | 473 | asb->s_namelen = ADFS_F_NAME_LEN; |
| 474 | } | 474 | } |
| 475 | 475 | ||
| 476 | sb->s_d_op = &adfs_dentry_operations; | ||
| 476 | root = adfs_iget(sb, &root_obj); | 477 | root = adfs_iget(sb, &root_obj); |
| 477 | sb->s_root = d_alloc_root(root); | 478 | sb->s_root = d_alloc_root(root); |
| 478 | if (!sb->s_root) { | 479 | if (!sb->s_root) { |
| @@ -483,8 +484,7 @@ static int adfs_fill_super(struct super_block *sb, void *data, int silent) | |||
| 483 | kfree(asb->s_map); | 484 | kfree(asb->s_map); |
| 484 | adfs_error(sb, "get root inode failed\n"); | 485 | adfs_error(sb, "get root inode failed\n"); |
| 485 | goto error; | 486 | goto error; |
| 486 | } else | 487 | } |
| 487 | d_set_d_op(sb->s_root, &adfs_dentry_operations); | ||
| 488 | unlock_kernel(); | 488 | unlock_kernel(); |
| 489 | return 0; | 489 | return 0; |
| 490 | 490 | ||
diff --git a/fs/affs/affs.h b/fs/affs/affs.h index a8cbdeb3402..0e95f73a702 100644 --- a/fs/affs/affs.h +++ b/fs/affs/affs.h | |||
| @@ -201,6 +201,7 @@ extern const struct address_space_operations affs_aops; | |||
| 201 | extern const struct address_space_operations affs_aops_ofs; | 201 | extern const struct address_space_operations affs_aops_ofs; |
| 202 | 202 | ||
| 203 | extern const struct dentry_operations affs_dentry_operations; | 203 | extern const struct dentry_operations affs_dentry_operations; |
| 204 | extern const struct dentry_operations affs_intl_dentry_operations; | ||
| 204 | 205 | ||
| 205 | static inline void | 206 | static inline void |
| 206 | affs_set_blocksize(struct super_block *sb, int size) | 207 | affs_set_blocksize(struct super_block *sb, int size) |
diff --git a/fs/affs/namei.c b/fs/affs/namei.c index 944a4042fb6..e3e9efc1fdd 100644 --- a/fs/affs/namei.c +++ b/fs/affs/namei.c | |||
| @@ -32,7 +32,7 @@ const struct dentry_operations affs_dentry_operations = { | |||
| 32 | .d_compare = affs_compare_dentry, | 32 | .d_compare = affs_compare_dentry, |
| 33 | }; | 33 | }; |
| 34 | 34 | ||
| 35 | static const struct dentry_operations affs_intl_dentry_operations = { | 35 | const struct dentry_operations affs_intl_dentry_operations = { |
| 36 | .d_hash = affs_intl_hash_dentry, | 36 | .d_hash = affs_intl_hash_dentry, |
| 37 | .d_compare = affs_intl_compare_dentry, | 37 | .d_compare = affs_intl_compare_dentry, |
| 38 | }; | 38 | }; |
| @@ -240,7 +240,6 @@ affs_lookup(struct inode *dir, struct dentry *dentry, struct nameidata *nd) | |||
| 240 | if (IS_ERR(inode)) | 240 | if (IS_ERR(inode)) |
| 241 | return ERR_CAST(inode); | 241 | return ERR_CAST(inode); |
| 242 | } | 242 | } |
| 243 | d_set_d_op(dentry, AFFS_SB(sb)->s_flags & SF_INTL ? &affs_intl_dentry_operations : &affs_dentry_operations); | ||
| 244 | d_add(dentry, inode); | 243 | d_add(dentry, inode); |
| 245 | return NULL; | 244 | return NULL; |
| 246 | } | 245 | } |
diff --git a/fs/affs/super.c b/fs/affs/super.c index d39081bbe7c..b31507d0f9b 100644 --- a/fs/affs/super.c +++ b/fs/affs/super.c | |||
| @@ -477,12 +477,16 @@ got_root: | |||
| 477 | goto out_error_noinode; | 477 | goto out_error_noinode; |
| 478 | } | 478 | } |
| 479 | 479 | ||
| 480 | if (AFFS_SB(sb)->s_flags & SF_INTL) | ||
| 481 | sb->s_d_op = &affs_intl_dentry_operations; | ||
| 482 | else | ||
| 483 | sb->s_d_op = &affs_dentry_operations; | ||
| 484 | |||
| 480 | sb->s_root = d_alloc_root(root_inode); | 485 | sb->s_root = d_alloc_root(root_inode); |
| 481 | if (!sb->s_root) { | 486 | if (!sb->s_root) { |
| 482 | printk(KERN_ERR "AFFS: Get root inode failed\n"); | 487 | printk(KERN_ERR "AFFS: Get root inode failed\n"); |
| 483 | goto out_error; | 488 | goto out_error; |
| 484 | } | 489 | } |
| 485 | d_set_d_op(sb->s_root, &affs_dentry_operations); | ||
| 486 | 490 | ||
| 487 | pr_debug("AFFS: s_flags=%lX\n",sb->s_flags); | 491 | pr_debug("AFFS: s_flags=%lX\n",sb->s_flags); |
| 488 | return 0; | 492 | return 0; |
diff --git a/fs/afs/dir.c b/fs/afs/dir.c index 34a3263d60a..e6a4ab980e3 100644 --- a/fs/afs/dir.c +++ b/fs/afs/dir.c | |||
| @@ -62,7 +62,7 @@ const struct inode_operations afs_dir_inode_operations = { | |||
| 62 | .setattr = afs_setattr, | 62 | .setattr = afs_setattr, |
| 63 | }; | 63 | }; |
| 64 | 64 | ||
| 65 | static const struct dentry_operations afs_fs_dentry_operations = { | 65 | const struct dentry_operations afs_fs_dentry_operations = { |
| 66 | .d_revalidate = afs_d_revalidate, | 66 | .d_revalidate = afs_d_revalidate, |
| 67 | .d_delete = afs_d_delete, | 67 | .d_delete = afs_d_delete, |
| 68 | .d_release = afs_d_release, | 68 | .d_release = afs_d_release, |
| @@ -582,8 +582,6 @@ static struct dentry *afs_lookup(struct inode *dir, struct dentry *dentry, | |||
| 582 | } | 582 | } |
| 583 | 583 | ||
| 584 | success: | 584 | success: |
| 585 | d_set_d_op(dentry, &afs_fs_dentry_operations); | ||
| 586 | |||
| 587 | d_add(dentry, inode); | 585 | d_add(dentry, inode); |
| 588 | _leave(" = 0 { vn=%u u=%u } -> { ino=%lu v=%llu }", | 586 | _leave(" = 0 { vn=%u u=%u } -> { ino=%lu v=%llu }", |
| 589 | fid.vnode, | 587 | fid.vnode, |
diff --git a/fs/afs/internal.h b/fs/afs/internal.h index 6d4bc1c8ff6..ab6db5abaf5 100644 --- a/fs/afs/internal.h +++ b/fs/afs/internal.h | |||
| @@ -486,6 +486,7 @@ extern bool afs_cm_incoming_call(struct afs_call *); | |||
| 486 | * dir.c | 486 | * dir.c |
| 487 | */ | 487 | */ |
| 488 | extern const struct inode_operations afs_dir_inode_operations; | 488 | extern const struct inode_operations afs_dir_inode_operations; |
| 489 | extern const struct dentry_operations afs_fs_dentry_operations; | ||
| 489 | extern const struct file_operations afs_dir_file_operations; | 490 | extern const struct file_operations afs_dir_file_operations; |
| 490 | 491 | ||
| 491 | /* | 492 | /* |
diff --git a/fs/afs/super.c b/fs/afs/super.c index f901a9d7c11..fb240e8766d 100644 --- a/fs/afs/super.c +++ b/fs/afs/super.c | |||
| @@ -336,6 +336,7 @@ static int afs_fill_super(struct super_block *sb, void *data) | |||
| 336 | if (!root) | 336 | if (!root) |
| 337 | goto error; | 337 | goto error; |
| 338 | 338 | ||
| 339 | sb->s_d_op = &afs_fs_dentry_operations; | ||
| 339 | sb->s_root = root; | 340 | sb->s_root = root; |
| 340 | 341 | ||
| 341 | _leave(" = 0"); | 342 | _leave(" = 0"); |
diff --git a/fs/anon_inodes.c b/fs/anon_inodes.c index 98edb657b84..cbe57f3c4d8 100644 --- a/fs/anon_inodes.c +++ b/fs/anon_inodes.c | |||
| @@ -26,12 +26,6 @@ static struct vfsmount *anon_inode_mnt __read_mostly; | |||
| 26 | static struct inode *anon_inode_inode; | 26 | static struct inode *anon_inode_inode; |
| 27 | static const struct file_operations anon_inode_fops; | 27 | static const struct file_operations anon_inode_fops; |
| 28 | 28 | ||
| 29 | static struct dentry *anon_inodefs_mount(struct file_system_type *fs_type, | ||
| 30 | int flags, const char *dev_name, void *data) | ||
| 31 | { | ||
| 32 | return mount_pseudo(fs_type, "anon_inode:", NULL, ANON_INODE_FS_MAGIC); | ||
| 33 | } | ||
| 34 | |||
| 35 | /* | 29 | /* |
| 36 | * anon_inodefs_dname() is called from d_path(). | 30 | * anon_inodefs_dname() is called from d_path(). |
| 37 | */ | 31 | */ |
| @@ -41,14 +35,22 @@ static char *anon_inodefs_dname(struct dentry *dentry, char *buffer, int buflen) | |||
| 41 | dentry->d_name.name); | 35 | dentry->d_name.name); |
| 42 | } | 36 | } |
| 43 | 37 | ||
| 38 | static const struct dentry_operations anon_inodefs_dentry_operations = { | ||
| 39 | .d_dname = anon_inodefs_dname, | ||
| 40 | }; | ||
| 41 | |||
| 42 | static struct dentry *anon_inodefs_mount(struct file_system_type *fs_type, | ||
| 43 | int flags, const char *dev_name, void *data) | ||
| 44 | { | ||
| 45 | return mount_pseudo(fs_type, "anon_inode:", NULL, | ||
| 46 | &anon_inodefs_dentry_operations, ANON_INODE_FS_MAGIC); | ||
| 47 | } | ||
| 48 | |||
| 44 | static struct file_system_type anon_inode_fs_type = { | 49 | static struct file_system_type anon_inode_fs_type = { |
| 45 | .name = "anon_inodefs", | 50 | .name = "anon_inodefs", |
| 46 | .mount = anon_inodefs_mount, | 51 | .mount = anon_inodefs_mount, |
| 47 | .kill_sb = kill_anon_super, | 52 | .kill_sb = kill_anon_super, |
| 48 | }; | 53 | }; |
| 49 | static const struct dentry_operations anon_inodefs_dentry_operations = { | ||
| 50 | .d_dname = anon_inodefs_dname, | ||
| 51 | }; | ||
| 52 | 54 | ||
| 53 | /* | 55 | /* |
| 54 | * nop .set_page_dirty method so that people can use .page_mkwrite on | 56 | * nop .set_page_dirty method so that people can use .page_mkwrite on |
| @@ -113,7 +115,6 @@ struct file *anon_inode_getfile(const char *name, | |||
| 113 | */ | 115 | */ |
| 114 | ihold(anon_inode_inode); | 116 | ihold(anon_inode_inode); |
| 115 | 117 | ||
| 116 | d_set_d_op(path.dentry, &anon_inodefs_dentry_operations); | ||
| 117 | d_instantiate(path.dentry, anon_inode_inode); | 118 | d_instantiate(path.dentry, anon_inode_inode); |
| 118 | 119 | ||
| 119 | error = -ENFILE; | 120 | error = -ENFILE; |
diff --git a/fs/block_dev.c b/fs/block_dev.c index 771f2352701..88da70355aa 100644 --- a/fs/block_dev.c +++ b/fs/block_dev.c | |||
| @@ -473,7 +473,7 @@ static const struct super_operations bdev_sops = { | |||
| 473 | static struct dentry *bd_mount(struct file_system_type *fs_type, | 473 | static struct dentry *bd_mount(struct file_system_type *fs_type, |
| 474 | int flags, const char *dev_name, void *data) | 474 | int flags, const char *dev_name, void *data) |
| 475 | { | 475 | { |
| 476 | return mount_pseudo(fs_type, "bdev:", &bdev_sops, 0x62646576); | 476 | return mount_pseudo(fs_type, "bdev:", &bdev_sops, NULL, 0x62646576); |
| 477 | } | 477 | } |
| 478 | 478 | ||
| 479 | static struct file_system_type bd_type = { | 479 | static struct file_system_type bd_type = { |
diff --git a/fs/btrfs/export.c b/fs/btrfs/export.c index 0ccf9a8afcd..9786963b07e 100644 --- a/fs/btrfs/export.c +++ b/fs/btrfs/export.c | |||
| @@ -65,7 +65,6 @@ static struct dentry *btrfs_get_dentry(struct super_block *sb, u64 objectid, | |||
| 65 | { | 65 | { |
| 66 | struct btrfs_fs_info *fs_info = btrfs_sb(sb)->fs_info; | 66 | struct btrfs_fs_info *fs_info = btrfs_sb(sb)->fs_info; |
| 67 | struct btrfs_root *root; | 67 | struct btrfs_root *root; |
| 68 | struct dentry *dentry; | ||
| 69 | struct inode *inode; | 68 | struct inode *inode; |
| 70 | struct btrfs_key key; | 69 | struct btrfs_key key; |
| 71 | int index; | 70 | int index; |
| @@ -108,10 +107,7 @@ static struct dentry *btrfs_get_dentry(struct super_block *sb, u64 objectid, | |||
| 108 | return ERR_PTR(-ESTALE); | 107 | return ERR_PTR(-ESTALE); |
| 109 | } | 108 | } |
| 110 | 109 | ||
| 111 | dentry = d_obtain_alias(inode); | 110 | return d_obtain_alias(inode); |
| 112 | if (!IS_ERR(dentry)) | ||
| 113 | d_set_d_op(dentry, &btrfs_dentry_operations); | ||
| 114 | return dentry; | ||
| 115 | fail: | 111 | fail: |
| 116 | srcu_read_unlock(&fs_info->subvol_srcu, index); | 112 | srcu_read_unlock(&fs_info->subvol_srcu, index); |
| 117 | return ERR_PTR(err); | 113 | return ERR_PTR(err); |
| @@ -166,7 +162,6 @@ static struct dentry *btrfs_fh_to_dentry(struct super_block *sb, struct fid *fh, | |||
| 166 | static struct dentry *btrfs_get_parent(struct dentry *child) | 162 | static struct dentry *btrfs_get_parent(struct dentry *child) |
| 167 | { | 163 | { |
| 168 | struct inode *dir = child->d_inode; | 164 | struct inode *dir = child->d_inode; |
| 169 | struct dentry *dentry; | ||
| 170 | struct btrfs_root *root = BTRFS_I(dir)->root; | 165 | struct btrfs_root *root = BTRFS_I(dir)->root; |
| 171 | struct btrfs_path *path; | 166 | struct btrfs_path *path; |
| 172 | struct extent_buffer *leaf; | 167 | struct extent_buffer *leaf; |
| @@ -223,10 +218,7 @@ static struct dentry *btrfs_get_parent(struct dentry *child) | |||
| 223 | 218 | ||
| 224 | key.type = BTRFS_INODE_ITEM_KEY; | 219 | key.type = BTRFS_INODE_ITEM_KEY; |
| 225 | key.offset = 0; | 220 | key.offset = 0; |
| 226 | dentry = d_obtain_alias(btrfs_iget(root->fs_info->sb, &key, root, NULL)); | 221 | return d_obtain_alias(btrfs_iget(root->fs_info->sb, &key, root, NULL)); |
| 227 | if (!IS_ERR(dentry)) | ||
| 228 | d_set_d_op(dentry, &btrfs_dentry_operations); | ||
| 229 | return dentry; | ||
| 230 | fail: | 222 | fail: |
| 231 | btrfs_free_path(path); | 223 | btrfs_free_path(path); |
| 232 | return ERR_PTR(ret); | 224 | return ERR_PTR(ret); |
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index a0ff46a4789..a3798a3aa0d 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c | |||
| @@ -4084,8 +4084,6 @@ struct inode *btrfs_lookup_dentry(struct inode *dir, struct dentry *dentry) | |||
| 4084 | int index; | 4084 | int index; |
| 4085 | int ret; | 4085 | int ret; |
| 4086 | 4086 | ||
| 4087 | d_set_d_op(dentry, &btrfs_dentry_operations); | ||
| 4088 | |||
| 4089 | if (dentry->d_name.len > BTRFS_NAME_LEN) | 4087 | if (dentry->d_name.len > BTRFS_NAME_LEN) |
| 4090 | return ERR_PTR(-ENAMETOOLONG); | 4088 | return ERR_PTR(-ENAMETOOLONG); |
| 4091 | 4089 | ||
| @@ -7117,6 +7115,10 @@ static long btrfs_fallocate(struct inode *inode, int mode, | |||
| 7117 | alloc_start = offset & ~mask; | 7115 | alloc_start = offset & ~mask; |
| 7118 | alloc_end = (offset + len + mask) & ~mask; | 7116 | alloc_end = (offset + len + mask) & ~mask; |
| 7119 | 7117 | ||
| 7118 | /* We only support the FALLOC_FL_KEEP_SIZE mode */ | ||
| 7119 | if (mode && (mode != FALLOC_FL_KEEP_SIZE)) | ||
| 7120 | return -EOPNOTSUPP; | ||
| 7121 | |||
| 7120 | /* | 7122 | /* |
| 7121 | * wait for ordered IO before we have any locks. We'll loop again | 7123 | * wait for ordered IO before we have any locks. We'll loop again |
| 7122 | * below with the locks held. | 7124 | * below with the locks held. |
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c index 883c6fa1367..22acdaa78ce 100644 --- a/fs/btrfs/super.c +++ b/fs/btrfs/super.c | |||
| @@ -460,6 +460,7 @@ static int btrfs_fill_super(struct super_block *sb, | |||
| 460 | sb->s_maxbytes = MAX_LFS_FILESIZE; | 460 | sb->s_maxbytes = MAX_LFS_FILESIZE; |
| 461 | sb->s_magic = BTRFS_SUPER_MAGIC; | 461 | sb->s_magic = BTRFS_SUPER_MAGIC; |
| 462 | sb->s_op = &btrfs_super_ops; | 462 | sb->s_op = &btrfs_super_ops; |
| 463 | sb->s_d_op = &btrfs_dentry_operations; | ||
| 463 | sb->s_export_op = &btrfs_export_ops; | 464 | sb->s_export_op = &btrfs_export_ops; |
| 464 | sb->s_xattr = btrfs_xattr_handlers; | 465 | sb->s_xattr = btrfs_xattr_handlers; |
| 465 | sb->s_time_gran = 1; | 466 | sb->s_time_gran = 1; |
diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c index 5e7075d5f13..d9f652a522a 100644 --- a/fs/cifs/cifsfs.c +++ b/fs/cifs/cifsfs.c | |||
| @@ -174,6 +174,12 @@ cifs_read_super(struct super_block *sb, void *data, | |||
| 174 | goto out_no_root; | 174 | goto out_no_root; |
| 175 | } | 175 | } |
| 176 | 176 | ||
| 177 | /* do that *after* d_alloc_root() - we want NULL ->d_op for root here */ | ||
| 178 | if (cifs_sb_master_tcon(cifs_sb)->nocase) | ||
| 179 | sb->s_d_op = &cifs_ci_dentry_ops; | ||
| 180 | else | ||
| 181 | sb->s_d_op = &cifs_dentry_ops; | ||
| 182 | |||
| 177 | #ifdef CONFIG_CIFS_EXPERIMENTAL | 183 | #ifdef CONFIG_CIFS_EXPERIMENTAL |
| 178 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SERVER_INUM) { | 184 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SERVER_INUM) { |
| 179 | cFYI(1, "export ops supported"); | 185 | cFYI(1, "export ops supported"); |
diff --git a/fs/cifs/dir.c b/fs/cifs/dir.c index 2e773825835..1e95dd63563 100644 --- a/fs/cifs/dir.c +++ b/fs/cifs/dir.c | |||
| @@ -130,17 +130,6 @@ cifs_bp_rename_retry: | |||
| 130 | return full_path; | 130 | return full_path; |
| 131 | } | 131 | } |
| 132 | 132 | ||
| 133 | static void setup_cifs_dentry(struct cifsTconInfo *tcon, | ||
| 134 | struct dentry *direntry, | ||
| 135 | struct inode *newinode) | ||
| 136 | { | ||
| 137 | if (tcon->nocase) | ||
| 138 | d_set_d_op(direntry, &cifs_ci_dentry_ops); | ||
| 139 | else | ||
| 140 | d_set_d_op(direntry, &cifs_dentry_ops); | ||
| 141 | d_instantiate(direntry, newinode); | ||
| 142 | } | ||
| 143 | |||
| 144 | /* Inode operations in similar order to how they appear in Linux file fs.h */ | 133 | /* Inode operations in similar order to how they appear in Linux file fs.h */ |
| 145 | 134 | ||
| 146 | int | 135 | int |
| @@ -327,7 +316,7 @@ cifs_create_get_file_info: | |||
| 327 | 316 | ||
| 328 | cifs_create_set_dentry: | 317 | cifs_create_set_dentry: |
| 329 | if (rc == 0) | 318 | if (rc == 0) |
| 330 | setup_cifs_dentry(tcon, direntry, newinode); | 319 | d_instantiate(direntry, newinode); |
| 331 | else | 320 | else |
| 332 | cFYI(1, "Create worked, get_inode_info failed rc = %d", rc); | 321 | cFYI(1, "Create worked, get_inode_info failed rc = %d", rc); |
| 333 | 322 | ||
| @@ -418,10 +407,6 @@ int cifs_mknod(struct inode *inode, struct dentry *direntry, int mode, | |||
| 418 | 407 | ||
| 419 | rc = cifs_get_inode_info_unix(&newinode, full_path, | 408 | rc = cifs_get_inode_info_unix(&newinode, full_path, |
| 420 | inode->i_sb, xid); | 409 | inode->i_sb, xid); |
| 421 | if (pTcon->nocase) | ||
| 422 | d_set_d_op(direntry, &cifs_ci_dentry_ops); | ||
| 423 | else | ||
| 424 | d_set_d_op(direntry, &cifs_dentry_ops); | ||
| 425 | 410 | ||
| 426 | if (rc == 0) | 411 | if (rc == 0) |
| 427 | d_instantiate(direntry, newinode); | 412 | d_instantiate(direntry, newinode); |
| @@ -601,10 +586,6 @@ cifs_lookup(struct inode *parent_dir_inode, struct dentry *direntry, | |||
| 601 | parent_dir_inode->i_sb, xid, NULL); | 586 | parent_dir_inode->i_sb, xid, NULL); |
| 602 | 587 | ||
| 603 | if ((rc == 0) && (newInode != NULL)) { | 588 | if ((rc == 0) && (newInode != NULL)) { |
| 604 | if (pTcon->nocase) | ||
| 605 | d_set_d_op(direntry, &cifs_ci_dentry_ops); | ||
| 606 | else | ||
| 607 | d_set_d_op(direntry, &cifs_dentry_ops); | ||
| 608 | d_add(direntry, newInode); | 589 | d_add(direntry, newInode); |
| 609 | if (posix_open) { | 590 | if (posix_open) { |
| 610 | filp = lookup_instantiate_filp(nd, direntry, | 591 | filp = lookup_instantiate_filp(nd, direntry, |
| @@ -631,10 +612,6 @@ cifs_lookup(struct inode *parent_dir_inode, struct dentry *direntry, | |||
| 631 | } else if (rc == -ENOENT) { | 612 | } else if (rc == -ENOENT) { |
| 632 | rc = 0; | 613 | rc = 0; |
| 633 | direntry->d_time = jiffies; | 614 | direntry->d_time = jiffies; |
| 634 | if (pTcon->nocase) | ||
| 635 | d_set_d_op(direntry, &cifs_ci_dentry_ops); | ||
| 636 | else | ||
| 637 | d_set_d_op(direntry, &cifs_dentry_ops); | ||
| 638 | d_add(direntry, NULL); | 615 | d_add(direntry, NULL); |
| 639 | /* if it was once a directory (but how can we tell?) we could do | 616 | /* if it was once a directory (but how can we tell?) we could do |
| 640 | shrink_dcache_parent(direntry); */ | 617 | shrink_dcache_parent(direntry); */ |
diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c index 0c7e36910e3..b06b6062024 100644 --- a/fs/cifs/inode.c +++ b/fs/cifs/inode.c | |||
| @@ -1324,10 +1324,6 @@ int cifs_mkdir(struct inode *inode, struct dentry *direntry, int mode) | |||
| 1324 | /*BB check (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SET_UID ) to see if need | 1324 | /*BB check (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SET_UID ) to see if need |
| 1325 | to set uid/gid */ | 1325 | to set uid/gid */ |
| 1326 | inc_nlink(inode); | 1326 | inc_nlink(inode); |
| 1327 | if (pTcon->nocase) | ||
| 1328 | d_set_d_op(direntry, &cifs_ci_dentry_ops); | ||
| 1329 | else | ||
| 1330 | d_set_d_op(direntry, &cifs_dentry_ops); | ||
| 1331 | 1327 | ||
| 1332 | cifs_unix_basic_to_fattr(&fattr, pInfo, cifs_sb); | 1328 | cifs_unix_basic_to_fattr(&fattr, pInfo, cifs_sb); |
| 1333 | cifs_fill_uniqueid(inode->i_sb, &fattr); | 1329 | cifs_fill_uniqueid(inode->i_sb, &fattr); |
| @@ -1368,10 +1364,6 @@ mkdir_get_info: | |||
| 1368 | rc = cifs_get_inode_info(&newinode, full_path, NULL, | 1364 | rc = cifs_get_inode_info(&newinode, full_path, NULL, |
| 1369 | inode->i_sb, xid, NULL); | 1365 | inode->i_sb, xid, NULL); |
| 1370 | 1366 | ||
| 1371 | if (pTcon->nocase) | ||
| 1372 | d_set_d_op(direntry, &cifs_ci_dentry_ops); | ||
| 1373 | else | ||
| 1374 | d_set_d_op(direntry, &cifs_dentry_ops); | ||
| 1375 | d_instantiate(direntry, newinode); | 1367 | d_instantiate(direntry, newinode); |
| 1376 | /* setting nlink not necessary except in cases where we | 1368 | /* setting nlink not necessary except in cases where we |
| 1377 | * failed to get it from the server or was set bogus */ | 1369 | * failed to get it from the server or was set bogus */ |
diff --git a/fs/cifs/link.c b/fs/cifs/link.c index fe2f6a93c49..306769de2fb 100644 --- a/fs/cifs/link.c +++ b/fs/cifs/link.c | |||
| @@ -524,10 +524,6 @@ cifs_symlink(struct inode *inode, struct dentry *direntry, const char *symname) | |||
| 524 | cFYI(1, "Create symlink ok, getinodeinfo fail rc = %d", | 524 | cFYI(1, "Create symlink ok, getinodeinfo fail rc = %d", |
| 525 | rc); | 525 | rc); |
| 526 | } else { | 526 | } else { |
| 527 | if (pTcon->nocase) | ||
| 528 | d_set_d_op(direntry, &cifs_ci_dentry_ops); | ||
| 529 | else | ||
| 530 | d_set_d_op(direntry, &cifs_dentry_ops); | ||
| 531 | d_instantiate(direntry, newinode); | 527 | d_instantiate(direntry, newinode); |
| 532 | } | 528 | } |
| 533 | } | 529 | } |
diff --git a/fs/cifs/readdir.c b/fs/cifs/readdir.c index 76b1b37c9e6..7f25cc3d225 100644 --- a/fs/cifs/readdir.c +++ b/fs/cifs/readdir.c | |||
| @@ -102,11 +102,6 @@ cifs_readdir_lookup(struct dentry *parent, struct qstr *name, | |||
| 102 | return NULL; | 102 | return NULL; |
| 103 | } | 103 | } |
| 104 | 104 | ||
| 105 | if (cifs_sb_master_tcon(CIFS_SB(sb))->nocase) | ||
| 106 | d_set_d_op(dentry, &cifs_ci_dentry_ops); | ||
| 107 | else | ||
| 108 | d_set_d_op(dentry, &cifs_dentry_ops); | ||
| 109 | |||
| 110 | alias = d_materialise_unique(dentry, inode); | 105 | alias = d_materialise_unique(dentry, inode); |
| 111 | if (alias != NULL) { | 106 | if (alias != NULL) { |
| 112 | dput(dentry); | 107 | dput(dentry); |
diff --git a/fs/coda/cache.c b/fs/coda/cache.c index 5525e1c660f..69015787618 100644 --- a/fs/coda/cache.c +++ b/fs/coda/cache.c | |||
| @@ -20,10 +20,9 @@ | |||
| 20 | #include <linux/spinlock.h> | 20 | #include <linux/spinlock.h> |
| 21 | 21 | ||
| 22 | #include <linux/coda.h> | 22 | #include <linux/coda.h> |
| 23 | #include <linux/coda_linux.h> | ||
| 24 | #include <linux/coda_psdev.h> | 23 | #include <linux/coda_psdev.h> |
| 25 | #include <linux/coda_fs_i.h> | 24 | #include "coda_linux.h" |
| 26 | #include <linux/coda_cache.h> | 25 | #include "coda_cache.h" |
| 27 | 26 | ||
| 28 | static atomic_t permission_epoch = ATOMIC_INIT(0); | 27 | static atomic_t permission_epoch = ATOMIC_INIT(0); |
| 29 | 28 | ||
diff --git a/fs/coda/cnode.c b/fs/coda/cnode.c index 602240569c8..6475877b076 100644 --- a/fs/coda/cnode.c +++ b/fs/coda/cnode.c | |||
| @@ -7,9 +7,8 @@ | |||
| 7 | #include <linux/time.h> | 7 | #include <linux/time.h> |
| 8 | 8 | ||
| 9 | #include <linux/coda.h> | 9 | #include <linux/coda.h> |
| 10 | #include <linux/coda_linux.h> | ||
| 11 | #include <linux/coda_fs_i.h> | ||
| 12 | #include <linux/coda_psdev.h> | 10 | #include <linux/coda_psdev.h> |
| 11 | #include "coda_linux.h" | ||
| 13 | 12 | ||
| 14 | static inline int coda_fideq(struct CodaFid *fid1, struct CodaFid *fid2) | 13 | static inline int coda_fideq(struct CodaFid *fid1, struct CodaFid *fid2) |
| 15 | { | 14 | { |
diff --git a/include/linux/coda_cache.h b/fs/coda/coda_cache.h index c910b5eb1ce..c910b5eb1ce 100644 --- a/include/linux/coda_cache.h +++ b/fs/coda/coda_cache.h | |||
diff --git a/include/linux/coda_fs_i.h b/fs/coda/coda_fs_i.h index e35071b1de0..e35071b1de0 100644 --- a/include/linux/coda_fs_i.h +++ b/fs/coda/coda_fs_i.h | |||
diff --git a/fs/coda/coda_linux.c b/fs/coda/coda_linux.c index bf4a3fd3c8e..2bdbcc11b37 100644 --- a/fs/coda/coda_linux.c +++ b/fs/coda/coda_linux.c | |||
| @@ -17,9 +17,8 @@ | |||
| 17 | #include <linux/string.h> | 17 | #include <linux/string.h> |
| 18 | 18 | ||
| 19 | #include <linux/coda.h> | 19 | #include <linux/coda.h> |
| 20 | #include <linux/coda_linux.h> | ||
| 21 | #include <linux/coda_psdev.h> | 20 | #include <linux/coda_psdev.h> |
| 22 | #include <linux/coda_fs_i.h> | 21 | #include "coda_linux.h" |
| 23 | 22 | ||
| 24 | /* initialize the debugging variables */ | 23 | /* initialize the debugging variables */ |
| 25 | int coda_fake_statfs; | 24 | int coda_fake_statfs; |
diff --git a/include/linux/coda_linux.h b/fs/coda/coda_linux.h index 4ccc59c1ea8..9b0c5323890 100644 --- a/include/linux/coda_linux.h +++ b/fs/coda/coda_linux.h | |||
| @@ -20,13 +20,15 @@ | |||
| 20 | #include <linux/wait.h> | 20 | #include <linux/wait.h> |
| 21 | #include <linux/types.h> | 21 | #include <linux/types.h> |
| 22 | #include <linux/fs.h> | 22 | #include <linux/fs.h> |
| 23 | #include <linux/coda_fs_i.h> | 23 | #include "coda_fs_i.h" |
| 24 | 24 | ||
| 25 | /* operations */ | 25 | /* operations */ |
| 26 | extern const struct inode_operations coda_dir_inode_operations; | 26 | extern const struct inode_operations coda_dir_inode_operations; |
| 27 | extern const struct inode_operations coda_file_inode_operations; | 27 | extern const struct inode_operations coda_file_inode_operations; |
| 28 | extern const struct inode_operations coda_ioctl_inode_operations; | 28 | extern const struct inode_operations coda_ioctl_inode_operations; |
| 29 | 29 | ||
| 30 | extern const struct dentry_operations coda_dentry_operations; | ||
| 31 | |||
| 30 | extern const struct address_space_operations coda_file_aops; | 32 | extern const struct address_space_operations coda_file_aops; |
| 31 | extern const struct address_space_operations coda_symlink_aops; | 33 | extern const struct address_space_operations coda_symlink_aops; |
| 32 | 34 | ||
diff --git a/fs/coda/dir.c b/fs/coda/dir.c index 29badd91360..2b8dae4d121 100644 --- a/fs/coda/dir.c +++ b/fs/coda/dir.c | |||
| @@ -23,10 +23,9 @@ | |||
| 23 | #include <asm/uaccess.h> | 23 | #include <asm/uaccess.h> |
| 24 | 24 | ||
| 25 | #include <linux/coda.h> | 25 | #include <linux/coda.h> |
| 26 | #include <linux/coda_linux.h> | ||
| 27 | #include <linux/coda_psdev.h> | 26 | #include <linux/coda_psdev.h> |
| 28 | #include <linux/coda_fs_i.h> | 27 | #include "coda_linux.h" |
| 29 | #include <linux/coda_cache.h> | 28 | #include "coda_cache.h" |
| 30 | 29 | ||
| 31 | #include "coda_int.h" | 30 | #include "coda_int.h" |
| 32 | 31 | ||
| @@ -61,7 +60,7 @@ static int coda_return_EIO(void) | |||
| 61 | } | 60 | } |
| 62 | #define CODA_EIO_ERROR ((void *) (coda_return_EIO)) | 61 | #define CODA_EIO_ERROR ((void *) (coda_return_EIO)) |
| 63 | 62 | ||
| 64 | static const struct dentry_operations coda_dentry_operations = | 63 | const struct dentry_operations coda_dentry_operations = |
| 65 | { | 64 | { |
| 66 | .d_revalidate = coda_dentry_revalidate, | 65 | .d_revalidate = coda_dentry_revalidate, |
| 67 | .d_delete = coda_dentry_delete, | 66 | .d_delete = coda_dentry_delete, |
| @@ -126,8 +125,6 @@ static struct dentry *coda_lookup(struct inode *dir, struct dentry *entry, struc | |||
| 126 | return ERR_PTR(error); | 125 | return ERR_PTR(error); |
| 127 | 126 | ||
| 128 | exit: | 127 | exit: |
| 129 | d_set_d_op(entry, &coda_dentry_operations); | ||
| 130 | |||
| 131 | if (inode && (type & CODA_NOCACHE)) | 128 | if (inode && (type & CODA_NOCACHE)) |
| 132 | coda_flag_inode(inode, C_VATTR | C_PURGE); | 129 | coda_flag_inode(inode, C_VATTR | C_PURGE); |
| 133 | 130 | ||
diff --git a/fs/coda/file.c b/fs/coda/file.c index c8b50ba4366..0433057be33 100644 --- a/fs/coda/file.c +++ b/fs/coda/file.c | |||
| @@ -21,10 +21,9 @@ | |||
| 21 | #include <asm/uaccess.h> | 21 | #include <asm/uaccess.h> |
| 22 | 22 | ||
| 23 | #include <linux/coda.h> | 23 | #include <linux/coda.h> |
| 24 | #include <linux/coda_linux.h> | ||
| 25 | #include <linux/coda_fs_i.h> | ||
| 26 | #include <linux/coda_psdev.h> | 24 | #include <linux/coda_psdev.h> |
| 27 | 25 | ||
| 26 | #include "coda_linux.h" | ||
| 28 | #include "coda_int.h" | 27 | #include "coda_int.h" |
| 29 | 28 | ||
| 30 | static ssize_t | 29 | static ssize_t |
diff --git a/fs/coda/inode.c b/fs/coda/inode.c index f065a5d31a1..871b2771546 100644 --- a/fs/coda/inode.c +++ b/fs/coda/inode.c | |||
| @@ -28,10 +28,9 @@ | |||
| 28 | #include <linux/vmalloc.h> | 28 | #include <linux/vmalloc.h> |
| 29 | 29 | ||
| 30 | #include <linux/coda.h> | 30 | #include <linux/coda.h> |
| 31 | #include <linux/coda_linux.h> | ||
| 32 | #include <linux/coda_psdev.h> | 31 | #include <linux/coda_psdev.h> |
| 33 | #include <linux/coda_fs_i.h> | 32 | #include "coda_linux.h" |
| 34 | #include <linux/coda_cache.h> | 33 | #include "coda_cache.h" |
| 35 | 34 | ||
| 36 | #include "coda_int.h" | 35 | #include "coda_int.h" |
| 37 | 36 | ||
| @@ -193,6 +192,7 @@ static int coda_fill_super(struct super_block *sb, void *data, int silent) | |||
| 193 | sb->s_blocksize_bits = 12; | 192 | sb->s_blocksize_bits = 12; |
| 194 | sb->s_magic = CODA_SUPER_MAGIC; | 193 | sb->s_magic = CODA_SUPER_MAGIC; |
| 195 | sb->s_op = &coda_super_operations; | 194 | sb->s_op = &coda_super_operations; |
| 195 | sb->s_d_op = &coda_dentry_operations; | ||
| 196 | sb->s_bdi = &vc->bdi; | 196 | sb->s_bdi = &vc->bdi; |
| 197 | 197 | ||
| 198 | /* get root fid from Venus: this needs the root inode */ | 198 | /* get root fid from Venus: this needs the root inode */ |
diff --git a/fs/coda/pioctl.c b/fs/coda/pioctl.c index 741f0bd0391..6cbb3afb36d 100644 --- a/fs/coda/pioctl.c +++ b/fs/coda/pioctl.c | |||
| @@ -19,10 +19,10 @@ | |||
| 19 | #include <asm/uaccess.h> | 19 | #include <asm/uaccess.h> |
| 20 | 20 | ||
| 21 | #include <linux/coda.h> | 21 | #include <linux/coda.h> |
| 22 | #include <linux/coda_linux.h> | ||
| 23 | #include <linux/coda_fs_i.h> | ||
| 24 | #include <linux/coda_psdev.h> | 22 | #include <linux/coda_psdev.h> |
| 25 | 23 | ||
| 24 | #include "coda_linux.h" | ||
| 25 | |||
| 26 | /* pioctl ops */ | 26 | /* pioctl ops */ |
| 27 | static int coda_ioctl_permission(struct inode *inode, int mask, unsigned int flags); | 27 | static int coda_ioctl_permission(struct inode *inode, int mask, unsigned int flags); |
| 28 | static long coda_pioctl(struct file *filp, unsigned int cmd, | 28 | static long coda_pioctl(struct file *filp, unsigned int cmd, |
diff --git a/fs/coda/psdev.c b/fs/coda/psdev.c index 62647a8595e..8f616e0e252 100644 --- a/fs/coda/psdev.c +++ b/fs/coda/psdev.c | |||
| @@ -43,10 +43,10 @@ | |||
| 43 | #include <asm/uaccess.h> | 43 | #include <asm/uaccess.h> |
| 44 | 44 | ||
| 45 | #include <linux/coda.h> | 45 | #include <linux/coda.h> |
| 46 | #include <linux/coda_linux.h> | ||
| 47 | #include <linux/coda_fs_i.h> | ||
| 48 | #include <linux/coda_psdev.h> | 46 | #include <linux/coda_psdev.h> |
| 49 | 47 | ||
| 48 | #include "coda_linux.h" | ||
| 49 | |||
| 50 | #include "coda_int.h" | 50 | #include "coda_int.h" |
| 51 | 51 | ||
| 52 | /* statistics */ | 52 | /* statistics */ |
diff --git a/fs/coda/symlink.c b/fs/coda/symlink.c index af78f007a2b..ab94ef63cae 100644 --- a/fs/coda/symlink.c +++ b/fs/coda/symlink.c | |||
| @@ -16,9 +16,9 @@ | |||
| 16 | #include <linux/pagemap.h> | 16 | #include <linux/pagemap.h> |
| 17 | 17 | ||
| 18 | #include <linux/coda.h> | 18 | #include <linux/coda.h> |
| 19 | #include <linux/coda_linux.h> | ||
| 20 | #include <linux/coda_psdev.h> | 19 | #include <linux/coda_psdev.h> |
| 21 | #include <linux/coda_fs_i.h> | 20 | |
| 21 | #include "coda_linux.h" | ||
| 22 | 22 | ||
| 23 | static int coda_symlink_filler(struct file *file, struct page *page) | 23 | static int coda_symlink_filler(struct file *file, struct page *page) |
| 24 | { | 24 | { |
diff --git a/fs/coda/upcall.c b/fs/coda/upcall.c index c3563cab975..9727e0c5257 100644 --- a/fs/coda/upcall.c +++ b/fs/coda/upcall.c | |||
| @@ -33,10 +33,9 @@ | |||
| 33 | #include <linux/vfs.h> | 33 | #include <linux/vfs.h> |
| 34 | 34 | ||
| 35 | #include <linux/coda.h> | 35 | #include <linux/coda.h> |
| 36 | #include <linux/coda_linux.h> | ||
| 37 | #include <linux/coda_psdev.h> | 36 | #include <linux/coda_psdev.h> |
| 38 | #include <linux/coda_fs_i.h> | 37 | #include "coda_linux.h" |
| 39 | #include <linux/coda_cache.h> | 38 | #include "coda_cache.h" |
| 40 | 39 | ||
| 41 | #include "coda_int.h" | 40 | #include "coda_int.h" |
| 42 | 41 | ||
diff --git a/fs/configfs/configfs_internal.h b/fs/configfs/configfs_internal.h index 026cf68553a..82bda8fdfc1 100644 --- a/fs/configfs/configfs_internal.h +++ b/fs/configfs/configfs_internal.h | |||
| @@ -90,6 +90,7 @@ extern const struct file_operations configfs_file_operations; | |||
| 90 | extern const struct file_operations bin_fops; | 90 | extern const struct file_operations bin_fops; |
| 91 | extern const struct inode_operations configfs_dir_inode_operations; | 91 | extern const struct inode_operations configfs_dir_inode_operations; |
| 92 | extern const struct inode_operations configfs_symlink_inode_operations; | 92 | extern const struct inode_operations configfs_symlink_inode_operations; |
| 93 | extern const struct dentry_operations configfs_dentry_ops; | ||
| 93 | 94 | ||
| 94 | extern int configfs_symlink(struct inode *dir, struct dentry *dentry, | 95 | extern int configfs_symlink(struct inode *dir, struct dentry *dentry, |
| 95 | const char *symname); | 96 | const char *symname); |
diff --git a/fs/configfs/dir.c b/fs/configfs/dir.c index 36637a8c1ed..90ff3cb10de 100644 --- a/fs/configfs/dir.c +++ b/fs/configfs/dir.c | |||
| @@ -72,7 +72,7 @@ static int configfs_d_delete(const struct dentry *dentry) | |||
| 72 | return 1; | 72 | return 1; |
| 73 | } | 73 | } |
| 74 | 74 | ||
| 75 | static const struct dentry_operations configfs_dentry_ops = { | 75 | const struct dentry_operations configfs_dentry_ops = { |
| 76 | .d_iput = configfs_d_iput, | 76 | .d_iput = configfs_d_iput, |
| 77 | /* simple_delete_dentry() isn't exported */ | 77 | /* simple_delete_dentry() isn't exported */ |
| 78 | .d_delete = configfs_d_delete, | 78 | .d_delete = configfs_d_delete, |
| @@ -442,7 +442,6 @@ static int configfs_attach_attr(struct configfs_dirent * sd, struct dentry * den | |||
| 442 | return error; | 442 | return error; |
| 443 | } | 443 | } |
| 444 | 444 | ||
| 445 | d_set_d_op(dentry, &configfs_dentry_ops); | ||
| 446 | d_rehash(dentry); | 445 | d_rehash(dentry); |
| 447 | 446 | ||
| 448 | return 0; | 447 | return 0; |
| @@ -489,7 +488,6 @@ static struct dentry * configfs_lookup(struct inode *dir, | |||
| 489 | */ | 488 | */ |
| 490 | if (dentry->d_name.len > NAME_MAX) | 489 | if (dentry->d_name.len > NAME_MAX) |
| 491 | return ERR_PTR(-ENAMETOOLONG); | 490 | return ERR_PTR(-ENAMETOOLONG); |
| 492 | d_set_d_op(dentry, &configfs_dentry_ops); | ||
| 493 | d_add(dentry, NULL); | 491 | d_add(dentry, NULL); |
| 494 | return NULL; | 492 | return NULL; |
| 495 | } | 493 | } |
| @@ -683,7 +681,6 @@ static int create_default_group(struct config_group *parent_group, | |||
| 683 | ret = -ENOMEM; | 681 | ret = -ENOMEM; |
| 684 | child = d_alloc(parent, &name); | 682 | child = d_alloc(parent, &name); |
| 685 | if (child) { | 683 | if (child) { |
| 686 | d_set_d_op(child, &configfs_dentry_ops); | ||
| 687 | d_add(child, NULL); | 684 | d_add(child, NULL); |
| 688 | 685 | ||
| 689 | ret = configfs_attach_group(&parent_group->cg_item, | 686 | ret = configfs_attach_group(&parent_group->cg_item, |
| @@ -1681,7 +1678,6 @@ int configfs_register_subsystem(struct configfs_subsystem *subsys) | |||
| 1681 | err = -ENOMEM; | 1678 | err = -ENOMEM; |
| 1682 | dentry = d_alloc(configfs_sb->s_root, &name); | 1679 | dentry = d_alloc(configfs_sb->s_root, &name); |
| 1683 | if (dentry) { | 1680 | if (dentry) { |
| 1684 | d_set_d_op(dentry, &configfs_dentry_ops); | ||
| 1685 | d_add(dentry, NULL); | 1681 | d_add(dentry, NULL); |
| 1686 | 1682 | ||
| 1687 | err = configfs_attach_group(sd->s_element, &group->cg_item, | 1683 | err = configfs_attach_group(sd->s_element, &group->cg_item, |
diff --git a/fs/configfs/mount.c b/fs/configfs/mount.c index 7d3607febe1..ecc62178bed 100644 --- a/fs/configfs/mount.c +++ b/fs/configfs/mount.c | |||
| @@ -101,6 +101,7 @@ static int configfs_fill_super(struct super_block *sb, void *data, int silent) | |||
| 101 | configfs_root_group.cg_item.ci_dentry = root; | 101 | configfs_root_group.cg_item.ci_dentry = root; |
| 102 | root->d_fsdata = &configfs_root; | 102 | root->d_fsdata = &configfs_root; |
| 103 | sb->s_root = root; | 103 | sb->s_root = root; |
| 104 | sb->s_d_op = &configfs_dentry_ops; /* the rest get that */ | ||
| 104 | return 0; | 105 | return 0; |
| 105 | } | 106 | } |
| 106 | 107 | ||
diff --git a/fs/dcache.c b/fs/dcache.c index 5699d4c027c..0c6d5c549d8 100644 --- a/fs/dcache.c +++ b/fs/dcache.c | |||
| @@ -1320,6 +1320,7 @@ struct dentry *d_alloc(struct dentry * parent, const struct qstr *name) | |||
| 1320 | __dget_dlock(parent); | 1320 | __dget_dlock(parent); |
| 1321 | dentry->d_parent = parent; | 1321 | dentry->d_parent = parent; |
| 1322 | dentry->d_sb = parent->d_sb; | 1322 | dentry->d_sb = parent->d_sb; |
| 1323 | d_set_d_op(dentry, dentry->d_sb->s_d_op); | ||
| 1323 | list_add(&dentry->d_u.d_child, &parent->d_subdirs); | 1324 | list_add(&dentry->d_u.d_child, &parent->d_subdirs); |
| 1324 | spin_unlock(&parent->d_lock); | 1325 | spin_unlock(&parent->d_lock); |
| 1325 | } | 1326 | } |
| @@ -1335,6 +1336,7 @@ struct dentry *d_alloc_pseudo(struct super_block *sb, const struct qstr *name) | |||
| 1335 | struct dentry *dentry = d_alloc(NULL, name); | 1336 | struct dentry *dentry = d_alloc(NULL, name); |
| 1336 | if (dentry) { | 1337 | if (dentry) { |
| 1337 | dentry->d_sb = sb; | 1338 | dentry->d_sb = sb; |
| 1339 | d_set_d_op(dentry, dentry->d_sb->s_d_op); | ||
| 1338 | dentry->d_parent = dentry; | 1340 | dentry->d_parent = dentry; |
| 1339 | dentry->d_flags |= DCACHE_DISCONNECTED; | 1341 | dentry->d_flags |= DCACHE_DISCONNECTED; |
| 1340 | } | 1342 | } |
| @@ -1507,6 +1509,7 @@ struct dentry * d_alloc_root(struct inode * root_inode) | |||
| 1507 | res = d_alloc(NULL, &name); | 1509 | res = d_alloc(NULL, &name); |
| 1508 | if (res) { | 1510 | if (res) { |
| 1509 | res->d_sb = root_inode->i_sb; | 1511 | res->d_sb = root_inode->i_sb; |
| 1512 | d_set_d_op(res, res->d_sb->s_d_op); | ||
| 1510 | res->d_parent = res; | 1513 | res->d_parent = res; |
| 1511 | d_instantiate(res, root_inode); | 1514 | d_instantiate(res, root_inode); |
| 1512 | } | 1515 | } |
| @@ -1567,6 +1570,7 @@ struct dentry *d_obtain_alias(struct inode *inode) | |||
| 1567 | /* attach a disconnected dentry */ | 1570 | /* attach a disconnected dentry */ |
| 1568 | spin_lock(&tmp->d_lock); | 1571 | spin_lock(&tmp->d_lock); |
| 1569 | tmp->d_sb = inode->i_sb; | 1572 | tmp->d_sb = inode->i_sb; |
| 1573 | d_set_d_op(tmp, tmp->d_sb->s_d_op); | ||
| 1570 | tmp->d_inode = inode; | 1574 | tmp->d_inode = inode; |
| 1571 | tmp->d_flags |= DCACHE_DISCONNECTED; | 1575 | tmp->d_flags |= DCACHE_DISCONNECTED; |
| 1572 | list_add(&tmp->d_alias, &inode->i_dentry); | 1576 | list_add(&tmp->d_alias, &inode->i_dentry); |
| @@ -1966,7 +1970,7 @@ out: | |||
| 1966 | /** | 1970 | /** |
| 1967 | * d_validate - verify dentry provided from insecure source (deprecated) | 1971 | * d_validate - verify dentry provided from insecure source (deprecated) |
| 1968 | * @dentry: The dentry alleged to be valid child of @dparent | 1972 | * @dentry: The dentry alleged to be valid child of @dparent |
| 1969 | * @dparent: The parent dentry (known to be valid) | 1973 | * @parent: The parent dentry (known to be valid) |
| 1970 | * | 1974 | * |
| 1971 | * An insecure source has sent us a dentry, here we verify it and dget() it. | 1975 | * An insecure source has sent us a dentry, here we verify it and dget() it. |
| 1972 | * This is used by ncpfs in its readdir implementation. | 1976 | * This is used by ncpfs in its readdir implementation. |
| @@ -2449,8 +2453,7 @@ static int prepend_name(char **buffer, int *buflen, struct qstr *name) | |||
| 2449 | } | 2453 | } |
| 2450 | 2454 | ||
| 2451 | /** | 2455 | /** |
| 2452 | * Prepend path string to a buffer | 2456 | * prepend_path - Prepend path string to a buffer |
| 2453 | * | ||
| 2454 | * @path: the dentry/vfsmount to report | 2457 | * @path: the dentry/vfsmount to report |
| 2455 | * @root: root vfsmnt/dentry (may be modified by this function) | 2458 | * @root: root vfsmnt/dentry (may be modified by this function) |
| 2456 | * @buffer: pointer to the end of the buffer | 2459 | * @buffer: pointer to the end of the buffer |
diff --git a/fs/ecryptfs/inode.c b/fs/ecryptfs/inode.c index 337352a9475..64ff0233075 100644 --- a/fs/ecryptfs/inode.c +++ b/fs/ecryptfs/inode.c | |||
| @@ -441,7 +441,6 @@ static struct dentry *ecryptfs_lookup(struct inode *ecryptfs_dir_inode, | |||
| 441 | struct qstr lower_name; | 441 | struct qstr lower_name; |
| 442 | int rc = 0; | 442 | int rc = 0; |
| 443 | 443 | ||
| 444 | d_set_d_op(ecryptfs_dentry, &ecryptfs_dops); | ||
| 445 | if ((ecryptfs_dentry->d_name.len == 1 | 444 | if ((ecryptfs_dentry->d_name.len == 1 |
| 446 | && !strcmp(ecryptfs_dentry->d_name.name, ".")) | 445 | && !strcmp(ecryptfs_dentry->d_name.name, ".")) |
| 447 | || (ecryptfs_dentry->d_name.len == 2 | 446 | || (ecryptfs_dentry->d_name.len == 2 |
diff --git a/fs/ecryptfs/main.c b/fs/ecryptfs/main.c index 35103867537..9ed47690632 100644 --- a/fs/ecryptfs/main.c +++ b/fs/ecryptfs/main.c | |||
| @@ -141,21 +141,9 @@ int ecryptfs_init_persistent_file(struct dentry *ecryptfs_dentry) | |||
| 141 | return rc; | 141 | return rc; |
| 142 | } | 142 | } |
| 143 | 143 | ||
| 144 | /** | 144 | static inode *ecryptfs_get_inode(struct inode *lower_inode, |
| 145 | * ecryptfs_interpose | 145 | struct super_block *sb) |
| 146 | * @lower_dentry: Existing dentry in the lower filesystem | ||
| 147 | * @dentry: ecryptfs' dentry | ||
| 148 | * @sb: ecryptfs's super_block | ||
| 149 | * @flags: flags to govern behavior of interpose procedure | ||
| 150 | * | ||
| 151 | * Interposes upper and lower dentries. | ||
| 152 | * | ||
| 153 | * Returns zero on success; non-zero otherwise | ||
| 154 | */ | ||
| 155 | int ecryptfs_interpose(struct dentry *lower_dentry, struct dentry *dentry, | ||
| 156 | struct super_block *sb, u32 flags) | ||
| 157 | { | 146 | { |
| 158 | struct inode *lower_inode; | ||
| 159 | struct inode *inode; | 147 | struct inode *inode; |
| 160 | int rc = 0; | 148 | int rc = 0; |
| 161 | 149 | ||
| @@ -189,17 +177,38 @@ int ecryptfs_interpose(struct dentry *lower_dentry, struct dentry *dentry, | |||
| 189 | if (special_file(lower_inode->i_mode)) | 177 | if (special_file(lower_inode->i_mode)) |
| 190 | init_special_inode(inode, lower_inode->i_mode, | 178 | init_special_inode(inode, lower_inode->i_mode, |
| 191 | lower_inode->i_rdev); | 179 | lower_inode->i_rdev); |
| 192 | d_set_d_op(dentry, &ecryptfs_dops); | ||
| 193 | fsstack_copy_attr_all(inode, lower_inode); | 180 | fsstack_copy_attr_all(inode, lower_inode); |
| 194 | /* This size will be overwritten for real files w/ headers and | 181 | /* This size will be overwritten for real files w/ headers and |
| 195 | * other metadata */ | 182 | * other metadata */ |
| 196 | fsstack_copy_inode_size(inode, lower_inode); | 183 | fsstack_copy_inode_size(inode, lower_inode); |
| 184 | return inode; | ||
| 185 | out: | ||
| 186 | return ERR_PTR(rc); | ||
| 187 | } | ||
| 188 | |||
| 189 | /** | ||
| 190 | * ecryptfs_interpose | ||
| 191 | * @lower_dentry: Existing dentry in the lower filesystem | ||
| 192 | * @dentry: ecryptfs' dentry | ||
| 193 | * @sb: ecryptfs's super_block | ||
| 194 | * @flags: flags to govern behavior of interpose procedure | ||
| 195 | * | ||
| 196 | * Interposes upper and lower dentries. | ||
| 197 | * | ||
| 198 | * Returns zero on success; non-zero otherwise | ||
| 199 | */ | ||
| 200 | int ecryptfs_interpose(struct dentry *lower_dentry, struct dentry *dentry, | ||
| 201 | struct super_block *sb, u32 flags) | ||
| 202 | { | ||
| 203 | struct inode *lower_inode = lower_dentry->d_inode; | ||
| 204 | struct inode *inode = ecryptfs_get_inode(lower_inode, sb); | ||
| 205 | if (IS_ERR(inode) | ||
| 206 | return PTR_ERR(inode); | ||
| 197 | if (flags & ECRYPTFS_INTERPOSE_FLAG_D_ADD) | 207 | if (flags & ECRYPTFS_INTERPOSE_FLAG_D_ADD) |
| 198 | d_add(dentry, inode); | 208 | d_add(dentry, inode); |
| 199 | else | 209 | else |
| 200 | d_instantiate(dentry, inode); | 210 | d_instantiate(dentry, inode); |
| 201 | out: | 211 | return 0; |
| 202 | return rc; | ||
| 203 | } | 212 | } |
| 204 | 213 | ||
| 205 | enum { ecryptfs_opt_sig, ecryptfs_opt_ecryptfs_sig, | 214 | enum { ecryptfs_opt_sig, ecryptfs_opt_ecryptfs_sig, |
| @@ -492,59 +501,11 @@ struct kmem_cache *ecryptfs_sb_info_cache; | |||
| 492 | static struct file_system_type ecryptfs_fs_type; | 501 | static struct file_system_type ecryptfs_fs_type; |
| 493 | 502 | ||
| 494 | /** | 503 | /** |
| 495 | * ecryptfs_read_super | ||
| 496 | * @sb: The ecryptfs super block | ||
| 497 | * @dev_name: The path to mount over | ||
| 498 | * | ||
| 499 | * Read the super block of the lower filesystem, and use | ||
| 500 | * ecryptfs_interpose to create our initial inode and super block | ||
| 501 | * struct. | ||
| 502 | */ | ||
| 503 | static int ecryptfs_read_super(struct super_block *sb, const char *dev_name) | ||
| 504 | { | ||
| 505 | struct path path; | ||
| 506 | int rc; | ||
| 507 | |||
| 508 | rc = kern_path(dev_name, LOOKUP_FOLLOW | LOOKUP_DIRECTORY, &path); | ||
| 509 | if (rc) { | ||
| 510 | ecryptfs_printk(KERN_WARNING, "path_lookup() failed\n"); | ||
| 511 | goto out; | ||
| 512 | } | ||
| 513 | if (path.dentry->d_sb->s_type == &ecryptfs_fs_type) { | ||
| 514 | rc = -EINVAL; | ||
| 515 | printk(KERN_ERR "Mount on filesystem of type " | ||
| 516 | "eCryptfs explicitly disallowed due to " | ||
| 517 | "known incompatibilities\n"); | ||
| 518 | goto out_free; | ||
| 519 | } | ||
| 520 | ecryptfs_set_superblock_lower(sb, path.dentry->d_sb); | ||
| 521 | sb->s_maxbytes = path.dentry->d_sb->s_maxbytes; | ||
| 522 | sb->s_blocksize = path.dentry->d_sb->s_blocksize; | ||
| 523 | ecryptfs_set_dentry_lower(sb->s_root, path.dentry); | ||
| 524 | ecryptfs_set_dentry_lower_mnt(sb->s_root, path.mnt); | ||
| 525 | rc = ecryptfs_interpose(path.dentry, sb->s_root, sb, 0); | ||
| 526 | if (rc) | ||
| 527 | goto out_free; | ||
| 528 | rc = 0; | ||
| 529 | goto out; | ||
| 530 | out_free: | ||
| 531 | path_put(&path); | ||
| 532 | out: | ||
| 533 | return rc; | ||
| 534 | } | ||
| 535 | |||
| 536 | /** | ||
| 537 | * ecryptfs_get_sb | 504 | * ecryptfs_get_sb |
| 538 | * @fs_type | 505 | * @fs_type |
| 539 | * @flags | 506 | * @flags |
| 540 | * @dev_name: The path to mount over | 507 | * @dev_name: The path to mount over |
| 541 | * @raw_data: The options passed into the kernel | 508 | * @raw_data: The options passed into the kernel |
| 542 | * | ||
| 543 | * The whole ecryptfs_get_sb process is broken into 3 functions: | ||
| 544 | * ecryptfs_parse_options(): handle options passed to ecryptfs, if any | ||
| 545 | * ecryptfs_read_super(): this accesses the lower filesystem and uses | ||
| 546 | * ecryptfs_interpose to perform most of the linking | ||
| 547 | * ecryptfs_interpose(): links the lower filesystem into ecryptfs (inode.c) | ||
| 548 | */ | 509 | */ |
| 549 | static struct dentry *ecryptfs_mount(struct file_system_type *fs_type, int flags, | 510 | static struct dentry *ecryptfs_mount(struct file_system_type *fs_type, int flags, |
| 550 | const char *dev_name, void *raw_data) | 511 | const char *dev_name, void *raw_data) |
| @@ -553,6 +514,8 @@ static struct dentry *ecryptfs_mount(struct file_system_type *fs_type, int flags | |||
| 553 | struct ecryptfs_sb_info *sbi; | 514 | struct ecryptfs_sb_info *sbi; |
| 554 | struct ecryptfs_dentry_info *root_info; | 515 | struct ecryptfs_dentry_info *root_info; |
| 555 | const char *err = "Getting sb failed"; | 516 | const char *err = "Getting sb failed"; |
| 517 | struct inode *inode; | ||
| 518 | struct path path; | ||
| 556 | int rc; | 519 | int rc; |
| 557 | 520 | ||
| 558 | sbi = kmem_cache_zalloc(ecryptfs_sb_info_cache, GFP_KERNEL); | 521 | sbi = kmem_cache_zalloc(ecryptfs_sb_info_cache, GFP_KERNEL); |
| @@ -575,10 +538,8 @@ static struct dentry *ecryptfs_mount(struct file_system_type *fs_type, int flags | |||
| 575 | 538 | ||
| 576 | s->s_flags = flags; | 539 | s->s_flags = flags; |
| 577 | rc = bdi_setup_and_register(&sbi->bdi, "ecryptfs", BDI_CAP_MAP_COPY); | 540 | rc = bdi_setup_and_register(&sbi->bdi, "ecryptfs", BDI_CAP_MAP_COPY); |
| 578 | if (rc) { | 541 | if (rc) |
| 579 | deactivate_locked_super(s); | 542 | goto out1; |
| 580 | goto out; | ||
| 581 | } | ||
| 582 | 543 | ||
| 583 | ecryptfs_set_superblock_private(s, sbi); | 544 | ecryptfs_set_superblock_private(s, sbi); |
| 584 | s->s_bdi = &sbi->bdi; | 545 | s->s_bdi = &sbi->bdi; |
| @@ -586,34 +547,54 @@ static struct dentry *ecryptfs_mount(struct file_system_type *fs_type, int flags | |||
| 586 | /* ->kill_sb() will take care of sbi after that point */ | 547 | /* ->kill_sb() will take care of sbi after that point */ |
| 587 | sbi = NULL; | 548 | sbi = NULL; |
| 588 | s->s_op = &ecryptfs_sops; | 549 | s->s_op = &ecryptfs_sops; |
| 550 | s->s_d_op = &ecryptfs_dops; | ||
| 589 | 551 | ||
| 590 | rc = -ENOMEM; | 552 | err = "Reading sb failed"; |
| 591 | s->s_root = d_alloc(NULL, &(const struct qstr) { | 553 | rc = kern_path(dev_name, LOOKUP_FOLLOW | LOOKUP_DIRECTORY, &path); |
| 592 | .hash = 0,.name = "/",.len = 1}); | 554 | if (rc) { |
| 555 | ecryptfs_printk(KERN_WARNING, "kern_path() failed\n"); | ||
| 556 | goto out1; | ||
| 557 | } | ||
| 558 | if (path.dentry->d_sb->s_type == &ecryptfs_fs_type) { | ||
| 559 | rc = -EINVAL; | ||
| 560 | printk(KERN_ERR "Mount on filesystem of type " | ||
| 561 | "eCryptfs explicitly disallowed due to " | ||
| 562 | "known incompatibilities\n"); | ||
| 563 | goto out_free; | ||
| 564 | } | ||
| 565 | ecryptfs_set_superblock_lower(s, path.dentry->d_sb); | ||
| 566 | s->s_maxbytes = path.dentry->d_sb->s_maxbytes; | ||
| 567 | s->s_blocksize = path.dentry->d_sb->s_blocksize; | ||
| 568 | |||
| 569 | inode = ecryptfs_get_inode(path.dentry->d_inode, s); | ||
| 570 | rc = PTR_ERR(inode); | ||
| 571 | if (IS_ERR(inode)) | ||
| 572 | goto out_free; | ||
| 573 | |||
| 574 | s->s_root = d_alloc_root(inode); | ||
| 593 | if (!s->s_root) { | 575 | if (!s->s_root) { |
| 594 | deactivate_locked_super(s); | 576 | iput(inode); |
| 595 | goto out; | 577 | rc = -ENOMEM; |
| 578 | goto out_free; | ||
| 596 | } | 579 | } |
| 597 | d_set_d_op(s->s_root, &ecryptfs_dops); | ||
| 598 | s->s_root->d_sb = s; | ||
| 599 | s->s_root->d_parent = s->s_root; | ||
| 600 | 580 | ||
| 581 | rc = -ENOMEM; | ||
| 601 | root_info = kmem_cache_zalloc(ecryptfs_dentry_info_cache, GFP_KERNEL); | 582 | root_info = kmem_cache_zalloc(ecryptfs_dentry_info_cache, GFP_KERNEL); |
| 602 | if (!root_info) { | 583 | if (!root_info) |
| 603 | deactivate_locked_super(s); | 584 | goto out_free; |
| 604 | goto out; | 585 | |
| 605 | } | ||
| 606 | /* ->kill_sb() will take care of root_info */ | 586 | /* ->kill_sb() will take care of root_info */ |
| 607 | ecryptfs_set_dentry_private(s->s_root, root_info); | 587 | ecryptfs_set_dentry_private(s->s_root, root_info); |
| 588 | ecryptfs_set_dentry_lower(s->s_root, path.dentry); | ||
| 589 | ecryptfs_set_dentry_lower_mnt(s->s_root, path.mnt); | ||
| 590 | |||
| 608 | s->s_flags |= MS_ACTIVE; | 591 | s->s_flags |= MS_ACTIVE; |
| 609 | rc = ecryptfs_read_super(s, dev_name); | ||
| 610 | if (rc) { | ||
| 611 | deactivate_locked_super(s); | ||
| 612 | err = "Reading sb failed"; | ||
| 613 | goto out; | ||
| 614 | } | ||
| 615 | return dget(s->s_root); | 592 | return dget(s->s_root); |
| 616 | 593 | ||
| 594 | out_free: | ||
| 595 | path_put(&path); | ||
| 596 | out1: | ||
| 597 | deactivate_locked_super(s); | ||
| 617 | out: | 598 | out: |
| 618 | if (sbi) { | 599 | if (sbi) { |
| 619 | ecryptfs_destroy_mount_crypt_stat(&sbi->mount_crypt_stat); | 600 | ecryptfs_destroy_mount_crypt_stat(&sbi->mount_crypt_stat); |
diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c index d202d765dad..c4068f6abf0 100644 --- a/fs/ext4/extents.c +++ b/fs/ext4/extents.c | |||
| @@ -3644,6 +3644,10 @@ long ext4_fallocate(struct inode *inode, int mode, loff_t offset, loff_t len) | |||
| 3644 | struct ext4_map_blocks map; | 3644 | struct ext4_map_blocks map; |
| 3645 | unsigned int credits, blkbits = inode->i_blkbits; | 3645 | unsigned int credits, blkbits = inode->i_blkbits; |
| 3646 | 3646 | ||
| 3647 | /* We only support the FALLOC_FL_KEEP_SIZE mode */ | ||
| 3648 | if (mode && (mode != FALLOC_FL_KEEP_SIZE)) | ||
| 3649 | return -EOPNOTSUPP; | ||
| 3650 | |||
| 3647 | /* | 3651 | /* |
| 3648 | * currently supporting (pre)allocate mode for extent-based | 3652 | * currently supporting (pre)allocate mode for extent-based |
| 3649 | * files _only_ | 3653 | * files _only_ |
diff --git a/fs/fat/fat.h b/fs/fat/fat.h index d75a77f85c2..f50408901f7 100644 --- a/fs/fat/fat.h +++ b/fs/fat/fat.h | |||
| @@ -319,7 +319,8 @@ extern struct inode *fat_build_inode(struct super_block *sb, | |||
| 319 | struct msdos_dir_entry *de, loff_t i_pos); | 319 | struct msdos_dir_entry *de, loff_t i_pos); |
| 320 | extern int fat_sync_inode(struct inode *inode); | 320 | extern int fat_sync_inode(struct inode *inode); |
| 321 | extern int fat_fill_super(struct super_block *sb, void *data, int silent, | 321 | extern int fat_fill_super(struct super_block *sb, void *data, int silent, |
| 322 | const struct inode_operations *fs_dir_inode_ops, int isvfat); | 322 | const struct inode_operations *fs_dir_inode_ops, |
| 323 | int isvfat, void (*setup)(struct super_block *)); | ||
| 323 | 324 | ||
| 324 | extern int fat_flush_inodes(struct super_block *sb, struct inode *i1, | 325 | extern int fat_flush_inodes(struct super_block *sb, struct inode *i1, |
| 325 | struct inode *i2); | 326 | struct inode *i2); |
diff --git a/fs/fat/inode.c b/fs/fat/inode.c index 206351af7c5..86753fe10bd 100644 --- a/fs/fat/inode.c +++ b/fs/fat/inode.c | |||
| @@ -703,7 +703,6 @@ static struct dentry *fat_fh_to_dentry(struct super_block *sb, | |||
| 703 | struct fid *fid, int fh_len, int fh_type) | 703 | struct fid *fid, int fh_len, int fh_type) |
| 704 | { | 704 | { |
| 705 | struct inode *inode = NULL; | 705 | struct inode *inode = NULL; |
| 706 | struct dentry *result; | ||
| 707 | u32 *fh = fid->raw; | 706 | u32 *fh = fid->raw; |
| 708 | 707 | ||
| 709 | if (fh_len < 5 || fh_type != 3) | 708 | if (fh_len < 5 || fh_type != 3) |
| @@ -748,10 +747,7 @@ static struct dentry *fat_fh_to_dentry(struct super_block *sb, | |||
| 748 | * the fat_iget lookup again. If that fails, then we are totally out | 747 | * the fat_iget lookup again. If that fails, then we are totally out |
| 749 | * of luck. But all that is for another day | 748 | * of luck. But all that is for another day |
| 750 | */ | 749 | */ |
| 751 | result = d_obtain_alias(inode); | 750 | return d_obtain_alias(inode); |
| 752 | if (!IS_ERR(result)) | ||
| 753 | d_set_d_op(result, sb->s_root->d_op); | ||
| 754 | return result; | ||
| 755 | } | 751 | } |
| 756 | 752 | ||
| 757 | static int | 753 | static int |
| @@ -799,8 +795,6 @@ static struct dentry *fat_get_parent(struct dentry *child) | |||
| 799 | brelse(bh); | 795 | brelse(bh); |
| 800 | 796 | ||
| 801 | parent = d_obtain_alias(inode); | 797 | parent = d_obtain_alias(inode); |
| 802 | if (!IS_ERR(parent)) | ||
| 803 | d_set_d_op(parent, sb->s_root->d_op); | ||
| 804 | out: | 798 | out: |
| 805 | unlock_super(sb); | 799 | unlock_super(sb); |
| 806 | 800 | ||
| @@ -1244,7 +1238,8 @@ static int fat_read_root(struct inode *inode) | |||
| 1244 | * Read the super block of an MS-DOS FS. | 1238 | * Read the super block of an MS-DOS FS. |
| 1245 | */ | 1239 | */ |
| 1246 | int fat_fill_super(struct super_block *sb, void *data, int silent, | 1240 | int fat_fill_super(struct super_block *sb, void *data, int silent, |
| 1247 | const struct inode_operations *fs_dir_inode_ops, int isvfat) | 1241 | const struct inode_operations *fs_dir_inode_ops, int isvfat, |
| 1242 | void (*setup)(struct super_block *)) | ||
| 1248 | { | 1243 | { |
| 1249 | struct inode *root_inode = NULL, *fat_inode = NULL; | 1244 | struct inode *root_inode = NULL, *fat_inode = NULL; |
| 1250 | struct buffer_head *bh; | 1245 | struct buffer_head *bh; |
| @@ -1280,6 +1275,8 @@ int fat_fill_super(struct super_block *sb, void *data, int silent, | |||
| 1280 | if (error) | 1275 | if (error) |
| 1281 | goto out_fail; | 1276 | goto out_fail; |
| 1282 | 1277 | ||
| 1278 | setup(sb); /* flavour-specific stuff that needs options */ | ||
| 1279 | |||
| 1283 | error = -EIO; | 1280 | error = -EIO; |
| 1284 | sb_min_blocksize(sb, 512); | 1281 | sb_min_blocksize(sb, 512); |
| 1285 | bh = sb_bread(sb, 0); | 1282 | bh = sb_bread(sb, 0); |
diff --git a/fs/fat/namei_msdos.c b/fs/fat/namei_msdos.c index 35ffe43afa4..711499040eb 100644 --- a/fs/fat/namei_msdos.c +++ b/fs/fat/namei_msdos.c | |||
| @@ -227,11 +227,7 @@ static struct dentry *msdos_lookup(struct inode *dir, struct dentry *dentry, | |||
| 227 | } | 227 | } |
| 228 | out: | 228 | out: |
| 229 | unlock_super(sb); | 229 | unlock_super(sb); |
| 230 | d_set_d_op(dentry, &msdos_dentry_operations); | 230 | return d_splice_alias(inode, dentry); |
| 231 | dentry = d_splice_alias(inode, dentry); | ||
| 232 | if (dentry) | ||
| 233 | d_set_d_op(dentry, &msdos_dentry_operations); | ||
| 234 | return dentry; | ||
| 235 | 231 | ||
| 236 | error: | 232 | error: |
| 237 | unlock_super(sb); | 233 | unlock_super(sb); |
| @@ -661,21 +657,16 @@ static const struct inode_operations msdos_dir_inode_operations = { | |||
| 661 | .getattr = fat_getattr, | 657 | .getattr = fat_getattr, |
| 662 | }; | 658 | }; |
| 663 | 659 | ||
| 664 | static int msdos_fill_super(struct super_block *sb, void *data, int silent) | 660 | static void setup(struct super_block *sb) |
| 665 | { | 661 | { |
| 666 | int res; | 662 | sb->s_d_op = &msdos_dentry_operations; |
| 667 | |||
| 668 | lock_super(sb); | ||
| 669 | res = fat_fill_super(sb, data, silent, &msdos_dir_inode_operations, 0); | ||
| 670 | if (res) { | ||
| 671 | unlock_super(sb); | ||
| 672 | return res; | ||
| 673 | } | ||
| 674 | |||
| 675 | sb->s_flags |= MS_NOATIME; | 663 | sb->s_flags |= MS_NOATIME; |
| 676 | d_set_d_op(sb->s_root, &msdos_dentry_operations); | 664 | } |
| 677 | unlock_super(sb); | 665 | |
| 678 | return 0; | 666 | static int msdos_fill_super(struct super_block *sb, void *data, int silent) |
| 667 | { | ||
| 668 | return fat_fill_super(sb, data, silent, &msdos_dir_inode_operations, | ||
| 669 | 0, setup); | ||
| 679 | } | 670 | } |
| 680 | 671 | ||
| 681 | static struct dentry *msdos_mount(struct file_system_type *fs_type, | 672 | static struct dentry *msdos_mount(struct file_system_type *fs_type, |
diff --git a/fs/fat/namei_vfat.c b/fs/fat/namei_vfat.c index e3ffc5e1233..f88f752babd 100644 --- a/fs/fat/namei_vfat.c +++ b/fs/fat/namei_vfat.c | |||
| @@ -772,13 +772,10 @@ static struct dentry *vfat_lookup(struct inode *dir, struct dentry *dentry, | |||
| 772 | 772 | ||
| 773 | out: | 773 | out: |
| 774 | unlock_super(sb); | 774 | unlock_super(sb); |
| 775 | d_set_d_op(dentry, sb->s_root->d_op); | ||
| 776 | dentry->d_time = dentry->d_parent->d_inode->i_version; | 775 | dentry->d_time = dentry->d_parent->d_inode->i_version; |
| 777 | dentry = d_splice_alias(inode, dentry); | 776 | dentry = d_splice_alias(inode, dentry); |
| 778 | if (dentry) { | 777 | if (dentry) |
| 779 | d_set_d_op(dentry, sb->s_root->d_op); | ||
| 780 | dentry->d_time = dentry->d_parent->d_inode->i_version; | 778 | dentry->d_time = dentry->d_parent->d_inode->i_version; |
| 781 | } | ||
| 782 | return dentry; | 779 | return dentry; |
| 783 | 780 | ||
| 784 | error: | 781 | error: |
| @@ -1066,24 +1063,18 @@ static const struct inode_operations vfat_dir_inode_operations = { | |||
| 1066 | .getattr = fat_getattr, | 1063 | .getattr = fat_getattr, |
| 1067 | }; | 1064 | }; |
| 1068 | 1065 | ||
| 1069 | static int vfat_fill_super(struct super_block *sb, void *data, int silent) | 1066 | static void setup(struct super_block *sb) |
| 1070 | { | 1067 | { |
| 1071 | int res; | ||
| 1072 | |||
| 1073 | lock_super(sb); | ||
| 1074 | res = fat_fill_super(sb, data, silent, &vfat_dir_inode_operations, 1); | ||
| 1075 | if (res) { | ||
| 1076 | unlock_super(sb); | ||
| 1077 | return res; | ||
| 1078 | } | ||
| 1079 | |||
| 1080 | if (MSDOS_SB(sb)->options.name_check != 's') | 1068 | if (MSDOS_SB(sb)->options.name_check != 's') |
| 1081 | d_set_d_op(sb->s_root, &vfat_ci_dentry_ops); | 1069 | sb->s_d_op = &vfat_ci_dentry_ops; |
| 1082 | else | 1070 | else |
| 1083 | d_set_d_op(sb->s_root, &vfat_dentry_ops); | 1071 | sb->s_d_op = &vfat_dentry_ops; |
| 1072 | } | ||
| 1084 | 1073 | ||
| 1085 | unlock_super(sb); | 1074 | static int vfat_fill_super(struct super_block *sb, void *data, int silent) |
| 1086 | return 0; | 1075 | { |
| 1076 | return fat_fill_super(sb, data, silent, &vfat_dir_inode_operations, | ||
| 1077 | 1, setup); | ||
| 1087 | } | 1078 | } |
| 1088 | 1079 | ||
| 1089 | static struct dentry *vfat_mount(struct file_system_type *fs_type, | 1080 | static struct dentry *vfat_mount(struct file_system_type *fs_type, |
diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c index 042af7346ec..bfed8447ed8 100644 --- a/fs/fuse/dir.c +++ b/fs/fuse/dir.c | |||
| @@ -350,7 +350,6 @@ static struct dentry *fuse_lookup(struct inode *dir, struct dentry *entry, | |||
| 350 | } | 350 | } |
| 351 | 351 | ||
| 352 | entry = newent ? newent : entry; | 352 | entry = newent ? newent : entry; |
| 353 | d_set_d_op(entry, &fuse_dentry_operations); | ||
| 354 | if (outarg_valid) | 353 | if (outarg_valid) |
| 355 | fuse_change_entry_timeout(entry, &outarg); | 354 | fuse_change_entry_timeout(entry, &outarg); |
| 356 | else | 355 | else |
diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c index f62b32cffea..9e3f68cc1bd 100644 --- a/fs/fuse/inode.c +++ b/fs/fuse/inode.c | |||
| @@ -617,10 +617,8 @@ static struct dentry *fuse_get_dentry(struct super_block *sb, | |||
| 617 | goto out_iput; | 617 | goto out_iput; |
| 618 | 618 | ||
| 619 | entry = d_obtain_alias(inode); | 619 | entry = d_obtain_alias(inode); |
| 620 | if (!IS_ERR(entry) && get_node_id(inode) != FUSE_ROOT_ID) { | 620 | if (!IS_ERR(entry) && get_node_id(inode) != FUSE_ROOT_ID) |
| 621 | d_set_d_op(entry, &fuse_dentry_operations); | ||
| 622 | fuse_invalidate_entry_cache(entry); | 621 | fuse_invalidate_entry_cache(entry); |
| 623 | } | ||
| 624 | 622 | ||
| 625 | return entry; | 623 | return entry; |
| 626 | 624 | ||
| @@ -719,10 +717,8 @@ static struct dentry *fuse_get_parent(struct dentry *child) | |||
| 719 | } | 717 | } |
| 720 | 718 | ||
| 721 | parent = d_obtain_alias(inode); | 719 | parent = d_obtain_alias(inode); |
| 722 | if (!IS_ERR(parent) && get_node_id(inode) != FUSE_ROOT_ID) { | 720 | if (!IS_ERR(parent) && get_node_id(inode) != FUSE_ROOT_ID) |
| 723 | d_set_d_op(parent, &fuse_dentry_operations); | ||
| 724 | fuse_invalidate_entry_cache(parent); | 721 | fuse_invalidate_entry_cache(parent); |
| 725 | } | ||
| 726 | 722 | ||
| 727 | return parent; | 723 | return parent; |
| 728 | } | 724 | } |
| @@ -989,6 +985,8 @@ static int fuse_fill_super(struct super_block *sb, void *data, int silent) | |||
| 989 | iput(root); | 985 | iput(root); |
| 990 | goto err_put_conn; | 986 | goto err_put_conn; |
| 991 | } | 987 | } |
| 988 | /* only now - we want root dentry with NULL ->d_op */ | ||
| 989 | sb->s_d_op = &fuse_dentry_operations; | ||
| 992 | 990 | ||
| 993 | init_req = fuse_request_alloc(); | 991 | init_req = fuse_request_alloc(); |
| 994 | if (!init_req) | 992 | if (!init_req) |
diff --git a/fs/gfs2/export.c b/fs/gfs2/export.c index 97012ecff56..9023db8184f 100644 --- a/fs/gfs2/export.c +++ b/fs/gfs2/export.c | |||
| @@ -126,12 +126,7 @@ static int gfs2_get_name(struct dentry *parent, char *name, | |||
| 126 | 126 | ||
| 127 | static struct dentry *gfs2_get_parent(struct dentry *child) | 127 | static struct dentry *gfs2_get_parent(struct dentry *child) |
| 128 | { | 128 | { |
| 129 | struct dentry *dentry; | 129 | return d_obtain_alias(gfs2_lookupi(child->d_inode, &gfs2_qdotdot, 1)); |
| 130 | |||
| 131 | dentry = d_obtain_alias(gfs2_lookupi(child->d_inode, &gfs2_qdotdot, 1)); | ||
| 132 | if (!IS_ERR(dentry)) | ||
| 133 | d_set_d_op(dentry, &gfs2_dops); | ||
| 134 | return dentry; | ||
| 135 | } | 130 | } |
| 136 | 131 | ||
| 137 | static struct dentry *gfs2_get_dentry(struct super_block *sb, | 132 | static struct dentry *gfs2_get_dentry(struct super_block *sb, |
| @@ -139,7 +134,6 @@ static struct dentry *gfs2_get_dentry(struct super_block *sb, | |||
| 139 | { | 134 | { |
| 140 | struct gfs2_sbd *sdp = sb->s_fs_info; | 135 | struct gfs2_sbd *sdp = sb->s_fs_info; |
| 141 | struct inode *inode; | 136 | struct inode *inode; |
| 142 | struct dentry *dentry; | ||
| 143 | 137 | ||
| 144 | inode = gfs2_ilookup(sb, inum->no_addr); | 138 | inode = gfs2_ilookup(sb, inum->no_addr); |
| 145 | if (inode) { | 139 | if (inode) { |
| @@ -156,10 +150,7 @@ static struct dentry *gfs2_get_dentry(struct super_block *sb, | |||
| 156 | return ERR_CAST(inode); | 150 | return ERR_CAST(inode); |
| 157 | 151 | ||
| 158 | out_inode: | 152 | out_inode: |
| 159 | dentry = d_obtain_alias(inode); | 153 | return d_obtain_alias(inode); |
| 160 | if (!IS_ERR(dentry)) | ||
| 161 | d_set_d_op(dentry, &gfs2_dops); | ||
| 162 | return dentry; | ||
| 163 | } | 154 | } |
| 164 | 155 | ||
| 165 | static struct dentry *gfs2_fh_to_dentry(struct super_block *sb, struct fid *fid, | 156 | static struct dentry *gfs2_fh_to_dentry(struct super_block *sb, struct fid *fid, |
diff --git a/fs/gfs2/ops_fstype.c b/fs/gfs2/ops_fstype.c index 2aeabd4218c..693f4470a2d 100644 --- a/fs/gfs2/ops_fstype.c +++ b/fs/gfs2/ops_fstype.c | |||
| @@ -440,7 +440,6 @@ static int gfs2_lookup_root(struct super_block *sb, struct dentry **dptr, | |||
| 440 | iput(inode); | 440 | iput(inode); |
| 441 | return -ENOMEM; | 441 | return -ENOMEM; |
| 442 | } | 442 | } |
| 443 | d_set_d_op(dentry, &gfs2_dops); | ||
| 444 | *dptr = dentry; | 443 | *dptr = dentry; |
| 445 | return 0; | 444 | return 0; |
| 446 | } | 445 | } |
| @@ -1106,6 +1105,7 @@ static int fill_super(struct super_block *sb, struct gfs2_args *args, int silent | |||
| 1106 | 1105 | ||
| 1107 | sb->s_magic = GFS2_MAGIC; | 1106 | sb->s_magic = GFS2_MAGIC; |
| 1108 | sb->s_op = &gfs2_super_ops; | 1107 | sb->s_op = &gfs2_super_ops; |
| 1108 | sb->s_d_op = &gfs2_dops; | ||
| 1109 | sb->s_export_op = &gfs2_export_ops; | 1109 | sb->s_export_op = &gfs2_export_ops; |
| 1110 | sb->s_xattr = gfs2_xattr_handlers; | 1110 | sb->s_xattr = gfs2_xattr_handlers; |
| 1111 | sb->s_qcop = &gfs2_quotactl_ops; | 1111 | sb->s_qcop = &gfs2_quotactl_ops; |
diff --git a/fs/gfs2/ops_inode.c b/fs/gfs2/ops_inode.c index 1501db4f0e6..040b5a2e655 100644 --- a/fs/gfs2/ops_inode.c +++ b/fs/gfs2/ops_inode.c | |||
| @@ -106,8 +106,6 @@ static struct dentry *gfs2_lookup(struct inode *dir, struct dentry *dentry, | |||
| 106 | { | 106 | { |
| 107 | struct inode *inode = NULL; | 107 | struct inode *inode = NULL; |
| 108 | 108 | ||
| 109 | d_set_d_op(dentry, &gfs2_dops); | ||
| 110 | |||
| 111 | inode = gfs2_lookupi(dir, &dentry->d_name, 0); | 109 | inode = gfs2_lookupi(dir, &dentry->d_name, 0); |
| 112 | if (inode && IS_ERR(inode)) | 110 | if (inode && IS_ERR(inode)) |
| 113 | return ERR_CAST(inode); | 111 | return ERR_CAST(inode); |
| @@ -1427,6 +1425,10 @@ static long gfs2_fallocate(struct inode *inode, int mode, loff_t offset, | |||
| 1427 | loff_t next = (offset + len - 1) >> sdp->sd_sb.sb_bsize_shift; | 1425 | loff_t next = (offset + len - 1) >> sdp->sd_sb.sb_bsize_shift; |
| 1428 | next = (next + 1) << sdp->sd_sb.sb_bsize_shift; | 1426 | next = (next + 1) << sdp->sd_sb.sb_bsize_shift; |
| 1429 | 1427 | ||
| 1428 | /* We only support the FALLOC_FL_KEEP_SIZE mode */ | ||
| 1429 | if (mode && (mode != FALLOC_FL_KEEP_SIZE)) | ||
| 1430 | return -EOPNOTSUPP; | ||
| 1431 | |||
| 1430 | offset = (offset >> sdp->sd_sb.sb_bsize_shift) << | 1432 | offset = (offset >> sdp->sd_sb.sb_bsize_shift) << |
| 1431 | sdp->sd_sb.sb_bsize_shift; | 1433 | sdp->sd_sb.sb_bsize_shift; |
| 1432 | 1434 | ||
diff --git a/fs/hfs/dir.c b/fs/hfs/dir.c index ea4aefe7c65..afa66aaa223 100644 --- a/fs/hfs/dir.c +++ b/fs/hfs/dir.c | |||
| @@ -25,8 +25,6 @@ static struct dentry *hfs_lookup(struct inode *dir, struct dentry *dentry, | |||
| 25 | struct inode *inode = NULL; | 25 | struct inode *inode = NULL; |
| 26 | int res; | 26 | int res; |
| 27 | 27 | ||
| 28 | d_set_d_op(dentry, &hfs_dentry_operations); | ||
| 29 | |||
| 30 | hfs_find_init(HFS_SB(dir->i_sb)->cat_tree, &fd); | 28 | hfs_find_init(HFS_SB(dir->i_sb)->cat_tree, &fd); |
| 31 | hfs_cat_build_key(dir->i_sb, fd.search_key, dir->i_ino, &dentry->d_name); | 29 | hfs_cat_build_key(dir->i_sb, fd.search_key, dir->i_ino, &dentry->d_name); |
| 32 | res = hfs_brec_read(&fd, &rec, sizeof(rec)); | 30 | res = hfs_brec_read(&fd, &rec, sizeof(rec)); |
diff --git a/fs/hfs/super.c b/fs/hfs/super.c index 0bef62aa4f4..1b55f704fb2 100644 --- a/fs/hfs/super.c +++ b/fs/hfs/super.c | |||
| @@ -429,13 +429,12 @@ static int hfs_fill_super(struct super_block *sb, void *data, int silent) | |||
| 429 | if (!root_inode) | 429 | if (!root_inode) |
| 430 | goto bail_no_root; | 430 | goto bail_no_root; |
| 431 | 431 | ||
| 432 | sb->s_d_op = &hfs_dentry_operations; | ||
| 432 | res = -ENOMEM; | 433 | res = -ENOMEM; |
| 433 | sb->s_root = d_alloc_root(root_inode); | 434 | sb->s_root = d_alloc_root(root_inode); |
| 434 | if (!sb->s_root) | 435 | if (!sb->s_root) |
| 435 | goto bail_iput; | 436 | goto bail_iput; |
| 436 | 437 | ||
| 437 | d_set_d_op(sb->s_root, &hfs_dentry_operations); | ||
| 438 | |||
| 439 | /* everything's okay */ | 438 | /* everything's okay */ |
| 440 | return 0; | 439 | return 0; |
| 441 | 440 | ||
diff --git a/fs/hfsplus/dir.c b/fs/hfsplus/dir.c index f896dc84302..4df5059c25d 100644 --- a/fs/hfsplus/dir.c +++ b/fs/hfsplus/dir.c | |||
| @@ -37,7 +37,6 @@ static struct dentry *hfsplus_lookup(struct inode *dir, struct dentry *dentry, | |||
| 37 | 37 | ||
| 38 | sb = dir->i_sb; | 38 | sb = dir->i_sb; |
| 39 | 39 | ||
| 40 | d_set_d_op(dentry, &hfsplus_dentry_operations); | ||
| 41 | dentry->d_fsdata = NULL; | 40 | dentry->d_fsdata = NULL; |
| 42 | hfs_find_init(HFSPLUS_SB(sb)->cat_tree, &fd); | 41 | hfs_find_init(HFSPLUS_SB(sb)->cat_tree, &fd); |
| 43 | hfsplus_cat_build_key(sb, fd.search_key, dir->i_ino, &dentry->d_name); | 42 | hfsplus_cat_build_key(sb, fd.search_key, dir->i_ino, &dentry->d_name); |
diff --git a/fs/hfsplus/super.c b/fs/hfsplus/super.c index 6ee6ad20acf..9a3b4795f43 100644 --- a/fs/hfsplus/super.c +++ b/fs/hfsplus/super.c | |||
| @@ -444,13 +444,13 @@ static int hfsplus_fill_super(struct super_block *sb, void *data, int silent) | |||
| 444 | err = PTR_ERR(root); | 444 | err = PTR_ERR(root); |
| 445 | goto cleanup; | 445 | goto cleanup; |
| 446 | } | 446 | } |
| 447 | sb->s_d_op = &hfsplus_dentry_operations; | ||
| 447 | sb->s_root = d_alloc_root(root); | 448 | sb->s_root = d_alloc_root(root); |
| 448 | if (!sb->s_root) { | 449 | if (!sb->s_root) { |
| 449 | iput(root); | 450 | iput(root); |
| 450 | err = -ENOMEM; | 451 | err = -ENOMEM; |
| 451 | goto cleanup; | 452 | goto cleanup; |
| 452 | } | 453 | } |
| 453 | d_set_d_op(sb->s_root, &hfsplus_dentry_operations); | ||
| 454 | 454 | ||
| 455 | str.len = sizeof(HFSP_HIDDENDIR_NAME) - 1; | 455 | str.len = sizeof(HFSP_HIDDENDIR_NAME) - 1; |
| 456 | str.name = HFSP_HIDDENDIR_NAME; | 456 | str.name = HFSP_HIDDENDIR_NAME; |
diff --git a/fs/hostfs/hostfs_kern.c b/fs/hostfs/hostfs_kern.c index d3244d949a4..2638c834ed2 100644 --- a/fs/hostfs/hostfs_kern.c +++ b/fs/hostfs/hostfs_kern.c | |||
| @@ -612,7 +612,6 @@ struct dentry *hostfs_lookup(struct inode *ino, struct dentry *dentry, | |||
| 612 | goto out_put; | 612 | goto out_put; |
| 613 | 613 | ||
| 614 | d_add(dentry, inode); | 614 | d_add(dentry, inode); |
| 615 | d_set_d_op(dentry, &hostfs_dentry_ops); | ||
| 616 | return NULL; | 615 | return NULL; |
| 617 | 616 | ||
| 618 | out_put: | 617 | out_put: |
| @@ -922,6 +921,7 @@ static int hostfs_fill_sb_common(struct super_block *sb, void *d, int silent) | |||
| 922 | sb->s_blocksize_bits = 10; | 921 | sb->s_blocksize_bits = 10; |
| 923 | sb->s_magic = HOSTFS_SUPER_MAGIC; | 922 | sb->s_magic = HOSTFS_SUPER_MAGIC; |
| 924 | sb->s_op = &hostfs_sbops; | 923 | sb->s_op = &hostfs_sbops; |
| 924 | sb->s_d_op = &hostfs_dentry_ops; | ||
| 925 | sb->s_maxbytes = MAX_LFS_FILESIZE; | 925 | sb->s_maxbytes = MAX_LFS_FILESIZE; |
| 926 | 926 | ||
| 927 | /* NULL is printed as <NULL> by sprintf: avoid that. */ | 927 | /* NULL is printed as <NULL> by sprintf: avoid that. */ |
diff --git a/fs/hpfs/dentry.c b/fs/hpfs/dentry.c index 32c13a94e1e..05d4816e4e7 100644 --- a/fs/hpfs/dentry.c +++ b/fs/hpfs/dentry.c | |||
| @@ -58,12 +58,7 @@ static int hpfs_compare_dentry(const struct dentry *parent, | |||
| 58 | return 0; | 58 | return 0; |
| 59 | } | 59 | } |
| 60 | 60 | ||
| 61 | static const struct dentry_operations hpfs_dentry_operations = { | 61 | const struct dentry_operations hpfs_dentry_operations = { |
| 62 | .d_hash = hpfs_hash_dentry, | 62 | .d_hash = hpfs_hash_dentry, |
| 63 | .d_compare = hpfs_compare_dentry, | 63 | .d_compare = hpfs_compare_dentry, |
| 64 | }; | 64 | }; |
| 65 | |||
| 66 | void hpfs_set_dentry_operations(struct dentry *dentry) | ||
| 67 | { | ||
| 68 | d_set_d_op(dentry, &hpfs_dentry_operations); | ||
| 69 | } | ||
diff --git a/fs/hpfs/dir.c b/fs/hpfs/dir.c index 2338130cceb..d32f63a569f 100644 --- a/fs/hpfs/dir.c +++ b/fs/hpfs/dir.c | |||
| @@ -298,7 +298,6 @@ struct dentry *hpfs_lookup(struct inode *dir, struct dentry *dentry, struct name | |||
| 298 | 298 | ||
| 299 | end: | 299 | end: |
| 300 | end_add: | 300 | end_add: |
| 301 | hpfs_set_dentry_operations(dentry); | ||
| 302 | unlock_kernel(); | 301 | unlock_kernel(); |
| 303 | d_add(dentry, result); | 302 | d_add(dentry, result); |
| 304 | return NULL; | 303 | return NULL; |
diff --git a/fs/hpfs/hpfs_fn.h b/fs/hpfs/hpfs_fn.h index 2fee17d0d9a..1c43dbea55e 100644 --- a/fs/hpfs/hpfs_fn.h +++ b/fs/hpfs/hpfs_fn.h | |||
| @@ -233,7 +233,7 @@ void hpfs_mark_4buffers_dirty(struct quad_buffer_head *); | |||
| 233 | 233 | ||
| 234 | /* dentry.c */ | 234 | /* dentry.c */ |
| 235 | 235 | ||
| 236 | void hpfs_set_dentry_operations(struct dentry *); | 236 | extern const struct dentry_operations hpfs_dentry_operations; |
| 237 | 237 | ||
| 238 | /* dir.c */ | 238 | /* dir.c */ |
| 239 | 239 | ||
diff --git a/fs/hpfs/super.c b/fs/hpfs/super.c index 49935ba78db..b30426b1fc9 100644 --- a/fs/hpfs/super.c +++ b/fs/hpfs/super.c | |||
| @@ -550,6 +550,7 @@ static int hpfs_fill_super(struct super_block *s, void *options, int silent) | |||
| 550 | /* Fill superblock stuff */ | 550 | /* Fill superblock stuff */ |
| 551 | s->s_magic = HPFS_SUPER_MAGIC; | 551 | s->s_magic = HPFS_SUPER_MAGIC; |
| 552 | s->s_op = &hpfs_sops; | 552 | s->s_op = &hpfs_sops; |
| 553 | s->s_d_op = &hpfs_dentry_operations; | ||
| 553 | 554 | ||
| 554 | sbi->sb_root = superblock->root; | 555 | sbi->sb_root = superblock->root; |
| 555 | sbi->sb_fs_size = superblock->n_sectors; | 556 | sbi->sb_fs_size = superblock->n_sectors; |
| @@ -651,7 +652,6 @@ static int hpfs_fill_super(struct super_block *s, void *options, int silent) | |||
| 651 | iput(root); | 652 | iput(root); |
| 652 | goto bail0; | 653 | goto bail0; |
| 653 | } | 654 | } |
| 654 | hpfs_set_dentry_operations(s->s_root); | ||
| 655 | 655 | ||
| 656 | /* | 656 | /* |
| 657 | * find the root directory's . pointer & finish filling in the inode | 657 | * find the root directory's . pointer & finish filling in the inode |
diff --git a/fs/isofs/inode.c b/fs/isofs/inode.c index 844a7903c72..a0f3833c0db 100644 --- a/fs/isofs/inode.c +++ b/fs/isofs/inode.c | |||
| @@ -939,17 +939,18 @@ root_found: | |||
| 939 | goto out_iput; | 939 | goto out_iput; |
| 940 | } | 940 | } |
| 941 | 941 | ||
| 942 | /* get the root dentry */ | ||
| 943 | s->s_root = d_alloc_root(inode); | ||
| 944 | if (!(s->s_root)) | ||
| 945 | goto out_no_root; | ||
| 946 | |||
| 947 | table = 0; | 942 | table = 0; |
| 948 | if (joliet_level) | 943 | if (joliet_level) |
| 949 | table += 2; | 944 | table += 2; |
| 950 | if (opt.check == 'r') | 945 | if (opt.check == 'r') |
| 951 | table++; | 946 | table++; |
| 952 | d_set_d_op(s->s_root, &isofs_dentry_ops[table]); | 947 | |
| 948 | s->s_d_op = &isofs_dentry_ops[table]; | ||
| 949 | |||
| 950 | /* get the root dentry */ | ||
| 951 | s->s_root = d_alloc_root(inode); | ||
| 952 | if (!(s->s_root)) | ||
| 953 | goto out_no_root; | ||
| 953 | 954 | ||
| 954 | kfree(opt.iocharset); | 955 | kfree(opt.iocharset); |
| 955 | 956 | ||
diff --git a/fs/isofs/namei.c b/fs/isofs/namei.c index 679a849c3b2..4fb3e8074fd 100644 --- a/fs/isofs/namei.c +++ b/fs/isofs/namei.c | |||
| @@ -172,8 +172,6 @@ struct dentry *isofs_lookup(struct inode *dir, struct dentry *dentry, struct nam | |||
| 172 | struct inode *inode; | 172 | struct inode *inode; |
| 173 | struct page *page; | 173 | struct page *page; |
| 174 | 174 | ||
| 175 | d_set_d_op(dentry, dir->i_sb->s_root->d_op); | ||
| 176 | |||
| 177 | page = alloc_page(GFP_USER); | 175 | page = alloc_page(GFP_USER); |
| 178 | if (!page) | 176 | if (!page) |
| 179 | return ERR_PTR(-ENOMEM); | 177 | return ERR_PTR(-ENOMEM); |
diff --git a/fs/jfs/namei.c b/fs/jfs/namei.c index 4414e3a4226..81ead850ddb 100644 --- a/fs/jfs/namei.c +++ b/fs/jfs/namei.c | |||
| @@ -1465,9 +1465,6 @@ static struct dentry *jfs_lookup(struct inode *dip, struct dentry *dentry, struc | |||
| 1465 | 1465 | ||
| 1466 | jfs_info("jfs_lookup: name = %s", name); | 1466 | jfs_info("jfs_lookup: name = %s", name); |
| 1467 | 1467 | ||
| 1468 | if (JFS_SBI(dip->i_sb)->mntflag & JFS_OS2) | ||
| 1469 | d_set_d_op(dentry, &jfs_ci_dentry_operations); | ||
| 1470 | |||
| 1471 | if ((name[0] == '.') && (len == 1)) | 1468 | if ((name[0] == '.') && (len == 1)) |
| 1472 | inum = dip->i_ino; | 1469 | inum = dip->i_ino; |
| 1473 | else if (strcmp(name, "..") == 0) | 1470 | else if (strcmp(name, "..") == 0) |
| @@ -1492,12 +1489,7 @@ static struct dentry *jfs_lookup(struct inode *dip, struct dentry *dentry, struc | |||
| 1492 | return ERR_CAST(ip); | 1489 | return ERR_CAST(ip); |
| 1493 | } | 1490 | } |
| 1494 | 1491 | ||
| 1495 | dentry = d_splice_alias(ip, dentry); | 1492 | return d_splice_alias(ip, dentry); |
| 1496 | |||
| 1497 | if (dentry && (JFS_SBI(dip->i_sb)->mntflag & JFS_OS2)) | ||
| 1498 | d_set_d_op(dentry, &jfs_ci_dentry_operations); | ||
| 1499 | |||
| 1500 | return dentry; | ||
| 1501 | } | 1493 | } |
| 1502 | 1494 | ||
| 1503 | static struct inode *jfs_nfs_get_inode(struct super_block *sb, | 1495 | static struct inode *jfs_nfs_get_inode(struct super_block *sb, |
diff --git a/fs/jfs/super.c b/fs/jfs/super.c index 3150d766e0d..eeca48a031a 100644 --- a/fs/jfs/super.c +++ b/fs/jfs/super.c | |||
| @@ -515,6 +515,9 @@ static int jfs_fill_super(struct super_block *sb, void *data, int silent) | |||
| 515 | 515 | ||
| 516 | sb->s_magic = JFS_SUPER_MAGIC; | 516 | sb->s_magic = JFS_SUPER_MAGIC; |
| 517 | 517 | ||
| 518 | if (sbi->mntflag & JFS_OS2) | ||
| 519 | sb->s_d_op = &jfs_ci_dentry_operations; | ||
| 520 | |||
| 518 | inode = jfs_iget(sb, ROOT_I); | 521 | inode = jfs_iget(sb, ROOT_I); |
| 519 | if (IS_ERR(inode)) { | 522 | if (IS_ERR(inode)) { |
| 520 | ret = PTR_ERR(inode); | 523 | ret = PTR_ERR(inode); |
| @@ -524,9 +527,6 @@ static int jfs_fill_super(struct super_block *sb, void *data, int silent) | |||
| 524 | if (!sb->s_root) | 527 | if (!sb->s_root) |
| 525 | goto out_no_root; | 528 | goto out_no_root; |
| 526 | 529 | ||
| 527 | if (sbi->mntflag & JFS_OS2) | ||
| 528 | d_set_d_op(sb->s_root, &jfs_ci_dentry_operations); | ||
| 529 | |||
| 530 | /* logical blocks are represented by 40 bits in pxd_t, etc. */ | 530 | /* logical blocks are represented by 40 bits in pxd_t, etc. */ |
| 531 | sb->s_maxbytes = ((u64) sb->s_blocksize) << 40; | 531 | sb->s_maxbytes = ((u64) sb->s_blocksize) << 40; |
| 532 | #if BITS_PER_LONG == 32 | 532 | #if BITS_PER_LONG == 32 |
diff --git a/fs/libfs.c b/fs/libfs.c index 889311e3d06..c88eab55aec 100644 --- a/fs/libfs.c +++ b/fs/libfs.c | |||
| @@ -217,7 +217,8 @@ static const struct super_operations simple_super_operations = { | |||
| 217 | * will never be mountable) | 217 | * will never be mountable) |
| 218 | */ | 218 | */ |
| 219 | struct dentry *mount_pseudo(struct file_system_type *fs_type, char *name, | 219 | struct dentry *mount_pseudo(struct file_system_type *fs_type, char *name, |
| 220 | const struct super_operations *ops, unsigned long magic) | 220 | const struct super_operations *ops, |
| 221 | const struct dentry_operations *dops, unsigned long magic) | ||
| 221 | { | 222 | { |
| 222 | struct super_block *s = sget(fs_type, NULL, set_anon_super, NULL); | 223 | struct super_block *s = sget(fs_type, NULL, set_anon_super, NULL); |
| 223 | struct dentry *dentry; | 224 | struct dentry *dentry; |
| @@ -254,6 +255,7 @@ struct dentry *mount_pseudo(struct file_system_type *fs_type, char *name, | |||
| 254 | dentry->d_parent = dentry; | 255 | dentry->d_parent = dentry; |
| 255 | d_instantiate(dentry, root); | 256 | d_instantiate(dentry, root); |
| 256 | s->s_root = dentry; | 257 | s->s_root = dentry; |
| 258 | s->s_d_op = dops; | ||
| 257 | s->s_flags |= MS_ACTIVE; | 259 | s->s_flags |= MS_ACTIVE; |
| 258 | return dget(s->s_root); | 260 | return dget(s->s_root); |
| 259 | 261 | ||
diff --git a/fs/minix/namei.c b/fs/minix/namei.c index 1b9e07728a9..ce7337ddfdb 100644 --- a/fs/minix/namei.c +++ b/fs/minix/namei.c | |||
| @@ -23,8 +23,6 @@ static struct dentry *minix_lookup(struct inode * dir, struct dentry *dentry, st | |||
| 23 | struct inode * inode = NULL; | 23 | struct inode * inode = NULL; |
| 24 | ino_t ino; | 24 | ino_t ino; |
| 25 | 25 | ||
| 26 | d_set_d_op(dentry, dir->i_sb->s_root->d_op); | ||
| 27 | |||
| 28 | if (dentry->d_name.len > minix_sb(dir->i_sb)->s_namelen) | 26 | if (dentry->d_name.len > minix_sb(dir->i_sb)->s_namelen) |
| 29 | return ERR_PTR(-ENAMETOOLONG); | 27 | return ERR_PTR(-ENAMETOOLONG); |
| 30 | 28 | ||
diff --git a/fs/namei.c b/fs/namei.c index 24ece10470b..0b14f6910fc 100644 --- a/fs/namei.c +++ b/fs/namei.c | |||
| @@ -1950,8 +1950,9 @@ int may_open(struct path *path, int acc_mode, int flag) | |||
| 1950 | return break_lease(inode, flag); | 1950 | return break_lease(inode, flag); |
| 1951 | } | 1951 | } |
| 1952 | 1952 | ||
| 1953 | static int handle_truncate(struct path *path) | 1953 | static int handle_truncate(struct file *filp) |
| 1954 | { | 1954 | { |
| 1955 | struct path *path = &filp->f_path; | ||
| 1955 | struct inode *inode = path->dentry->d_inode; | 1956 | struct inode *inode = path->dentry->d_inode; |
| 1956 | int error = get_write_access(inode); | 1957 | int error = get_write_access(inode); |
| 1957 | if (error) | 1958 | if (error) |
| @@ -1965,7 +1966,7 @@ static int handle_truncate(struct path *path) | |||
| 1965 | if (!error) { | 1966 | if (!error) { |
| 1966 | error = do_truncate(path->dentry, 0, | 1967 | error = do_truncate(path->dentry, 0, |
| 1967 | ATTR_MTIME|ATTR_CTIME|ATTR_OPEN, | 1968 | ATTR_MTIME|ATTR_CTIME|ATTR_OPEN, |
| 1968 | NULL); | 1969 | filp); |
| 1969 | } | 1970 | } |
| 1970 | put_write_access(inode); | 1971 | put_write_access(inode); |
| 1971 | return error; | 1972 | return error; |
| @@ -2063,7 +2064,7 @@ static struct file *finish_open(struct nameidata *nd, | |||
| 2063 | } | 2064 | } |
| 2064 | if (!IS_ERR(filp)) { | 2065 | if (!IS_ERR(filp)) { |
| 2065 | if (will_truncate) { | 2066 | if (will_truncate) { |
| 2066 | error = handle_truncate(&nd->path); | 2067 | error = handle_truncate(filp); |
| 2067 | if (error) { | 2068 | if (error) { |
| 2068 | fput(filp); | 2069 | fput(filp); |
| 2069 | filp = ERR_PTR(error); | 2070 | filp = ERR_PTR(error); |
diff --git a/fs/ncpfs/dir.c b/fs/ncpfs/dir.c index 28f136d4aae..f6946bb5cb5 100644 --- a/fs/ncpfs/dir.c +++ b/fs/ncpfs/dir.c | |||
| @@ -21,9 +21,7 @@ | |||
| 21 | #include <asm/uaccess.h> | 21 | #include <asm/uaccess.h> |
| 22 | #include <asm/byteorder.h> | 22 | #include <asm/byteorder.h> |
| 23 | 23 | ||
| 24 | #include <linux/ncp_fs.h> | 24 | #include "ncp_fs.h" |
| 25 | |||
| 26 | #include "ncplib_kernel.h" | ||
| 27 | 25 | ||
| 28 | static void ncp_read_volume_list(struct file *, void *, filldir_t, | 26 | static void ncp_read_volume_list(struct file *, void *, filldir_t, |
| 29 | struct ncp_cache_control *); | 27 | struct ncp_cache_control *); |
| @@ -82,7 +80,7 @@ static int ncp_compare_dentry(const struct dentry *, const struct inode *, | |||
| 82 | unsigned int, const char *, const struct qstr *); | 80 | unsigned int, const char *, const struct qstr *); |
| 83 | static int ncp_delete_dentry(const struct dentry *); | 81 | static int ncp_delete_dentry(const struct dentry *); |
| 84 | 82 | ||
| 85 | static const struct dentry_operations ncp_dentry_operations = | 83 | const struct dentry_operations ncp_dentry_operations = |
| 86 | { | 84 | { |
| 87 | .d_revalidate = ncp_lookup_validate, | 85 | .d_revalidate = ncp_lookup_validate, |
| 88 | .d_hash = ncp_hash_dentry, | 86 | .d_hash = ncp_hash_dentry, |
| @@ -90,14 +88,6 @@ static const struct dentry_operations ncp_dentry_operations = | |||
| 90 | .d_delete = ncp_delete_dentry, | 88 | .d_delete = ncp_delete_dentry, |
| 91 | }; | 89 | }; |
| 92 | 90 | ||
| 93 | const struct dentry_operations ncp_root_dentry_operations = | ||
| 94 | { | ||
| 95 | .d_hash = ncp_hash_dentry, | ||
| 96 | .d_compare = ncp_compare_dentry, | ||
| 97 | .d_delete = ncp_delete_dentry, | ||
| 98 | }; | ||
| 99 | |||
| 100 | |||
| 101 | #define ncp_namespace(i) (NCP_SERVER(i)->name_space[NCP_FINFO(i)->volNumber]) | 91 | #define ncp_namespace(i) (NCP_SERVER(i)->name_space[NCP_FINFO(i)->volNumber]) |
| 102 | 92 | ||
| 103 | static inline int ncp_preserve_entry_case(struct inode *i, __u32 nscreator) | 93 | static inline int ncp_preserve_entry_case(struct inode *i, __u32 nscreator) |
| @@ -309,6 +299,9 @@ ncp_lookup_validate(struct dentry *dentry, struct nameidata *nd) | |||
| 309 | int res, val = 0, len; | 299 | int res, val = 0, len; |
| 310 | __u8 __name[NCP_MAXPATHLEN + 1]; | 300 | __u8 __name[NCP_MAXPATHLEN + 1]; |
| 311 | 301 | ||
| 302 | if (dentry == dentry->d_sb->s_root) | ||
| 303 | return 1; | ||
| 304 | |||
| 312 | if (nd->flags & LOOKUP_RCU) | 305 | if (nd->flags & LOOKUP_RCU) |
| 313 | return -ECHILD; | 306 | return -ECHILD; |
| 314 | 307 | ||
| @@ -637,7 +630,6 @@ ncp_fill_cache(struct file *filp, void *dirent, filldir_t filldir, | |||
| 637 | entry->ino = iunique(dir->i_sb, 2); | 630 | entry->ino = iunique(dir->i_sb, 2); |
| 638 | inode = ncp_iget(dir->i_sb, entry); | 631 | inode = ncp_iget(dir->i_sb, entry); |
| 639 | if (inode) { | 632 | if (inode) { |
| 640 | d_set_d_op(newdent, &ncp_dentry_operations); | ||
| 641 | d_instantiate(newdent, inode); | 633 | d_instantiate(newdent, inode); |
| 642 | if (!hashed) | 634 | if (!hashed) |
| 643 | d_rehash(newdent); | 635 | d_rehash(newdent); |
| @@ -893,7 +885,6 @@ static struct dentry *ncp_lookup(struct inode *dir, struct dentry *dentry, struc | |||
| 893 | if (inode) { | 885 | if (inode) { |
| 894 | ncp_new_dentry(dentry); | 886 | ncp_new_dentry(dentry); |
| 895 | add_entry: | 887 | add_entry: |
| 896 | d_set_d_op(dentry, &ncp_dentry_operations); | ||
| 897 | d_add(dentry, inode); | 888 | d_add(dentry, inode); |
| 898 | error = 0; | 889 | error = 0; |
| 899 | } | 890 | } |
diff --git a/fs/ncpfs/file.c b/fs/ncpfs/file.c index cb50aaf981d..0ed65e0c3df 100644 --- a/fs/ncpfs/file.c +++ b/fs/ncpfs/file.c | |||
| @@ -18,8 +18,7 @@ | |||
| 18 | #include <linux/vmalloc.h> | 18 | #include <linux/vmalloc.h> |
| 19 | #include <linux/sched.h> | 19 | #include <linux/sched.h> |
| 20 | 20 | ||
| 21 | #include <linux/ncp_fs.h> | 21 | #include "ncp_fs.h" |
| 22 | #include "ncplib_kernel.h" | ||
| 23 | 22 | ||
| 24 | static int ncp_fsync(struct file *file, int datasync) | 23 | static int ncp_fsync(struct file *file, int datasync) |
| 25 | { | 24 | { |
diff --git a/fs/ncpfs/inode.c b/fs/ncpfs/inode.c index 9b39a5dd413..00a1d1c3d3a 100644 --- a/fs/ncpfs/inode.c +++ b/fs/ncpfs/inode.c | |||
| @@ -31,11 +31,9 @@ | |||
| 31 | #include <linux/seq_file.h> | 31 | #include <linux/seq_file.h> |
| 32 | #include <linux/namei.h> | 32 | #include <linux/namei.h> |
| 33 | 33 | ||
| 34 | #include <linux/ncp_fs.h> | ||
| 35 | |||
| 36 | #include <net/sock.h> | 34 | #include <net/sock.h> |
| 37 | 35 | ||
| 38 | #include "ncplib_kernel.h" | 36 | #include "ncp_fs.h" |
| 39 | #include "getopt.h" | 37 | #include "getopt.h" |
| 40 | 38 | ||
| 41 | #define NCP_DEFAULT_FILE_MODE 0600 | 39 | #define NCP_DEFAULT_FILE_MODE 0600 |
| @@ -544,6 +542,7 @@ static int ncp_fill_super(struct super_block *sb, void *raw_data, int silent) | |||
| 544 | sb->s_blocksize_bits = 10; | 542 | sb->s_blocksize_bits = 10; |
| 545 | sb->s_magic = NCP_SUPER_MAGIC; | 543 | sb->s_magic = NCP_SUPER_MAGIC; |
| 546 | sb->s_op = &ncp_sops; | 544 | sb->s_op = &ncp_sops; |
| 545 | sb->s_d_op = &ncp_dentry_operations; | ||
| 547 | sb->s_bdi = &server->bdi; | 546 | sb->s_bdi = &server->bdi; |
| 548 | 547 | ||
| 549 | server = NCP_SBP(sb); | 548 | server = NCP_SBP(sb); |
| @@ -723,7 +722,6 @@ static int ncp_fill_super(struct super_block *sb, void *raw_data, int silent) | |||
| 723 | sb->s_root = d_alloc_root(root_inode); | 722 | sb->s_root = d_alloc_root(root_inode); |
| 724 | if (!sb->s_root) | 723 | if (!sb->s_root) |
| 725 | goto out_no_root; | 724 | goto out_no_root; |
| 726 | d_set_d_op(sb->s_root, &ncp_root_dentry_operations); | ||
| 727 | return 0; | 725 | return 0; |
| 728 | 726 | ||
| 729 | out_no_root: | 727 | out_no_root: |
diff --git a/fs/ncpfs/ioctl.c b/fs/ncpfs/ioctl.c index d40a547e337..790e92a9ec6 100644 --- a/fs/ncpfs/ioctl.c +++ b/fs/ncpfs/ioctl.c | |||
| @@ -20,11 +20,9 @@ | |||
| 20 | #include <linux/vmalloc.h> | 20 | #include <linux/vmalloc.h> |
| 21 | #include <linux/sched.h> | 21 | #include <linux/sched.h> |
| 22 | 22 | ||
| 23 | #include <linux/ncp_fs.h> | ||
| 24 | |||
| 25 | #include <asm/uaccess.h> | 23 | #include <asm/uaccess.h> |
| 26 | 24 | ||
| 27 | #include "ncplib_kernel.h" | 25 | #include "ncp_fs.h" |
| 28 | 26 | ||
| 29 | /* maximum limit for ncp_objectname_ioctl */ | 27 | /* maximum limit for ncp_objectname_ioctl */ |
| 30 | #define NCP_OBJECT_NAME_MAX_LEN 4096 | 28 | #define NCP_OBJECT_NAME_MAX_LEN 4096 |
diff --git a/fs/ncpfs/mmap.c b/fs/ncpfs/mmap.c index 56f5b3a0e1e..a7c07b44b10 100644 --- a/fs/ncpfs/mmap.c +++ b/fs/ncpfs/mmap.c | |||
| @@ -16,12 +16,12 @@ | |||
| 16 | #include <linux/mman.h> | 16 | #include <linux/mman.h> |
| 17 | #include <linux/string.h> | 17 | #include <linux/string.h> |
| 18 | #include <linux/fcntl.h> | 18 | #include <linux/fcntl.h> |
| 19 | #include <linux/ncp_fs.h> | ||
| 20 | 19 | ||
| 21 | #include "ncplib_kernel.h" | ||
| 22 | #include <asm/uaccess.h> | 20 | #include <asm/uaccess.h> |
| 23 | #include <asm/system.h> | 21 | #include <asm/system.h> |
| 24 | 22 | ||
| 23 | #include "ncp_fs.h" | ||
| 24 | |||
| 25 | /* | 25 | /* |
| 26 | * Fill in the supplied page for mmap | 26 | * Fill in the supplied page for mmap |
| 27 | * XXX: how are we excluding truncate/invalidate here? Maybe need to lock | 27 | * XXX: how are we excluding truncate/invalidate here? Maybe need to lock |
diff --git a/fs/ncpfs/ncp_fs.h b/fs/ncpfs/ncp_fs.h new file mode 100644 index 00000000000..31831afe1c3 --- /dev/null +++ b/fs/ncpfs/ncp_fs.h | |||
| @@ -0,0 +1,98 @@ | |||
| 1 | #include <linux/ncp_fs.h> | ||
| 2 | #include "ncp_fs_i.h" | ||
| 3 | #include "ncp_fs_sb.h" | ||
| 4 | |||
| 5 | /* define because it is easy to change PRINTK to {*}PRINTK */ | ||
| 6 | #define PRINTK(format, args...) printk(KERN_DEBUG format , ## args) | ||
| 7 | |||
| 8 | #undef NCPFS_PARANOIA | ||
| 9 | #ifdef NCPFS_PARANOIA | ||
| 10 | #define PPRINTK(format, args...) PRINTK(format , ## args) | ||
| 11 | #else | ||
| 12 | #define PPRINTK(format, args...) | ||
| 13 | #endif | ||
| 14 | |||
| 15 | #ifndef DEBUG_NCP | ||
| 16 | #define DEBUG_NCP 0 | ||
| 17 | #endif | ||
| 18 | #if DEBUG_NCP > 0 | ||
| 19 | #define DPRINTK(format, args...) PRINTK(format , ## args) | ||
| 20 | #else | ||
| 21 | #define DPRINTK(format, args...) | ||
| 22 | #endif | ||
| 23 | #if DEBUG_NCP > 1 | ||
| 24 | #define DDPRINTK(format, args...) PRINTK(format , ## args) | ||
| 25 | #else | ||
| 26 | #define DDPRINTK(format, args...) | ||
| 27 | #endif | ||
| 28 | |||
| 29 | #define NCP_MAX_RPC_TIMEOUT (6*HZ) | ||
| 30 | |||
| 31 | |||
| 32 | struct ncp_entry_info { | ||
| 33 | struct nw_info_struct i; | ||
| 34 | ino_t ino; | ||
| 35 | int opened; | ||
| 36 | int access; | ||
| 37 | unsigned int volume; | ||
| 38 | __u8 file_handle[6]; | ||
| 39 | }; | ||
| 40 | |||
| 41 | static inline struct ncp_server *NCP_SBP(const struct super_block *sb) | ||
| 42 | { | ||
| 43 | return sb->s_fs_info; | ||
| 44 | } | ||
| 45 | |||
| 46 | #define NCP_SERVER(inode) NCP_SBP((inode)->i_sb) | ||
| 47 | static inline struct ncp_inode_info *NCP_FINFO(const struct inode *inode) | ||
| 48 | { | ||
| 49 | return container_of(inode, struct ncp_inode_info, vfs_inode); | ||
| 50 | } | ||
| 51 | |||
| 52 | /* linux/fs/ncpfs/inode.c */ | ||
| 53 | int ncp_notify_change(struct dentry *, struct iattr *); | ||
| 54 | struct inode *ncp_iget(struct super_block *, struct ncp_entry_info *); | ||
| 55 | void ncp_update_inode(struct inode *, struct ncp_entry_info *); | ||
| 56 | void ncp_update_inode2(struct inode *, struct ncp_entry_info *); | ||
| 57 | |||
| 58 | /* linux/fs/ncpfs/dir.c */ | ||
| 59 | extern const struct inode_operations ncp_dir_inode_operations; | ||
| 60 | extern const struct file_operations ncp_dir_operations; | ||
| 61 | extern const struct dentry_operations ncp_dentry_operations; | ||
| 62 | int ncp_conn_logged_in(struct super_block *); | ||
| 63 | int ncp_date_dos2unix(__le16 time, __le16 date); | ||
| 64 | void ncp_date_unix2dos(int unix_date, __le16 * time, __le16 * date); | ||
| 65 | |||
| 66 | /* linux/fs/ncpfs/ioctl.c */ | ||
| 67 | long ncp_ioctl(struct file *, unsigned int, unsigned long); | ||
| 68 | long ncp_compat_ioctl(struct file *, unsigned int, unsigned long); | ||
| 69 | |||
| 70 | /* linux/fs/ncpfs/sock.c */ | ||
| 71 | int ncp_request2(struct ncp_server *server, int function, | ||
| 72 | void* reply, int max_reply_size); | ||
| 73 | static inline int ncp_request(struct ncp_server *server, int function) { | ||
| 74 | return ncp_request2(server, function, server->packet, server->packet_size); | ||
| 75 | } | ||
| 76 | int ncp_connect(struct ncp_server *server); | ||
| 77 | int ncp_disconnect(struct ncp_server *server); | ||
| 78 | void ncp_lock_server(struct ncp_server *server); | ||
| 79 | void ncp_unlock_server(struct ncp_server *server); | ||
| 80 | |||
| 81 | /* linux/fs/ncpfs/symlink.c */ | ||
| 82 | #if defined(CONFIG_NCPFS_EXTRAS) || defined(CONFIG_NCPFS_NFS_NS) | ||
| 83 | extern const struct address_space_operations ncp_symlink_aops; | ||
| 84 | int ncp_symlink(struct inode*, struct dentry*, const char*); | ||
| 85 | #endif | ||
| 86 | |||
| 87 | /* linux/fs/ncpfs/file.c */ | ||
| 88 | extern const struct inode_operations ncp_file_inode_operations; | ||
| 89 | extern const struct file_operations ncp_file_operations; | ||
| 90 | int ncp_make_open(struct inode *, int); | ||
| 91 | |||
| 92 | /* linux/fs/ncpfs/mmap.c */ | ||
| 93 | int ncp_mmap(struct file *, struct vm_area_struct *); | ||
| 94 | |||
| 95 | /* linux/fs/ncpfs/ncplib_kernel.c */ | ||
| 96 | int ncp_make_closed(struct inode *); | ||
| 97 | |||
| 98 | #include "ncplib_kernel.h" | ||
diff --git a/include/linux/ncp_fs_i.h b/fs/ncpfs/ncp_fs_i.h index 4b0bec47784..4b0bec47784 100644 --- a/include/linux/ncp_fs_i.h +++ b/fs/ncpfs/ncp_fs_i.h | |||
diff --git a/include/linux/ncp_fs_sb.h b/fs/ncpfs/ncp_fs_sb.h index d64b0e89433..4af803f1351 100644 --- a/include/linux/ncp_fs_sb.h +++ b/fs/ncpfs/ncp_fs_sb.h | |||
| @@ -13,15 +13,30 @@ | |||
| 13 | #include <linux/net.h> | 13 | #include <linux/net.h> |
| 14 | #include <linux/mutex.h> | 14 | #include <linux/mutex.h> |
| 15 | #include <linux/backing-dev.h> | 15 | #include <linux/backing-dev.h> |
| 16 | |||
| 17 | #ifdef __KERNEL__ | ||
| 18 | |||
| 19 | #include <linux/workqueue.h> | 16 | #include <linux/workqueue.h> |
| 20 | 17 | ||
| 21 | #define NCP_DEFAULT_OPTIONS 0 /* 2 for packet signatures */ | 18 | #define NCP_DEFAULT_OPTIONS 0 /* 2 for packet signatures */ |
| 22 | 19 | ||
| 23 | struct sock; | 20 | struct sock; |
| 24 | 21 | ||
| 22 | struct ncp_mount_data_kernel { | ||
| 23 | unsigned long flags; /* NCP_MOUNT_* flags */ | ||
| 24 | unsigned int int_flags; /* internal flags */ | ||
| 25 | #define NCP_IMOUNT_LOGGEDIN_POSSIBLE 0x0001 | ||
| 26 | __kernel_uid32_t mounted_uid; /* Who may umount() this filesystem? */ | ||
| 27 | struct pid *wdog_pid; /* Who cares for our watchdog packets? */ | ||
| 28 | unsigned int ncp_fd; /* The socket to the ncp port */ | ||
| 29 | unsigned int time_out; /* How long should I wait after | ||
| 30 | sending a NCP request? */ | ||
| 31 | unsigned int retry_count; /* And how often should I retry? */ | ||
| 32 | unsigned char mounted_vol[NCP_VOLNAME_LEN + 1]; | ||
| 33 | __kernel_uid32_t uid; | ||
| 34 | __kernel_gid32_t gid; | ||
| 35 | __kernel_mode_t file_mode; | ||
| 36 | __kernel_mode_t dir_mode; | ||
| 37 | int info_fd; | ||
| 38 | }; | ||
| 39 | |||
| 25 | struct ncp_server { | 40 | struct ncp_server { |
| 26 | 41 | ||
| 27 | struct ncp_mount_data_kernel m; /* Nearly all of the mount data is of | 42 | struct ncp_mount_data_kernel m; /* Nearly all of the mount data is of |
| @@ -158,7 +173,4 @@ static inline void ncp_invalidate_conn(struct ncp_server *server) | |||
| 158 | server->conn_status |= 0x01; | 173 | server->conn_status |= 0x01; |
| 159 | } | 174 | } |
| 160 | 175 | ||
| 161 | #endif /* __KERNEL__ */ | ||
| 162 | |||
| 163 | #endif | 176 | #endif |
| 164 | |||
diff --git a/fs/ncpfs/ncplib_kernel.c b/fs/ncpfs/ncplib_kernel.c index a95615a0b6a..981a95617fc 100644 --- a/fs/ncpfs/ncplib_kernel.c +++ b/fs/ncpfs/ncplib_kernel.c | |||
| @@ -11,7 +11,7 @@ | |||
| 11 | 11 | ||
| 12 | 12 | ||
| 13 | 13 | ||
| 14 | #include "ncplib_kernel.h" | 14 | #include "ncp_fs.h" |
| 15 | 15 | ||
| 16 | static inline void assert_server_locked(struct ncp_server *server) | 16 | static inline void assert_server_locked(struct ncp_server *server) |
| 17 | { | 17 | { |
diff --git a/fs/ncpfs/ncplib_kernel.h b/fs/ncpfs/ncplib_kernel.h index 1220df75ff2..09881e6aa5a 100644 --- a/fs/ncpfs/ncplib_kernel.h +++ b/fs/ncpfs/ncplib_kernel.h | |||
| @@ -32,8 +32,6 @@ | |||
| 32 | #include <linux/ctype.h> | 32 | #include <linux/ctype.h> |
| 33 | #endif /* CONFIG_NCPFS_NLS */ | 33 | #endif /* CONFIG_NCPFS_NLS */ |
| 34 | 34 | ||
| 35 | #include <linux/ncp_fs.h> | ||
| 36 | |||
| 37 | #define NCP_MIN_SYMLINK_SIZE 8 | 35 | #define NCP_MIN_SYMLINK_SIZE 8 |
| 38 | #define NCP_MAX_SYMLINK_SIZE 512 | 36 | #define NCP_MAX_SYMLINK_SIZE 512 |
| 39 | 37 | ||
diff --git a/fs/ncpfs/ncpsign_kernel.c b/fs/ncpfs/ncpsign_kernel.c index d8b2d7e6910..08907599dcd 100644 --- a/fs/ncpfs/ncpsign_kernel.c +++ b/fs/ncpfs/ncpsign_kernel.c | |||
| @@ -11,6 +11,7 @@ | |||
| 11 | #include <linux/string.h> | 11 | #include <linux/string.h> |
| 12 | #include <linux/ncp.h> | 12 | #include <linux/ncp.h> |
| 13 | #include <linux/bitops.h> | 13 | #include <linux/bitops.h> |
| 14 | #include "ncp_fs.h" | ||
| 14 | #include "ncpsign_kernel.h" | 15 | #include "ncpsign_kernel.h" |
| 15 | 16 | ||
| 16 | /* i386: 32-bit, little endian, handles mis-alignment */ | 17 | /* i386: 32-bit, little endian, handles mis-alignment */ |
diff --git a/fs/ncpfs/ncpsign_kernel.h b/fs/ncpfs/ncpsign_kernel.h index 6451a68381c..d9a1438bb1f 100644 --- a/fs/ncpfs/ncpsign_kernel.h +++ b/fs/ncpfs/ncpsign_kernel.h | |||
| @@ -8,8 +8,6 @@ | |||
| 8 | #ifndef _NCPSIGN_KERNEL_H | 8 | #ifndef _NCPSIGN_KERNEL_H |
| 9 | #define _NCPSIGN_KERNEL_H | 9 | #define _NCPSIGN_KERNEL_H |
| 10 | 10 | ||
| 11 | #include <linux/ncp_fs.h> | ||
| 12 | |||
| 13 | #ifdef CONFIG_NCPFS_PACKET_SIGNING | 11 | #ifdef CONFIG_NCPFS_PACKET_SIGNING |
| 14 | void __sign_packet(struct ncp_server *server, const char *data, size_t size, __u32 totalsize, void *sign_buff); | 12 | void __sign_packet(struct ncp_server *server, const char *data, size_t size, __u32 totalsize, void *sign_buff); |
| 15 | int sign_verify_reply(struct ncp_server *server, const char *data, size_t size, __u32 totalsize, const void *sign_buff); | 13 | int sign_verify_reply(struct ncp_server *server, const char *data, size_t size, __u32 totalsize, const void *sign_buff); |
diff --git a/fs/ncpfs/sock.c b/fs/ncpfs/sock.c index 668bd267346..3a1587222c8 100644 --- a/fs/ncpfs/sock.c +++ b/fs/ncpfs/sock.c | |||
| @@ -28,7 +28,7 @@ | |||
| 28 | #include <linux/poll.h> | 28 | #include <linux/poll.h> |
| 29 | #include <linux/file.h> | 29 | #include <linux/file.h> |
| 30 | 30 | ||
| 31 | #include <linux/ncp_fs.h> | 31 | #include "ncp_fs.h" |
| 32 | 32 | ||
| 33 | #include "ncpsign_kernel.h" | 33 | #include "ncpsign_kernel.h" |
| 34 | 34 | ||
diff --git a/fs/ncpfs/symlink.c b/fs/ncpfs/symlink.c index c634fd17b33..661f861d80c 100644 --- a/fs/ncpfs/symlink.c +++ b/fs/ncpfs/symlink.c | |||
| @@ -25,13 +25,11 @@ | |||
| 25 | 25 | ||
| 26 | #include <linux/errno.h> | 26 | #include <linux/errno.h> |
| 27 | #include <linux/fs.h> | 27 | #include <linux/fs.h> |
| 28 | #include <linux/ncp_fs.h> | ||
| 29 | #include <linux/time.h> | 28 | #include <linux/time.h> |
| 30 | #include <linux/slab.h> | 29 | #include <linux/slab.h> |
| 31 | #include <linux/mm.h> | 30 | #include <linux/mm.h> |
| 32 | #include <linux/stat.h> | 31 | #include <linux/stat.h> |
| 33 | #include "ncplib_kernel.h" | 32 | #include "ncp_fs.h" |
| 34 | |||
| 35 | 33 | ||
| 36 | /* these magic numbers must appear in the symlink file -- this makes it a bit | 34 | /* these magic numbers must appear in the symlink file -- this makes it a bit |
| 37 | more resilient against the magic attributes being set on random files. */ | 35 | more resilient against the magic attributes being set on random files. */ |
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c index abe4f0c8dc5..95b081bc9e2 100644 --- a/fs/nfs/dir.c +++ b/fs/nfs/dir.c | |||
| @@ -439,7 +439,6 @@ void nfs_prime_dcache(struct dentry *parent, struct nfs_entry *entry) | |||
| 439 | if (dentry == NULL) | 439 | if (dentry == NULL) |
| 440 | return; | 440 | return; |
| 441 | 441 | ||
| 442 | d_set_d_op(dentry, NFS_PROTO(dir)->dentry_ops); | ||
| 443 | inode = nfs_fhget(dentry->d_sb, entry->fh, entry->fattr); | 442 | inode = nfs_fhget(dentry->d_sb, entry->fh, entry->fattr); |
| 444 | if (IS_ERR(inode)) | 443 | if (IS_ERR(inode)) |
| 445 | goto out; | 444 | goto out; |
| @@ -1193,8 +1192,6 @@ static struct dentry *nfs_lookup(struct inode *dir, struct dentry * dentry, stru | |||
| 1193 | if (dentry->d_name.len > NFS_SERVER(dir)->namelen) | 1192 | if (dentry->d_name.len > NFS_SERVER(dir)->namelen) |
| 1194 | goto out; | 1193 | goto out; |
| 1195 | 1194 | ||
| 1196 | d_set_d_op(dentry, NFS_PROTO(dir)->dentry_ops); | ||
| 1197 | |||
| 1198 | /* | 1195 | /* |
| 1199 | * If we're doing an exclusive create, optimize away the lookup | 1196 | * If we're doing an exclusive create, optimize away the lookup |
| 1200 | * but don't hash the dentry. | 1197 | * but don't hash the dentry. |
| @@ -1338,7 +1335,6 @@ static struct dentry *nfs_atomic_lookup(struct inode *dir, struct dentry *dentry | |||
| 1338 | res = ERR_PTR(-ENAMETOOLONG); | 1335 | res = ERR_PTR(-ENAMETOOLONG); |
| 1339 | goto out; | 1336 | goto out; |
| 1340 | } | 1337 | } |
| 1341 | d_set_d_op(dentry, NFS_PROTO(dir)->dentry_ops); | ||
| 1342 | 1338 | ||
| 1343 | /* Let vfs_create() deal with O_EXCL. Instantiate, but don't hash | 1339 | /* Let vfs_create() deal with O_EXCL. Instantiate, but don't hash |
| 1344 | * the dentry. */ | 1340 | * the dentry. */ |
diff --git a/fs/nfs/getroot.c b/fs/nfs/getroot.c index 5596c6a2881..b5ffe8fa291 100644 --- a/fs/nfs/getroot.c +++ b/fs/nfs/getroot.c | |||
| @@ -119,9 +119,6 @@ struct dentry *nfs_get_root(struct super_block *sb, struct nfs_fh *mntfh) | |||
| 119 | } | 119 | } |
| 120 | 120 | ||
| 121 | security_d_instantiate(ret, inode); | 121 | security_d_instantiate(ret, inode); |
| 122 | |||
| 123 | if (ret->d_op == NULL) | ||
| 124 | d_set_d_op(ret, server->nfs_client->rpc_ops->dentry_ops); | ||
| 125 | out: | 122 | out: |
| 126 | nfs_free_fattr(fsinfo.fattr); | 123 | nfs_free_fattr(fsinfo.fattr); |
| 127 | return ret; | 124 | return ret; |
| @@ -227,9 +224,6 @@ struct dentry *nfs4_get_root(struct super_block *sb, struct nfs_fh *mntfh) | |||
| 227 | 224 | ||
| 228 | security_d_instantiate(ret, inode); | 225 | security_d_instantiate(ret, inode); |
| 229 | 226 | ||
| 230 | if (ret->d_op == NULL) | ||
| 231 | d_set_d_op(ret, server->nfs_client->rpc_ops->dentry_ops); | ||
| 232 | |||
| 233 | out: | 227 | out: |
| 234 | nfs_free_fattr(fattr); | 228 | nfs_free_fattr(fattr); |
| 235 | dprintk("<-- nfs4_get_root()\n"); | 229 | dprintk("<-- nfs4_get_root()\n"); |
diff --git a/fs/nfs/super.c b/fs/nfs/super.c index 0f9ea73e778..b68c8607770 100644 --- a/fs/nfs/super.c +++ b/fs/nfs/super.c | |||
| @@ -2202,6 +2202,7 @@ static int nfs_set_super(struct super_block *s, void *data) | |||
| 2202 | 2202 | ||
| 2203 | s->s_flags = sb_mntdata->mntflags; | 2203 | s->s_flags = sb_mntdata->mntflags; |
| 2204 | s->s_fs_info = server; | 2204 | s->s_fs_info = server; |
| 2205 | s->s_d_op = server->nfs_client->rpc_ops->dentry_ops; | ||
| 2205 | ret = set_anon_super(s, server); | 2206 | ret = set_anon_super(s, server); |
| 2206 | if (ret == 0) | 2207 | if (ret == 0) |
| 2207 | server->s_dev = s->s_dev; | 2208 | server->s_dev = s->s_dev; |
diff --git a/fs/ocfs2/export.c b/fs/ocfs2/export.c index 6adafa57606..5dbc3062b4f 100644 --- a/fs/ocfs2/export.c +++ b/fs/ocfs2/export.c | |||
| @@ -137,9 +137,7 @@ check_gen: | |||
| 137 | } | 137 | } |
| 138 | 138 | ||
| 139 | result = d_obtain_alias(inode); | 139 | result = d_obtain_alias(inode); |
| 140 | if (!IS_ERR(result)) | 140 | if (IS_ERR(result)) |
| 141 | d_set_d_op(result, &ocfs2_dentry_ops); | ||
| 142 | else | ||
| 143 | mlog_errno(PTR_ERR(result)); | 141 | mlog_errno(PTR_ERR(result)); |
| 144 | 142 | ||
| 145 | bail: | 143 | bail: |
| @@ -175,8 +173,6 @@ static struct dentry *ocfs2_get_parent(struct dentry *child) | |||
| 175 | } | 173 | } |
| 176 | 174 | ||
| 177 | parent = d_obtain_alias(ocfs2_iget(OCFS2_SB(dir->i_sb), blkno, 0, 0)); | 175 | parent = d_obtain_alias(ocfs2_iget(OCFS2_SB(dir->i_sb), blkno, 0, 0)); |
| 178 | if (!IS_ERR(parent)) | ||
| 179 | d_set_d_op(parent, &ocfs2_dentry_ops); | ||
| 180 | 176 | ||
| 181 | bail_unlock: | 177 | bail_unlock: |
| 182 | ocfs2_inode_unlock(dir, 0); | 178 | ocfs2_inode_unlock(dir, 0); |
diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c index bdadbae0909..63e3fca266e 100644 --- a/fs/ocfs2/file.c +++ b/fs/ocfs2/file.c | |||
| @@ -1995,6 +1995,7 @@ static long ocfs2_fallocate(struct inode *inode, int mode, loff_t offset, | |||
| 1995 | struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); | 1995 | struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); |
| 1996 | struct ocfs2_space_resv sr; | 1996 | struct ocfs2_space_resv sr; |
| 1997 | int change_size = 1; | 1997 | int change_size = 1; |
| 1998 | int cmd = OCFS2_IOC_RESVSP64; | ||
| 1998 | 1999 | ||
| 1999 | if (!ocfs2_writes_unwritten_extents(osb)) | 2000 | if (!ocfs2_writes_unwritten_extents(osb)) |
| 2000 | return -EOPNOTSUPP; | 2001 | return -EOPNOTSUPP; |
| @@ -2005,12 +2006,15 @@ static long ocfs2_fallocate(struct inode *inode, int mode, loff_t offset, | |||
| 2005 | if (mode & FALLOC_FL_KEEP_SIZE) | 2006 | if (mode & FALLOC_FL_KEEP_SIZE) |
| 2006 | change_size = 0; | 2007 | change_size = 0; |
| 2007 | 2008 | ||
| 2009 | if (mode & FALLOC_FL_PUNCH_HOLE) | ||
| 2010 | cmd = OCFS2_IOC_UNRESVSP64; | ||
| 2011 | |||
| 2008 | sr.l_whence = 0; | 2012 | sr.l_whence = 0; |
| 2009 | sr.l_start = (s64)offset; | 2013 | sr.l_start = (s64)offset; |
| 2010 | sr.l_len = (s64)len; | 2014 | sr.l_len = (s64)len; |
| 2011 | 2015 | ||
| 2012 | return __ocfs2_change_file_space(NULL, inode, offset, | 2016 | return __ocfs2_change_file_space(NULL, inode, offset, cmd, &sr, |
| 2013 | OCFS2_IOC_RESVSP64, &sr, change_size); | 2017 | change_size); |
| 2014 | } | 2018 | } |
| 2015 | 2019 | ||
| 2016 | int ocfs2_check_range_for_refcount(struct inode *inode, loff_t pos, | 2020 | int ocfs2_check_range_for_refcount(struct inode *inode, loff_t pos, |
diff --git a/fs/ocfs2/namei.c b/fs/ocfs2/namei.c index 30c52314445..849fb4a2e81 100644 --- a/fs/ocfs2/namei.c +++ b/fs/ocfs2/namei.c | |||
| @@ -147,7 +147,6 @@ static struct dentry *ocfs2_lookup(struct inode *dir, struct dentry *dentry, | |||
| 147 | spin_unlock(&oi->ip_lock); | 147 | spin_unlock(&oi->ip_lock); |
| 148 | 148 | ||
| 149 | bail_add: | 149 | bail_add: |
| 150 | d_set_d_op(dentry, &ocfs2_dentry_ops); | ||
| 151 | ret = d_splice_alias(inode, dentry); | 150 | ret = d_splice_alias(inode, dentry); |
| 152 | 151 | ||
| 153 | if (inode) { | 152 | if (inode) { |
| @@ -415,7 +414,6 @@ static int ocfs2_mknod(struct inode *dir, | |||
| 415 | mlog_errno(status); | 414 | mlog_errno(status); |
| 416 | goto leave; | 415 | goto leave; |
| 417 | } | 416 | } |
| 418 | d_set_d_op(dentry, &ocfs2_dentry_ops); | ||
| 419 | 417 | ||
| 420 | status = ocfs2_add_entry(handle, dentry, inode, | 418 | status = ocfs2_add_entry(handle, dentry, inode, |
| 421 | OCFS2_I(inode)->ip_blkno, parent_fe_bh, | 419 | OCFS2_I(inode)->ip_blkno, parent_fe_bh, |
| @@ -743,7 +741,6 @@ static int ocfs2_link(struct dentry *old_dentry, | |||
| 743 | } | 741 | } |
| 744 | 742 | ||
| 745 | ihold(inode); | 743 | ihold(inode); |
| 746 | d_set_d_op(dentry, &ocfs2_dentry_ops); | ||
| 747 | d_instantiate(dentry, inode); | 744 | d_instantiate(dentry, inode); |
| 748 | 745 | ||
| 749 | out_commit: | 746 | out_commit: |
| @@ -1797,7 +1794,6 @@ static int ocfs2_symlink(struct inode *dir, | |||
| 1797 | mlog_errno(status); | 1794 | mlog_errno(status); |
| 1798 | goto bail; | 1795 | goto bail; |
| 1799 | } | 1796 | } |
| 1800 | d_set_d_op(dentry, &ocfs2_dentry_ops); | ||
| 1801 | 1797 | ||
| 1802 | status = ocfs2_add_entry(handle, dentry, inode, | 1798 | status = ocfs2_add_entry(handle, dentry, inode, |
| 1803 | le64_to_cpu(fe->i_blkno), parent_fe_bh, | 1799 | le64_to_cpu(fe->i_blkno), parent_fe_bh, |
| @@ -2462,7 +2458,6 @@ int ocfs2_mv_orphaned_inode_to_new(struct inode *dir, | |||
| 2462 | goto out_commit; | 2458 | goto out_commit; |
| 2463 | } | 2459 | } |
| 2464 | 2460 | ||
| 2465 | d_set_d_op(dentry, &ocfs2_dentry_ops); | ||
| 2466 | d_instantiate(dentry, inode); | 2461 | d_instantiate(dentry, inode); |
| 2467 | status = 0; | 2462 | status = 0; |
| 2468 | out_commit: | 2463 | out_commit: |
diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c index 17ff46fa8a1..06d1f749ca8 100644 --- a/fs/ocfs2/super.c +++ b/fs/ocfs2/super.c | |||
| @@ -2097,6 +2097,7 @@ static int ocfs2_initialize_super(struct super_block *sb, | |||
| 2097 | 2097 | ||
| 2098 | sb->s_fs_info = osb; | 2098 | sb->s_fs_info = osb; |
| 2099 | sb->s_op = &ocfs2_sops; | 2099 | sb->s_op = &ocfs2_sops; |
| 2100 | sb->s_d_op = &ocfs2_dentry_ops; | ||
| 2100 | sb->s_export_op = &ocfs2_export_ops; | 2101 | sb->s_export_op = &ocfs2_export_ops; |
| 2101 | sb->s_qcop = &ocfs2_quotactl_ops; | 2102 | sb->s_qcop = &ocfs2_quotactl_ops; |
| 2102 | sb->dq_op = &ocfs2_quota_operations; | 2103 | sb->dq_op = &ocfs2_quota_operations; |
| @@ -223,7 +223,12 @@ int do_fallocate(struct file *file, int mode, loff_t offset, loff_t len) | |||
| 223 | return -EINVAL; | 223 | return -EINVAL; |
| 224 | 224 | ||
| 225 | /* Return error if mode is not supported */ | 225 | /* Return error if mode is not supported */ |
| 226 | if (mode && !(mode & FALLOC_FL_KEEP_SIZE)) | 226 | if (mode & ~(FALLOC_FL_KEEP_SIZE | FALLOC_FL_PUNCH_HOLE)) |
| 227 | return -EOPNOTSUPP; | ||
| 228 | |||
| 229 | /* Punch hole must have keep size set */ | ||
| 230 | if ((mode & FALLOC_FL_PUNCH_HOLE) && | ||
| 231 | !(mode & FALLOC_FL_KEEP_SIZE)) | ||
| 227 | return -EOPNOTSUPP; | 232 | return -EOPNOTSUPP; |
| 228 | 233 | ||
| 229 | if (!(file->f_mode & FMODE_WRITE)) | 234 | if (!(file->f_mode & FMODE_WRITE)) |
| @@ -1004,7 +1004,6 @@ struct file *create_write_pipe(int flags) | |||
| 1004 | goto err_inode; | 1004 | goto err_inode; |
| 1005 | path.mnt = mntget(pipe_mnt); | 1005 | path.mnt = mntget(pipe_mnt); |
| 1006 | 1006 | ||
| 1007 | d_set_d_op(path.dentry, &pipefs_dentry_operations); | ||
| 1008 | d_instantiate(path.dentry, inode); | 1007 | d_instantiate(path.dentry, inode); |
| 1009 | 1008 | ||
| 1010 | err = -ENFILE; | 1009 | err = -ENFILE; |
| @@ -1266,7 +1265,8 @@ static const struct super_operations pipefs_ops = { | |||
| 1266 | static struct dentry *pipefs_mount(struct file_system_type *fs_type, | 1265 | static struct dentry *pipefs_mount(struct file_system_type *fs_type, |
| 1267 | int flags, const char *dev_name, void *data) | 1266 | int flags, const char *dev_name, void *data) |
| 1268 | { | 1267 | { |
| 1269 | return mount_pseudo(fs_type, "pipe:", &pipefs_ops, PIPEFS_MAGIC); | 1268 | return mount_pseudo(fs_type, "pipe:", &pipefs_ops, |
| 1269 | &pipefs_dentry_operations, PIPEFS_MAGIC); | ||
| 1270 | } | 1270 | } |
| 1271 | 1271 | ||
| 1272 | static struct file_system_type pipe_fs_type = { | 1272 | static struct file_system_type pipe_fs_type = { |
diff --git a/fs/read_write.c b/fs/read_write.c index 5d431bacbea..5520f8ad550 100644 --- a/fs/read_write.c +++ b/fs/read_write.c | |||
| @@ -30,18 +30,9 @@ const struct file_operations generic_ro_fops = { | |||
| 30 | 30 | ||
| 31 | EXPORT_SYMBOL(generic_ro_fops); | 31 | EXPORT_SYMBOL(generic_ro_fops); |
| 32 | 32 | ||
| 33 | static int | 33 | static inline int unsigned_offsets(struct file *file) |
| 34 | __negative_fpos_check(struct file *file, loff_t pos, size_t count) | ||
| 35 | { | 34 | { |
| 36 | /* | 35 | return file->f_mode & FMODE_UNSIGNED_OFFSET; |
| 37 | * pos or pos+count is negative here, check overflow. | ||
| 38 | * too big "count" will be caught in rw_verify_area(). | ||
| 39 | */ | ||
| 40 | if ((pos < 0) && (pos + count < pos)) | ||
| 41 | return -EOVERFLOW; | ||
| 42 | if (file->f_mode & FMODE_UNSIGNED_OFFSET) | ||
| 43 | return 0; | ||
| 44 | return -EINVAL; | ||
| 45 | } | 36 | } |
| 46 | 37 | ||
| 47 | /** | 38 | /** |
| @@ -75,7 +66,7 @@ generic_file_llseek_unlocked(struct file *file, loff_t offset, int origin) | |||
| 75 | break; | 66 | break; |
| 76 | } | 67 | } |
| 77 | 68 | ||
| 78 | if (offset < 0 && __negative_fpos_check(file, offset, 0)) | 69 | if (offset < 0 && !unsigned_offsets(file)) |
| 79 | return -EINVAL; | 70 | return -EINVAL; |
| 80 | if (offset > inode->i_sb->s_maxbytes) | 71 | if (offset > inode->i_sb->s_maxbytes) |
| 81 | return -EINVAL; | 72 | return -EINVAL; |
| @@ -152,7 +143,7 @@ loff_t default_llseek(struct file *file, loff_t offset, int origin) | |||
| 152 | offset += file->f_pos; | 143 | offset += file->f_pos; |
| 153 | } | 144 | } |
| 154 | retval = -EINVAL; | 145 | retval = -EINVAL; |
| 155 | if (offset >= 0 || !__negative_fpos_check(file, offset, 0)) { | 146 | if (offset >= 0 || unsigned_offsets(file)) { |
| 156 | if (offset != file->f_pos) { | 147 | if (offset != file->f_pos) { |
| 157 | file->f_pos = offset; | 148 | file->f_pos = offset; |
| 158 | file->f_version = 0; | 149 | file->f_version = 0; |
| @@ -252,9 +243,13 @@ int rw_verify_area(int read_write, struct file *file, loff_t *ppos, size_t count | |||
| 252 | if (unlikely((ssize_t) count < 0)) | 243 | if (unlikely((ssize_t) count < 0)) |
| 253 | return retval; | 244 | return retval; |
| 254 | pos = *ppos; | 245 | pos = *ppos; |
| 255 | if (unlikely((pos < 0) || (loff_t) (pos + count) < 0)) { | 246 | if (unlikely(pos < 0)) { |
| 256 | retval = __negative_fpos_check(file, pos, count); | 247 | if (!unsigned_offsets(file)) |
| 257 | if (retval) | 248 | return retval; |
| 249 | if (count >= -pos) /* both values are in 0..LLONG_MAX */ | ||
| 250 | return -EOVERFLOW; | ||
| 251 | } else if (unlikely((loff_t) (pos + count) < 0)) { | ||
| 252 | if (!unsigned_offsets(file)) | ||
| 258 | return retval; | 253 | return retval; |
| 259 | } | 254 | } |
| 260 | 255 | ||
diff --git a/fs/sysv/namei.c b/fs/sysv/namei.c index b5e68da2db3..b427b1208c2 100644 --- a/fs/sysv/namei.c +++ b/fs/sysv/namei.c | |||
| @@ -48,7 +48,6 @@ static struct dentry *sysv_lookup(struct inode * dir, struct dentry * dentry, st | |||
| 48 | struct inode * inode = NULL; | 48 | struct inode * inode = NULL; |
| 49 | ino_t ino; | 49 | ino_t ino; |
| 50 | 50 | ||
| 51 | d_set_d_op(dentry, dir->i_sb->s_root->d_op); | ||
| 52 | if (dentry->d_name.len > SYSV_NAMELEN) | 51 | if (dentry->d_name.len > SYSV_NAMELEN) |
| 53 | return ERR_PTR(-ENAMETOOLONG); | 52 | return ERR_PTR(-ENAMETOOLONG); |
| 54 | ino = sysv_inode_by_name(dentry); | 53 | ino = sysv_inode_by_name(dentry); |
diff --git a/fs/sysv/super.c b/fs/sysv/super.c index 76712aefc4a..f60c196913e 100644 --- a/fs/sysv/super.c +++ b/fs/sysv/super.c | |||
| @@ -332,6 +332,10 @@ static int complete_read_super(struct super_block *sb, int silent, int size) | |||
| 332 | sb->s_magic = SYSV_MAGIC_BASE + sbi->s_type; | 332 | sb->s_magic = SYSV_MAGIC_BASE + sbi->s_type; |
| 333 | /* set up enough so that it can read an inode */ | 333 | /* set up enough so that it can read an inode */ |
| 334 | sb->s_op = &sysv_sops; | 334 | sb->s_op = &sysv_sops; |
| 335 | if (sbi->s_forced_ro) | ||
| 336 | sb->s_flags |= MS_RDONLY; | ||
| 337 | if (sbi->s_truncate) | ||
| 338 | sb->s_d_op = &sysv_dentry_operations; | ||
| 335 | root_inode = sysv_iget(sb, SYSV_ROOT_INO); | 339 | root_inode = sysv_iget(sb, SYSV_ROOT_INO); |
| 336 | if (IS_ERR(root_inode)) { | 340 | if (IS_ERR(root_inode)) { |
| 337 | printk("SysV FS: get root inode failed\n"); | 341 | printk("SysV FS: get root inode failed\n"); |
| @@ -343,10 +347,6 @@ static int complete_read_super(struct super_block *sb, int silent, int size) | |||
| 343 | printk("SysV FS: get root dentry failed\n"); | 347 | printk("SysV FS: get root dentry failed\n"); |
| 344 | return 0; | 348 | return 0; |
| 345 | } | 349 | } |
| 346 | if (sbi->s_forced_ro) | ||
| 347 | sb->s_flags |= MS_RDONLY; | ||
| 348 | if (sbi->s_truncate) | ||
| 349 | d_set_d_op(sb->s_root, &sysv_dentry_operations); | ||
| 350 | return 1; | 350 | return 1; |
| 351 | } | 351 | } |
| 352 | 352 | ||
diff --git a/fs/xfs/linux-2.6/xfs_iops.c b/fs/xfs/linux-2.6/xfs_iops.c index 94d5fd6a297..da54403633b 100644 --- a/fs/xfs/linux-2.6/xfs_iops.c +++ b/fs/xfs/linux-2.6/xfs_iops.c | |||
| @@ -516,6 +516,7 @@ xfs_vn_fallocate( | |||
| 516 | loff_t new_size = 0; | 516 | loff_t new_size = 0; |
| 517 | xfs_flock64_t bf; | 517 | xfs_flock64_t bf; |
| 518 | xfs_inode_t *ip = XFS_I(inode); | 518 | xfs_inode_t *ip = XFS_I(inode); |
| 519 | int cmd = XFS_IOC_RESVSP; | ||
| 519 | 520 | ||
| 520 | /* preallocation on directories not yet supported */ | 521 | /* preallocation on directories not yet supported */ |
| 521 | error = -ENODEV; | 522 | error = -ENODEV; |
| @@ -528,6 +529,9 @@ xfs_vn_fallocate( | |||
| 528 | 529 | ||
| 529 | xfs_ilock(ip, XFS_IOLOCK_EXCL); | 530 | xfs_ilock(ip, XFS_IOLOCK_EXCL); |
| 530 | 531 | ||
| 532 | if (mode & FALLOC_FL_PUNCH_HOLE) | ||
| 533 | cmd = XFS_IOC_UNRESVSP; | ||
| 534 | |||
| 531 | /* check the new inode size is valid before allocating */ | 535 | /* check the new inode size is valid before allocating */ |
| 532 | if (!(mode & FALLOC_FL_KEEP_SIZE) && | 536 | if (!(mode & FALLOC_FL_KEEP_SIZE) && |
| 533 | offset + len > i_size_read(inode)) { | 537 | offset + len > i_size_read(inode)) { |
| @@ -537,8 +541,7 @@ xfs_vn_fallocate( | |||
| 537 | goto out_unlock; | 541 | goto out_unlock; |
| 538 | } | 542 | } |
| 539 | 543 | ||
| 540 | error = -xfs_change_file_space(ip, XFS_IOC_RESVSP, &bf, | 544 | error = -xfs_change_file_space(ip, cmd, &bf, 0, XFS_ATTR_NOLOCK); |
| 541 | 0, XFS_ATTR_NOLOCK); | ||
| 542 | if (error) | 545 | if (error) |
| 543 | goto out_unlock; | 546 | goto out_unlock; |
| 544 | 547 | ||
diff --git a/include/linux/falloc.h b/include/linux/falloc.h index 3c155107d61..73e0b628e05 100644 --- a/include/linux/falloc.h +++ b/include/linux/falloc.h | |||
| @@ -2,6 +2,7 @@ | |||
| 2 | #define _FALLOC_H_ | 2 | #define _FALLOC_H_ |
| 3 | 3 | ||
| 4 | #define FALLOC_FL_KEEP_SIZE 0x01 /* default is extend size */ | 4 | #define FALLOC_FL_KEEP_SIZE 0x01 /* default is extend size */ |
| 5 | #define FALLOC_FL_PUNCH_HOLE 0x02 /* de-allocates range */ | ||
| 5 | 6 | ||
| 6 | #ifdef __KERNEL__ | 7 | #ifdef __KERNEL__ |
| 7 | 8 | ||
diff --git a/include/linux/fs.h b/include/linux/fs.h index f84d9928bdb..c0701288d20 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
| @@ -1423,6 +1423,7 @@ struct super_block { | |||
| 1423 | * generic_show_options() | 1423 | * generic_show_options() |
| 1424 | */ | 1424 | */ |
| 1425 | char __rcu *s_options; | 1425 | char __rcu *s_options; |
| 1426 | const struct dentry_operations *s_d_op; /* default d_op for dentries */ | ||
| 1426 | }; | 1427 | }; |
| 1427 | 1428 | ||
| 1428 | extern struct timespec current_fs_time(struct super_block *sb); | 1429 | extern struct timespec current_fs_time(struct super_block *sb); |
| @@ -1834,7 +1835,9 @@ struct super_block *sget(struct file_system_type *type, | |||
| 1834 | int (*set)(struct super_block *,void *), | 1835 | int (*set)(struct super_block *,void *), |
| 1835 | void *data); | 1836 | void *data); |
| 1836 | extern struct dentry *mount_pseudo(struct file_system_type *, char *, | 1837 | extern struct dentry *mount_pseudo(struct file_system_type *, char *, |
| 1837 | const struct super_operations *ops, unsigned long); | 1838 | const struct super_operations *ops, |
| 1839 | const struct dentry_operations *dops, | ||
| 1840 | unsigned long); | ||
| 1838 | extern void simple_set_mnt(struct vfsmount *mnt, struct super_block *sb); | 1841 | extern void simple_set_mnt(struct vfsmount *mnt, struct super_block *sb); |
| 1839 | 1842 | ||
| 1840 | static inline void sb_mark_dirty(struct super_block *sb) | 1843 | static inline void sb_mark_dirty(struct super_block *sb) |
diff --git a/include/linux/ncp_fs.h b/include/linux/ncp_fs.h index 1c27f201c85..e13eefef065 100644 --- a/include/linux/ncp_fs.h +++ b/include/linux/ncp_fs.h | |||
| @@ -143,104 +143,4 @@ struct ncp_nls_ioctl | |||
| 143 | #define NCP_MAXPATHLEN 255 | 143 | #define NCP_MAXPATHLEN 255 |
| 144 | #define NCP_MAXNAMELEN 14 | 144 | #define NCP_MAXNAMELEN 14 |
| 145 | 145 | ||
| 146 | #ifdef __KERNEL__ | ||
| 147 | |||
| 148 | #include <linux/ncp_fs_i.h> | ||
| 149 | #include <linux/ncp_fs_sb.h> | ||
| 150 | |||
| 151 | /* define because it is easy to change PRINTK to {*}PRINTK */ | ||
| 152 | #define PRINTK(format, args...) printk(KERN_DEBUG format , ## args) | ||
| 153 | |||
| 154 | #undef NCPFS_PARANOIA | ||
| 155 | #ifdef NCPFS_PARANOIA | ||
| 156 | #define PPRINTK(format, args...) PRINTK(format , ## args) | ||
| 157 | #else | ||
| 158 | #define PPRINTK(format, args...) | ||
| 159 | #endif | ||
| 160 | |||
| 161 | #ifndef DEBUG_NCP | ||
| 162 | #define DEBUG_NCP 0 | ||
| 163 | #endif | ||
| 164 | #if DEBUG_NCP > 0 | ||
| 165 | #define DPRINTK(format, args...) PRINTK(format , ## args) | ||
| 166 | #else | ||
| 167 | #define DPRINTK(format, args...) | ||
| 168 | #endif | ||
| 169 | #if DEBUG_NCP > 1 | ||
| 170 | #define DDPRINTK(format, args...) PRINTK(format , ## args) | ||
| 171 | #else | ||
| 172 | #define DDPRINTK(format, args...) | ||
| 173 | #endif | ||
| 174 | |||
| 175 | #define NCP_MAX_RPC_TIMEOUT (6*HZ) | ||
| 176 | |||
| 177 | |||
| 178 | struct ncp_entry_info { | ||
| 179 | struct nw_info_struct i; | ||
| 180 | ino_t ino; | ||
| 181 | int opened; | ||
| 182 | int access; | ||
| 183 | unsigned int volume; | ||
| 184 | __u8 file_handle[6]; | ||
| 185 | }; | ||
| 186 | |||
| 187 | static inline struct ncp_server *NCP_SBP(const struct super_block *sb) | ||
| 188 | { | ||
| 189 | return sb->s_fs_info; | ||
| 190 | } | ||
| 191 | |||
| 192 | #define NCP_SERVER(inode) NCP_SBP((inode)->i_sb) | ||
| 193 | static inline struct ncp_inode_info *NCP_FINFO(const struct inode *inode) | ||
| 194 | { | ||
| 195 | return container_of(inode, struct ncp_inode_info, vfs_inode); | ||
| 196 | } | ||
| 197 | |||
| 198 | /* linux/fs/ncpfs/inode.c */ | ||
| 199 | int ncp_notify_change(struct dentry *, struct iattr *); | ||
| 200 | struct inode *ncp_iget(struct super_block *, struct ncp_entry_info *); | ||
| 201 | void ncp_update_inode(struct inode *, struct ncp_entry_info *); | ||
| 202 | void ncp_update_inode2(struct inode *, struct ncp_entry_info *); | ||
| 203 | |||
| 204 | /* linux/fs/ncpfs/dir.c */ | ||
| 205 | extern const struct inode_operations ncp_dir_inode_operations; | ||
| 206 | extern const struct file_operations ncp_dir_operations; | ||
| 207 | extern const struct dentry_operations ncp_root_dentry_operations; | ||
| 208 | int ncp_conn_logged_in(struct super_block *); | ||
| 209 | int ncp_date_dos2unix(__le16 time, __le16 date); | ||
| 210 | void ncp_date_unix2dos(int unix_date, __le16 * time, __le16 * date); | ||
| 211 | |||
| 212 | /* linux/fs/ncpfs/ioctl.c */ | ||
| 213 | long ncp_ioctl(struct file *, unsigned int, unsigned long); | ||
| 214 | long ncp_compat_ioctl(struct file *, unsigned int, unsigned long); | ||
| 215 | |||
| 216 | /* linux/fs/ncpfs/sock.c */ | ||
| 217 | int ncp_request2(struct ncp_server *server, int function, | ||
| 218 | void* reply, int max_reply_size); | ||
| 219 | static inline int ncp_request(struct ncp_server *server, int function) { | ||
| 220 | return ncp_request2(server, function, server->packet, server->packet_size); | ||
| 221 | } | ||
| 222 | int ncp_connect(struct ncp_server *server); | ||
| 223 | int ncp_disconnect(struct ncp_server *server); | ||
| 224 | void ncp_lock_server(struct ncp_server *server); | ||
| 225 | void ncp_unlock_server(struct ncp_server *server); | ||
| 226 | |||
| 227 | /* linux/fs/ncpfs/symlink.c */ | ||
| 228 | #if defined(CONFIG_NCPFS_EXTRAS) || defined(CONFIG_NCPFS_NFS_NS) | ||
| 229 | extern const struct address_space_operations ncp_symlink_aops; | ||
| 230 | int ncp_symlink(struct inode*, struct dentry*, const char*); | ||
| 231 | #endif | ||
| 232 | |||
| 233 | /* linux/fs/ncpfs/file.c */ | ||
| 234 | extern const struct inode_operations ncp_file_inode_operations; | ||
| 235 | extern const struct file_operations ncp_file_operations; | ||
| 236 | int ncp_make_open(struct inode *, int); | ||
| 237 | |||
| 238 | /* linux/fs/ncpfs/mmap.c */ | ||
| 239 | int ncp_mmap(struct file *, struct vm_area_struct *); | ||
| 240 | |||
| 241 | /* linux/fs/ncpfs/ncplib_kernel.c */ | ||
| 242 | int ncp_make_closed(struct inode *); | ||
| 243 | |||
| 244 | #endif /* __KERNEL__ */ | ||
| 245 | |||
| 246 | #endif /* _LINUX_NCP_FS_H */ | 146 | #endif /* _LINUX_NCP_FS_H */ |
diff --git a/include/linux/ncp_mount.h b/include/linux/ncp_mount.h index a2b549eb1ec..dfcbea2d889 100644 --- a/include/linux/ncp_mount.h +++ b/include/linux/ncp_mount.h | |||
| @@ -68,26 +68,4 @@ struct ncp_mount_data_v4 { | |||
| 68 | 68 | ||
| 69 | #define NCP_MOUNT_VERSION_V5 (5) /* Text only */ | 69 | #define NCP_MOUNT_VERSION_V5 (5) /* Text only */ |
| 70 | 70 | ||
| 71 | #ifdef __KERNEL__ | ||
| 72 | |||
| 73 | struct ncp_mount_data_kernel { | ||
| 74 | unsigned long flags; /* NCP_MOUNT_* flags */ | ||
| 75 | unsigned int int_flags; /* internal flags */ | ||
| 76 | #define NCP_IMOUNT_LOGGEDIN_POSSIBLE 0x0001 | ||
| 77 | __kernel_uid32_t mounted_uid; /* Who may umount() this filesystem? */ | ||
| 78 | struct pid *wdog_pid; /* Who cares for our watchdog packets? */ | ||
| 79 | unsigned int ncp_fd; /* The socket to the ncp port */ | ||
| 80 | unsigned int time_out; /* How long should I wait after | ||
| 81 | sending a NCP request? */ | ||
| 82 | unsigned int retry_count; /* And how often should I retry? */ | ||
| 83 | unsigned char mounted_vol[NCP_VOLNAME_LEN + 1]; | ||
| 84 | __kernel_uid32_t uid; | ||
| 85 | __kernel_gid32_t gid; | ||
| 86 | __kernel_mode_t file_mode; | ||
| 87 | __kernel_mode_t dir_mode; | ||
| 88 | int info_fd; | ||
| 89 | }; | ||
| 90 | |||
| 91 | #endif /* __KERNEL__ */ | ||
| 92 | |||
| 93 | #endif | 71 | #endif |
diff --git a/kernel/cgroup.c b/kernel/cgroup.c index 51cddc11cd8..5c5f4cc2e99 100644 --- a/kernel/cgroup.c +++ b/kernel/cgroup.c | |||
| @@ -763,8 +763,6 @@ EXPORT_SYMBOL_GPL(cgroup_unlock); | |||
| 763 | * -> cgroup_mkdir. | 763 | * -> cgroup_mkdir. |
| 764 | */ | 764 | */ |
| 765 | 765 | ||
| 766 | static struct dentry *cgroup_lookup(struct inode *dir, | ||
| 767 | struct dentry *dentry, struct nameidata *nd); | ||
| 768 | static int cgroup_mkdir(struct inode *dir, struct dentry *dentry, int mode); | 766 | static int cgroup_mkdir(struct inode *dir, struct dentry *dentry, int mode); |
| 769 | static int cgroup_rmdir(struct inode *unused_dir, struct dentry *dentry); | 767 | static int cgroup_rmdir(struct inode *unused_dir, struct dentry *dentry); |
| 770 | static int cgroup_populate_dir(struct cgroup *cgrp); | 768 | static int cgroup_populate_dir(struct cgroup *cgrp); |
| @@ -1451,6 +1449,10 @@ static int cgroup_set_super(struct super_block *sb, void *data) | |||
| 1451 | 1449 | ||
| 1452 | static int cgroup_get_rootdir(struct super_block *sb) | 1450 | static int cgroup_get_rootdir(struct super_block *sb) |
| 1453 | { | 1451 | { |
| 1452 | static const struct dentry_operations cgroup_dops = { | ||
| 1453 | .d_iput = cgroup_diput, | ||
| 1454 | }; | ||
| 1455 | |||
| 1454 | struct inode *inode = | 1456 | struct inode *inode = |
| 1455 | cgroup_new_inode(S_IFDIR | S_IRUGO | S_IXUGO | S_IWUSR, sb); | 1457 | cgroup_new_inode(S_IFDIR | S_IRUGO | S_IXUGO | S_IWUSR, sb); |
| 1456 | struct dentry *dentry; | 1458 | struct dentry *dentry; |
| @@ -1468,6 +1470,8 @@ static int cgroup_get_rootdir(struct super_block *sb) | |||
| 1468 | return -ENOMEM; | 1470 | return -ENOMEM; |
| 1469 | } | 1471 | } |
| 1470 | sb->s_root = dentry; | 1472 | sb->s_root = dentry; |
| 1473 | /* for everything else we want ->d_op set */ | ||
| 1474 | sb->s_d_op = &cgroup_dops; | ||
| 1471 | return 0; | 1475 | return 0; |
| 1472 | } | 1476 | } |
| 1473 | 1477 | ||
| @@ -2191,7 +2195,7 @@ static const struct file_operations cgroup_file_operations = { | |||
| 2191 | }; | 2195 | }; |
| 2192 | 2196 | ||
| 2193 | static const struct inode_operations cgroup_dir_inode_operations = { | 2197 | static const struct inode_operations cgroup_dir_inode_operations = { |
| 2194 | .lookup = cgroup_lookup, | 2198 | .lookup = simple_lookup, |
| 2195 | .mkdir = cgroup_mkdir, | 2199 | .mkdir = cgroup_mkdir, |
| 2196 | .rmdir = cgroup_rmdir, | 2200 | .rmdir = cgroup_rmdir, |
| 2197 | .rename = cgroup_rename, | 2201 | .rename = cgroup_rename, |
| @@ -2207,26 +2211,6 @@ static inline struct cftype *__file_cft(struct file *file) | |||
| 2207 | return __d_cft(file->f_dentry); | 2211 | return __d_cft(file->f_dentry); |
| 2208 | } | 2212 | } |
| 2209 | 2213 | ||
| 2210 | static int cgroup_delete_dentry(const struct dentry *dentry) | ||
| 2211 | { | ||
| 2212 | return 1; | ||
| 2213 | } | ||
| 2214 | |||
| 2215 | static struct dentry *cgroup_lookup(struct inode *dir, | ||
| 2216 | struct dentry *dentry, struct nameidata *nd) | ||
| 2217 | { | ||
| 2218 | static const struct dentry_operations cgroup_dentry_operations = { | ||
| 2219 | .d_delete = cgroup_delete_dentry, | ||
| 2220 | .d_iput = cgroup_diput, | ||
| 2221 | }; | ||
| 2222 | |||
| 2223 | if (dentry->d_name.len > NAME_MAX) | ||
| 2224 | return ERR_PTR(-ENAMETOOLONG); | ||
| 2225 | d_set_d_op(dentry, &cgroup_dentry_operations); | ||
| 2226 | d_add(dentry, NULL); | ||
| 2227 | return NULL; | ||
| 2228 | } | ||
| 2229 | |||
| 2230 | static int cgroup_create_file(struct dentry *dentry, mode_t mode, | 2214 | static int cgroup_create_file(struct dentry *dentry, mode_t mode, |
| 2231 | struct super_block *sb) | 2215 | struct super_block *sb) |
| 2232 | { | 2216 | { |
diff --git a/net/socket.c b/net/socket.c index ccc576a6a50..ac2219f90d5 100644 --- a/net/socket.c +++ b/net/socket.c | |||
| @@ -306,20 +306,6 @@ static const struct super_operations sockfs_ops = { | |||
| 306 | .statfs = simple_statfs, | 306 | .statfs = simple_statfs, |
| 307 | }; | 307 | }; |
| 308 | 308 | ||
| 309 | static struct dentry *sockfs_mount(struct file_system_type *fs_type, | ||
| 310 | int flags, const char *dev_name, void *data) | ||
| 311 | { | ||
| 312 | return mount_pseudo(fs_type, "socket:", &sockfs_ops, SOCKFS_MAGIC); | ||
| 313 | } | ||
| 314 | |||
| 315 | static struct vfsmount *sock_mnt __read_mostly; | ||
| 316 | |||
| 317 | static struct file_system_type sock_fs_type = { | ||
| 318 | .name = "sockfs", | ||
| 319 | .mount = sockfs_mount, | ||
| 320 | .kill_sb = kill_anon_super, | ||
| 321 | }; | ||
| 322 | |||
| 323 | /* | 309 | /* |
| 324 | * sockfs_dname() is called from d_path(). | 310 | * sockfs_dname() is called from d_path(). |
| 325 | */ | 311 | */ |
| @@ -333,6 +319,21 @@ static const struct dentry_operations sockfs_dentry_operations = { | |||
| 333 | .d_dname = sockfs_dname, | 319 | .d_dname = sockfs_dname, |
| 334 | }; | 320 | }; |
| 335 | 321 | ||
| 322 | static struct dentry *sockfs_mount(struct file_system_type *fs_type, | ||
| 323 | int flags, const char *dev_name, void *data) | ||
| 324 | { | ||
| 325 | return mount_pseudo(fs_type, "socket:", &sockfs_ops, | ||
| 326 | &sockfs_dentry_operations, SOCKFS_MAGIC); | ||
| 327 | } | ||
| 328 | |||
| 329 | static struct vfsmount *sock_mnt __read_mostly; | ||
| 330 | |||
| 331 | static struct file_system_type sock_fs_type = { | ||
| 332 | .name = "sockfs", | ||
| 333 | .mount = sockfs_mount, | ||
| 334 | .kill_sb = kill_anon_super, | ||
| 335 | }; | ||
| 336 | |||
| 336 | /* | 337 | /* |
| 337 | * Obtains the first available file descriptor and sets it up for use. | 338 | * Obtains the first available file descriptor and sets it up for use. |
| 338 | * | 339 | * |
| @@ -368,7 +369,6 @@ static int sock_alloc_file(struct socket *sock, struct file **f, int flags) | |||
| 368 | } | 369 | } |
| 369 | path.mnt = mntget(sock_mnt); | 370 | path.mnt = mntget(sock_mnt); |
| 370 | 371 | ||
| 371 | d_set_d_op(path.dentry, &sockfs_dentry_operations); | ||
| 372 | d_instantiate(path.dentry, SOCK_INODE(sock)); | 372 | d_instantiate(path.dentry, SOCK_INODE(sock)); |
| 373 | SOCK_INODE(sock)->i_fop = &socket_file_ops; | 373 | SOCK_INODE(sock)->i_fop = &socket_file_ops; |
| 374 | 374 | ||
