Fix the NFS server so that it sets va_birthtime.
r362490 marked that the NFSv4 attribute TimeCreate (va_birthtime) is supported, but it did not change the NFS server code to actually do it. As such, errors could occur when unrolling a tarball onto an NFSv4 mounted volume, since setting TimeCreate would fail with a NFSERR_ATTRNOTSUPP reply. This patch fixes the server so that it does TimeCreate and also makes sure that TimeCreate will not be set for a DS file for a pNFS server. A separate commit will add a check to the NFSv4 client for support of the TimeCreate attribute before attempting to set it, to avoid a problem when mounting a server that does not support the attribute. The failures will still occur for r362490 or later kernels that do not have this patch, since they indicate support for the attribute, but do not actually support the attribute.
This commit is contained in:
parent
a450ecfdbd
commit
2de592f6e1
@ -459,6 +459,7 @@ nfsvno_setattr(struct vnode *vp, struct nfsvattr *nvap, struct ucred *cred,
|
||||
{
|
||||
u_quad_t savsize = 0;
|
||||
int error, savedit;
|
||||
time_t savbtime;
|
||||
|
||||
/*
|
||||
* If this is an exported file system and a pNFS service is running,
|
||||
@ -490,9 +491,13 @@ nfsvno_setattr(struct vnode *vp, struct nfsvattr *nvap, struct ucred *cred,
|
||||
nvap->na_vattr.va_mode != (mode_t)VNOVAL ||
|
||||
nvap->na_vattr.va_atime.tv_sec != VNOVAL ||
|
||||
nvap->na_vattr.va_mtime.tv_sec != VNOVAL)) {
|
||||
/* Never modify birthtime on a DS file. */
|
||||
savbtime = nvap->na_vattr.va_birthtime.tv_sec;
|
||||
nvap->na_vattr.va_birthtime.tv_sec = VNOVAL;
|
||||
/* For a pNFS server, set the attributes on the DS file. */
|
||||
error = nfsrv_proxyds(vp, 0, 0, cred, p, NFSPROC_SETATTR,
|
||||
NULL, NULL, NULL, nvap, NULL, NULL, 0, NULL);
|
||||
nvap->na_vattr.va_birthtime.tv_sec = savbtime;
|
||||
if (error == ENOENT)
|
||||
error = 0;
|
||||
}
|
||||
@ -2914,8 +2919,7 @@ nfsv4_sattr(struct nfsrv_descript *nd, vnode_t vp, struct nfsvattr *nvap,
|
||||
break;
|
||||
case NFSATTRBIT_TIMECREATE:
|
||||
NFSM_DISSECT(tl, u_int32_t *, NFSX_V4TIME);
|
||||
if (!nd->nd_repstat)
|
||||
nd->nd_repstat = NFSERR_ATTRNOTSUPP;
|
||||
fxdr_nfsv4time(tl, &nvap->na_btime);
|
||||
attrsum += NFSX_V4TIME;
|
||||
break;
|
||||
case NFSATTRBIT_TIMEMODIFYSET:
|
||||
|
Loading…
x
Reference in New Issue
Block a user