/* Now create the file and set attributes */
nfserr = nfsd_create_v3(rqstp, dirfhp, argp->name, argp->len,
attr, newfhp,
- argp->createmode, argp->verf);
+ argp->createmode, argp->verf, NULL);
RETURN_STATUS(nfserr);
}
int
nfsd_create_v3(struct svc_rqst *rqstp, struct svc_fh *fhp,
char *fname, int flen, struct iattr *iap,
- struct svc_fh *resfhp, int createmode, u32 *verifier)
+ struct svc_fh *resfhp, int createmode, u32 *verifier,
+ int *truncp)
{
struct dentry *dentry, *dchild;
struct inode *dirp;
case NFS3_CREATE_UNCHECKED:
if (! S_ISREG(dchild->d_inode->i_mode))
err = nfserr_exist;
+ else if (truncp) {
+ /* in nfsv4, we need to treat this case a little
+ * differently. we don't want to truncate the
+ * file now; this would be wrong if the OPEN
+ * fails for some other reason. furthermore,
+ * if the size is nonzero, we should ignore it
+ * according to spec!
+ */
+ *truncp = (iap->ia_valid & ATTR_SIZE) && !iap->ia_size;
+ }
else {
iap->ia_valid &= ATTR_SIZE;
goto set_attr;
int nfsd_create_v3(struct svc_rqst *, struct svc_fh *,
char *name, int len, struct iattr *attrs,
struct svc_fh *res, int createmode,
- u32 *verifier);
+ u32 *verifier, int *truncp);
int nfsd_commit(struct svc_rqst *, struct svc_fh *,
off_t, unsigned long);
#endif /* CONFIG_NFSD_V3 */