Skip to contentSkip to conversation

device: include goto label also for O_NOATIME

PATCH New Daniel Golle 2 participants 5 messages May 20, 2016 – May 23, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 device: include goto label also for O_NOATIME

commit b5314c2a6ae5fe4f802e82a4f31cf2fad398ded9
device: Retry open without O_NOATIME if it fails.

makes use of goto lable 'opened:' but that might not be defined, e.g. on standard C libraries without O_DIRECT_SUPPORT. Make sure it is defined also if only O_NOATIME is supported as compiling obviously fails otherwise:
device/dev-io.c:508:5: error: label 'opened' used but not defined

---
 lib/device/dev-io.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/device/dev-io.c +1 -1
index a9a2374..4d71967 100644
@@ -529,7 +529,7 @@ int dev_open_flags(struct device *dev, int flags, int direct, int quiet)
 		return 0;
 	}
 
-#ifdef O_DIRECT_SUPPORT
+#if defined(O_DIRECT_SUPPORT) || defined(O_NOATIME)
       opened:
 	if (direct)
 		dev->flags |= DEV_O_DIRECT_TESTED;
Signature · 1 line
2.8.2
#1 lore raw

PATCH 1/1 device: include goto label also for O_NOATIME

Quoted 1 line · Daniel Golle

on standard C libraries without O_DIRECT_SUPPORT. Make sure it is

Which library or libraries are leading to this problem and what systems are still using them and do we know why they still don't support O_DIRECT?

Alasdair

#2 lore raw

PATCH 1/1 device: include goto label also for O_NOATIME

Hi Alasdair,

Quoted 6 lines · Alasdair G Kergon
Quoted 1 line · Daniel Golle

on standard C libraries without O_DIRECT_SUPPORT. Make sure it is

Which library or libraries are leading to this problem and what systems are still using them and do we know why they still don't support O_DIRECT?

The musl libc [1] apparently doesn't support O_DIRECT.

Alpine Linux [2], LEDE [3] and OpenWrt [4] are affected.

Never the less, if you use goto a view lines above in code which is not augmented by the precompiler and then augment the goto target this is obviously wrong. Either depend on O_DIRECT support always being present and thus remove the ifdef'ery and make configure fail if O_DIRECT isn't supported or make sure that the code is symantically sound if you do all precompiler magic. Currently it simply allows for the pre-compiler to generate code in which the goto target isn't defined though it is being used.

[1]: http://www.musl-libc.org/
[2]: http://alpinelinux.org/
[3]: http://www.lede-project.org/
[4]: http://www.openwrt.org/

Cheers

Daniel

#3 lore raw

PATCH 1/1 device: include goto label also for O_NOATIME

Quoted 2 lines · Daniel Golle

The musl libc [1] apparently doesn't support O_DIRECT. Alpine Linux [2], LEDE [3] and OpenWrt [4] are affected.

So that's still widespread enough that we need to continue to support this and should probably add it to our upstream test matrix.

Alasdair

#4 lore raw

PATCH 1/1 device: include goto label also for O_NOATIME

Hi again!

Quoted 6 lines · Alasdair G Kergon
Quoted 2 lines · Daniel Golle

The musl libc [1] apparently doesn't support O_DIRECT. Alpine Linux [2], LEDE [3] and OpenWrt [4] are affected.

So that's still widespread enough that we need to continue to support this and should probably add it to our upstream test matrix.

Neither you nor anyone else made any comments on the patch itself. I'd be happy to see it being reviewed and, if possible, merged as it fixes an obvious semantical error in the existing code.

Some more work is needed to be fully compatible with musl, see
https://github.com/openwrt/packages/tree/master/utils/lvm2/patches
or patches in
http://git.alpinelinux.org/cgit/aports/tree/main/lvm2?h=master

Cheers

Daniel