Skip to contentSkip to conversation

xfs_repair: update the manual content about xfs_repair exit status

PATCH Superseded Zorro Lang 4 participants 7 messages Sep 13, 2016 – Sep 14, 2016

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Zorro Lang

author
#0 lore raw

PATCH v2 1/1 xfs_repair: update the manual content about xfs_repair exit status

The man 8 xfs_repair said "xfs_repair run without the -n option will always return a status code of 0". That's not correct.

xfs_repair will return 2 if it finds a fs log which needs to be replayed or cleared, 1 if runtime error is encountered, and 0 for all other cases.

---

Hi,

V2 patch did below things:
- change the description for xfs_repair
- remove the description for "xfs_repair -L"

Thanks,
Zorro

 man/man8/xfs_repair.8 | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
man/man8/xfs_repair.8 +6 -1
index 1b4d9e3..e45fd90 100644
@@ -504,12 +504,17 @@ that is known to be free. The entry is therefore invalid and is deleted.
 This message refers to a large directory.
 If the directory were small, the message would read "junking entry ...".
 .SH EXIT STATUS
+.TP
 .B xfs_repair \-n
 (no modify node)
 will return a status of 1 if filesystem corruption was detected and
 0 if no filesystem corruption was detected.
+.TP
 .B xfs_repair
-run without the \-n option will always return a status code of 0.
+run without the \-n option will return a status code of 2 if it finds a
+filesystem log which needs to be replayed(by a mount/umount cycle) or
+cleared(by -L option), 1 if a runtime error is encountered, and 0 in all
+other cases, whether or not filesystem corruption was detected.
 .SH BUGS
 The filesystem to be checked and repaired must have been
 unmounted cleanly using normal system administration procedures
Signature · 6 lines
2.7.4

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Reviewed-by on v2 1/1
#1 lore raw
Quoted 27 lines · Zorro Lang

The man 8 xfs_repair said "xfs_repair run without the -n option will always return a status code of 0". That's not correct.

xfs_repair will return 2 if it finds a fs log which needs to be replayed or cleared, 1 if runtime error is encountered, and 0 for all other cases.

---

Hi,

V2 patch did below things:
- change the description for xfs_repair
- remove the description for "xfs_repair -L"

Thanks,
Zorro

 man/man8/xfs_repair.8 | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
man/man8/xfs_repair.8 +0 -0
index 1b4d9e3..e45fd90 100644

man/man8/xfs_repair.8 that is known to be free. The entry is therefore invalid and is deleted. · line 509

Quoted 6 lines
man/man8/xfs_repair.8 +1 -0
@@ -504,12 +504,17 @@ that is known to be free. The entry is therefore invalid and is deleted.
 This message refers to a large directory.
 If the directory were small, the message would read "junking entry ...".
 .SH EXIT STATUS
+.TP
 .B xfs_repair \-n
 (no modify node)

s/node/mode/, maybe Dave can fix that on commit. Sorry I missed it the first time.

man/man8/xfs_repair.8 that is known to be free. The entry is therefore invalid and is deleted. · line 515

Quoted 7 lines
man/man8/xfs_repair.8 +3 -1
 will return a status of 1 if filesystem corruption was detected and
 0 if no filesystem corruption was detected.
+.TP
 .B xfs_repair
-run without the \-n option will always return a status code of 0.
+run without the \-n option will return a status code of 2 if it finds a
+filesystem log which needs to be replayed(by a mount/umount cycle) or

space after replayed

man/man8/xfs_repair.8 that is known to be free. The entry is therefore invalid and is deleted. · line 516

Quoted 1 line
man/man8/xfs_repair.8 +1 -0
+cleared(by -L option), 1 if a runtime error is encountered, and 0 in all

space after cleared

man/man8/xfs_repair.8 that is known to be free. The entry is therefore invalid and is deleted. · line 517

Quoted 1 line
man/man8/xfs_repair.8 +1 -0
+other cases, whether or not filesystem corruption was detected.

