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
Kirill Smelkov
linux
Commits
3a136177
Commit
3a136177
authored
Feb 08, 2024
by
Kent Overstreet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bcachefs: check_path() now prints full inode when reattaching
Signed-off-by:
Kent Overstreet
<
kent.overstreet@linux.dev
>
parent
688a7694
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
8 deletions
+18
-8
fs/bcachefs/fsck.c
fs/bcachefs/fsck.c
+18
-8
No files found.
fs/bcachefs/fsck.c
View file @
3a136177
...
...
@@ -2108,7 +2108,9 @@ static int path_down(struct bch_fs *c, pathbuf *p,
static
int
check_path
(
struct
btree_trans
*
trans
,
pathbuf
*
p
,
struct
bkey_s_c
inode_k
)
{
struct
bch_fs
*
c
=
trans
->
c
;
struct
btree_iter
inode_iter
=
{};
struct
bch_inode_unpacked
inode
;
struct
printbuf
buf
=
PRINTBUF
;
u32
snapshot
=
bch2_snapshot_equiv
(
c
,
inode_k
.
k
->
p
.
snapshot
);
int
ret
=
0
;
...
...
@@ -2134,14 +2136,12 @@ static int check_path(struct btree_trans *trans, pathbuf *p, struct bkey_s_c ino
if
(
bch2_err_matches
(
ret
,
ENOENT
))
{
if
(
fsck_err
(
c
,
inode_unreachable
,
"unreachable inode %llu:%u, type %s nlink %u backptr %llu:%llu"
,
inode
.
bi_inum
,
snapshot
,
bch2_d_type_str
(
inode_d_type
(
&
inode
)),
inode
.
bi_nlink
,
inode
.
bi_dir
,
inode
.
bi_dir_offset
))
"unreachable inode
\n
%s"
,
(
printbuf_reset
(
&
buf
),
bch2_bkey_val_to_text
(
&
buf
,
c
,
inode_k
),
buf
.
buf
)))
ret
=
reattach_inode
(
trans
,
&
inode
,
snapshot
);
break
;
goto
out
;
}
bch2_trans_iter_exit
(
trans
,
&
dirent_iter
);
...
...
@@ -2157,7 +2157,12 @@ static int check_path(struct btree_trans *trans, pathbuf *p, struct bkey_s_c ino
snapshot
=
parent_snapshot
;
ret
=
lookup_inode
(
trans
,
inode
.
bi_dir
,
&
inode
,
&
snapshot
);
bch2_trans_iter_exit
(
trans
,
&
inode_iter
);
inode_k
=
bch2_bkey_get_iter
(
trans
,
&
inode_iter
,
BTREE_ID_inodes
,
SPOS
(
0
,
inode
.
bi_dir
,
snapshot
),
0
);
ret
=
bkey_err
(
inode_k
)
?:
!
bkey_is_inode
(
inode_k
.
k
)
?
-
BCH_ERR_ENOENT_inode
:
bch2_inode_unpack
(
inode_k
,
&
inode
);
if
(
ret
)
{
/* Should have been caught in dirents pass */
if
(
!
bch2_err_matches
(
ret
,
BCH_ERR_transaction_restart
))
...
...
@@ -2165,6 +2170,8 @@ static int check_path(struct btree_trans *trans, pathbuf *p, struct bkey_s_c ino
break
;
}
snapshot
=
inode_k
.
k
->
p
.
snapshot
;
if
(
path_is_dup
(
p
,
inode
.
bi_inum
,
snapshot
))
{
/* XXX print path */
bch_err
(
c
,
"directory structure loop"
);
...
...
@@ -2188,7 +2195,10 @@ static int check_path(struct btree_trans *trans, pathbuf *p, struct bkey_s_c ino
break
;
}
}
out:
fsck_err:
bch2_trans_iter_exit
(
trans
,
&
inode_iter
);
printbuf_exit
(
&
buf
);
bch_err_fn
(
c
,
ret
);
return
ret
;
}
...
...
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