Skip to content

Commit 3e413e6

Browse files
manninglucasgvisor-bot
authored andcommitted
Return the response error before EIO in fuse write.
PiperOrigin-RevId: 787162692
1 parent 88f0a26 commit 3e413e6

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

pkg/sentry/fsimpl/fuse/read_write.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,10 @@ func (fs *filesystem) Write(ctx context.Context, fd *regularFileFD, offset int64
195195
if err != nil {
196196
return n, offset, err
197197
}
198+
if err := res.Error(); err != nil {
199+
return n, offset, err
200+
}
201+
198202
out := linux.FUSEWriteOut{}
199203
if err := res.UnmarshalPayload(&out); err != nil {
200204
return n, offset, err
@@ -203,9 +207,6 @@ func (fs *filesystem) Write(ctx context.Context, fd *regularFileFD, offset int64
203207
offset += int64(out.Size)
204208
src = src.DropFirst64(int64(out.Size))
205209

206-
if err := res.Error(); err != nil {
207-
return n, offset, err
208-
}
209210
// Write more than requested? EIO.
210211
if out.Size > writeSize {
211212
return n, offset, linuxerr.EIO

0 commit comments

Comments
 (0)