Yep, I think this is ok with the small fixes above. I hope the "whether or not" is not more confusing, but I think it probably clarifies.

Dave, if you don't mind the small fixups on the way in,

Thanks,
-Eric

Quoted 4 lines
man/man8/xfs_repair.8 +0 -0
 .SH BUGS
 The filesystem to be checked and repaired must have been
 unmounted cleanly using normal system administration procedures
#2 lore raw
In reply to Zorro Lang
Quoted 32 lines · Zorro Lang

The man 8 xfs_repair said "xfs_repair run without the -n option will always return a status code of 0". That's not correct.

xfs_repair will return 2 if it finds a fs log which needs to be replayed or cleared, 1 if runtime error is encountered, and 0 for all other cases.

---

Hi,

V2 patch did below things:
- change the description for xfs_repair
- remove the description for "xfs_repair -L"

Thanks,
Zorro

 man/man8/xfs_repair.8 | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
man/man8/xfs_repair.8 +1 -0
index 1b4d9e3..e45fd90 100644
@@ -504,12 +504,17 @@ that is known to be free. The entry is therefore invalid and is deleted.
 This message refers to a large directory.
 If the directory were small, the message would read "junking entry ...".
 .SH EXIT STATUS
+.TP
 .B xfs_repair \-n

man/man8/xfs_repair.8 that is known to be free. The entry is therefore invalid and is deleted. · line 517

Quoted 10 lines
man/man8/xfs_repair.8 +5 -1
 (no modify node)
 will return a status of 1 if filesystem corruption was detected and
 0 if no filesystem corruption was detected.
+.TP
 .B xfs_repair
-run without the \-n option will always return a status code of 0.
+run without the \-n option will return a status code of 2 if it finds a
+filesystem log which needs to be replayed(by a mount/umount cycle) or
+cleared(by -L option), 1 if a runtime error is encountered, and 0 in all
+other cases, whether or not filesystem corruption was detected.

So... I'd rather the documentation about the return code reflect the status of the filesystem -- 2 means "unclean log, replay it or zap it", 1 means "errors encountered, fs may not be correct", and 0 /should/ mean "fs is correct".

OTOH I don't know for sure that xfs_repair always cleans up the fs on the first try. From my fuzzing experiments a few years ago this seems to be the case nearly all the time (unlike e2fsck) but not 100%. ISTR asking Dave about this, and I think he said that the FS should be clean if repair returns 0. But I'll let him reiterate that if it's true; don't trust my crummy memory, that's why I have filesystems. ;)

--D

Quoted 10 lines
man/man8/xfs_repair.8 +0 -0
 .SH BUGS
 The filesystem to be checked and repaired must have been
 unmounted cleanly using normal system administration procedures
Signature · 6 lines
2.7.4

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

#3 lore raw
Quoted 49 lines · Darrick J. Wong
Quoted 32 lines · Zorro Lang

The man 8 xfs_repair said "xfs_repair run without the -n option will always return a status code of 0". That's not correct.

xfs_repair will return 2 if it finds a fs log which needs to be replayed or cleared, 1 if runtime error is encountered, and 0 for all other cases.

---

Hi,

V2 patch did below things:
- change the description for xfs_repair
- remove the description for "xfs_repair -L"

Thanks,
Zorro

 man/man8/xfs_repair.8 | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
man/man8/xfs_repair.8 +1 -0
index 1b4d9e3..e45fd90 100644
@@ -504,12 +504,17 @@ that is known to be free. The entry is therefore invalid and is deleted.
 This message refers to a large directory.
 If the directory were small, the message would read "junking entry ...".
 .SH EXIT STATUS
+.TP
 .B xfs_repair \-n

man/man8/xfs_repair.8 that is known to be free. The entry is therefore invalid and is deleted. · line 517

Quoted 10 lines
man/man8/xfs_repair.8 +5 -1
 (no modify node)
 will return a status of 1 if filesystem corruption was detected and
 0 if no filesystem corruption was detected.
