diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2011-06-22 18:30:55 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2011-07-20 01:43:42 -0400 |
commit | 82a2c1b77ada3b81911deeb871719ec5ff77f83c (patch) | |
tree | 89b0329a54274e51c19c342048e80639bc489129 /fs/nfs | |
parent | 643168c2dc0d04cb884ae7bcd1ee19d9ecdff6a8 (diff) |
nfs4_opendata doesn't need struct path either
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/nfs')
-rw-r--r-- | fs/nfs/nfs4proc.c | 45 |
1 files changed, 22 insertions, 23 deletions
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index e99d674149ae..aef22fa0a1c0 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c | |||
@@ -763,8 +763,8 @@ struct nfs4_opendata { | |||
763 | struct nfs_open_confirmres c_res; | 763 | struct nfs_open_confirmres c_res; |
764 | struct nfs_fattr f_attr; | 764 | struct nfs_fattr f_attr; |
765 | struct nfs_fattr dir_attr; | 765 | struct nfs_fattr dir_attr; |
766 | struct path path; | ||
767 | struct dentry *dir; | 766 | struct dentry *dir; |
767 | struct dentry *dentry; | ||
768 | struct nfs4_state_owner *owner; | 768 | struct nfs4_state_owner *owner; |
769 | struct nfs4_state *state; | 769 | struct nfs4_state *state; |
770 | struct iattr attrs; | 770 | struct iattr attrs; |
@@ -786,12 +786,12 @@ static void nfs4_init_opendata_res(struct nfs4_opendata *p) | |||
786 | nfs_fattr_init(&p->dir_attr); | 786 | nfs_fattr_init(&p->dir_attr); |
787 | } | 787 | } |
788 | 788 | ||
789 | static struct nfs4_opendata *nfs4_opendata_alloc(struct path *path, | 789 | static struct nfs4_opendata *nfs4_opendata_alloc(struct dentry *dentry, |
790 | struct nfs4_state_owner *sp, fmode_t fmode, int flags, | 790 | struct nfs4_state_owner *sp, fmode_t fmode, int flags, |
791 | const struct iattr *attrs, | 791 | const struct iattr *attrs, |
792 | gfp_t gfp_mask) | 792 | gfp_t gfp_mask) |
793 | { | 793 | { |
794 | struct dentry *parent = dget_parent(path->dentry); | 794 | struct dentry *parent = dget_parent(dentry); |
795 | struct inode *dir = parent->d_inode; | 795 | struct inode *dir = parent->d_inode; |
796 | struct nfs_server *server = NFS_SERVER(dir); | 796 | struct nfs_server *server = NFS_SERVER(dir); |
797 | struct nfs4_opendata *p; | 797 | struct nfs4_opendata *p; |
@@ -802,8 +802,8 @@ static struct nfs4_opendata *nfs4_opendata_alloc(struct path *path, | |||
802 | p->o_arg.seqid = nfs_alloc_seqid(&sp->so_seqid, gfp_mask); | 802 | p->o_arg.seqid = nfs_alloc_seqid(&sp->so_seqid, gfp_mask); |
803 | if (p->o_arg.seqid == NULL) | 803 | if (p->o_arg.seqid == NULL) |
804 | goto err_free; | 804 | goto err_free; |
805 | path_get(path); | 805 | nfs_sb_active(dentry->d_sb); |
806 | p->path = *path; | 806 | p->dentry = dget(dentry); |
807 | p->dir = parent; | 807 | p->dir = parent; |
808 | p->owner = sp; | 808 | p->owner = sp; |
809 | atomic_inc(&sp->so_count); | 809 | atomic_inc(&sp->so_count); |
@@ -812,7 +812,7 @@ static struct nfs4_opendata *nfs4_opendata_alloc(struct path *path, | |||
812 | p->o_arg.fmode = fmode & (FMODE_READ|FMODE_WRITE); | 812 | p->o_arg.fmode = fmode & (FMODE_READ|FMODE_WRITE); |
813 | p->o_arg.clientid = server->nfs_client->cl_clientid; | 813 | p->o_arg.clientid = server->nfs_client->cl_clientid; |
814 | p->o_arg.id = sp->so_owner_id.id; | 814 | p->o_arg.id = sp->so_owner_id.id; |
815 | p->o_arg.name = &p->path.dentry->d_name; | 815 | p->o_arg.name = &dentry->d_name; |
816 | p->o_arg.server = server; | 816 | p->o_arg.server = server; |
817 | p->o_arg.bitmask = server->attr_bitmask; | 817 | p->o_arg.bitmask = server->attr_bitmask; |
818 | p->o_arg.claim = NFS4_OPEN_CLAIM_NULL; | 818 | p->o_arg.claim = NFS4_OPEN_CLAIM_NULL; |
@@ -842,13 +842,15 @@ static void nfs4_opendata_free(struct kref *kref) | |||
842 | { | 842 | { |
843 | struct nfs4_opendata *p = container_of(kref, | 843 | struct nfs4_opendata *p = container_of(kref, |
844 | struct nfs4_opendata, kref); | 844 | struct nfs4_opendata, kref); |
845 | struct super_block *sb = p->dentry->d_sb; | ||
845 | 846 | ||
846 | nfs_free_seqid(p->o_arg.seqid); | 847 | nfs_free_seqid(p->o_arg.seqid); |
847 | if (p->state != NULL) | 848 | if (p->state != NULL) |
848 | nfs4_put_open_state(p->state); | 849 | nfs4_put_open_state(p->state); |
849 | nfs4_put_state_owner(p->owner); | 850 | nfs4_put_state_owner(p->owner); |
850 | dput(p->dir); | 851 | dput(p->dir); |
851 | path_put(&p->path); | 852 | dput(p->dentry); |
853 | nfs_sb_deactive(sb); | ||
852 | kfree(p); | 854 | kfree(p); |
853 | } | 855 | } |
854 | 856 | ||
@@ -1130,7 +1132,7 @@ static struct nfs4_opendata *nfs4_open_recoverdata_alloc(struct nfs_open_context | |||
1130 | { | 1132 | { |
1131 | struct nfs4_opendata *opendata; | 1133 | struct nfs4_opendata *opendata; |
1132 | 1134 | ||
1133 | opendata = nfs4_opendata_alloc(&ctx->path, state->owner, 0, 0, NULL, GFP_NOFS); | 1135 | opendata = nfs4_opendata_alloc(ctx->path.dentry, state->owner, 0, 0, NULL, GFP_NOFS); |
1134 | if (opendata == NULL) | 1136 | if (opendata == NULL) |
1135 | return ERR_PTR(-ENOMEM); | 1137 | return ERR_PTR(-ENOMEM); |
1136 | opendata->state = state; | 1138 | opendata->state = state; |
@@ -1706,7 +1708,7 @@ static inline void nfs4_exclusive_attrset(struct nfs4_opendata *opendata, struct | |||
1706 | /* | 1708 | /* |
1707 | * Returns a referenced nfs4_state | 1709 | * Returns a referenced nfs4_state |
1708 | */ | 1710 | */ |
1709 | static int _nfs4_do_open(struct inode *dir, struct path *path, fmode_t fmode, int flags, struct iattr *sattr, struct rpc_cred *cred, struct nfs4_state **res) | 1711 | static int _nfs4_do_open(struct inode *dir, struct dentry *dentry, fmode_t fmode, int flags, struct iattr *sattr, struct rpc_cred *cred, struct nfs4_state **res) |
1710 | { | 1712 | { |
1711 | struct nfs4_state_owner *sp; | 1713 | struct nfs4_state_owner *sp; |
1712 | struct nfs4_state *state = NULL; | 1714 | struct nfs4_state *state = NULL; |
@@ -1723,15 +1725,15 @@ static int _nfs4_do_open(struct inode *dir, struct path *path, fmode_t fmode, in | |||
1723 | status = nfs4_recover_expired_lease(server); | 1725 | status = nfs4_recover_expired_lease(server); |
1724 | if (status != 0) | 1726 | if (status != 0) |
1725 | goto err_put_state_owner; | 1727 | goto err_put_state_owner; |
1726 | if (path->dentry->d_inode != NULL) | 1728 | if (dentry->d_inode != NULL) |
1727 | nfs4_return_incompatible_delegation(path->dentry->d_inode, fmode); | 1729 | nfs4_return_incompatible_delegation(dentry->d_inode, fmode); |
1728 | status = -ENOMEM; | 1730 | status = -ENOMEM; |
1729 | opendata = nfs4_opendata_alloc(path, sp, fmode, flags, sattr, GFP_KERNEL); | 1731 | opendata = nfs4_opendata_alloc(dentry, sp, fmode, flags, sattr, GFP_KERNEL); |
1730 | if (opendata == NULL) | 1732 | if (opendata == NULL) |
1731 | goto err_put_state_owner; | 1733 | goto err_put_state_owner; |
1732 | 1734 | ||
1733 | if (path->dentry->d_inode != NULL) | 1735 | if (dentry->d_inode != NULL) |
1734 | opendata->state = nfs4_get_open_state(path->dentry->d_inode, sp); | 1736 | opendata->state = nfs4_get_open_state(dentry->d_inode, sp); |
1735 | 1737 | ||
1736 | status = _nfs4_proc_open(opendata); | 1738 | status = _nfs4_proc_open(opendata); |
1737 | if (status != 0) | 1739 | if (status != 0) |
@@ -1769,14 +1771,14 @@ out_err: | |||
1769 | } | 1771 | } |
1770 | 1772 | ||
1771 | 1773 | ||
1772 | static struct nfs4_state *nfs4_do_open(struct inode *dir, struct path *path, fmode_t fmode, int flags, struct iattr *sattr, struct rpc_cred *cred) | 1774 | static struct nfs4_state *nfs4_do_open(struct inode *dir, struct dentry *dentry, fmode_t fmode, int flags, struct iattr *sattr, struct rpc_cred *cred) |
1773 | { | 1775 | { |
1774 | struct nfs4_exception exception = { }; | 1776 | struct nfs4_exception exception = { }; |
1775 | struct nfs4_state *res; | 1777 | struct nfs4_state *res; |
1776 | int status; | 1778 | int status; |
1777 | 1779 | ||
1778 | do { | 1780 | do { |
1779 | status = _nfs4_do_open(dir, path, fmode, flags, sattr, cred, &res); | 1781 | status = _nfs4_do_open(dir, dentry, fmode, flags, sattr, cred, &res); |
1780 | if (status == 0) | 1782 | if (status == 0) |
1781 | break; | 1783 | break; |
1782 | /* NOTE: BAD_SEQID means the server and client disagree about the | 1784 | /* NOTE: BAD_SEQID means the server and client disagree about the |
@@ -2079,7 +2081,7 @@ nfs4_atomic_open(struct inode *dir, struct nfs_open_context *ctx, int open_flags | |||
2079 | struct nfs4_state *state; | 2081 | struct nfs4_state *state; |
2080 | 2082 | ||
2081 | /* Protect against concurrent sillydeletes */ | 2083 | /* Protect against concurrent sillydeletes */ |
2082 | state = nfs4_do_open(dir, &ctx->path, ctx->mode, open_flags, attr, ctx->cred); | 2084 | state = nfs4_do_open(dir, ctx->path.dentry, ctx->mode, open_flags, attr, ctx->cred); |
2083 | if (IS_ERR(state)) | 2085 | if (IS_ERR(state)) |
2084 | return ERR_CAST(state); | 2086 | return ERR_CAST(state); |
2085 | ctx->state = state; | 2087 | ctx->state = state; |
@@ -2615,10 +2617,7 @@ static int | |||
2615 | nfs4_proc_create(struct inode *dir, struct dentry *dentry, struct iattr *sattr, | 2617 | nfs4_proc_create(struct inode *dir, struct dentry *dentry, struct iattr *sattr, |
2616 | int flags, struct nfs_open_context *ctx) | 2618 | int flags, struct nfs_open_context *ctx) |
2617 | { | 2619 | { |
2618 | struct path my_path = { | 2620 | struct dentry *de = dentry; |
2619 | .dentry = dentry, | ||
2620 | }; | ||
2621 | struct path *path = &my_path; | ||
2622 | struct nfs4_state *state; | 2621 | struct nfs4_state *state; |
2623 | struct rpc_cred *cred = NULL; | 2622 | struct rpc_cred *cred = NULL; |
2624 | fmode_t fmode = 0; | 2623 | fmode_t fmode = 0; |
@@ -2626,11 +2625,11 @@ nfs4_proc_create(struct inode *dir, struct dentry *dentry, struct iattr *sattr, | |||
2626 | 2625 | ||
2627 | if (ctx != NULL) { | 2626 | if (ctx != NULL) { |
2628 | cred = ctx->cred; | 2627 | cred = ctx->cred; |
2629 | path = &ctx->path; | 2628 | de = ctx->path.dentry; |
2630 | fmode = ctx->mode; | 2629 | fmode = ctx->mode; |
2631 | } | 2630 | } |
2632 | sattr->ia_mode &= ~current_umask(); | 2631 | sattr->ia_mode &= ~current_umask(); |
2633 | state = nfs4_do_open(dir, path, fmode, flags, sattr, cred); | 2632 | state = nfs4_do_open(dir, de, fmode, flags, sattr, cred); |
2634 | d_drop(dentry); | 2633 | d_drop(dentry); |
2635 | if (IS_ERR(state)) { | 2634 | if (IS_ERR(state)) { |
2636 | status = PTR_ERR(state); | 2635 | status = PTR_ERR(state); |