Re: linux-next: manual merge of the nfsd tree with Linus' tree

2015-07-29 Thread J. Bruce Fields
On Wed, Jul 29, 2015 at 09:35:11PM -0400, Trond Myklebust wrote:
> Hi Stephen,
> 
> On Wed, Jul 29, 2015 at 9:23 PM, Stephen Rothwell  
> wrote:
> > Hi all,
> >
> > Today's linux-next merge of the nfsd tree got a conflict in:
> >
> >   fs/nfs/nfs42proc.c
> >
> > between commit:
> >
> >   bdcc2cd14e4e ("NFSv4.2: handle NFS-specific llseek errors")
> >
> > from Linus' tree and commit:
> >
> >   0183ae17c741 ("NFSv4.2: handle NFS-specific llseek errors")
> >
> > from the nfsd tree.
> >
> > The only difference here is that _nfs42_proc_llseek is static in the
> > former, so I used that.

Whoops, thanks, I shouldn't have even had that one in my tree

> Yes, I snuck that declaration into the patch since it was obvious that
> we would never want to export _nfs42_proc_llseek(), and because
> "sparse" complained. Apologies if that caused a conflict...

I actually noticed that, then noticed a bunch of other stuff there had
the same problem, then started to make a patch to fix all those in one
fell swoop, then decided I was being annoying and dropped it.

Um.

--b.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: linux-next: manual merge of the nfsd tree with Linus' tree

2015-07-29 Thread Trond Myklebust
Hi Stephen,

On Wed, Jul 29, 2015 at 9:23 PM, Stephen Rothwell  wrote:
> Hi all,
>
> Today's linux-next merge of the nfsd tree got a conflict in:
>
>   fs/nfs/nfs42proc.c
>
> between commit:
>
>   bdcc2cd14e4e ("NFSv4.2: handle NFS-specific llseek errors")
>
> from Linus' tree and commit:
>
>   0183ae17c741 ("NFSv4.2: handle NFS-specific llseek errors")
>
> from the nfsd tree.
>
> The only difference here is that _nfs42_proc_llseek is static in the
> former, so I used that.
>

Yes, I snuck that declaration into the patch since it was obvious that
we would never want to export _nfs42_proc_llseek(), and because
"sparse" complained. Apologies if that caused a conflict...

Cheers
  Trond
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


linux-next: manual merge of the nfsd tree with Linus' tree

2015-07-29 Thread Stephen Rothwell
Hi all,

Today's linux-next merge of the nfsd tree got a conflict in:

  fs/nfs/nfs42proc.c

between commit:

  bdcc2cd14e4e ("NFSv4.2: handle NFS-specific llseek errors")

from Linus' tree and commit:

  0183ae17c741 ("NFSv4.2: handle NFS-specific llseek errors")

from the nfsd tree.

The only difference here is that _nfs42_proc_llseek is static in the
former, so I used that.

-- 
Cheers,
Stephen Rothwells...@canb.auug.org.au
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


linux-next: manual merge of the nfsd tree with Linus' tree

2015-07-29 Thread Stephen Rothwell
Hi all,

Today's linux-next merge of the nfsd tree got a conflict in:

  fs/nfs/nfs42proc.c

between commit:

  bdcc2cd14e4e (NFSv4.2: handle NFS-specific llseek errors)

from Linus' tree and commit:

  0183ae17c741 (NFSv4.2: handle NFS-specific llseek errors)

from the nfsd tree.

The only difference here is that _nfs42_proc_llseek is static in the
former, so I used that.

-- 
Cheers,
Stephen Rothwells...@canb.auug.org.au
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: linux-next: manual merge of the nfsd tree with Linus' tree

2015-07-29 Thread Trond Myklebust
Hi Stephen,

On Wed, Jul 29, 2015 at 9:23 PM, Stephen Rothwell s...@canb.auug.org.au wrote:
 Hi all,

 Today's linux-next merge of the nfsd tree got a conflict in:

   fs/nfs/nfs42proc.c

 between commit:

   bdcc2cd14e4e (NFSv4.2: handle NFS-specific llseek errors)

 from Linus' tree and commit:

   0183ae17c741 (NFSv4.2: handle NFS-specific llseek errors)

 from the nfsd tree.

 The only difference here is that _nfs42_proc_llseek is static in the
 former, so I used that.


