Repository navigation
Conversation
fuse_dev_do_read returns ECONNABORTED when the connection is aborted, as an unmount does, after the read took a request off the pending list. readMessage mapped only ENODEV to io.EOF, so ReadOp returned the error and fuseutil's ServeOps panicked on it at unmount. readMessage now maps ECONNABORTED to io.EOF on Linux. A test replaces the read through the new initInMessage variable.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
On Linux, a read from
/dev/fusecan fail with ECONNABORTED while the file system is unmounted.readMessagemaps only ENODEV toio.EOF(connection.go L388-L423), soReadOpreturns the error.fuseutil'sServeOpspanics on everyReadOperror other thanio.EOF(fuseutil/file_system.go L107-L115), so the process crashes at unmount.This PR makes
readMessagemap ECONNABORTED toio.EOFon Linux, as it does ENODEV.I hit the panic in
samples/forgetfs(ForgetFSTest.Open_ManyTimes) while running the mounting tests on a GitHub Actions Ubuntu runner. It came fromfileSystemServer.ServeOps:When the read returns ECONNABORTED
fuse_dev_do_readtakes a request off the pending list (dev.c L1315-L1318). It then checks the connection again underfpq->lock. When the connection was aborted in between, it ends the request and returns ECONNABORTED (L1332-L1340).fuse_abort_connclearsfpq->connected(L2261) beforefiq->connected(L2285), so a read that got past thefiq->connectedcheck can land there. Unmounting aborts the connection (fuse_conn_destroy, inode.c L1946-L1953).The other two abort checks in
fuse_dev_do_readreturn ECONNABORTED only when the connection was aborted through/sys/fs/fuse/connections/<N>/abortafter the file system negotiatedFUSE_ABORT_ERROR(dev.c L1296-L1299, L1352-L1355, control.c L34-L41). They return ENODEV otherwise. This library does not requestFUSE_ABORT_ERROR.The mapping is Linux-only, because the code above is where the errno comes from. On macOS
readMessagebehaves as before.Tests
TestReadOpReturnsEOFWhenTheReadIsAborted(connection_linux_test.go) makes the read fail with an*os.PathErrorholding ENODEV, ECONNABORTED or EIO, the formos.File.Readreturns.ReadOpmust returnio.EOFfor the first two and the error itself for EIO. The test does not mount. Run it with:A test cannot make a read from a real file fail with ECONNABORTED, so
readMessagenow calls(*buffer.InMessage).Initthrough a package variable,initInMessage, which the test replaces. If you prefer no test seam, I can drop the variable and the test.On master (a124548) with only
initInMessageadded, the ECONNABORTED case fails:With this PR, all three cases pass, also under
-race.Validation
CI runs no
go test, so these local runs are the test evidence.gofmt -l .prints nothing.go build ./...passes withGOOS=linuxand withGOOS=darwin.go vet ./...reports the same findings as on master, withGOOS=linuxand withGOOS=darwin, all in files this PR does not touch: unkeyedfusekernel.Protocolliterals,reflect.SliceHeaderuses and, on linux/arm64,syscall.SYS_DUP2insamples/flushfs.Not changed