ClusterLabs / resource-agents

Combined repository of OCF agents from the RHCS and Linux-HA projects
GNU General Public License v2.0
493 stars 580 forks source link

storage_mon: Use the O_DIRECT flag in open() to eliminate cache effects #1797

Closed inouekazu closed 2 years ago

inouekazu commented 2 years ago

Use of O_DIRECT in open() eliminates the possibility of false negatives resulting from buffer cache reads.

please refer to https://lists.clusterlabs.org/pipermail/users/2022-August/030459.html for background.

knet-ci-bot commented 2 years ago

Can one of the admins verify this patch?

fabbione commented 2 years ago

test this please

chrissie-c commented 2 years ago

I agree with Ken (in the above thread) that there should be a fallback if O_DIRECT fails. There are filesystems and options even on Linux that don't always support O_DIRECT and they shouldn't be ecxluded or errored

inouekazu commented 2 years ago
wenningerk commented 2 years ago

Also, I don't understand why the error checking for the ioctl is done on the sec_size value rather than the ioctl return. If that's fine then a comment saying why would be helpful. Maybe we need both?

Some kind of shortcut for 'ioctl has to succeed and not return bogus'. But some comment would of course make sense. Basically I guess the code should be safe though I don't know if there are actually cases where ioctl would succeed without returning a proper block-size. Same code-pattern btw. has been in sbd since ever.

inouekazu commented 2 years ago
chrissie-c commented 2 years ago

retest this please

chrissie-c commented 2 years ago

retest this please

oalbrigt commented 2 years ago

Thanks.