Yes, I snuck that declaration into the patch since it was obvious that
we would never want to export _nfs42_proc_llseek(), and because
sparse complained. Apologies if that caused a conflict...

Cheers
  Trond
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: linux-next: manual merge of the nfsd tree with Linus' tree

2015-07-29 Thread J. Bruce Fields
On Wed, Jul 29, 2015 at 09:35:11PM -0400, Trond Myklebust wrote:
 Hi Stephen,
 
 On Wed, Jul 29, 2015 at 9:23 PM, Stephen Rothwell s...@canb.auug.org.au 
 wrote:
  Hi all,
 
  Today's linux-next merge of the nfsd tree got a conflict in:
 
fs/nfs/nfs42proc.c
 
  between commit:
 
bdcc2cd14e4e (NFSv4.2: handle NFS-specific llseek errors)
 
  from Linus' tree and commit:
 
0183ae17c741 (NFSv4.2: handle NFS-specific llseek errors)
 
  from the nfsd tree.
 
  The only difference here is that _nfs42_proc_llseek is static in the
  former, so I used that.

Whoops, thanks, I shouldn't have even had that one in my tree

 Yes, I snuck that declaration into the patch since it was obvious that
 we would never want to export _nfs42_proc_llseek(), and because
 sparse complained. Apologies if that caused a conflict...

I actually noticed that, then noticed a bunch of other stuff there had
the same problem, then started to make a patch to fix all those in one
fell swoop, then decided I was being annoying and dropped it.

Um.

--b.
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


linux-next: manual merge of the nfsd tree with Linus' tree

2014-01-28 Thread Stephen Rothwell
Hi all,

Today's linux-next merge of the nfsd tree got a conflict in
fs/nfsd/nfs4acl.c between commit 4ac7249ea5a0 ("nfsd: use get_acl and
->set_acl") from Linus' tree and commit 3554116d3aae ("nfsd4: simplify
xdr encoding of nfsv4 names") from the nfsd tree.

I fixed it up (see below) and can carry the fix as necessary (no action
is required).

-- 
Cheers,
Stephen Rothwells...@canb.auug.org.au

diff --cc fs/nfsd/nfs4acl.c
index 649ad7cf2204,eea24c9a561d..
--- a/fs/nfsd/nfs4acl.c
+++ b/fs/nfsd/nfs4acl.c
@@@ -37,13 -37,9 +37,14 @@@
  #include 
  #include 
  #include 
 +#include "nfsfh.h"
+ #include "nfsd.h"
  #include "acl.h"
 +#include "vfs.h"
  
 +#define NFS4_ACL_TYPE_DEFAULT 0x01
 +#define NFS4_ACL_DIR  0x02
 +#define NFS4_ACL_OWNER0x04
  
  /* mode bit translations: */
  #define NFS4_READ_MODE (NFS4_ACE_READ_DATA)
@@@ -916,17 -849,26 +917,22 @@@ nfs4_acl_get_whotype(char *p, u32 len
return NFS4_ACL_WHO_NAMED;
  }
  
- int
- nfs4_acl_write_who(int who, char *p)
+ __be32 nfs4_acl_write_who(int who, __be32 **p, int *len)
  {
int i;
+   int bytes;
  
for (i = 0; i < ARRAY_SIZE(s2t_map); i++) {
-   if (s2t_map[i].type == who) {
-   memcpy(p, s2t_map[i].string, s2t_map[i].stringlen);
-   return s2t_map[i].stringlen;
-   }
+   if (s2t_map[i].type != who)
+   continue;
+   bytes = 4 + (XDR_QUADLEN(s2t_map[i].stringlen) << 2);
+   if (bytes > *len)
+   return nfserr_resource;
+   *p = xdr_encode_opaque(*p, s2t_map[i].string,
+   s2t_map[i].stringlen);
+   *len -= bytes;
+   return 0;
}
-   BUG();
+   WARN_ON_ONCE(1);
return -1;
  }
 -
 -EXPORT_SYMBOL(nfs4_acl_new);
 -EXPORT_SYMBOL(nfs4_acl_get_whotype);
 -EXPORT_SYMBOL(nfs4_acl_write_who);


pgp2UwckCXLPJ.pgp
Description: PGP signature


linux-next: manual merge of the nfsd tree with Linus' tree

2014-01-28 Thread Stephen Rothwell
Hi all,

Today's linux-next merge of the nfsd tree got a conflict in
fs/nfsd/nfs4acl.c between commit 4ac7249ea5a0 (nfsd: use get_acl and
-set_acl) from Linus' tree and commit 3554116d3aae (nfsd4: simplify
xdr encoding of nfsv4 names) from the nfsd tree.

