aboutsummaryrefslogtreecommitdiff
path: root/sys/fs
diff options
context:
space:
mode:
Diffstat (limited to 'sys/fs')
-rw-r--r--sys/fs/nfs/nfs_commonsubs.c47
-rw-r--r--sys/fs/nfs/nfs_var.h2
-rw-r--r--sys/fs/nfs/nfsproto.h4
-rw-r--r--sys/fs/nfsclient/nfs_clrpcops.c3
-rw-r--r--sys/fs/nfsclient/nfs_clvnops.c8
-rw-r--r--sys/fs/nfsserver/nfs_nfsdport.c11
-rw-r--r--sys/fs/nfsserver/nfs_nfsdserv.c12
7 files changed, 68 insertions, 19 deletions
diff --git a/sys/fs/nfs/nfs_commonsubs.c b/sys/fs/nfs/nfs_commonsubs.c
index 7f5b29ca2085..8d506a5643a9 100644
--- a/sys/fs/nfs/nfs_commonsubs.c
+++ b/sys/fs/nfs/nfs_commonsubs.c
@@ -216,10 +216,17 @@ NFSD_VNET_DEFINE_STATIC(u_char *, nfsrv_dnsname) = NULL;
* marked 0 in this array, the code will still work, just not quite as
* efficiently.)
*/
-static int nfs_bigreply[NFSV42_NPROCS] = { 0, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0 };
+static bool nfs_bigreply[NFSV42_NPROCS] = {
+ [NFSPROC_GETACL] = true,
+ [NFSPROC_GETEXTATTR] = true,
+ [NFSPROC_LISTEXTATTR] = true,
+ [NFSPROC_LOOKUP] = true,
+ [NFSPROC_READ] = true,
+ [NFSPROC_READDIR] = true,
+ [NFSPROC_READDIRPLUS] = true,
+ [NFSPROC_READDS] = true,
+ [NFSPROC_READLINK] = true,
+};
/* local functions */
static int nfsrv_skipace(struct nfsrv_descript *nd, int *acesizep);
@@ -232,6 +239,8 @@ static int nfsrv_getrefstr(struct nfsrv_descript *, u_char **, u_char **,
static void nfsrv_refstrbigenough(int, u_char **, u_char **, int *);
static uint32_t vtonfsv4_type(struct vattr *);
static __enum_uint8(vtype) nfsv4tov_type(uint32_t, uint16_t *);
+static void nfsv4_setsequence(struct nfsmount *, struct nfsrv_descript *,
+ struct nfsclsession *, bool, struct ucred *);
static struct {
int op;
@@ -632,6 +641,7 @@ nfscl_fillsattr(struct nfsrv_descript *nd, struct vattr *vap,
if ((flags & NFSSATTR_FULL) && vap->va_size != VNOVAL)
NFSSETBIT_ATTRBIT(&attrbits, NFSATTRBIT_SIZE);
if ((flags & NFSSATTR_FULL) && vap->va_flags != VNOVAL) {
+ NFSSETBIT_ATTRBIT(&attrbits, NFSATTRBIT_ARCHIVE);
NFSSETBIT_ATTRBIT(&attrbits, NFSATTRBIT_HIDDEN);
NFSSETBIT_ATTRBIT(&attrbits, NFSATTRBIT_SYSTEM);
}
@@ -1663,9 +1673,17 @@ nfsv4_loadattr(struct nfsrv_descript *nd, vnode_t vp,
attrsum += NFSX_UNSIGNED;
break;
case NFSATTRBIT_ARCHIVE:
- NFSM_DISSECT(tl, u_int32_t *, NFSX_UNSIGNED);
- if (compare && !(*retcmpp))
- *retcmpp = NFSERR_ATTRNOTSUPP;
+ NFSM_DISSECT(tl, uint32_t *, NFSX_UNSIGNED);
+ if (compare) {
+ if (!(*retcmpp) && ((*tl == newnfs_true &&
+ (nap->na_flags & UF_ARCHIVE) == 0) ||
+ (*tl == newnfs_false &&
+ (nap->na_flags & UF_ARCHIVE) != 0)))
+ *retcmpp = NFSERR_NOTSAME;
+ } else if (nap != NULL) {
+ if (*tl == newnfs_true)
+ nap->na_flags |= UF_ARCHIVE;
+ }
attrsum += NFSX_UNSIGNED;
break;
case NFSATTRBIT_CANSETTIME:
@@ -2795,6 +2813,7 @@ nfsv4_fillattr(struct nfsrv_descript *nd, struct mount *mp, vnode_t vp,
if (!has_hiddensystem) {
NFSCLRBIT_ATTRBIT(&attrbits, NFSATTRBIT_HIDDEN);
NFSCLRBIT_ATTRBIT(&attrbits, NFSATTRBIT_SYSTEM);
+ NFSCLRBIT_ATTRBIT(&attrbits, NFSATTRBIT_ARCHIVE);
}
if (clone_blksize == 0)
NFSCLRBIT_ATTRBIT(&attrbits,
@@ -2879,6 +2898,14 @@ nfsv4_fillattr(struct nfsrv_descript *nd, struct mount *mp, vnode_t vp,
*tl = txdr_unsigned(NFSV4ACE_SUPTYPES);
retnum += NFSX_UNSIGNED;
break;
+ case NFSATTRBIT_ARCHIVE:
+ NFSM_BUILD(tl, uint32_t *, NFSX_UNSIGNED);
+ if ((vap->va_flags & UF_ARCHIVE) != 0)
+ *tl = newnfs_true;
+ else
+ *tl = newnfs_false;
+ retnum += NFSX_UNSIGNED;
+ break;
case NFSATTRBIT_CANSETTIME:
NFSM_BUILD(tl, u_int32_t *, NFSX_UNSIGNED);
if (fsinf.fs_properties & NFSV3FSINFO_CANSETTIME)
@@ -5021,9 +5048,9 @@ nfsv4_seqsess_cacherep(uint32_t slotid, struct nfsslot *slots, int repstat,
/*
* Generate the xdr for an NFSv4.1 Sequence Operation.
*/
-void
+static void
nfsv4_setsequence(struct nfsmount *nmp, struct nfsrv_descript *nd,
- struct nfsclsession *sep, int dont_replycache, struct ucred *cred)
+ struct nfsclsession *sep, bool dont_replycache, struct ucred *cred)
{
uint32_t *tl, slotseq = 0;
int error, maxslot, slotpos;
@@ -5054,7 +5081,7 @@ nfsv4_setsequence(struct nfsmount *nmp, struct nfsrv_descript *nd,
*tl++ = txdr_unsigned(slotseq);
*tl++ = txdr_unsigned(slotpos);
*tl++ = txdr_unsigned(maxslot);
- if (dont_replycache == 0)
+ if (!dont_replycache)
*tl = newnfs_true;
else
*tl = newnfs_false;
diff --git a/sys/fs/nfs/nfs_var.h b/sys/fs/nfs/nfs_var.h
index 61083ecf2d66..16a76c060e78 100644
--- a/sys/fs/nfs/nfs_var.h
+++ b/sys/fs/nfs/nfs_var.h
@@ -361,8 +361,6 @@ int nfsv4_getipaddr(struct nfsrv_descript *, struct sockaddr_in *,
int nfsv4_seqsession(uint32_t, uint32_t, uint32_t, struct nfsslot *,
struct mbuf **, uint16_t);
void nfsv4_seqsess_cacherep(uint32_t, struct nfsslot *, int, struct mbuf **);
-void nfsv4_setsequence(struct nfsmount *, struct nfsrv_descript *,
- struct nfsclsession *, int, struct ucred *);
int nfsv4_sequencelookup(struct nfsmount *, struct nfsclsession *, int *,
int *, uint32_t *, uint8_t *, bool);
void nfsv4_freeslot(struct nfsclsession *, int, bool);
diff --git a/sys/fs/nfs/nfsproto.h b/sys/fs/nfs/nfsproto.h
index d628108bdc1a..13fec8a102a3 100644
--- a/sys/fs/nfs/nfsproto.h
+++ b/sys/fs/nfs/nfsproto.h
@@ -1135,6 +1135,7 @@ struct nfsv3_sattr {
NFSATTRBM_RDATTRERROR | \
NFSATTRBM_ACL | \
NFSATTRBM_ACLSUPPORT | \
+ NFSATTRBM_ARCHIVE | \
NFSATTRBM_CANSETTIME | \
NFSATTRBM_CASEINSENSITIVE | \
NFSATTRBM_CASEPRESERVING | \
@@ -1217,6 +1218,7 @@ struct nfsv3_sattr {
#define NFSATTRBIT_SETABLE0 \
(NFSATTRBM_SIZE | \
NFSATTRBM_HIDDEN | \
+ NFSATTRBM_ARCHIVE | \
NFSATTRBM_ACL)
#define NFSATTRBIT_SETABLE1 \
(NFSATTRBM_MODE | \
@@ -1262,6 +1264,7 @@ struct nfsv3_sattr {
NFSATTRBM_CHANGE | \
NFSATTRBM_SIZE | \
NFSATTRBM_FSID | \
+ NFSATTRBM_ARCHIVE | \
NFSATTRBM_FILEID | \
NFSATTRBM_HIDDEN | \
NFSATTRBM_MAXREAD)
@@ -1298,6 +1301,7 @@ struct nfsv3_sattr {
NFSATTRBM_CHANGE | \
NFSATTRBM_SIZE | \
NFSATTRBM_FSID | \
+ NFSATTRBM_ARCHIVE | \
NFSATTRBM_FILEID | \
NFSATTRBM_HIDDEN | \
NFSATTRBM_MAXREAD)
diff --git a/sys/fs/nfsclient/nfs_clrpcops.c b/sys/fs/nfsclient/nfs_clrpcops.c
index ad9404a18fc8..d3b83eb8b94b 100644
--- a/sys/fs/nfsclient/nfs_clrpcops.c
+++ b/sys/fs/nfsclient/nfs_clrpcops.c
@@ -4162,9 +4162,12 @@ nfsrpc_readdirplus(vnode_t vp, struct uio *uiop, nfsuint64 *cookiep,
NFSATTRBIT_TIMECREATE))
NFSCLRBIT_ATTRBIT(&attrbits, NFSATTRBIT_TIMECREATE);
if (!NFSISSET_ATTRBIT(&dnp->n_vattr.na_suppattr,
+ NFSATTRBIT_ARCHIVE) ||
+ !NFSISSET_ATTRBIT(&dnp->n_vattr.na_suppattr,
NFSATTRBIT_HIDDEN) ||
!NFSISSET_ATTRBIT(&dnp->n_vattr.na_suppattr,
NFSATTRBIT_SYSTEM)) {
+ NFSCLRBIT_ATTRBIT(&attrbits, NFSATTRBIT_ARCHIVE);
NFSCLRBIT_ATTRBIT(&attrbits, NFSATTRBIT_HIDDEN);
NFSCLRBIT_ATTRBIT(&attrbits, NFSATTRBIT_SYSTEM);
}
diff --git a/sys/fs/nfsclient/nfs_clvnops.c b/sys/fs/nfsclient/nfs_clvnops.c
index e9ae91e046e7..f80cf30669ca 100644
--- a/sys/fs/nfsclient/nfs_clvnops.c
+++ b/sys/fs/nfsclient/nfs_clvnops.c
@@ -1081,12 +1081,14 @@ nfs_setattr(struct vop_setattr_args *ap)
#endif
/*
- * Only setting of UF_HIDDEN and UF_SYSTEM are supported and
+ * Only setting of UF_ARCHIVE, UF_HIDDEN and UF_SYSTEM are supported and
* only for NFSv4 servers that support them.
*/
nmp = VFSTONFS(vp->v_mount);
if (vap->va_flags != VNOVAL && (!NFSHASNFSV4(nmp) ||
- (vap->va_flags & ~(UF_HIDDEN | UF_SYSTEM)) != 0 ||
+ (vap->va_flags & ~(UF_ARCHIVE | UF_HIDDEN | UF_SYSTEM)) != 0 ||
+ ((vap->va_flags & UF_ARCHIVE) != 0 &&
+ !NFSISSET_ATTRBIT(&np->n_vattr.na_suppattr, NFSATTRBIT_ARCHIVE)) ||
((vap->va_flags & UF_HIDDEN) != 0 &&
!NFSISSET_ATTRBIT(&np->n_vattr.na_suppattr, NFSATTRBIT_HIDDEN)) ||
((vap->va_flags & UF_SYSTEM) != 0 &&
@@ -4835,6 +4837,8 @@ nfs_pathconf(struct vop_pathconf_args *ap)
break;
case _PC_HAS_HIDDENSYSTEM:
if (NFS_ISV4(vp) && NFSISSET_ATTRBIT(&np->n_vattr.na_suppattr,
+ NFSATTRBIT_ARCHIVE) &&
+ NFSISSET_ATTRBIT(&np->n_vattr.na_suppattr,
NFSATTRBIT_HIDDEN) &&
NFSISSET_ATTRBIT(&np->n_vattr.na_suppattr,
NFSATTRBIT_SYSTEM))
diff --git a/sys/fs/nfsserver/nfs_nfsdport.c b/sys/fs/nfsserver/nfs_nfsdport.c
index eb6ba285f8fe..9fe3f4426124 100644
--- a/sys/fs/nfsserver/nfs_nfsdport.c
+++ b/sys/fs/nfsserver/nfs_nfsdport.c
@@ -3193,7 +3193,8 @@ nfsv4_sattr(struct nfsrv_descript *nd, vnode_t vp, struct nfsvattr *nvap,
bitpos = NFSATTRBIT_MAX;
} else {
bitpos = 0;
- if (NFSISSET_ATTRBIT(attrbitp, NFSATTRBIT_HIDDEN) ||
+ if (NFSISSET_ATTRBIT(attrbitp, NFSATTRBIT_ARCHIVE) ||
+ NFSISSET_ATTRBIT(attrbitp, NFSATTRBIT_HIDDEN) ||
NFSISSET_ATTRBIT(attrbitp, NFSATTRBIT_SYSTEM))
nvap->na_flags = 0;
}
@@ -3226,9 +3227,11 @@ nfsv4_sattr(struct nfsrv_descript *nd, vnode_t vp, struct nfsvattr *nvap,
attrsum += aclsize;
break;
case NFSATTRBIT_ARCHIVE:
- NFSM_DISSECT(tl, u_int32_t *, NFSX_UNSIGNED);
- if (!nd->nd_repstat)
- nd->nd_repstat = NFSERR_ATTRNOTSUPP;
+ NFSM_DISSECT(tl, uint32_t *, NFSX_UNSIGNED);
+ if (nd->nd_repstat == 0) {
+ if (*tl == newnfs_true)
+ nvap->na_flags |= UF_ARCHIVE;
+ }
attrsum += NFSX_UNSIGNED;
break;
case NFSATTRBIT_HIDDEN:
diff --git a/sys/fs/nfsserver/nfs_nfsdserv.c b/sys/fs/nfsserver/nfs_nfsdserv.c
index 921ea4887af1..6f3447f26620 100644
--- a/sys/fs/nfsserver/nfs_nfsdserv.c
+++ b/sys/fs/nfsserver/nfs_nfsdserv.c
@@ -436,6 +436,7 @@ nfsrvd_setattr(struct nfsrv_descript *nd, __unused int isdgram,
/* For NFSv4, only va_uid and va_flags is used from nva2. */
NFSSETBIT_ATTRBIT(&retbits, NFSATTRBIT_OWNER);
+ NFSSETBIT_ATTRBIT(&retbits, NFSATTRBIT_ARCHIVE);
NFSSETBIT_ATTRBIT(&retbits, NFSATTRBIT_HIDDEN);
NFSSETBIT_ATTRBIT(&retbits, NFSATTRBIT_SYSTEM);
preat_ret = nfsvno_getattr(vp, &nva2, nd, p, 1, &retbits);
@@ -569,8 +570,15 @@ nfsrvd_setattr(struct nfsrv_descript *nd, __unused int isdgram,
}
}
if (!nd->nd_repstat &&
- (NFSISSET_ATTRBIT(&attrbits, NFSATTRBIT_HIDDEN) ||
+ (NFSISSET_ATTRBIT(&attrbits, NFSATTRBIT_ARCHIVE) ||
+ NFSISSET_ATTRBIT(&attrbits, NFSATTRBIT_HIDDEN) ||
NFSISSET_ATTRBIT(&attrbits, NFSATTRBIT_SYSTEM))) {
+ if (NFSISSET_ATTRBIT(&attrbits, NFSATTRBIT_ARCHIVE)) {
+ if ((nva.na_flags & UF_ARCHIVE) != 0)
+ oldflags |= UF_ARCHIVE;
+ else
+ oldflags &= ~UF_ARCHIVE;
+ }
if (NFSISSET_ATTRBIT(&attrbits, NFSATTRBIT_HIDDEN)) {
if ((nva.na_flags & UF_HIDDEN) != 0)
oldflags |= UF_HIDDEN;
@@ -588,6 +596,8 @@ nfsrvd_setattr(struct nfsrv_descript *nd, __unused int isdgram,
nd->nd_repstat = nfsvno_setattr(vp, &nva2, nd->nd_cred, p,
exp);
if (!nd->nd_repstat) {
+ if (NFSISSET_ATTRBIT(&attrbits, NFSATTRBIT_ARCHIVE))
+ NFSSETBIT_ATTRBIT(&retbits, NFSATTRBIT_ARCHIVE);
if (NFSISSET_ATTRBIT(&attrbits, NFSATTRBIT_HIDDEN))
NFSSETBIT_ATTRBIT(&retbits, NFSATTRBIT_HIDDEN);
if (NFSISSET_ATTRBIT(&attrbits, NFSATTRBIT_SYSTEM))