From 24657859a89fd4c3da4833e6b451bf36faf053d0 Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Wed, 2 Feb 2022 08:54:52 -0800 Subject: [PATCH] when o_direct is disabled do not attempt fadvise call (#14230) --- cmd/xl-storage.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cmd/xl-storage.go b/cmd/xl-storage.go index 4f0bc28e1..8e7a964bf 100644 --- a/cmd/xl-storage.go +++ b/cmd/xl-storage.go @@ -1715,7 +1715,11 @@ func (s *xlStorage) ReadFileStream(ctx context.Context, volume, path string, off }{Reader: io.LimitReader(or, length), Closer: closeWrapper(func() error { if !alignment || offset+length%xioutil.DirectioAlignSize != 0 { // invalidate page-cache for unaligned reads. - disk.FadviseDontNeed(file) + if !globalAPIConfig.isDisableODirect() { + // skip removing from page-cache only + // if O_DIRECT was disabled. + disk.FadviseDontNeed(file) + } } return or.Close() })}