afs: Add a couple of tracepoints to log I/O errors
Add a couple of tracepoints to log the production of I/O errors within the AFS filesystem. Signed-off-by: David Howells <dhowells@redhat.com>
This commit is contained in:
18
fs/afs/dir.c
18
fs/afs/dir.c
@@ -138,6 +138,7 @@ static bool afs_dir_check_page(struct afs_vnode *dvnode, struct page *page,
|
||||
ntohs(dbuf->blocks[tmp].hdr.magic));
|
||||
trace_afs_dir_check_failed(dvnode, off, i_size);
|
||||
kunmap(page);
|
||||
trace_afs_file_error(dvnode, -EIO, afs_file_error_dir_bad_magic);
|
||||
goto error;
|
||||
}
|
||||
|
||||
@@ -190,9 +191,11 @@ static struct afs_read *afs_read_dir(struct afs_vnode *dvnode, struct key *key)
|
||||
retry:
|
||||
i_size = i_size_read(&dvnode->vfs_inode);
|
||||
if (i_size < 2048)
|
||||
return ERR_PTR(-EIO);
|
||||
if (i_size > 2048 * 1024)
|
||||
return ERR_PTR(afs_bad(dvnode, afs_file_error_dir_small));
|
||||
if (i_size > 2048 * 1024) {
|
||||
trace_afs_file_error(dvnode, -EFBIG, afs_file_error_dir_big);
|
||||
return ERR_PTR(-EFBIG);
|
||||
}
|
||||
|
||||
_enter("%llu", i_size);
|
||||
|
||||
@@ -315,7 +318,8 @@ content_has_grown:
|
||||
/*
|
||||
* deal with one block in an AFS directory
|
||||
*/
|
||||
static int afs_dir_iterate_block(struct dir_context *ctx,
|
||||
static int afs_dir_iterate_block(struct afs_vnode *dvnode,
|
||||
struct dir_context *ctx,
|
||||
union afs_xdr_dir_block *block,
|
||||
unsigned blkoff)
|
||||
{
|
||||
@@ -365,7 +369,7 @@ static int afs_dir_iterate_block(struct dir_context *ctx,
|
||||
" (len %u/%zu)",
|
||||
blkoff / sizeof(union afs_xdr_dir_block),
|
||||
offset, next, tmp, nlen);
|
||||
return -EIO;
|
||||
return afs_bad(dvnode, afs_file_error_dir_over_end);
|
||||
}
|
||||
if (!(block->hdr.bitmap[next / 8] &
|
||||
(1 << (next % 8)))) {
|
||||
@@ -373,7 +377,7 @@ static int afs_dir_iterate_block(struct dir_context *ctx,
|
||||
" %u unmarked extension (len %u/%zu)",
|
||||
blkoff / sizeof(union afs_xdr_dir_block),
|
||||
offset, next, tmp, nlen);
|
||||
return -EIO;
|
||||
return afs_bad(dvnode, afs_file_error_dir_unmarked_ext);
|
||||
}
|
||||
|
||||
_debug("ENT[%zu.%u]: ext %u/%zu",
|
||||
@@ -442,7 +446,7 @@ static int afs_dir_iterate(struct inode *dir, struct dir_context *ctx,
|
||||
*/
|
||||
page = req->pages[blkoff / PAGE_SIZE];
|
||||
if (!page) {
|
||||
ret = -EIO;
|
||||
ret = afs_bad(dvnode, afs_file_error_dir_missing_page);
|
||||
break;
|
||||
}
|
||||
mark_page_accessed(page);
|
||||
@@ -455,7 +459,7 @@ static int afs_dir_iterate(struct inode *dir, struct dir_context *ctx,
|
||||
do {
|
||||
dblock = &dbuf->blocks[(blkoff % PAGE_SIZE) /
|
||||
sizeof(union afs_xdr_dir_block)];
|
||||
ret = afs_dir_iterate_block(ctx, dblock, blkoff);
|
||||
ret = afs_dir_iterate_block(dvnode, ctx, dblock, blkoff);
|
||||
if (ret != 1) {
|
||||
kunmap(page);
|
||||
goto out;
|
||||
|
Reference in New Issue
Block a user