I fixed it up (see below) and can carry the fix as necessary (no action
is required).

-- 
Cheers,
Stephen Rothwells...@canb.auug.org.au

diff --cc fs/nfsd/nfs4acl.c
index 649ad7cf2204,eea24c9a561d..
--- a/fs/nfsd/nfs4acl.c
+++ b/fs/nfsd/nfs4acl.c
@@@ -37,13 -37,9 +37,14 @@@
  #include linux/slab.h
  #include linux/nfs_fs.h
  #include linux/export.h
 +#include nfsfh.h
+ #include nfsd.h
  #include acl.h
 +#include vfs.h
  
 +#define NFS4_ACL_TYPE_DEFAULT 0x01
 +#define NFS4_ACL_DIR  0x02
 +#define NFS4_ACL_OWNER0x04
  
  /* mode bit translations: */
  #define NFS4_READ_MODE (NFS4_ACE_READ_DATA)
@@@ -916,17 -849,26 +917,22 @@@ nfs4_acl_get_whotype(char *p, u32 len
return NFS4_ACL_WHO_NAMED;
  }
  
- int
- nfs4_acl_write_who(int who, char *p)
+ __be32 nfs4_acl_write_who(int who, __be32 **p, int *len)
  {
int i;
+   int bytes;
  
for (i = 0; i  ARRAY_SIZE(s2t_map); i++) {
-   if (s2t_map[i].type == who) {
-   memcpy(p, s2t_map[i].string, s2t_map[i].stringlen);
-   return s2t_map[i].stringlen;
-   }
+   if (s2t_map[i].type != who)
+   continue;
+   bytes = 4 + (XDR_QUADLEN(s2t_map[i].stringlen)  2);
+   if (bytes  *len)
+   return nfserr_resource;
+   *p = xdr_encode_opaque(*p, s2t_map[i].string,
+   s2t_map[i].stringlen);
+   *len -= bytes;
+   return 0;
}
-   BUG();
+   WARN_ON_ONCE(1);
return -1;
  }
 -
 -EXPORT_SYMBOL(nfs4_acl_new);
 -EXPORT_SYMBOL(nfs4_acl_get_whotype);
 -EXPORT_SYMBOL(nfs4_acl_write_who);


pgp2UwckCXLPJ.pgp
Description: PGP signature


linux-next: manual merge of the nfsd tree with Linus' tree

2013-04-02 Thread Stephen Rothwell
Hi,

