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
4da1713a
Commit
4da1713a
authored
Apr 25, 2024
by
Kent Overstreet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bcachefs: check for inodes that should have backpointers in fsck
Signed-off-by:
Kent Overstreet
<
kent.overstreet@linux.dev
>
parent
45150765
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
0 deletions
+18
-0
fs/bcachefs/fsck.c
fs/bcachefs/fsck.c
+10
-0
fs/bcachefs/inode.h
fs/bcachefs/inode.h
+8
-0
No files found.
fs/bcachefs/fsck.c
View file @
4da1713a
...
...
@@ -1713,6 +1713,15 @@ static int check_dirent_inode_dirent(struct btree_trans *trans,
if
(
inode_points_to_dirent
(
target
,
d
))
return
0
;
if
(
bch2_inode_should_have_bp
(
target
)
&&
!
fsck_err
(
c
,
inode_wrong_backpointer
,
"dirent points to inode that does not point back:
\n
%s"
,
(
bch2_bkey_val_to_text
(
&
buf
,
c
,
d
.
s_c
),
prt_printf
(
&
buf
,
"
\n
"
),
bch2_inode_unpacked_to_text
(
&
buf
,
target
),
buf
.
buf
)))
goto
out_noiter
;
if
(
!
target
->
bi_dir
&&
!
target
->
bi_dir_offset
)
{
target
->
bi_dir
=
d
.
k
->
p
.
inode
;
...
...
@@ -1781,6 +1790,7 @@ static int check_dirent_inode_dirent(struct btree_trans *trans,
err:
fsck_err:
bch2_trans_iter_exit
(
trans
,
&
bp_iter
);
out_noiter:
printbuf_exit
(
&
buf
);
bch_err_fn
(
c
,
ret
);
return
ret
;
...
...
fs/bcachefs/inode.h
View file @
4da1713a
...
...
@@ -221,6 +221,14 @@ static inline void bch2_inode_nlink_set(struct bch_inode_unpacked *bi,
int
bch2_inode_nlink_inc
(
struct
bch_inode_unpacked
*
);
void
bch2_inode_nlink_dec
(
struct
btree_trans
*
,
struct
bch_inode_unpacked
*
);
static
inline
bool
bch2_inode_should_have_bp
(
struct
bch_inode_unpacked
*
inode
)
{
bool
inode_has_bp
=
inode
->
bi_dir
||
inode
->
bi_dir_offset
;
return
S_ISDIR
(
inode
->
bi_mode
)
||
(
!
inode
->
bi_nlink
&&
inode_has_bp
);
}
struct
bch_opts
bch2_inode_opts_to_opts
(
struct
bch_inode_unpacked
*
);
void
bch2_inode_opts_get
(
struct
bch_io_opts
*
,
struct
bch_fs
*
,
struct
bch_inode_unpacked
*
);
...
...
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