aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakob Unterwurzacher2021-05-18 18:38:23 +0200
committerJakob Unterwurzacher2021-05-18 18:38:23 +0200
commit0650a512bbf5a49031d47afac538a92e0994757a (patch)
tree53ea16ddce8f7b714301a929f8374a20921779a8
parent5da20da977ae5c870bc2009cd540cb5fe9aae79b (diff)
fsck: redirect go-fuse noise to syslog
-rw-r--r--fsck.go7
-rw-r--r--internal/tlog/log.go4
-rw-r--r--mount.go2
3 files changed, 11 insertions, 2 deletions
diff --git a/fsck.go b/fsck.go
index 5b32a5e..70528cf 100644
--- a/fsck.go
+++ b/fsck.go
@@ -253,6 +253,7 @@ func (ck *fsckObj) xattrs(relPath string) {
}
}
+// entrypoint from main()
func fsck(args *argContainer) (exitcode int) {
if args.reverse {
tlog.Fatal.Printf("Running -fsck with -reverse is not supported")
@@ -274,6 +275,12 @@ func fsck(args *argContainer) (exitcode int) {
watchDone: make(chan struct{}),
seenInodes: make(map[uint64]struct{}),
}
+ if args.quiet {
+ // go-fuse throws a lot of these:
+ // writer: Write/Writev failed, err: 2=no such file or directory. opcode: INTERRUPT
+ // This is ugly and causes failures in xfstests. Hide them away in syslog.
+ tlog.SwitchLoggerToSyslog()
+ }
// Mount
srv := initGoFuse(pfs, args)
// Handle SIGINT & SIGTERM
diff --git a/internal/tlog/log.go b/internal/tlog/log.go
index 0eee704..6d32a6b 100644
--- a/internal/tlog/log.go
+++ b/internal/tlog/log.go
@@ -136,6 +136,7 @@ func init() {
}
// SwitchToSyslog redirects the output of this logger to syslog.
+// p = facility | severity
func (l *toggledLogger) SwitchToSyslog(p syslog.Priority) {
w, err := syslog.New(p, ProgramName)
if err != nil {
@@ -150,7 +151,8 @@ func (l *toggledLogger) SwitchToSyslog(p syslog.Priority) {
// SwitchLoggerToSyslog redirects the default log.Logger that the go-fuse lib uses
// to syslog.
-func SwitchLoggerToSyslog(p syslog.Priority) {
+func SwitchLoggerToSyslog() {
+ p := syslog.LOG_USER | syslog.LOG_WARNING
w, err := syslog.New(p, ProgramName)
if err != nil {
Warn.Printf("SwitchLoggerToSyslog: %v", err)
diff --git a/mount.go b/mount.go
index 9409471..f992f94 100644
--- a/mount.go
+++ b/mount.go
@@ -143,7 +143,7 @@ func doMount(args *argContainer) {
tlog.Debug.SwitchToSyslog(syslog.LOG_USER | syslog.LOG_DEBUG)
tlog.Warn.SwitchToSyslog(syslog.LOG_USER | syslog.LOG_WARNING)
tlog.Fatal.SwitchToSyslog(syslog.LOG_USER | syslog.LOG_CRIT)
- tlog.SwitchLoggerToSyslog(syslog.LOG_USER | syslog.LOG_WARNING)
+ tlog.SwitchLoggerToSyslog()
// Daemons should redirect stdin, stdout and stderr
redirectStdFds()
}