Skip to content

Commit a87e84b

Browse files
committed
Merge branch 'for-2.6.32' of git://linux-nfs.org/~bfields/linux
* 'for-2.6.32' of git://linux-nfs.org/~bfields/linux: (68 commits) nfsd4: nfsv4 clients should cross mountpoints nfsd: revise 4.1 status documentation sunrpc/cache: avoid variable over-loading in cache_defer_req sunrpc/cache: use list_del_init for the list_head entries in cache_deferred_req nfsd: return success for non-NFS4 nfs4_state_start nfsd41: Refactor create_client() nfsd41: modify nfsd4.1 backchannel to use new xprt class nfsd41: Backchannel: Implement cb_recall over NFSv4.1 nfsd41: Backchannel: cb_sequence callback nfsd41: Backchannel: Setup sequence information nfsd41: Backchannel: Server backchannel RPC wait queue nfsd41: Backchannel: Add sequence arguments to callback RPC arguments nfsd41: Backchannel: callback infrastructure nfsd4: use common rpc_cred for all callbacks nfsd4: allow nfs4 state startup to fail SUNRPC: Defer the auth_gss upcall when the RPC call is asynchronous nfsd4: fix null dereference creating nfsv4 callback client nfsd4: fix whitespace in NFSPROC4_CLNT_CB_NULL definition nfsd41: sunrpc: add new xprt class for nfsv4.1 backchannel sunrpc/cache: simplify cache_fresh_locked and cache_fresh_unlocked. ...
2 parents 342ff1a + 3c394dd commit a87e84b

42 files changed

Lines changed: 1640 additions & 897 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎Documentation/filesystems/nfs41-server.txt‎

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ the /proc/fs/nfsd/versions control file. Note that to write this
1111
control file, the nfsd service must be taken down. Use your user-mode
1212
nfs-utils to set this up; see rpc.nfsd(8)
1313

14+
(Warning: older servers will interpret "+4.1" and "-4.1" as "+4" and
15+
"-4", respectively. Therefore, code meant to work on both new and old
16+
kernels must turn 4.1 on or off *before* turning support for version 4
17+
on or off; rpc.nfsd does this correctly.)
18+
1419
The NFSv4 minorversion 1 (NFSv4.1) implementation in nfsd is based
1520
on the latest NFSv4.1 Internet Draft:
1621
http://tools.ietf.org/html/draft-ietf-nfsv4-minorversion1-29
@@ -25,6 +30,49 @@ are still under development out of tree.
2530
See http://wiki.linux-nfs.org/wiki/index.php/PNFS_prototype_design
2631
for more information.
2732

33+
The current implementation is intended for developers only: while it
34+
does support ordinary file operations on clients we have tested against
35+
(including the linux client), it is incomplete in ways which may limit
36+
features unexpectedly, cause known bugs in rare cases, or cause
37+
interoperability problems with future clients. Known issues:
38+
39+
- gss support is questionable: currently mounts with kerberos
40+
from a linux client are possible, but we aren't really
41+
conformant with the spec (for example, we don't use kerberos
42+
on the backchannel correctly).
43+
- no trunking support: no clients currently take advantage of
44+
trunking, but this is a mandatory failure, and its use is
45+
recommended to clients in a number of places. (E.g. to ensure
46+
timely renewal in case an existing connection's retry timeouts
47+
have gotten too long; see section 8.3 of the draft.)
48+
Therefore, lack of this feature may cause future clients to
49+
fail.
50+
- Incomplete backchannel support: incomplete backchannel gss
51+
support and no support for BACKCHANNEL_CTL mean that
52+
callbacks (hence delegations and layouts) may not be
53+
available and clients confused by the incomplete
54+
implementation may fail.
55+
- Server reboot recovery is unsupported; if the server reboots,
56+
clients may fail.
57+
- We do not support SSV, which provides security for shared
58+
client-server state (thus preventing unauthorized tampering
59+
with locks and opens, for example). It is mandatory for
60+
servers to support this, though no clients use it yet.
61+
- Mandatory operations which we do not support, such as
62+
DESTROY_CLIENTID, FREE_STATEID, SECINFO_NO_NAME, and
63+
TEST_STATEID, are not currently used by clients, but will be
64+
(and the spec recommends their uses in common cases), and
65+
clients should not be expected to know how to recover from the
66+
case where they are not supported. This will eventually cause
67+
interoperability failures.
68+
69+
In addition, some limitations are inherited from the current NFSv4
70+
implementation:
71+
72+
- Incomplete delegation enforcement: if a file is renamed or
73+
unlinked, a client holding a delegation may continue to
74+
indefinitely allow opens of the file under the old name.
75+
2876
The table below, taken from the NFSv4.1 document, lists
2977
the operations that are mandatory to implement (REQ), optional
3078
(OPT), and NFSv4.0 operations that are required not to implement (MNI)
@@ -142,6 +190,12 @@ NS*| CB_WANTS_CANCELLED | OPT | FDELG, | Section 20.10 |
142190

