mirror of
https://github.com/torvalds/linux
synced 2024-09-21 03:28:37 +00:00
afs: Improve dir check failure reports
Improve the content of directory check failure reports from: kAFS: afs_dir_check_page(6d57): bad magic 1/2 is 0000 to dump more information about the individual blocks in a directory page. Signed-off-by: David Howells <dhowells@redhat.com>
This commit is contained in:
parent
d46966013b
commit
445b10289f
36
fs/afs/dir.c
36
fs/afs/dir.c
|
@ -159,6 +159,38 @@ static bool afs_dir_check_page(struct afs_vnode *dvnode, struct page *page,
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Check the contents of a directory that we've just read.
|
||||||
|
*/
|
||||||
|
static bool afs_dir_check_pages(struct afs_vnode *dvnode, struct afs_read *req)
|
||||||
|
{
|
||||||
|
struct afs_xdr_dir_page *dbuf;
|
||||||
|
unsigned int i, j, qty = PAGE_SIZE / sizeof(union afs_xdr_dir_block);
|
||||||
|
|
||||||
|
for (i = 0; i < req->nr_pages; i++)
|
||||||
|
if (!afs_dir_check_page(dvnode, req->pages[i], req->actual_len))
|
||||||
|
goto bad;
|
||||||
|
return true;
|
||||||
|
|
||||||
|
bad:
|
||||||
|
pr_warn("DIR %llx:%llx f=%llx l=%llx al=%llx r=%llx\n",
|
||||||
|
dvnode->fid.vid, dvnode->fid.vnode,
|
||||||
|
req->file_size, req->len, req->actual_len, req->remain);
|
||||||
|
pr_warn("DIR %llx %x %x %x\n",
|
||||||
|
req->pos, req->index, req->nr_pages, req->offset);
|
||||||
|
|
||||||
|
for (i = 0; i < req->nr_pages; i++) {
|
||||||
|
dbuf = kmap(req->pages[i]);
|
||||||
|
for (j = 0; j < qty; j++) {
|
||||||
|
union afs_xdr_dir_block *block = &dbuf->blocks[j];
|
||||||
|
|
||||||
|
pr_warn("[%02x] %32phN\n", i * qty + j, block);
|
||||||
|
}
|
||||||
|
kunmap(req->pages[i]);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* open an AFS directory file
|
* open an AFS directory file
|
||||||
*/
|
*/
|
||||||
|
@ -288,9 +320,7 @@ static struct afs_read *afs_read_dir(struct afs_vnode *dvnode, struct key *key)
|
||||||
|
|
||||||
/* Validate the data we just read. */
|
/* Validate the data we just read. */
|
||||||
ret = -EIO;
|
ret = -EIO;
|
||||||
for (i = 0; i < req->nr_pages; i++)
|
if (!afs_dir_check_pages(dvnode, req))
|
||||||
if (!afs_dir_check_page(dvnode, req->pages[i],
|
|
||||||
req->actual_len))
|
|
||||||
goto error_unlock;
|
goto error_unlock;
|
||||||
|
|
||||||
// TODO: Trim excess pages
|
// TODO: Trim excess pages
|
||||||
|
|
Loading…
Reference in a new issue