From: Fan Yong Date: Thu, 28 Feb 2013 03:25:48 +0000 (+0800) Subject: LU-2990 osd-zfs: locate cursor to specified pos via load API X-Git-Tag: 2.3.64~20 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=aea3cfc62c101066910daf1f9f12a7848f04be13 LU-2990 osd-zfs: locate cursor to specified pos via load API There was defect for zfs-based backend when traverse directory: the dt_iteration API ::load() did not locate the cursor to the specified position, then caused non-first directory readpage RPC obtained repeated entries, and then caused readdir() loop or unexpected dir hash collision. Signed-off-by: Fan Yong Change-Id: I9c159f0f80677590869246dd9f30f0dfb9cc2fbc Reviewed-on: http://review.whamcloud.com/5894 Tested-by: Hudson Reviewed-by: Li Wei Reviewed-by: Alex Zhuravlev Tested-by: Maloo Reviewed-by: Oleg Drokin --- diff --git a/lustre/osd-zfs/osd_index.c b/lustre/osd-zfs/osd_index.c index f88958c..2c02470 100644 --- a/lustre/osd-zfs/osd_index.c +++ b/lustre/osd-zfs/osd_index.c @@ -998,14 +998,10 @@ static int osd_dir_it_load(const struct lu_env *env, int rc; ENTRY; - if (it->ozi_pos != 0) { - /* the cursor wasn't at the beginning - * so we should reset ZAP cursor as well */ - udmu_zap_cursor_fini(it->ozi_zc); - if (udmu_zap_cursor_init(&it->ozi_zc, &osd->od_objset, - obj->oo_db->db_object, hash)) - RETURN(-ENOMEM); - } + udmu_zap_cursor_fini(it->ozi_zc); + if (udmu_zap_cursor_init(&it->ozi_zc, &osd->od_objset, + obj->oo_db->db_object, hash)) + RETURN(-ENOMEM); if (hash <= 2) { it->ozi_pos = hash;