[Sheepdog] [PATCH v2] object cache: incorrect lock may lead to update lost
Liu Yuan
namei.unix at gmail.com
Mon Apr 16 02:52:04 CEST 2012
On 04/16/2012 12:59 AM, Yunkai Zhang wrote:
> When we pass NULL as entry's value, the new version of this function
> will create a new object_cache_entry just list we pass 1 as create's
> value in the old style.
>
> Have any questions?
Yes, you should never ask object_cache_rw to create cache entry. But you
use add_to_dirty_tree_and_list(oc, idx, NULL); both for
object_cache_lookup and object_cache_rw. so please keep 'create' flag
and keep the interface meaningful and clean.
- add_to_dirty_tree_and_list(oc, idx, NULL); NULL means always create
new entry, this is definitely wrong.
> +static inline void del_from_dirty_tree_and_list(
> + struct object_cache_entry *entry,
> + struct rb_root *inactive_dirty_tree,
> + struct list_head *inactive_dirty_list)
> +{
> + rb_erase(&entry->rb, inactive_dirty_tree);
> + list_del(&entry->list);
> +}
> +
Got another comment, drop third argument if you don't use it in the code.
Thanks,
Yuan
More information about the sheepdog
mailing list