From 1da9b84b39ab36be9ba67a72ae175dde6521769b Mon Sep 17 00:00:00 2001 From: Nathaniel Clark Date: Wed, 5 Nov 2014 13:05:22 -0500 Subject: [PATCH] LU-3573 osd-zfs: Only advance zap cursor as needed Only advance the zap cursor when ozi_pos is not advanced, otherwise occasionally the a file could get "lost" because the zap_cursor would advance over it before the retrieve happened. Signed-off-by: Nathaniel Clark Change-Id: Iad560e2ffb4cfe2c74a1cf9197be7c2537538822 Reviewed-on: http://review.whamcloud.com/12582 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Isaac Huang Reviewed-by: Alex Zhuravlev Reviewed-by: Oleg Drokin --- lustre/osd-zfs/osd_index.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lustre/osd-zfs/osd_index.c b/lustre/osd-zfs/osd_index.c index 210a00e..8765df1 100644 --- a/lustre/osd-zfs/osd_index.c +++ b/lustre/osd-zfs/osd_index.c @@ -842,6 +842,8 @@ static int osd_dir_it_next(const struct lu_env *env, struct dt_it *di) zap_attribute_t *za = &osd_oti_get(env)->oti_za; int rc; + ENTRY; + /* temp. storage should be enough for any key supported by ZFS */ CLASSERT(sizeof(za->za_name) <= sizeof(it->ozi_name)); @@ -854,9 +856,10 @@ static int osd_dir_it_next(const struct lu_env *env, struct dt_it *di) it->ozi_pos++; if (it->ozi_pos <=2) RETURN(0); - } - zap_cursor_advance(it->ozi_zc); + } else { + zap_cursor_advance(it->ozi_zc); + } /* * According to current API we need to return error if its last entry. -- 1.8.3.1