diff options
author | Miklos Szeredi <mszeredi@suse.cz> | 2012-06-05 09:10:19 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2012-07-14 08:33:08 -0400 |
commit | 8867fe5899010a0c0ac36dadfdacf1072b1c990c (patch) | |
tree | 3af6bb8d50fb06a46a451ba23bde8dac98361c25 /fs/nfs/dir.c | |
parent | 0dd2b474d0b69d58859399b1df7fdc699ea005d4 (diff) |
nfs: clean up ->create in nfs_rpc_ops
Don't pass nfs_open_context() to ->create(). Only the NFS4 implementation
needed that and only because it wanted to return an open file using open
intents. That task has been replaced by ->atomic_open so it is not necessary
anymore to pass the context to the create rpc operation.
Despite nfs4_proc_create apparently being okay with a NULL context it Oopses
somewhere down the call chain. So allocate a context here.
Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
CC: Trond Myklebust <Trond.Myklebust@netapp.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/nfs/dir.c')
-rw-r--r-- | fs/nfs/dir.c | 42 |
1 files changed, 2 insertions, 40 deletions
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c index 0d8c71271d1a..45015d32a865 100644 --- a/fs/nfs/dir.c +++ b/fs/nfs/dir.c | |||
@@ -114,10 +114,8 @@ const struct inode_operations nfs3_dir_inode_operations = { | |||
114 | static struct file *nfs_atomic_open(struct inode *, struct dentry *, | 114 | static struct file *nfs_atomic_open(struct inode *, struct dentry *, |
115 | struct opendata *, unsigned, umode_t, | 115 | struct opendata *, unsigned, umode_t, |
116 | bool *); | 116 | bool *); |
117 | static int nfs4_create(struct inode *dir, struct dentry *dentry, | ||
118 | umode_t mode, struct nameidata *nd); | ||
119 | const struct inode_operations nfs4_dir_inode_operations = { | 117 | const struct inode_operations nfs4_dir_inode_operations = { |
120 | .create = nfs4_create, | 118 | .create = nfs_create, |
121 | .lookup = nfs_lookup, | 119 | .lookup = nfs_lookup, |
122 | .atomic_open = nfs_atomic_open, | 120 | .atomic_open = nfs_atomic_open, |
123 | .link = nfs_link, | 121 | .link = nfs_link, |
@@ -1582,42 +1580,6 @@ no_open: | |||
1582 | return nfs_lookup_revalidate(dentry, nd); | 1580 | return nfs_lookup_revalidate(dentry, nd); |
1583 | } | 1581 | } |
1584 | 1582 | ||
1585 | static int nfs4_create(struct inode *dir, struct dentry *dentry, | ||
1586 | umode_t mode, struct nameidata *nd) | ||
1587 | { | ||
1588 | struct nfs_open_context *ctx = NULL; | ||
1589 | struct iattr attr; | ||
1590 | int error; | ||
1591 | int open_flags = O_CREAT|O_EXCL; | ||
1592 | |||
1593 | dfprintk(VFS, "NFS: create(%s/%ld), %s\n", | ||
1594 | dir->i_sb->s_id, dir->i_ino, dentry->d_name.name); | ||
1595 | |||
1596 | attr.ia_mode = mode; | ||
1597 | attr.ia_valid = ATTR_MODE; | ||
1598 | |||
1599 | if (nd) | ||
1600 | open_flags = nd->intent.open.flags; | ||
1601 | |||
1602 | ctx = create_nfs_open_context(dentry, open_flags); | ||
1603 | error = PTR_ERR(ctx); | ||
1604 | if (IS_ERR(ctx)) | ||
1605 | goto out_err_drop; | ||
1606 | |||
1607 | error = NFS_PROTO(dir)->create(dir, dentry, &attr, open_flags, ctx); | ||
1608 | if (error != 0) | ||
1609 | goto out_put_ctx; | ||
1610 | |||
1611 | put_nfs_open_context(ctx); | ||
1612 | |||
1613 | return 0; | ||
1614 | out_put_ctx: | ||
1615 | put_nfs_open_context(ctx); | ||
1616 | out_err_drop: | ||
1617 | d_drop(dentry); | ||
1618 | return error; | ||
1619 | } | ||
1620 | |||
1621 | #endif /* CONFIG_NFSV4 */ | 1583 | #endif /* CONFIG_NFSV4 */ |
1622 | 1584 | ||
1623 | /* | 1585 | /* |
@@ -1684,7 +1646,7 @@ static int nfs_create(struct inode *dir, struct dentry *dentry, | |||
1684 | if (nd) | 1646 | if (nd) |
1685 | open_flags = nd->intent.open.flags; | 1647 | open_flags = nd->intent.open.flags; |
1686 | 1648 | ||
1687 | error = NFS_PROTO(dir)->create(dir, dentry, &attr, open_flags, NULL); | 1649 | error = NFS_PROTO(dir)->create(dir, dentry, &attr, open_flags); |
1688 | if (error != 0) | 1650 | if (error != 0) |
1689 | goto out_err; | 1651 | goto out_err; |
1690 | return 0; | 1652 | return 0; |