aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2005-06-22 13:16:39 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2005-06-22 16:07:44 -0400
commiteadf4598e7ec37a234e70e965bd335860e58bda4 (patch)
treed82bd76e553a4165a972b1ad93d1e1d8ddb017bb
parent6ebf3656fd18430d90fbb3199b31d08178c37134 (diff)
[PATCH] NFS: Add debugging code to NFSv4 readdir
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
-rw-r--r--fs/nfs/nfs4proc.c5
-rw-r--r--fs/nfs/nfs4xdr.c18
2 files changed, 23 insertions, 0 deletions
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 0ddc20102d46..1b76f80aedb9 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -1722,6 +1722,10 @@ static int _nfs4_proc_readdir(struct dentry *dentry, struct rpc_cred *cred,
1722 }; 1722 };
1723 int status; 1723 int status;
1724 1724
1725 dprintk("%s: dentry = %s/%s, cookie = %Lu\n", __FUNCTION__,
1726 dentry->d_parent->d_name.name,
1727 dentry->d_name.name,
1728 (unsigned long long)cookie);
1725 lock_kernel(); 1729 lock_kernel();
1726 nfs4_setup_readdir(cookie, NFS_COOKIEVERF(dir), dentry, &args); 1730 nfs4_setup_readdir(cookie, NFS_COOKIEVERF(dir), dentry, &args);
1727 res.pgbase = args.pgbase; 1731 res.pgbase = args.pgbase;
@@ -1729,6 +1733,7 @@ static int _nfs4_proc_readdir(struct dentry *dentry, struct rpc_cred *cred,
1729 if (status == 0) 1733 if (status == 0)
1730 memcpy(NFS_COOKIEVERF(dir), res.verifier.data, NFS4_VERIFIER_SIZE); 1734 memcpy(NFS_COOKIEVERF(dir), res.verifier.data, NFS4_VERIFIER_SIZE);
1731 unlock_kernel(); 1735 unlock_kernel();
1736 dprintk("%s: returns %d\n", __FUNCTION__, status);
1732 return status; 1737 return status;
1733} 1738}
1734 1739
diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c
index 577b4429c8f6..6c564ef9489e 100644
--- a/fs/nfs/nfs4xdr.c
+++ b/fs/nfs/nfs4xdr.c
@@ -1035,6 +1035,13 @@ static int encode_readdir(struct xdr_stream *xdr, const struct nfs4_readdir_arg
1035 attrs[1] &= ~FATTR4_WORD1_MOUNTED_ON_FILEID; 1035 attrs[1] &= ~FATTR4_WORD1_MOUNTED_ON_FILEID;
1036 WRITE32(attrs[0] & readdir->bitmask[0]); 1036 WRITE32(attrs[0] & readdir->bitmask[0]);
1037 WRITE32(attrs[1] & readdir->bitmask[1]); 1037 WRITE32(attrs[1] & readdir->bitmask[1]);
1038 dprintk("%s: cookie = %Lu, verifier = 0x%x%x, bitmap = 0x%x%x\n",
1039 __FUNCTION__,
1040 (unsigned long long)readdir->cookie,
1041 ((u32 *)readdir->verifier.data)[0],
1042 ((u32 *)readdir->verifier.data)[1],
1043 attrs[0] & readdir->bitmask[0],
1044 attrs[1] & readdir->bitmask[1]);
1038 1045
1039 /* set up reply kvec 1046 /* set up reply kvec
1040 * toplevel_status + taglen + rescount + OP_PUTFH + status 1047 * toplevel_status + taglen + rescount + OP_PUTFH + status
@@ -1043,6 +1050,9 @@ static int encode_readdir(struct xdr_stream *xdr, const struct nfs4_readdir_arg
1043 replen = (RPC_REPHDRSIZE + auth->au_rslack + 9) << 2; 1050 replen = (RPC_REPHDRSIZE + auth->au_rslack + 9) << 2;
1044 xdr_inline_pages(&req->rq_rcv_buf, replen, readdir->pages, 1051 xdr_inline_pages(&req->rq_rcv_buf, replen, readdir->pages,
1045 readdir->pgbase, readdir->count); 1052 readdir->pgbase, readdir->count);
1053 dprintk("%s: inlined page args = (%u, %p, %u, %u)\n",
1054 __FUNCTION__, replen, readdir->pages,
1055 readdir->pgbase, readdir->count);
1046 1056
1047 return 0; 1057 return 0;
1048} 1058}
@@ -3066,6 +3076,11 @@ static int decode_readdir(struct xdr_stream *xdr, struct rpc_rqst *req, struct n
3066 return status; 3076 return status;
3067 READ_BUF(8); 3077 READ_BUF(8);
3068 COPYMEM(readdir->verifier.data, 8); 3078 COPYMEM(readdir->verifier.data, 8);
3079 dprintk("%s: verifier = 0x%x%x\n",
3080 __FUNCTION__,
3081 ((u32 *)readdir->verifier.data)[0],
3082 ((u32 *)readdir->verifier.data)[1]);
3083
3069 3084
3070 hdrlen = (char *) p - (char *) iov->iov_base; 3085 hdrlen = (char *) p - (char *) iov->iov_base;
3071 recvd = rcvbuf->len - hdrlen; 3086 recvd = rcvbuf->len - hdrlen;
@@ -3080,12 +3095,14 @@ static int decode_readdir(struct xdr_stream *xdr, struct rpc_rqst *req, struct n
3080 for (nr = 0; *p++; nr++) { 3095 for (nr = 0; *p++; nr++) {
3081 if (p + 3 > end) 3096 if (p + 3 > end)
3082 goto short_pkt; 3097 goto short_pkt;
3098 dprintk("cookie = %Lu, ", *((unsigned long long *)p));
3083 p += 2; /* cookie */ 3099 p += 2; /* cookie */
3084 len = ntohl(*p++); /* filename length */ 3100 len = ntohl(*p++); /* filename length */
3085 if (len > NFS4_MAXNAMLEN) { 3101 if (len > NFS4_MAXNAMLEN) {
3086 printk(KERN_WARNING "NFS: giant filename in readdir (len 0x%x)\n", len); 3102 printk(KERN_WARNING "NFS: giant filename in readdir (len 0x%x)\n", len);
3087 goto err_unmap; 3103 goto err_unmap;
3088 } 3104 }
3105 dprintk("filename = %*s\n", len, (char *)p);
3089 p += XDR_QUADLEN(len); 3106 p += XDR_QUADLEN(len);
3090 if (p + 1 > end) 3107 if (p + 1 > end)
3091 goto short_pkt; 3108 goto short_pkt;
@@ -3105,6 +3122,7 @@ out:
3105 kunmap_atomic(kaddr, KM_USER0); 3122 kunmap_atomic(kaddr, KM_USER0);
3106 return 0; 3123 return 0;
3107short_pkt: 3124short_pkt:
3125 dprintk("%s: short packet at entry %d\n", __FUNCTION__, nr);
3108 entry[0] = entry[1] = 0; 3126 entry[0] = entry[1] = 0;
3109 /* truncate listing ? */ 3127 /* truncate listing ? */
3110 if (!nr) { 3128 if (!nr) {