From: Trond Myklebust Date: Mon, 16 Jul 2012 16:01:42 +0000 (-0400) Subject: Merge commit '9249e17fe094d853d1ef7475dd559a2cc7e23d42' into nfs-for-3.6 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=8626e4a42675ff9903f7d4fbf14d8ebc11b5926c;p=linux-beck.git Merge commit '9249e17fe094d853d1ef7475dd559a2cc7e23d42' into nfs-for-3.6 Resolve conflicts with the VFS atomic open and sget changes. Conflicts: fs/nfs/nfs4proc.c --- 8626e4a42675ff9903f7d4fbf14d8ebc11b5926c diff --cc fs/nfs/nfs4proc.c index 7d387cb8ceb5,c157b2089b47..006e98da730a --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c @@@ -2804,39 -2806,22 +2804,24 @@@ static int nfs4_proc_readlink(struct in } /* - * Got race? - * We will need to arrange for the VFS layer to provide an atomic open. - * Until then, this create/open method is prone to inefficiency and race - * conditions due to the lookup, create, and open VFS calls from sys_open() - * placed on the wire. - * - * Given the above sorry state of affairs, I'm simply sending an OPEN. - * The file will be opened again in the subsequent VFS open call - * (nfs4_proc_file_open). - * - * The open for read will just hang around to be used by any process that - * opens the file O_RDONLY. This will all be resolved with the VFS changes. + * This is just for mknod. open(O_CREAT) will always do ->open_context(). */ - static int nfs4_proc_create(struct inode *dir, struct dentry *dentry, struct iattr *sattr, - int flags, struct nfs_open_context *ctx) + int flags) { - struct dentry *de = dentry; + struct nfs_open_context *ctx; struct nfs4_state *state; - struct rpc_cred *cred = NULL; - struct nfs4_threshold **thp = NULL; - fmode_t fmode = 0; int status = 0; - if (ctx != NULL) { - cred = ctx->cred; - de = ctx->dentry; - fmode = ctx->mode; - thp = &ctx->mdsthreshold; - } + ctx = alloc_nfs_open_context(dentry, FMODE_READ); + if (IS_ERR(ctx)) + return PTR_ERR(ctx); + sattr->ia_mode &= ~current_umask(); - state = nfs4_do_open(dir, de, fmode, flags, sattr, cred, thp); - state = nfs4_do_open(dir, dentry, ctx->mode, flags, sattr, ctx->cred, NULL); ++ state = nfs4_do_open(dir, dentry, ctx->mode, ++ flags, sattr, ctx->cred, ++ &ctx->mdsthreshold); d_drop(dentry); if (IS_ERR(state)) { status = PTR_ERR(state);