Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
jacobsa-fuse
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
jacobsa-fuse
Commits
263bbab5
Commit
263bbab5
authored
Aug 03, 2015
by
Aaron Jacobs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't log errors that we expect to happen regularly.
For GoogleCloudPlatform/gcsfuse#99.
parent
13eb2958
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
1 deletion
+35
-1
connection.go
connection.go
+35
-1
No files found.
connection.go
View file @
263bbab5
...
...
@@ -26,6 +26,7 @@ import (
"golang.org/x/net/context"
"github.com/jacobsa/fuse/fuseops"
"github.com/jacobsa/fuse/internal/buffer"
"github.com/jacobsa/fuse/internal/freelist"
"github.com/jacobsa/fuse/internal/fusekernel"
...
...
@@ -418,6 +419,39 @@ func (c *Connection) ReadOp() (ctx context.Context, op interface{}, err error) {
}
}
// Skip errors that happen as a matter of course, since they spook users.
func
(
c
*
Connection
)
shouldLogError
(
op
interface
{},
err
error
)
bool
{
// We don't log non-errors.
if
err
==
nil
{
return
false
}
// We can't log if there's nothing to log to.
if
c
.
errorLogger
==
nil
{
return
false
}
switch
op
.
(
type
)
{
case
*
fuseops
.
LookUpInodeOp
:
// It is totally normal for the kernel to ask to look up an inode by name
// and find the name doesn't exist. For example, this happens when linking
// a new file.
if
err
==
syscall
.
ENOENT
{
return
false
}
case
*
unknownOp
:
// Don't bother the user with methods we intentionally don't support.
if
err
==
syscall
.
ENOSYS
{
return
false
}
}
return
true
}
// Reply to an op previously read using ReadOp, with the supplied error (or nil
// if successful). The context must be the context returned by ReadOp.
//
...
...
@@ -453,7 +487,7 @@ func (c *Connection) Reply(ctx context.Context, opErr error) {
}
// Error logging
if
opErr
!=
nil
&&
c
.
errorLogger
!=
nil
{
if
c
.
shouldLogError
(
op
,
opErr
)
{
c
.
errorLogger
.
Printf
(
"%T error: %v"
,
op
,
opErr
)
}
...
...
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