Commit cdb5f710 authored by Ned Bass's avatar Ned Bass Committed by Greg Kroah-Hartman

staging/lustre/lmv: fix duplicate directory entries

Previously, I accidentally introduced a new way for duplicate
directory entries to be returned from readdir().  That patch fails
to properly decrement the nlupgs counter when breaking out of the
inner-for loop.  This accounting error causes an extra iteration
of the inner-for loop when processing the next cfs page and a bad
ldp_hash_end value is then saved in the lu_dirpage.  To fix this,
always decrement the nlupgs counter on entry into the inner loop.

Note: this bug only affects architectures with > 4k-sized pages, e.g.
PowerPC.

Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3182
Lustre-change: http://review.whamcloud.com/6405Signed-off-by: default avatarNed Bass <bass6@llnl.gov>
Reviewed-by: default avatarFan Yong <fan.yong@intel.com>
Reviewed-by: default avatarAndreas Dilger <andreas.dilger@intel.com>
Reviewed-by: default avatarBobi Jam <bobijam@gmail.com>
Signed-off-by: default avatarPeng Tao <tao.peng@emc.com>
Signed-off-by: default avatarAndreas Dilger <andreas.dilger@intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 5907838a
......@@ -1959,7 +1959,7 @@ static void lmv_adjust_dirpages(struct page **pages, int ncfspgs, int nlupgs)
__u64 hash_end = dp->ldp_hash_end;
__u32 flags = dp->ldp_flags;
for (; nlupgs > 1; nlupgs--) {
while (--nlupgs > 0) {
ent = lu_dirent_start(dp);
for (end_dirent = ent; ent != NULL;
end_dirent = ent, ent = lu_dirent_next(ent));
......@@ -1993,6 +1993,7 @@ static void lmv_adjust_dirpages(struct page **pages, int ncfspgs, int nlupgs)
kunmap(pages[i]);
}
LASSERTF(nlupgs == 0, "left = %d", nlupgs);
}
#else
#define lmv_adjust_dirpages(pages, ncfspgs, nlupgs) do {} while (0)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment