summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2018-04-06 09:17:24 -0400
committerDavid Howells <dhowells@redhat.com>2018-04-09 16:53:52 -0400
commit888b33846111927d94dee6d8187c72515160edd3 (patch)
treea4e2096226d11d0278ddc2172e0895b39d7cf34c /fs
parent37ab636880cbc95ba87a5790bee23a1c813089c6 (diff)
afs: Dump bad status record
Dump an AFS FileStatus record that is detected as invalid. Signed-off-by: David Howells <dhowells@redhat.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/afs/fsclient.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/fs/afs/fsclient.c b/fs/afs/fsclient.c
index 75554ee98d02..90aa3eb2c893 100644
--- a/fs/afs/fsclient.c
+++ b/fs/afs/fsclient.c
@@ -44,6 +44,26 @@ static void xdr_decode_AFSFid(const __be32 **_bp, struct afs_fid *fid)
44} 44}
45 45
46/* 46/*
47 * Dump a bad file status record.
48 */
49static void xdr_dump_bad(const __be32 *bp)
50{
51 __be32 x[4];
52 int i;
53
54 pr_notice("AFS XDR: Bad status record\n");
55 for (i = 0; i < 5 * 4 * 4; i += 16) {
56 memcpy(x, bp, 16);
57 bp += 4;
58 pr_notice("%03x: %08x %08x %08x %08x\n",
59 i, ntohl(x[0]), ntohl(x[1]), ntohl(x[2]), ntohl(x[3]));
60 }
61
62 memcpy(x, bp, 4);
63 pr_notice("0x50: %08x\n", ntohl(x[0]));
64}
65
66/*
47 * decode an AFSFetchStatus block 67 * decode an AFSFetchStatus block
48 */ 68 */
49static void xdr_decode_AFSFetchStatus(const __be32 **_bp, 69static void xdr_decode_AFSFetchStatus(const __be32 **_bp,
@@ -97,6 +117,20 @@ static void xdr_decode_AFSFetchStatus(const __be32 **_bp,
97 EXTRACT(status->abort_code); /* spare 4 */ 117 EXTRACT(status->abort_code); /* spare 4 */
98 *_bp = bp; 118 *_bp = bp;
99 119
120 switch (status->type) {
121 case AFS_FTYPE_FILE:
122 case AFS_FTYPE_DIR:
123 case AFS_FTYPE_SYMLINK:
124 break;
125 case AFS_FTYPE_INVALID:
126 if (status->abort_code != 0)
127 goto out;
128 /* Fall through */
129 default:
130 xdr_dump_bad(bp - 2);
131 goto out;
132 }
133
100 if (size != status->size) { 134 if (size != status->size) {
101 status->size = size; 135 status->size = size;
102 changed |= true; 136 changed |= true;
@@ -145,6 +179,7 @@ static void xdr_decode_AFSFetchStatus(const __be32 **_bp,
145 status->data_version = data_version; 179 status->data_version = data_version;
146 } 180 }
147 181
182out:
148 if (vnode) 183 if (vnode)
149 write_sequnlock(&vnode->cb_lock); 184 write_sequnlock(&vnode->cb_lock);
150} 185}