Today's linux-next merge of the nfsd tree got a conflict in
fs/nfsd/nfscache.c between commit a517b608fa3d ("nfsd: only unhash DRC
entries that are in the hashtable") from Linus' tree and commit
559aa350587e ("nfsd: track memory utilization in the DRC") from the nfsd
tree.

I fixed it up (see below) and can carry the fix as necessary (no action
is required).

-- 
Cheers,
Stephen Rothwells...@canb.auug.org.au

diff --cc fs/nfsd/nfscache.c
index ca05f6d,3af1767..000
--- a/fs/nfsd/nfscache.c
+++ b/fs/nfsd/nfscache.c
@@@ -100,12 -130,14 +130,15 @@@ nfsd_reply_cache_alloc(void
  static void
  nfsd_reply_cache_free_locked(struct svc_cacherep *rp)
  {
-   if (rp->c_type == RC_REPLBUFF)
+   if (rp->c_type == RC_REPLBUFF && rp->c_replvec.iov_base) {
+   drc_mem_usage -= rp->c_replvec.iov_len;
kfree(rp->c_replvec.iov_base);
+   }
 -  hlist_del(>c_hash);
 +  if (!hlist_unhashed(>c_hash))
 +  hlist_del(>c_hash);
list_del(>c_lru);
--num_drc_entries;
+   drc_mem_usage -= sizeof(*rp);
kmem_cache_free(drc_slab, rp);
  }
  


pgpGslUOc1hrk.pgp
Description: PGP signature


linux-next: manual merge of the nfsd tree with Linus' tree

2013-04-02 Thread Stephen Rothwell
Hi,

Today's linux-next merge of the nfsd tree got a conflict in
fs/nfsd/nfscache.c between commit a517b608fa3d (nfsd: only unhash DRC
entries that are in the hashtable) from Linus' tree and commit
559aa350587e (nfsd: track memory utilization in the DRC) from the nfsd
tree.

I fixed it up (see below) and can carry the fix as necessary (no action
is required).

-- 
Cheers,
Stephen Rothwells...@canb.auug.org.au

diff --cc fs/nfsd/nfscache.c
index ca05f6d,3af1767..000
--- a/fs/nfsd/nfscache.c
+++ b/fs/nfsd/nfscache.c
@@@ -100,12 -130,14 +130,15 @@@ nfsd_reply_cache_alloc(void
  static void
  nfsd_reply_cache_free_locked(struct svc_cacherep *rp)
  {
-   if (rp-c_type == RC_REPLBUFF)
+   if (rp-c_type == RC_REPLBUFF  rp-c_replvec.iov_base) {
+   drc_mem_usage -= rp-c_replvec.iov_len;
kfree(rp-c_replvec.iov_base);
+   }
 -  hlist_del(rp-c_hash);
 +  if (!hlist_unhashed(rp-c_hash))
 +  hlist_del(rp-c_hash);
list_del(rp-c_lru);
--num_drc_entries;
+   drc_mem_usage -= sizeof(*rp);
kmem_cache_free(drc_slab, rp);
  }
  


pgpGslUOc1hrk.pgp
Description: PGP signature


linux-next: manual merge of the nfsd tree with Linus' tree

2013-02-28 Thread Stephen Rothwell
Hi all,

Today's linux-next merge of the nfsd tree got a conflict in
fs/nfsd/nfscache.c between commit b67bfe0d42ca ("hlist: drop the node
parameter from iterators") from Linus' tree and commit a4a3ec329124
("nfsd: break out hashtable search into separate function") from the nfsd
tree.

I fixed it up (see below) and can carry the fix as necessary (no action
is required).

-- 
Cheers,
Stephen Rothwells...@canb.auug.org.au

diff --cc fs/nfsd/nfscache.c
index da3dbd0,ca43664..000
--- a/fs/nfsd/nfscache.c
+++ b/fs/nfsd/nfscache.c
@@@ -112,10 -182,130 +182,129 @@@ hash_refile(struct svc_cacherep *rp
hlist_add_head(>c_hash, cache_hash + request_hash(rp->c_xid));
  }
  
+ static inline bool
+ nfsd_cache_entry_expired(struct svc_cacherep *rp)
+ {
+   return rp->c_state != RC_INPROG &&
+  time_after(jiffies, rp->c_timestamp + RC_EXPIRE);
+ }
+ 
+ /*
+  * Walk the LRU list and prune off entries that are older than RC_EXPIRE.
+  * Also prune the oldest ones when the total exceeds the max number of 
entries.
+  */
+ static void
+ prune_cache_entries(void)
+ {
+   struct svc_cacherep *rp, *tmp;
+ 
+   list_for_each_entry_safe(rp, tmp, _head, c_lru) {
+   if (!nfsd_cache_entry_expired(rp) &&
+   num_drc_entries <= max_drc_entries)
+   break;
+   nfsd_reply_cache_free_locked(rp);
+   }
+ 
+   /*
+* Conditionally rearm the job. If we cleaned out the list, then
+* cancel any pending run (since there won't be any work to do).
+* Otherwise, we rearm the job or modify the existing one to run in
+* RC_EXPIRE since we just ran the pruner.
+*/
+   if (list_empty(_head))
+   cancel_delayed_work(_cleaner);
+   else
+   mod_delayed_work(system_wq, _cleaner, RC_EXPIRE);
+ }
+ 
+ static void
+ cache_cleaner_func(struct work_struct *unused)
+ {
+   spin_lock(_lock);
+   prune_cache_entries();
+   spin_unlock(_lock);
+ }
+ 
+ static int
+ nfsd_reply_cache_shrink(struct shrinker *shrink, struct shrink_control *sc)
+ {
+   unsigned int num;
+ 
+   spin_lock(_lock);
+   if (sc->nr_to_scan)
+   prune_cache_entries();
+   num = num_drc_entries;
+   spin_unlock(_lock);
+ 
+   return num;
+ }
+ 
+ /*
+  * Walk an xdr_buf and get a CRC for at most the first RC_CSUMLEN bytes
+  */
+ static __wsum
+ nfsd_cache_csum(struct svc_rqst *rqstp)
+ {
+   int idx;
+   unsigned int base;
+   __wsum csum;
+   struct xdr_buf *buf = >rq_arg;
+   const unsigned char *p = buf->head[0].iov_base;
+   size_t csum_len = min_t(size_t, buf->head[0].iov_len + buf->page_len,
+   RC_CSUMLEN);
+   size_t len = min(buf->head[0].iov_len, csum_len);
+ 
+   /* rq_arg.head first */
+   csum = csum_partial(p, len, 0);
+   csum_len -= len;
+ 
+   /* Continue into page array */
+   idx = buf->page_base / PAGE_SIZE;
+   base = buf->page_base & ~PAGE_MASK;
+   while (csum_len) {
+   p = page_address(buf->pages[idx]) + base;
+   len = min_t(size_t, PAGE_SIZE - base, csum_len);
+   csum = csum_partial(p, len, csum);
+   csum_len -= len;
+   base = 0;
+   ++idx;
+   }
+   return csum;
+ }
+ 
+ /*
+  * Search the request hash for an entry that matches the given rqstp.
+  * Must be called with cache_lock held. Returns the found entry or
+  * NULL on failure.
+  */
+ static struct svc_cacherep *
+ nfsd_cache_search(struct svc_rqst *rqstp, __wsum csum)
+ {
+   struct svc_cacherep *rp;
 -  struct hlist_node   *hn;
+   struct hlist_head   *rh;
+   __be32  xid = rqstp->rq_xid;
+   u32 proto =  rqstp->rq_prot,
+   vers = rqstp->rq_vers,
+   proc = rqstp->rq_proc;
+ 
+   rh = _hash[request_hash(xid)];
 -  hlist_for_each_entry(rp, hn, rh, c_hash) {
++  hlist_for_each_entry(rp, rh, c_hash) {
+   if (xid == rp->c_xid && proc == rp->c_proc &&
+   proto == rp->c_prot && vers == rp->c_vers &&
+   rqstp->rq_arg.len == rp->c_len && csum == rp->c_csum &&
+   rpc_cmp_addr(svc_addr(rqstp), (struct sockaddr 
*)>c_addr) &&
+   rpc_get_port(svc_addr(rqstp)) == rpc_get_port((struct 
sockaddr *)>c_addr))
+   return rp;
+   }
+   return NULL;
+ }
+ 
  /*
   * Try to find an entry matching the current call in the cache. When none
-  * is found, we grab the oldest unlocked entry off the LRU list.
-  * Note that no operation within the loop may sleep.
+  * is found, we try to grab the oldest expired entry off the LRU list. If
+  * a suitable one isn't there, then drop the cache_lock and allocate a
+  * new one, then search again in case one got inserted while this thread
+  

linux-next: manual merge of the nfsd tree with Linus' tree

2013-02-28 Thread Stephen Rothwell
Hi all,

Today's linux-next merge of the nfsd tree got a conflict in
fs/nfsd/nfscache.c between commit b67bfe0d42ca (hlist: drop the node
parameter from iterators) from Linus' tree and commit a4a3ec329124
(nfsd: break out hashtable search into separate function) from the nfsd
tree.

I fixed it up (see below) and can carry the fix as necessary (no action
is required).

-- 
Cheers,
Stephen Rothwells...@canb.auug.org.au

diff --cc fs/nfsd/nfscache.c
index da3dbd0,ca43664..000
--- a/fs/nfsd/nfscache.c
+++ b/fs/nfsd/nfscache.c
@@@ -112,10 -182,130 +182,129 @@@ hash_refile(struct svc_cacherep *rp
hlist_add_head(rp-c_hash, cache_hash + request_hash(rp-c_xid));
  }
  
+ static inline bool
+ nfsd_cache_entry_expired(struct svc_cacherep *rp)
+ {
+   return rp-c_state != RC_INPROG 
+  time_after(jiffies, rp-c_timestamp + RC_EXPIRE);
+ }
+ 
+ /*
+  * Walk the LRU list and prune off entries that are older than RC_EXPIRE.
+  * Also prune the oldest ones when the total exceeds the max number of 
entries.
+  */
+ static void
+ prune_cache_entries(void)
+ {
+   struct svc_cacherep *rp, *tmp;
+ 
+   list_for_each_entry_safe(rp, tmp, lru_head, c_lru) {
+   if (!nfsd_cache_entry_expired(rp) 
+   num_drc_entries = max_drc_entries)
+   break;
+   nfsd_reply_cache_free_locked(rp);
+   }
+ 
+   /*
+* Conditionally rearm the job. If we cleaned out the list, then
+* cancel any pending run (since there won't be any work to do).
+* Otherwise, we rearm the job or modify the existing one to run in
+* RC_EXPIRE since we just ran the pruner.
+*/
+   if (list_empty(lru_head))
+   cancel_delayed_work(cache_cleaner);
+   else
+   mod_delayed_work(system_wq, cache_cleaner, RC_EXPIRE);
+ }
+ 
+ static void
+ cache_cleaner_func(struct work_struct *unused)
+ {
+   spin_lock(cache_lock);
+   prune_cache_entries();
+   spin_unlock(cache_lock);
+ }
+ 
+ static int
+ nfsd_reply_cache_shrink(struct shrinker *shrink, struct shrink_control *sc)
+ {
+   unsigned int num;
+ 
+   spin_lock(cache_lock);
+   if (sc-nr_to_scan)
+   prune_cache_entries();
+   num = num_drc_entries;
+   spin_unlock(cache_lock);
+ 
+   return num;
+ }
+ 
+ /*
+  * Walk an xdr_buf and get a CRC for at most the first RC_CSUMLEN bytes
+  */
+ static __wsum
+ nfsd_cache_csum(struct svc_rqst *rqstp)
+ {
+   int idx;
+   unsigned int base;
+   __wsum csum;
+   struct xdr_buf *buf = rqstp-rq_arg;
+   const unsigned char *p = buf-head[0].iov_base;
+   size_t csum_len = min_t(size_t, buf-head[0].iov_len + buf-page_len,
+   RC_CSUMLEN);
+   size_t len = min(buf-head[0].iov_len, csum_len);
+ 
+   /* rq_arg.head first */
+   csum = csum_partial(p, len, 0);
+   csum_len -= len;
+ 
+   /* Continue into page array */
+   idx = buf-page_base / PAGE_SIZE;
+   base = buf-page_base  ~PAGE_MASK;
+   while (csum_len) {
+   p = page_address(buf-pages[idx]) + base;
+   len = min_t(size_t, PAGE_SIZE - base, csum_len);
+   csum = csum_partial(p, len, csum);
+   csum_len -= len;
+   base = 0;
+   ++idx;
+   }
+   return csum;
+ }
+ 
+ /*
+  * Search the request hash for an entry that matches the given rqstp.
+  * Must be called with cache_lock held. Returns the found entry or
+  * NULL on failure.
+  */
+ static struct svc_cacherep *
+ nfsd_cache_search(struct svc_rqst *rqstp, __wsum csum)
+ {
+   struct svc_cacherep *rp;
 -  struct hlist_node   *hn;
+   struct hlist_head   *rh;
+   __be32  xid = rqstp-rq_xid;
+   u32 proto =  rqstp-rq_prot,
+   vers = rqstp-rq_vers,
+   proc = rqstp-rq_proc;
+ 
+   rh = cache_hash[request_hash(xid)];
 -  hlist_for_each_entry(rp, hn, rh, c_hash) {
++  hlist_for_each_entry(rp, rh, c_hash) {
+   if (xid == rp-c_xid  proc == rp-c_proc 
+   proto == rp-c_prot  vers == rp-c_vers 
+   rqstp-rq_arg.len == rp-c_len  csum == rp-c_csum 
+   rpc_cmp_addr(svc_addr(rqstp), (struct sockaddr 
*)rp-c_addr) 
+   rpc_get_port(svc_addr(rqstp)) == rpc_get_port((struct 
sockaddr *)rp-c_addr))
+   return rp;
+   }
+   return NULL;
+ }
+ 
  /*
   * Try to find an entry matching the current call in the cache. When none
-  * is found, we grab the oldest unlocked entry off the LRU list.
-  * Note that no operation within the loop may sleep.
+  * is found, we try to grab the oldest expired entry off the LRU list. If
+  * a suitable one isn't there, then drop the cache_lock and allocate a
+  * new one, then search again in case one got inserted while this