Whamcloud - gitweb
LU-2285 osp: Fix last_created updates after orphan cleanups
authorLi Wei <wei.g.li@intel.com>
Mon, 12 Nov 2012 09:50:01 +0000 (17:50 +0800)
committerOleg Drokin <green@whamcloud.com>
Wed, 28 Nov 2012 18:31:11 +0000 (13:31 -0500)
commit02603e5f84523049246b57ac168e97f16e5f5eb1
tree80dd8f38b38f7ea95f1ff1a4bf2c6511421117a0
parent82f46ea2f1d46fe9cead2add30098692b2f66029
LU-2285 osp: Fix last_created updates after orphan cleanups

After an OST orphan cleanup, the OST's last created ID plus one is
stored into opd_pre_last_created.  This is weird and contradicts with
osp_precreate_send() and a few other places, like the following except
from osp_precreate_reserve():

  ...
  precreated = d->opd_pre_last_created - d->opd_pre_used_id;
  if (precreated > d->opd_pre_reserved) {
          d->opd_pre_reserved++;
  ...

The issue is not only about coding style, as suggested by this piece
of debug log dumped by a run of replay-ost-single 2:

  00000004:00080000:0.0:1353838616.328831:0:14474:0:(osp_precreate.c:4
  51:osp_precreate_cleanup_orphans()) lustre-OST0000-osc-MDT0000: Got
  last_id 130 from OST, last_used is 36, pre_used 130
  ...
  00000004:00080000:1.0:1353838616.328935:0:14230:0:(osp_precreate.c:7
  42:osp_precreate_reserve()) lustre-OST0000-osc-MDT0000: precreated 1
  : opd_pre_last_created 131 opd_pre_used_id 130 opd_pre_reserved 0
  00000004:00080000:1.0:1353838616.329173:0:14230:0:(osp_precreate.c:8
  01:osp_precreate_get_id()) lustre-OST0000-osc-MDT0000: Incremented o
  pd_pre_used_id: 131

The first line says that opd_pre_last_created was 131, while on the OST
side the last created ID was 130.  Then, according to the second line, a
request tried to reserve an object and found one.  The last line tells
us that the request consumed 131.  Actually, the OSP at that time hadn't
officially created 131 on the OST yet.

This patch makes sure opd_pre_last_created stores what its name
implies.

Change-Id: I8b94df2c4c702aaac9d68859f59c2d5ec1e8b796
Signed-off-by: Li Wei <wei.g.li@intel.com>
Reviewed-on: http://review.whamcloud.com/4625
Tested-by: Hudson
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Mike Pershin <tappro@whamcloud.com>
Reviewed-by: Alex Zhuravlev <bzzz@whamcloud.com>
lustre/osp/osp_precreate.c