aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/nfs4proc.c
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2012-07-16 12:01:42 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2012-07-16 12:01:42 -0400
commit8626e4a42675ff9903f7d4fbf14d8ebc11b5926c (patch)
treec631dfe2854cb1382a5d8f5aa11b071762ddf27d /fs/nfs/nfs4proc.c
parenta8d8f02cf0c379693762107afe812b9e52090e39 (diff)
parent9249e17fe094d853d1ef7475dd559a2cc7e23d42 (diff)
Merge commit '9249e17fe094d853d1ef7475dd559a2cc7e23d42' into nfs-for-3.6
Resolve conflicts with the VFS atomic open and sget changes. Conflicts: fs/nfs/nfs4proc.c
Diffstat (limited to 'fs/nfs/nfs4proc.c')
-rw-r--r--fs/nfs/nfs4proc.c41
1 files changed, 12 insertions, 29 deletions
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 7d387cb8ceb5..006e98da730a 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -2804,39 +2804,24 @@ static int nfs4_proc_readlink(struct inode *inode, struct page *page,
2804} 2804}
2805 2805
2806/* 2806/*
2807 * Got race? 2807 * This is just for mknod. open(O_CREAT) will always do ->open_context().
2808 * We will need to arrange for the VFS layer to provide an atomic open.
2809 * Until then, this create/open method is prone to inefficiency and race
2810 * conditions due to the lookup, create, and open VFS calls from sys_open()
2811 * placed on the wire.
2812 *
2813 * Given the above sorry state of affairs, I'm simply sending an OPEN.
2814 * The file will be opened again in the subsequent VFS open call
2815 * (nfs4_proc_file_open).
2816 *
2817 * The open for read will just hang around to be used by any process that
2818 * opens the file O_RDONLY. This will all be resolved with the VFS changes.
2819 */ 2808 */
2820
2821static int 2809static int
2822nfs4_proc_create(struct inode *dir, struct dentry *dentry, struct iattr *sattr, 2810nfs4_proc_create(struct inode *dir, struct dentry *dentry, struct iattr *sattr,
2823 int flags, struct nfs_open_context *ctx) 2811 int flags)
2824{ 2812{
2825 struct dentry *de = dentry; 2813 struct nfs_open_context *ctx;
2826 struct nfs4_state *state; 2814 struct nfs4_state *state;
2827 struct rpc_cred *cred = NULL;
2828 struct nfs4_threshold **thp = NULL;
2829 fmode_t fmode = 0;
2830 int status = 0; 2815 int status = 0;
2831 2816
2832 if (ctx != NULL) { 2817 ctx = alloc_nfs_open_context(dentry, FMODE_READ);
2833 cred = ctx->cred; 2818 if (IS_ERR(ctx))
2834 de = ctx->dentry; 2819 return PTR_ERR(ctx);
2835 fmode = ctx->mode; 2820
2836 thp = &ctx->mdsthreshold;
2837 }
2838 sattr->ia_mode &= ~current_umask(); 2821 sattr->ia_mode &= ~current_umask();
2839 state = nfs4_do_open(dir, de, fmode, flags, sattr, cred, thp); 2822 state = nfs4_do_open(dir, dentry, ctx->mode,
2823 flags, sattr, ctx->cred,
2824 &ctx->mdsthreshold);
2840 d_drop(dentry); 2825 d_drop(dentry);
2841 if (IS_ERR(state)) { 2826 if (IS_ERR(state)) {
2842 status = PTR_ERR(state); 2827 status = PTR_ERR(state);
@@ -2844,11 +2829,9 @@ nfs4_proc_create(struct inode *dir, struct dentry *dentry, struct iattr *sattr,
2844 } 2829 }
2845 d_add(dentry, igrab(state->inode)); 2830 d_add(dentry, igrab(state->inode));
2846 nfs_set_verifier(dentry, nfs_save_change_attribute(dir)); 2831 nfs_set_verifier(dentry, nfs_save_change_attribute(dir));
2847 if (ctx != NULL) 2832 ctx->state = state;
2848 ctx->state = state;
2849 else
2850 nfs4_close_sync(state, fmode);
2851out: 2833out:
2834 put_nfs_open_context(ctx);
2852 return status; 2835 return status;
2853} 2836}
2854 2837