143191
Implementation notes:
144192

193+
DELEGPURGE:
194+
* mandatory only for servers that support CLAIM_DELEGATE_PREV and/or
195+
CLAIM_DELEG_PREV_FH (which allows clients to keep delegations that
196+
persist across client reboots). Thus we need not implement this for
197+
now.
198+
145199
EXCHANGE_ID:
146200
* only SP4_NONE state protection supported
147201
* implementation ids are ignored

‎fs/lockd/clntlock.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ __be32 nlmclnt_grant(const struct sockaddr *addr, const struct nlm_lock *lock)
166166
*/
167167
if (fl_blocked->fl_u.nfs_fl.owner->pid != lock->svid)
168168
continue;
169-
if (!nlm_cmp_addr(nlm_addr(block->b_host), addr))
169+
if (!rpc_cmp_addr(nlm_addr(block->b_host), addr))
170170
continue;
171171
if (nfs_compare_fh(NFS_FH(fl_blocked->fl_file->f_path.dentry->d_inode) ,fh) != 0)
172172
continue;

‎fs/lockd/host.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ static struct nlm_host *nlm_lookup_host(struct nlm_lookup_host_info *ni)
111111
*/
112112
chain = &nlm_hosts[nlm_hash_address(ni->sap)];
113113
hlist_for_each_entry(host, pos, chain, h_hash) {
114-
if (!nlm_cmp_addr(nlm_addr(host), ni->sap))
114+
if (!rpc_cmp_addr(nlm_addr(host), ni->sap))
115115
continue;
116116

117117
/* See if we have an NSM handle for this client */
@@ -125,7 +125,7 @@ static struct nlm_host *nlm_lookup_host(struct nlm_lookup_host_info *ni)
125125
if (host->h_server != ni->server)
126126
continue;
127127
if (ni->server &&
128-
!nlm_cmp_addr(nlm_srcaddr(host), ni->src_sap))
128+
!rpc_cmp_addr(nlm_srcaddr(host), ni->src_sap))
129129
continue;
130130

131131
/* Move to head of hash chain. */

‎fs/lockd/mon.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ static struct nsm_handle *nsm_lookup_addr(const struct sockaddr *sap)
209209
struct nsm_handle *nsm;
210210

211211
list_for_each_entry(nsm, &nsm_handles, sm_link)
212-
if (nlm_cmp_addr(nsm_addr(nsm), sap))
212+
if (rpc_cmp_addr(nsm_addr(nsm), sap))
213213
return nsm;
214214
return NULL;
215215
}

‎fs/lockd/svcsubs.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,7 @@ EXPORT_SYMBOL_GPL(nlmsvc_unlock_all_by_sb);
417417
static int
418418
nlmsvc_match_ip(void *datap, struct nlm_host *host)
419419
{
420-
return nlm_cmp_addr(nlm_srcaddr(host), datap);
420+
return rpc_cmp_addr(nlm_srcaddr(host), datap);
421421
}
422422

423423
/**

‎fs/nfsd/export.c‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1341,6 +1341,8 @@ exp_pseudoroot(struct svc_rqst *rqstp, struct svc_fh *fhp)
13411341
if (rv)
13421342
goto out;
13431343
rv = check_nfsd_access(exp, rqstp);
1344+
if (rv)
1345+
fh_put(fhp);
13441346
out:
13451347
exp_put(exp);
13461348
return rv;

‎fs/nfsd/nfs3xdr.c‎

Lines changed: 36 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -814,17 +814,6 @@ encode_entry_baggage(struct nfsd3_readdirres *cd, __be32 *p, const char *name,
814814
return p;
815815
}
816816

817-
static __be32 *
818-
encode_entryplus_baggage(struct nfsd3_readdirres *cd, __be32 *p,
819-
struct svc_fh *fhp)
820-
{
821-
p = encode_post_op_attr(cd->rqstp, p, fhp);
822-
*p++ = xdr_one; /* yes, a file handle follows */
823-
p = encode_fh(p, fhp);
824-
fh_put(fhp);
825-
return p;
826-
}
827-
828817
static int
829818
compose_entry_fh(struct nfsd3_readdirres *cd, struct svc_fh *fhp,
830819
const char *name, int namlen)
@@ -836,29 +825,54 @@ compose_entry_fh(struct nfsd3_readdirres *cd, struct svc_fh *fhp,
836825
dparent = cd->fh.fh_dentry;
837826
exp = cd->fh.fh_export;
838827

839-
fh_init(fhp, NFS3_FHSIZE);
840828
if (isdotent(name, namlen)) {
841829
if (namlen == 2) {
842830
dchild = dget_parent(dparent);
843831
if (dchild == dparent) {
844832
/* filesystem root - cannot return filehandle for ".." */
845833
dput(dchild);
846-
return 1;
834+
return -ENOENT;
847835
}
848836
} else
849837
dchild = dget(dparent);
850838
} else
851839
dchild = lookup_one_len(name, dparent, namlen);
852840
if (IS_ERR(dchild))
853-
return 1;
854-
if (d_mountpoint(dchild) ||
855-
fh_compose(fhp, exp, dchild, &cd->fh) != 0 ||
856-
!dchild->d_inode)
857-
rv = 1;
841+
return -ENOENT;
842+
rv = -ENOENT;
843+
if (d_mountpoint(dchild))
844+
goto out;
845+
rv = fh_compose(fhp, exp, dchild, &cd->fh);
846+
if (rv)
847+
goto out;
848+
if (!dchild->d_inode)
849+
goto out;
850+
rv = 0;
851+
out:
858852
dput(dchild);
859853
return rv;
860854
}
861855