+.TP
 .B xfs_repair
-run without the \-n option will always return a status code of 0.
+run without the \-n option will return a status code of 2 if it finds a
+filesystem log which needs to be replayed(by a mount/umount cycle) or
+cleared(by -L option), 1 if a runtime error is encountered, and 0 in all
+other cases, whether or not filesystem corruption was detected.

So... I'd rather the documentation about the return code reflect the status of the filesystem -- 2 means "unclean log, replay it or zap it", 1 means "errors encountered, fs may not be correct", and 0 /should/ mean "fs is correct".

Quoted 2 lines

OTOH I don't know for sure that xfs_repair always cleans up the fs on the first try.

That's certainly the intent; I can't imagine a manpage documenting return codes qualified with "... unless bugs happen." :)

Quoted 2 lines

From my fuzzing experiments a few years ago this seems
to be the case nearly all the time (unlike e2fsck) but not 100%.

Same here, I fixed what I found...

Quoted 4 lines

ISTR
asking Dave about this, and I think he said that the FS should be clean if repair returns 0. But I'll let him reiterate that if it's true; don't trust my crummy memory, that's why I have filesystems. ;)

Did you have an alternate wording in mind?

-Eric

Quoted 13 lines

--D

Quoted 10 lines
man/man8/xfs_repair.8 +0 -0
 .SH BUGS
 The filesystem to be checked and repaired must have been
 unmounted cleanly using normal system administration procedures
Signature · 6 lines
2.7.4

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Quoted 5 lines

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

#4 lore raw
Quoted 50 lines · Eric Sandeen
Quoted 49 lines · Darrick J. Wong
Quoted 32 lines · Zorro Lang

The man 8 xfs_repair said "xfs_repair run without the -n option will always return a status code of 0". That's not correct.

xfs_repair will return 2 if it finds a fs log which needs to be replayed or cleared, 1 if runtime error is encountered, and 0 for all other cases.

---

Hi,

V2 patch did below things:
- change the description for xfs_repair
- remove the description for "xfs_repair -L"

Thanks,
Zorro

 man/man8/xfs_repair.8 | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
man/man8/xfs_repair.8 +1 -0
index 1b4d9e3..e45fd90 100644
@@ -504,12 +504,17 @@ that is known to be free. The entry is therefore invalid and is deleted.
 This message refers to a large directory.
 If the directory were small, the message would read "junking entry ...".
 .SH EXIT STATUS
+.TP
 .B xfs_repair \-n

man/man8/xfs_repair.8 that is known to be free. The entry is therefore invalid and is deleted. · line 517

Quoted 10 lines
man/man8/xfs_repair.8 +5 -1
 (no modify node)
 will return a status of 1 if filesystem corruption was detected and
 0 if no filesystem corruption was detected.
+.TP
 .B xfs_repair
-run without the \-n option will always return a status code of 0.
+run without the \-n option will return a status code of 2 if it finds a
+filesystem log which needs to be replayed(by a mount/umount cycle) or
+cleared(by -L option), 1 if a runtime error is encountered, and 0 in all
+other cases, whether or not filesystem corruption was detected.

So... I'd rather the documentation about the return code reflect the status of the filesystem -- 2 means "unclean log, replay it or zap it", 1 means "errors encountered, fs may not be correct", and 0 /should/ mean "fs is correct".

Quoted 5 lines
Quoted 2 lines

OTOH I don't know for sure that xfs_repair always cleans up the fs on the first try.

That's certainly the intent; I can't imagine a manpage documenting return codes qualified with "... unless bugs happen." :)

Right - if we hit bugs, all bets are off. But otherwise, the fs should be repaired and clean after a single pass.

Quoted 6 lines
Quoted 4 lines

ISTR
asking Dave about this, and I think he said that the FS should be clean if repair returns 0. But I'll let him reiterate that if it's true; don't trust my crummy memory, that's why I have filesystems. ;)

