Skip to content

Commit f72caf7

Browse files
committed
Merge branch 'for-2.6.35' of git://linux-nfs.org/~bfields/linux
* 'for-2.6.35' of git://linux-nfs.org/~bfields/linux: (45 commits) Revert "nfsd4: distinguish expired from stale stateids" nfsd: safer initialization order in find_file() nfs4: minor callback code simplification, comment NFSD: don't report compiled-out versions as present nfsd4: implement reclaim_complete nfsd4: nfsd4_destroy_session must set callback client under the state lock nfsd4: keep a reference count on client while in use nfsd4: mark_client_expired nfsd4: introduce nfs4_client.cl_refcount nfsd4: refactor expire_client nfsd4: extend the client_lock to cover cl_lru nfsd4: use list_move in move_to_confirmed nfsd4: fold release_session into expire_client nfsd4: rename sessionid_lock to client_lock nfsd4: fix bare destroy_session null dereference nfsd4: use local variable in nfs4svc_encode_compoundres nfsd: further comment typos sunrpc: centralise most calls to svc_xprt_received nfsd4: fix unlikely race in session replay case nfsd4: fix filehandle comment ...
2 parents 6a6be47 + e4e83ea commit f72caf7

File tree

18 files changed

+510
-343
lines changed

18 files changed

+510
-343
lines changed

Documentation/filesystems/nfs/nfs41-server.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ NS*| OPENATTR | OPT | | Section 18.17 |
137137
| READ | REQ | | Section 18.22 |
138138
| READDIR | REQ | | Section 18.23 |
139139
| READLINK | OPT | | Section 18.24 |
140-
NS | RECLAIM_COMPLETE | REQ | | Section 18.51 |
140+
| RECLAIM_COMPLETE | REQ | | Section 18.51 |
141141
| RELEASE_LOCKOWNER | MNI | | N/A |
142142
| REMOVE | REQ | | Section 18.25 |
143143
| RENAME | REQ | | Section 18.26 |

fs/nfsd/export.c

Lines changed: 25 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -259,17 +259,24 @@ static struct cache_detail svc_expkey_cache = {
259259
.alloc = expkey_alloc,
260260
};
261261

262-
static struct svc_expkey *
263-
svc_expkey_lookup(struct svc_expkey *item)
262+
static int
263+
svc_expkey_hash(struct svc_expkey *item)
264264
{
265-
struct cache_head *ch;
266265
int hash = item->ek_fsidtype;
267266
char * cp = (char*)item->ek_fsid;
268267
int len = key_len(item->ek_fsidtype);
269268

270269
hash ^= hash_mem(cp, len, EXPKEY_HASHBITS);
271270
hash ^= hash_ptr(item->ek_client, EXPKEY_HASHBITS);
272271
hash &= EXPKEY_HASHMASK;
272+
return hash;
273+
}
274+
275+
static struct svc_expkey *
276+
svc_expkey_lookup(struct svc_expkey *item)
277+
{
278+
struct cache_head *ch;
279+
int hash = svc_expkey_hash(item);
273280

274281
ch = sunrpc_cache_lookup(&svc_expkey_cache, &item->h,
275282
hash);
@@ -283,13 +290,7 @@ static struct svc_expkey *
283290
svc_expkey_update(struct svc_expkey *new, struct svc_expkey *old)
284291
{
285292
struct cache_head *ch;
286-
int hash = new->ek_fsidtype;
287-
char * cp = (char*)new->ek_fsid;
288-
int len = key_len(new->ek_fsidtype);
289-
290-
hash ^= hash_mem(cp, len, EXPKEY_HASHBITS);
291-
hash ^= hash_ptr(new->ek_client, EXPKEY_HASHBITS);
292-
hash &= EXPKEY_HASHMASK;
293+
int hash = svc_expkey_hash(new);
293294

294295
ch = sunrpc_cache_update(&svc_expkey_cache, &new->h,
295296
&old->h, hash);
@@ -738,14 +739,22 @@ struct cache_detail svc_export_cache = {
738739
.alloc = svc_export_alloc,
739740
};
740741

741-
static struct svc_export *
742-
svc_export_lookup(struct svc_export *exp)
742+
static int
743+
svc_export_hash(struct svc_export *exp)
743744
{
744-
struct cache_head *ch;
745745
int hash;
746+
746747
hash = hash_ptr(exp->ex_client, EXPORT_HASHBITS);
747748
hash ^= hash_ptr(exp->ex_path.dentry, EXPORT_HASHBITS);
748749
hash ^= hash_ptr(exp->ex_path.mnt, EXPORT_HASHBITS);
750+
return hash;
751+
}
752+
753+
static struct svc_export *
754+
svc_export_lookup(struct svc_export *exp)
755+
{
756+
struct cache_head *ch;
757+
int hash = svc_export_hash(exp);
749758

750759
ch = sunrpc_cache_lookup(&svc_export_cache, &exp->h,
751760
hash);
@@ -759,10 +768,7 @@ static struct svc_export *
759768
svc_export_update(struct svc_export *new, struct svc_export *old)
760769
{
761770
struct cache_head *ch;
762-
int hash;
763-
hash = hash_ptr(old->ex_client, EXPORT_HASHBITS);
764-
hash ^= hash_ptr(old->ex_path.dentry, EXPORT_HASHBITS);
765-
hash ^= hash_ptr(old->ex_path.mnt, EXPORT_HASHBITS);
771+
int hash = svc_export_hash(old);
766772

767773
ch = sunrpc_cache_update(&svc_export_cache, &new->h,
768774
&old->h,
@@ -1071,9 +1077,9 @@ exp_export(struct nfsctl_export *nxp)
10711077
err = 0;
10721078
finish:
10731079
kfree(new.ex_pathname);
1074-
if (exp)
1080+
if (!IS_ERR_OR_NULL(exp))
10751081
exp_put(exp);
1076-
if (fsid_key && !IS_ERR(fsid_key))
1082+
if (!IS_ERR_OR_NULL(fsid_key))
10771083
cache_put(&fsid_key->h, &svc_expkey_cache);
10781084
path_put(&path);
10791085
out_put_clp:

0 commit comments

Comments
 (0)