aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/nfsd/nfs3proc.c2
-rw-r--r--fs/nfsd/nfs4proc.c6
-rw-r--r--fs/nfsd/vfs.c4
-rw-r--r--include/linux/nfsd/nfsd.h2
4 files changed, 9 insertions, 5 deletions
diff --git a/fs/nfsd/nfs3proc.c b/fs/nfsd/nfs3proc.c
index 64db601c2bd2..7f5bad0393b1 100644
--- a/fs/nfsd/nfs3proc.c
+++ b/fs/nfsd/nfs3proc.c
@@ -258,7 +258,7 @@ nfsd3_proc_create(struct svc_rqst *rqstp, struct nfsd3_createargs *argp,
258 /* Now create the file and set attributes */ 258 /* Now create the file and set attributes */
259 nfserr = nfsd_create_v3(rqstp, dirfhp, argp->name, argp->len, 259 nfserr = nfsd_create_v3(rqstp, dirfhp, argp->name, argp->len,
260 attr, newfhp, 260 attr, newfhp,
261 argp->createmode, argp->verf, NULL); 261 argp->createmode, argp->verf, NULL, NULL);
262 262
263 RETURN_STATUS(nfserr); 263 RETURN_STATUS(nfserr);
264} 264}
diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c
index 4a73f5b2546f..50bc94243ca1 100644
--- a/fs/nfsd/nfs4proc.c
+++ b/fs/nfsd/nfs4proc.c
@@ -93,6 +93,7 @@ do_open_lookup(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_o
93{ 93{
94 struct svc_fh resfh; 94 struct svc_fh resfh;
95 __be32 status; 95 __be32 status;
96 int created = 0;
96 97
97 fh_init(&resfh, NFS4_FHSIZE); 98 fh_init(&resfh, NFS4_FHSIZE);
98 open->op_truncate = 0; 99 open->op_truncate = 0;
@@ -105,7 +106,7 @@ do_open_lookup(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_o
105 status = nfsd_create_v3(rqstp, current_fh, open->op_fname.data, 106 status = nfsd_create_v3(rqstp, current_fh, open->op_fname.data,
106 open->op_fname.len, &open->op_iattr, 107 open->op_fname.len, &open->op_iattr,
107 &resfh, open->op_createmode, 108 &resfh, open->op_createmode,
108 (u32 *)open->op_verf.data, &open->op_truncate); 109 (u32 *)open->op_verf.data, &open->op_truncate, &created);
109 } else { 110 } else {
110 status = nfsd_lookup(rqstp, current_fh, 111 status = nfsd_lookup(rqstp, current_fh,
111 open->op_fname.data, open->op_fname.len, &resfh); 112 open->op_fname.data, open->op_fname.len, &resfh);
@@ -122,7 +123,8 @@ do_open_lookup(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_o
122 memcpy(open->op_stateowner->so_replay.rp_openfh, 123 memcpy(open->op_stateowner->so_replay.rp_openfh,
123 &resfh.fh_handle.fh_base, resfh.fh_handle.fh_size); 124 &resfh.fh_handle.fh_base, resfh.fh_handle.fh_size);
124 125
125 status = do_open_permission(rqstp, current_fh, open, MAY_NOP); 126 if (!created)
127 status = do_open_permission(rqstp, current_fh, open, MAY_NOP);
126 128
127out: 129out:
128 fh_put(&resfh); 130 fh_put(&resfh);
diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c
index f21e917bb8ed..1a7ad8c983d1 100644
--- a/fs/nfsd/vfs.c
+++ b/fs/nfsd/vfs.c
@@ -1237,7 +1237,7 @@ __be32
1237nfsd_create_v3(struct svc_rqst *rqstp, struct svc_fh *fhp, 1237nfsd_create_v3(struct svc_rqst *rqstp, struct svc_fh *fhp,
1238 char *fname, int flen, struct iattr *iap, 1238 char *fname, int flen, struct iattr *iap,
1239 struct svc_fh *resfhp, int createmode, u32 *verifier, 1239 struct svc_fh *resfhp, int createmode, u32 *verifier,
1240 int *truncp) 1240 int *truncp, int *created)
1241{ 1241{
1242 struct dentry *dentry, *dchild = NULL; 1242 struct dentry *dentry, *dchild = NULL;
1243 struct inode *dirp; 1243 struct inode *dirp;
@@ -1331,6 +1331,8 @@ nfsd_create_v3(struct svc_rqst *rqstp, struct svc_fh *fhp,
1331 host_err = vfs_create(dirp, dchild, iap->ia_mode, NULL); 1331 host_err = vfs_create(dirp, dchild, iap->ia_mode, NULL);
1332 if (host_err < 0) 1332 if (host_err < 0)
1333 goto out_nfserr; 1333 goto out_nfserr;
1334 if (created)
1335 *created = 1;
1334 1336
1335 if (EX_ISSYNC(fhp->fh_export)) { 1337 if (EX_ISSYNC(fhp->fh_export)) {
1336 err = nfserrno(nfsd_sync_dir(dentry)); 1338 err = nfserrno(nfsd_sync_dir(dentry));
diff --git a/include/linux/nfsd/nfsd.h b/include/linux/nfsd/nfsd.h
index eb231143d579..edb54c3171b3 100644
--- a/include/linux/nfsd/nfsd.h
+++ b/include/linux/nfsd/nfsd.h
@@ -89,7 +89,7 @@ __be32 nfsd_access(struct svc_rqst *, struct svc_fh *, u32 *, u32 *);
89__be32 nfsd_create_v3(struct svc_rqst *, struct svc_fh *, 89__be32 nfsd_create_v3(struct svc_rqst *, struct svc_fh *,
90 char *name, int len, struct iattr *attrs, 90 char *name, int len, struct iattr *attrs,
91 struct svc_fh *res, int createmode, 91 struct svc_fh *res, int createmode,
92 u32 *verifier, int *truncp); 92 u32 *verifier, int *truncp, int *created);
93__be32 nfsd_commit(struct svc_rqst *, struct svc_fh *, 93__be32 nfsd_commit(struct svc_rqst *, struct svc_fh *,
94 loff_t, unsigned long); 94 loff_t, unsigned long);
95#endif /* CONFIG_NFSD_V3 */ 95#endif /* CONFIG_NFSD_V3 */