856+
__be32 *encode_entryplus_baggage(struct nfsd3_readdirres *cd, __be32 *p, const char *name, int namlen)
857+
{
858+
struct svc_fh fh;
859+
int err;
860+
861+
fh_init(&fh, NFS3_FHSIZE);
862+
err = compose_entry_fh(cd, &fh, name, namlen);
863+
if (err) {
864+
*p++ = 0;
865+
*p++ = 0;
866+
goto out;
867+
}
868+
p = encode_post_op_attr(cd->rqstp, p, &fh);
869+
*p++ = xdr_one; /* yes, a file handle follows */
870+
p = encode_fh(p, &fh);
871+
out:
872+
fh_put(&fh);
873+
return p;
874+
}
875+
862876
/*
863877
* Encode a directory entry. This one works for both normal readdir
864878
* and readdirplus.
@@ -929,16 +943,8 @@ encode_entry(struct readdir_cd *ccd, const char *name, int namlen,
929943

930944
p = encode_entry_baggage(cd, p, name, namlen, ino);
931945

932-
/* throw in readdirplus baggage */
933-
if (plus) {
934-
struct svc_fh fh;
935-
936-
if (compose_entry_fh(cd, &fh, name, namlen) > 0) {
937-
*p++ = 0;
938-
*p++ = 0;
939-
} else
940-
p = encode_entryplus_baggage(cd, p, &fh);
941-
}
946+
if (plus)
947+
p = encode_entryplus_baggage(cd, p, name, namlen);
942948
num_entry_words = p - cd->buffer;
943949
} else if (cd->rqstp->rq_respages[pn+1] != NULL) {
944950
/* temporarily encode entry into next page, then move back to
@@ -951,17 +957,8 @@ encode_entry(struct readdir_cd *ccd, const char *name, int namlen,
951957

952958
p1 = encode_entry_baggage(cd, p1, name, namlen, ino);
953959

954-
/* throw in readdirplus baggage */
955-
if (plus) {
956-
struct svc_fh fh;
957-
958-
if (compose_entry_fh(cd, &fh, name, namlen) > 0) {
959-
/* zero out the filehandle */
960-
*p1++ = 0;
961-
*p1++ = 0;
962-
} else
963-
p1 = encode_entryplus_baggage(cd, p1, &fh);
964-
}
960+
if (plus)
961+
p = encode_entryplus_baggage(cd, p1, name, namlen);
965962

966963
/* determine entry word length and lengths to go in pages */
967964
num_entry_words = p1 - tmp;

‎fs/nfsd/nfs4acl.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ _posix_to_nfsv4_one(struct posix_acl *pacl, struct nfs4_acl *acl,
321321
deny = ~pas.group & pas.other;
322322
if (deny) {
323323
ace->type = NFS4_ACE_ACCESS_DENIED_ACE_TYPE;
324-
ace->flag = eflag | NFS4_ACE_IDENTIFIER_GROUP;
324+
ace->flag = eflag;
325325
ace->access_mask = deny_mask_from_posix(deny, flags);
326326
ace->whotype = NFS4_ACL_WHO_GROUP;
327327
ace++;
@@ -335,7 +335,7 @@ _posix_to_nfsv4_one(struct posix_acl *pacl, struct nfs4_acl *acl,
335335
if (deny) {
336336
ace->type = NFS4_ACE_ACCESS_DENIED_ACE_TYPE;
337337
ace->flag = eflag | NFS4_ACE_IDENTIFIER_GROUP;
338-
ace->access_mask = mask_from_posix(deny, flags);
338+
ace->access_mask = deny_mask_from_posix(deny, flags);
339339
ace->whotype = NFS4_ACL_WHO_NAMED;
340340
ace->who = pa->e_id;
341341
ace++;

0 commit comments

Comments
 (0)