Skip to contentSkip to conversation

remove BKL from ext2's readdir

PATCH Andi Kleen 2 participants 2 messages Mar 15, 2003 2 messages not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

Andi Kleen

author
#2 lore raw
Quoted 10 lines · Andrew Morton

foo_readdir()

{
	loff_t pos = file->f_pos;

	....
	<code which doesn't touch file->f_pos, but which modifies pos>
	...

	file->f_pos = pos;
}

At least for alpha this will require an rmb_depends() between the read and the write. Probably on x86 an rmb() wouldn't hurt neither.

Otherwise there is no guarantee other CPUs see that intended memory modification order

-Andi

#3 lore raw
Quoted 11 lines · Andi Kleen
Quoted 8 lines · Andrew Morton

foo_readdir()

{
	loff_t pos = file->f_pos;

	....
	<code which doesn't touch file->f_pos, but which modifies pos>
	...
Quoted 9 lines
Quoted 2 lines
	file->f_pos = pos;
}

At least for alpha this will require an rmb_depends() between the read and the write. Probably on x86 an rmb() wouldn't hurt neither.

Otherwise there is no guarantee other CPUs see that intended memory modification order

Won't the atomic operations in down() and up() do that?

It's all a bit moot really. If two user threads or processes are fighting over the value of f_pos at the same time in this manner then they're buggy anyway. All we need to do here is to ensure that the kernel doesn't do anything grossly wrong or insecure.