Did you have an alternate wording in mind?

Yup, 0 = " fs is clean", 1 = "fs is still b0rken", 2 = "couldn't run for whatever reason given"

Cheers,

Dave.

Signature · 7 lines
Dave Chinner
[email protected]

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
#5 lore raw
Quoted 2 lines · Dave Chinner
Quoted 1 line · Eric Sandeen

On 9/13/16 11:32 AM, Darrick J. Wong wrote:

...

Quoted 19 lines
Quoted 10 lines
Quoted 7 lines

So... I'd rather the documentation about the return code reflect the status of the filesystem -- 2 means "unclean log, replay it or zap it", 1 means "errors encountered, fs may not be correct", and 0 /should/ mean "fs is correct".

OTOH I don't know for sure that xfs_repair always cleans up the fs on the first try.

That's certainly the intent; I can't imagine a manpage documenting return codes qualified with "... unless bugs happen." :)

Right - if we hit bugs, all bets are off. But otherwise, the fs should be repaired and clean after a single pass.

Quoted 5 lines
Quoted 4 lines

ISTR
asking Dave about this, and I think he said that the FS should be clean if repair returns 0. But I'll let him reiterate that if it's true; don't trust my crummy memory, that's why I have filesystems. ;)

Quoted 4 lines
Quoted 1 line

Did you have an alternate wording in mind?

Yup, 0 = " fs is clean", 1 = "fs is still b0rken", 2 = "couldn't run for whatever reason given"

Technically, 1 = "may or may not be broken" - we really don't know. We could get an exit of 1 for a consistent filesystem, for example if some allocation failed... all we know is something bonked out in the middle.

Maybe "1 == xfs_repair did not run to completion?"

-Eric

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

#6 lore raw
Quoted 32 lines · Eric Sandeen
Quoted 2 lines · Dave Chinner
Quoted 1 line · Eric Sandeen

On 9/13/16 11:32 AM, Darrick J. Wong wrote:

...

Quoted 19 lines
Quoted 10 lines
Quoted 7 lines

So... I'd rather the documentation about the return code reflect the status of the filesystem -- 2 means "unclean log, replay it or zap it", 1 means "errors encountered, fs may not be correct", and 0 /should/ mean "fs is correct".

OTOH I don't know for sure that xfs_repair always cleans up the fs on the first try.

That's certainly the intent; I can't imagine a manpage documenting return codes qualified with "... unless bugs happen." :)

Right - if we hit bugs, all bets are off. But otherwise, the fs should be repaired and clean after a single pass.

Quoted 5 lines
Quoted 4 lines

ISTR
asking Dave about this, and I think he said that the FS should be clean if repair returns 0. But I'll let him reiterate that if it's true; don't trust my crummy memory, that's why I have filesystems. ;)

Quoted 4 lines
Quoted 1 line

Did you have an alternate wording in mind?

Yup, 0 = " fs is clean", 1 = "fs is still b0rken", 2 = "couldn't run for whatever reason given"

Quoted 6 lines

Technically, 1 = "may or may not be broken" - we really don't know. We could get an exit of 1 for a consistent filesystem, for example if some allocation failed... all we know is something bonked out in the middle.

Maybe "1 == xfs_repair did not run to completion?"

Well, if it fails part way through phase 5, then the filesystem is most definitely broken, even if it was clean to begin with. i.e. repair, even when the filesystem is clean, will rebuild parts of the filesystem from scratch.

And repair nulls out directory entries in phase 4 and doesn't rebuild those directories till phase 6, so between those points the filesystem is actually in a corrupt state that requires repair. hence there is a large scope where a failure in repair really does mean that we need to run repair again. Hence I think it's simply safer to explicitly document it as:

	"1 == fs may be even more broken than before repair started,
	so repair needs to be run again"

because "did not run to completion" does not really tell the user what to do when it occurs.

Cheers,

Dave.

Signature · 7 lines
Dave Chinner
[email protected]

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs