Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
linux
Commits
84eed90f
Commit
84eed90f
authored
Apr 25, 2008
by
Chris Mason
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Btrfs: Add failure handling for read_sys_array
Signed-off-by:
Chris Mason
<
chris.mason@oracle.com
>
parent
004fb575
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
9 deletions
+18
-9
fs/btrfs/disk-io.c
fs/btrfs/disk-io.c
+9
-2
fs/btrfs/volumes.c
fs/btrfs/volumes.c
+9
-7
No files found.
fs/btrfs/disk-io.c
View file @
84eed90f
...
...
@@ -1278,7 +1278,11 @@ struct btrfs_root *open_ctree(struct super_block *sb,
mutex_lock
(
&
fs_info
->
fs_mutex
);
ret
=
btrfs_read_sys_array
(
tree_root
);
BUG_ON
(
ret
);
if
(
ret
)
{
printk
(
"btrfs: failed to read the system array on %s
\n
"
,
sb
->
s_id
);
goto
fail_sys_array
;
}
blocksize
=
btrfs_level_size
(
tree_root
,
btrfs_super_chunk_root_level
(
disk_super
));
...
...
@@ -1335,8 +1339,9 @@ struct btrfs_root *open_ctree(struct super_block *sb,
fail_extent_root:
free_extent_buffer
(
extent_root
->
node
);
fail_tree_root:
mutex_unlock
(
&
fs_info
->
fs_mutex
);
free_extent_buffer
(
tree_root
->
node
);
fail_sys_array:
mutex_unlock
(
&
fs_info
->
fs_mutex
);
fail_sb_buffer:
free_extent_buffer
(
fs_info
->
sb_buffer
);
extent_io_tree_empty_lru
(
&
BTRFS_I
(
fs_info
->
btree_inode
)
->
io_tree
);
...
...
@@ -1344,6 +1349,8 @@ struct btrfs_root *open_ctree(struct super_block *sb,
iput
(
fs_info
->
btree_inode
);
fail:
close_all_devices
(
fs_info
);
btrfs_mapping_tree_free
(
&
fs_info
->
mapping_tree
);
kfree
(
extent_root
);
kfree
(
tree_root
);
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,23)
...
...
fs/btrfs/volumes.c
View file @
84eed90f
...
...
@@ -1365,14 +1365,14 @@ int btrfs_read_sys_array(struct btrfs_root *root)
struct
extent_buffer
*
sb
=
root
->
fs_info
->
sb_buffer
;
struct
btrfs_disk_key
*
disk_key
;
struct
btrfs_chunk
*
chunk
;
struct
btrfs_key
key
;
u8
*
ptr
;
unsigned
long
sb_ptr
;
int
ret
=
0
;
u32
num_stripes
;
u32
array_size
;
u32
len
=
0
;
u8
*
ptr
;
unsigned
long
sb_ptr
;
u32
cur
;
int
ret
;
struct
btrfs_key
key
;
array_size
=
btrfs_super_sys_array_size
(
super_copy
);
...
...
@@ -1397,17 +1397,19 @@ int btrfs_read_sys_array(struct btrfs_root *root)
if
(
key
.
type
==
BTRFS_CHUNK_ITEM_KEY
)
{
chunk
=
(
struct
btrfs_chunk
*
)
sb_ptr
;
ret
=
read_one_chunk
(
root
,
&
key
,
sb
,
chunk
);
BUG_ON
(
ret
);
if
(
ret
)
break
;
num_stripes
=
btrfs_chunk_num_stripes
(
sb
,
chunk
);
len
=
btrfs_chunk_item_size
(
num_stripes
);
}
else
{
BUG
();
ret
=
-
EIO
;
break
;
}
ptr
+=
len
;
sb_ptr
+=
len
;
cur
+=
len
;
}
return
0
;
return
ret
;
}
int
btrfs_read_chunk_tree
(
struct
btrfs_root
*
root
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment