nfs timeout error

This commit is contained in:
royalcat 2024-04-06 16:51:17 +03:00
parent 7bb411e7a4
commit f4f60df6b2
9 changed files with 13 additions and 11 deletions

View file

@ -27,7 +27,7 @@ func onGetAttr(ctx context.Context, w *response, userHandle Handler) error {
return &NFSStatusError{NFSStatusNoEnt, err} return &NFSStatusError{NFSStatusNoEnt, err}
} }
if errors.Is(err, context.DeadlineExceeded) { if errors.Is(err, context.DeadlineExceeded) {
return &NFSStatusError{NFSStatusJukebox, err} return &NFSStatusError{timeoutStatus, err}
} }
return &NFSStatusError{NFSStatusIO, err} return &NFSStatusError{NFSStatusIO, err}
} }

View file

@ -48,7 +48,7 @@ func onRead(ctx context.Context, w *response, userHandle Handler) error {
return &NFSStatusError{NFSStatusNoEnt, err} return &NFSStatusError{NFSStatusNoEnt, err}
} }
if errors.Is(err, context.DeadlineExceeded) { if errors.Is(err, context.DeadlineExceeded) {
return &NFSStatusError{NFSStatusJukebox, err} return &NFSStatusError{timeoutStatus, err}
} }
return &NFSStatusError{NFSStatusAccess, err} return &NFSStatusError{NFSStatusAccess, err}
} }

View file

@ -160,7 +160,7 @@ func getDirListingWithVerifier(ctx context.Context, userHandle Handler, fsHandle
return nil, 0, &NFSStatusError{NFSStatusAccess, err} return nil, 0, &NFSStatusError{NFSStatusAccess, err}
} }
if errors.Is(err, context.DeadlineExceeded) { if errors.Is(err, context.DeadlineExceeded) {
return nil, 0, &NFSStatusError{NFSStatusJukebox, err} return nil, 0, &NFSStatusError{timeoutStatus, err}
} }
return nil, 0, &NFSStatusError{NFSStatusIO, err} return nil, 0, &NFSStatusError{NFSStatusIO, err}
} }

View file

@ -31,7 +31,7 @@ func onReadLink(ctx context.Context, w *response, userHandle Handler) error {
return &NFSStatusError{NFSStatusNoEnt, err} return &NFSStatusError{NFSStatusNoEnt, err}
} }
if errors.Is(err, context.DeadlineExceeded) { if errors.Is(err, context.DeadlineExceeded) {
return &NFSStatusError{NFSStatusJukebox, err} return &NFSStatusError{timeoutStatus, err}
} }
return &NFSStatusError{NFSStatusAccess, err} return &NFSStatusError{NFSStatusAccess, err}

View file

@ -39,7 +39,7 @@ func onRemove(ctx context.Context, w *response, userHandle Handler) error {
return &NFSStatusError{NFSStatusAccess, err} return &NFSStatusError{NFSStatusAccess, err}
} }
if errors.Is(err, context.DeadlineExceeded) { if errors.Is(err, context.DeadlineExceeded) {
return &NFSStatusError{NFSStatusJukebox, err} return &NFSStatusError{timeoutStatus, err}
} }
return &NFSStatusError{NFSStatusIO, err} return &NFSStatusError{NFSStatusIO, err}
} }
@ -60,7 +60,7 @@ func onRemove(ctx context.Context, w *response, userHandle Handler) error {
return &NFSStatusError{NFSStatusAccess, err} return &NFSStatusError{NFSStatusAccess, err}
} }
if errors.Is(err, context.DeadlineExceeded) { if errors.Is(err, context.DeadlineExceeded) {
return &NFSStatusError{NFSStatusJukebox, err} return &NFSStatusError{timeoutStatus, err}
} }
return &NFSStatusError{NFSStatusIO, err} return &NFSStatusError{NFSStatusIO, err}
} }

View file

@ -53,7 +53,7 @@ func onRename(ctx context.Context, w *response, userHandle Handler) error {
return &NFSStatusError{NFSStatusNoEnt, err} return &NFSStatusError{NFSStatusNoEnt, err}
} }
if errors.Is(err, context.DeadlineExceeded) { if errors.Is(err, context.DeadlineExceeded) {
return &NFSStatusError{NFSStatusJukebox, err} return &NFSStatusError{timeoutStatus, err}
} }
return &NFSStatusError{NFSStatusIO, err} return &NFSStatusError{NFSStatusIO, err}
} }
@ -69,7 +69,7 @@ func onRename(ctx context.Context, w *response, userHandle Handler) error {
return &NFSStatusError{NFSStatusNoEnt, err} return &NFSStatusError{NFSStatusNoEnt, err}
} }
if errors.Is(err, context.DeadlineExceeded) { if errors.Is(err, context.DeadlineExceeded) {
return &NFSStatusError{NFSStatusJukebox, err} return &NFSStatusError{timeoutStatus, err}
} }
return &NFSStatusError{NFSStatusIO, err} return &NFSStatusError{NFSStatusIO, err}
} }
@ -92,7 +92,7 @@ func onRename(ctx context.Context, w *response, userHandle Handler) error {
return &NFSStatusError{NFSStatusAccess, err} return &NFSStatusError{NFSStatusAccess, err}
} }
if errors.Is(err, context.DeadlineExceeded) { if errors.Is(err, context.DeadlineExceeded) {
return &NFSStatusError{NFSStatusJukebox, err} return &NFSStatusError{timeoutStatus, err}
} }
return &NFSStatusError{NFSStatusIO, err} return &NFSStatusError{NFSStatusIO, err}
} }

View file

@ -33,7 +33,7 @@ func onSetAttr(ctx context.Context, w *response, userHandle Handler) error {
return &NFSStatusError{NFSStatusNoEnt, err} return &NFSStatusError{NFSStatusNoEnt, err}
} }
if errors.Is(err, context.DeadlineExceeded) { if errors.Is(err, context.DeadlineExceeded) {
return &NFSStatusError{NFSStatusJukebox, err} return &NFSStatusError{timeoutStatus, err}
} }
return &NFSStatusError{NFSStatusAccess, err} return &NFSStatusError{NFSStatusAccess, err}
} }

View file

@ -58,7 +58,7 @@ func onWrite(ctx context.Context, w *response, userHandle Handler) error {
return &NFSStatusError{NFSStatusNoEnt, err} return &NFSStatusError{NFSStatusNoEnt, err}
} }
if errors.Is(err, context.DeadlineExceeded) { if errors.Is(err, context.DeadlineExceeded) {
return &NFSStatusError{NFSStatusJukebox, err} return &NFSStatusError{timeoutStatus, err}
} }
return &NFSStatusError{NFSStatusAccess, err} return &NFSStatusError{NFSStatusAccess, err}
} }

View file

@ -80,6 +80,8 @@ func (n NFSProcedure) String() string {
} }
} }
const timeoutStatus = NFSStatusIO
// NFSStatus (nfsstat3) is a result code for nfs rpc calls // NFSStatus (nfsstat3) is a result code for nfs rpc calls
type NFSStatus uint32 type NFSStatus uint32