summaryrefslogtreecommitdiffstats
path: root/fs/afs/fsclient.c
diff options
context:
space:
mode:
authorDavid Howells2018-04-06 15:17:24 +0200
committerDavid Howells2018-04-09 22:53:52 +0200
commit888b33846111927d94dee6d8187c72515160edd3 (patch)
treea4e2096226d11d0278ddc2172e0895b39d7cf34c /fs/afs/fsclient.c
parentafs: Implement @cell substitution handling (diff)
downloadkernel-qcow2-linux-888b33846111927d94dee6d8187c72515160edd3.tar.gz
kernel-qcow2-linux-888b33846111927d94dee6d8187c72515160edd3.tar.xz
kernel-qcow2-linux-888b33846111927d94dee6d8187c72515160edd3.zip
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/afs/fsclient.c')
-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)
}
/*
+ * Dump a bad file status record.
+ */
+static void xdr_dump_bad(const __be32 *bp)
+{
+ __be32 x[4];
+ int i;
+
+ pr_notice("AFS XDR: Bad status record\n");
+ for (i = 0; i < 5 * 4 * 4; i += 16) {
+ memcpy(x, bp, 16);
+ bp += 4;
+ pr_notice("%03x: %08x %08x %08x %08x\n",
+ i, ntohl(x[0]), ntohl(x[1]), ntohl(x[2]), ntohl(x[3]));
+ }
+
+ memcpy(x, bp, 4);
+ pr_notice("0x50: %08x\n", ntohl(x[0]));
+}
+
+/*
* decode an AFSFetchStatus block
*/
static void xdr_decode_AFSFetchStatus(const __be32 **_bp,
@@ -97,6 +117,20 @@ static void xdr_decode_AFSFetchStatus(const __be32 **_bp,
EXTRACT(status->abort_code); /* spare 4 */
*_bp = bp;
+ switch (status->type) {
+ case AFS_FTYPE_FILE:
+ case AFS_FTYPE_DIR:
+ case AFS_FTYPE_SYMLINK:
+ break;
+ case AFS_FTYPE_INVALID:
+ if (status->abort_code != 0)
+ goto out;
+ /* Fall through */
+ default:
+ xdr_dump_bad(bp - 2);
+ goto out;
+ }
+
if (size != status->size) {
status->size = size;
changed |= true;
@@ -145,6 +179,7 @@ static void xdr_decode_AFSFetchStatus(const __be32 **_bp,
status->data_version = data_version;
}
+out:
if (vnode)
write_sequnlock(&vnode->cb_lock);
}