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
0bc166ff
Commit
0bc166ff
authored
Mar 28, 2019
by
Kent Overstreet
Committed by
Kent Overstreet
Oct 22, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bcachefs: Track whether filesystem has errors in superblock
Signed-off-by:
Kent Overstreet
<
kent.overstreet@linux.dev
>
parent
a6d90385
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
26 additions
and
33 deletions
+26
-33
fs/bcachefs/bcachefs.h
fs/bcachefs/bcachefs.h
+1
-10
fs/bcachefs/bcachefs_format.h
fs/bcachefs/bcachefs_format.h
+3
-1
fs/bcachefs/error.c
fs/bcachefs/error.c
+14
-18
fs/bcachefs/recovery.c
fs/bcachefs/recovery.c
+4
-1
fs/bcachefs/super-io.c
fs/bcachefs/super-io.c
+4
-2
fs/bcachefs/super.c
fs/bcachefs/super.c
+0
-1
No files found.
fs/bcachefs/bcachefs.h
View file @
0bc166ff
...
@@ -473,14 +473,6 @@ struct bch_dev {
...
@@ -473,14 +473,6 @@ struct bch_dev {
struct
io_count
__percpu
*
io_done
;
struct
io_count
__percpu
*
io_done
;
};
};
/*
* Flag bits for what phase of startup/shutdown the cache set is at, how we're
* shutting down, etc.:
*
* BCH_FS_UNREGISTERING means we're not just shutting down, we're detaching
* all the backing devices first (their cached data gets invalidated, and they
* won't automatically reattach).
*/
enum
{
enum
{
/* startup: */
/* startup: */
BCH_FS_ALLOC_READ_DONE
,
BCH_FS_ALLOC_READ_DONE
,
...
@@ -497,11 +489,10 @@ enum {
...
@@ -497,11 +489,10 @@ enum {
/* errors: */
/* errors: */
BCH_FS_ERROR
,
BCH_FS_ERROR
,
BCH_FS_ERRORS_FIXED
,
/* misc: */
/* misc: */
BCH_FS_BDEV_MOUNTED
,
BCH_FS_BDEV_MOUNTED
,
BCH_FS_FSCK_FIXED_ERRORS
,
BCH_FS_FSCK_UNFIXED_ERRORS
,
BCH_FS_FIXED_GENS
,
BCH_FS_FIXED_GENS
,
BCH_FS_REBUILD_REPLICAS
,
BCH_FS_REBUILD_REPLICAS
,
BCH_FS_HOLD_BTREE_WRITES
,
BCH_FS_HOLD_BTREE_WRITES
,
...
...
fs/bcachefs/bcachefs_format.h
View file @
0bc166ff
...
@@ -1241,7 +1241,9 @@ LE64_BITMASK(BCH_SB_USRQUOTA, struct bch_sb, flags[0], 57, 58);
...
@@ -1241,7 +1241,9 @@ LE64_BITMASK(BCH_SB_USRQUOTA, struct bch_sb, flags[0], 57, 58);
LE64_BITMASK
(
BCH_SB_GRPQUOTA
,
struct
bch_sb
,
flags
[
0
],
58
,
59
);
LE64_BITMASK
(
BCH_SB_GRPQUOTA
,
struct
bch_sb
,
flags
[
0
],
58
,
59
);
LE64_BITMASK
(
BCH_SB_PRJQUOTA
,
struct
bch_sb
,
flags
[
0
],
59
,
60
);
LE64_BITMASK
(
BCH_SB_PRJQUOTA
,
struct
bch_sb
,
flags
[
0
],
59
,
60
);
/* 60-64 unused */
LE64_BITMASK
(
BCH_SB_HAS_ERRORS
,
struct
bch_sb
,
flags
[
0
],
60
,
61
);
/* 61-64 unused */
LE64_BITMASK
(
BCH_SB_STR_HASH_TYPE
,
struct
bch_sb
,
flags
[
1
],
0
,
4
);
LE64_BITMASK
(
BCH_SB_STR_HASH_TYPE
,
struct
bch_sb
,
flags
[
1
],
0
,
4
);
LE64_BITMASK
(
BCH_SB_COMPRESSION_TYPE
,
struct
bch_sb
,
flags
[
1
],
4
,
8
);
LE64_BITMASK
(
BCH_SB_COMPRESSION_TYPE
,
struct
bch_sb
,
flags
[
1
],
4
,
8
);
...
...
fs/bcachefs/error.c
View file @
0bc166ff
...
@@ -72,12 +72,9 @@ enum fsck_err_ret bch2_fsck_err(struct bch_fs *c, unsigned flags,
...
@@ -72,12 +72,9 @@ enum fsck_err_ret bch2_fsck_err(struct bch_fs *c, unsigned flags,
vprintk
(
fmt
,
args
);
vprintk
(
fmt
,
args
);
va_end
(
args
);
va_end
(
args
);
if
(
c
->
opts
.
errors
==
BCH_ON_ERROR_CONTINUE
&&
return
bch2_inconsistent_error
(
c
)
flags
&
FSCK_CAN_FIX
)
?
FSCK_ERR_EXIT
return
FSCK_ERR_FIX
;
:
FSCK_ERR_FIX
;
bch2_inconsistent_error
(
c
);
return
FSCK_ERR_EXIT
;
}
}
mutex_lock
(
&
c
->
fsck_error_lock
);
mutex_lock
(
&
c
->
fsck_error_lock
);
...
@@ -110,11 +107,7 @@ enum fsck_err_ret bch2_fsck_err(struct bch_fs *c, unsigned flags,
...
@@ -110,11 +107,7 @@ enum fsck_err_ret bch2_fsck_err(struct bch_fs *c, unsigned flags,
if
(
c
->
opts
.
fix_errors
==
FSCK_OPT_EXIT
)
{
if
(
c
->
opts
.
fix_errors
==
FSCK_OPT_EXIT
)
{
bch_err
(
c
,
"%s, exiting"
,
buf
);
bch_err
(
c
,
"%s, exiting"
,
buf
);
mutex_unlock
(
&
c
->
fsck_error_lock
);
}
else
if
(
flags
&
FSCK_CAN_FIX
)
{
return
FSCK_ERR_EXIT
;
}
if
(
flags
&
FSCK_CAN_FIX
)
{
if
(
c
->
opts
.
fix_errors
==
FSCK_OPT_ASK
)
{
if
(
c
->
opts
.
fix_errors
==
FSCK_OPT_ASK
)
{
printk
(
KERN_ERR
"%s: fix?"
,
buf
);
printk
(
KERN_ERR
"%s: fix?"
,
buf
);
fix
=
ask_yn
();
fix
=
ask_yn
();
...
@@ -142,13 +135,16 @@ enum fsck_err_ret bch2_fsck_err(struct bch_fs *c, unsigned flags,
...
@@ -142,13 +135,16 @@ enum fsck_err_ret bch2_fsck_err(struct bch_fs *c, unsigned flags,
mutex_unlock
(
&
c
->
fsck_error_lock
);
mutex_unlock
(
&
c
->
fsck_error_lock
);
set_bit
(
fix
if
(
fix
)
{
?
BCH_FS_FSCK_FIXED_ERRORS
set_bit
(
BCH_FS_ERRORS_FIXED
,
&
c
->
flags
);
:
BCH_FS_FSCK_UNFIXED_ERRORS
,
&
c
->
flags
);
return
FSCK_ERR_FIX
;
}
else
{
return
fix
?
FSCK_ERR_FIX
set_bit
(
BCH_FS_ERROR
,
&
c
->
flags
);
:
flags
&
FSCK_CAN_IGNORE
?
FSCK_ERR_IGNORE
return
c
->
opts
.
fix_errors
==
FSCK_OPT_EXIT
||
:
FSCK_ERR_EXIT
;
!
(
flags
&
FSCK_CAN_IGNORE
)
?
FSCK_ERR_EXIT
:
FSCK_ERR_IGNORE
;
}
}
}
void
bch2_flush_fsck_errs
(
struct
bch_fs
*
c
)
void
bch2_flush_fsck_errs
(
struct
bch_fs
*
c
)
...
...
fs/bcachefs/recovery.c
View file @
0bc166ff
...
@@ -365,8 +365,11 @@ int bch2_fs_recovery(struct bch_fs *c)
...
@@ -365,8 +365,11 @@ int bch2_fs_recovery(struct bch_fs *c)
c
->
disk_sb
.
sb
->
version
=
le16_to_cpu
(
bcachefs_metadata_version_current
);
c
->
disk_sb
.
sb
->
version
=
le16_to_cpu
(
bcachefs_metadata_version_current
);
}
}
if
(
!
test_bit
(
BCH_FS_FSCK_UNFIXED_ERRORS
,
&
c
->
flags
))
if
(
c
->
opts
.
fsck
&&
!
test_bit
(
BCH_FS_ERROR
,
&
c
->
flags
))
{
c
->
disk_sb
.
sb
->
features
[
0
]
|=
1ULL
<<
BCH_FEATURE_ATOMIC_NLINK
;
c
->
disk_sb
.
sb
->
features
[
0
]
|=
1ULL
<<
BCH_FEATURE_ATOMIC_NLINK
;
SET_BCH_SB_HAS_ERRORS
(
c
->
disk_sb
.
sb
,
0
);
}
mutex_unlock
(
&
c
->
sb_lock
);
mutex_unlock
(
&
c
->
sb_lock
);
if
(
enabled_qtypes
(
c
))
{
if
(
enabled_qtypes
(
c
))
{
...
...
fs/bcachefs/super-io.c
View file @
0bc166ff
...
@@ -707,6 +707,9 @@ int bch2_write_super(struct bch_fs *c)
...
@@ -707,6 +707,9 @@ int bch2_write_super(struct bch_fs *c)
le64_add_cpu
(
&
c
->
disk_sb
.
sb
->
seq
,
1
);
le64_add_cpu
(
&
c
->
disk_sb
.
sb
->
seq
,
1
);
if
(
test_bit
(
BCH_FS_ERROR
,
&
c
->
flags
))
SET_BCH_SB_HAS_ERRORS
(
c
->
disk_sb
.
sb
,
1
);
for_each_online_member
(
ca
,
c
,
i
)
for_each_online_member
(
ca
,
c
,
i
)
bch2_sb_from_fs
(
c
,
ca
);
bch2_sb_from_fs
(
c
,
ca
);
...
@@ -719,8 +722,7 @@ int bch2_write_super(struct bch_fs *c)
...
@@ -719,8 +722,7 @@ int bch2_write_super(struct bch_fs *c)
}
}
}
}
if
(
c
->
opts
.
nochanges
||
if
(
c
->
opts
.
nochanges
)
test_bit
(
BCH_FS_ERROR
,
&
c
->
flags
))
goto
out
;
goto
out
;
for_each_online_member
(
ca
,
c
,
i
)
{
for_each_online_member
(
ca
,
c
,
i
)
{
...
...
fs/bcachefs/super.c
View file @
0bc166ff
...
@@ -843,7 +843,6 @@ const char *bch2_fs_start(struct bch_fs *c)
...
@@ -843,7 +843,6 @@ const char *bch2_fs_start(struct bch_fs *c)
}
}
BUG_ON
(
!
err
);
BUG_ON
(
!
err
);
set_bit
(
BCH_FS_ERROR
,
&
c
->
flags
);
goto
out
;
goto
out
;
}
}
...
...
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