fix bug in error handling on FUSE channel shutdown

Summary:
Fix the code in FuseChannel::processSession() to look at the errno value
instead of the return value from `read()` when checking for ENODEV.

I accidentally broke this in D7436867.  This wasn't causing any major issues,
since we would still break out of the loop, but it caused us to incorrectly
print warning messages about receiving an unexpected error.  We would also
print this error message once per FUSE thread rather than just once for the
mount point.

Reviewed By: bolinfest

Differential Revision: D8109889

fbshipit-source-id: 9a53ca47b436ccf6731144ee2b829131339b6445
This commit is contained in:
Adam Simpkins 2018-05-23 11:40:21 -07:00 committed by Facebook Github Bot
parent eb052bb5c4
commit dac67ee976

View File

@ -1021,13 +1021,13 @@ void FuseChannel::processSession() {
// According to comments in the libfuse code:
// ENOENT means the operation was interrupted; it's safe to restart
continue;
} else if (res == -ENODEV) {
} else if (error == ENODEV) {
// ENODEV means the filesystem was unmounted
requestSessionExit(StopReason::UNMOUNTED);
break;
} else {
XLOG(WARNING) << "error reading from fuse channel: "
<< folly::errnoStr(-res);
<< folly::errnoStr(error);
requestSessionExit(StopReason::FUSE_READ_ERROR);
break;
}