From bfd07915c9e459a3510ecbfd957dbd6e383dc3e7 Mon Sep 17 00:00:00 2001 From: Alex Zhuravlev Date: Mon, 18 Jan 2016 22:03:19 +0300 Subject: [PATCH] LU-7680 mdd: put migrated object on the orphan list do this unconditionally. mdd_finish_unlink() can't do this properly as la_nlink cached in ma greater than 0. this results in lost inodes (i.e. we still have an entry in OI, but corresponding inode doesn't exist) and many messages like: LustreError: 3458:0:(osd_handler.c:3239:osd_object_ref_del()) lustre-MDT0001-osd: nlink == 0 on [0x240000403:0x53b:0x0], maybe an upgraded file? (LU-3915) the patch also adds a sanity check in osd_object_release() to ensure that nobody is trying to leave non-destroyed object with nlink = 0. Change-Id: Iecfae75944854d8e9613431acb68ad17dfea90f0 Signed-off-by: Alex Zhuravlev Reviewed-on: http://review.whamcloud.com/18032 Reviewed-by: wangdi Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger Reviewed-by: John L. Hammond Reviewed-by: Oleg Drokin --- lustre/mdd/mdd_dir.c | 13 ++++++------- lustre/osd-ldiskfs/osd_handler.c | 6 ++++++ 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/lustre/mdd/mdd_dir.c b/lustre/mdd/mdd_dir.c index 2cb3736..6f7f17c 100644 --- a/lustre/mdd/mdd_dir.c +++ b/lustre/mdd/mdd_dir.c @@ -4035,13 +4035,12 @@ static int mdd_migrate_update_name(const struct lu_env *env, mdd_write_lock(env, mdd_sobj, MOR_TGT_CHILD); - /* Increase mod_count to add the source object to the orphan list, - * so if other clients still send RPC to the old object, then these - * objects can help the request to find the new object, see - * mdt_reint_open() */ - mdd_sobj->mod_count++; - rc = mdd_finish_unlink(env, mdd_sobj, ma, mdd_pobj, lname, handle); - mdd_sobj->mod_count--; + mdd_sobj->mod_flags |= DEAD_OBJ; + rc = mdd_mark_orphan_object(env, mdd_sobj, handle, false); + if (rc != 0) + GOTO(out_unlock, rc); + + rc = __mdd_orphan_add(env, mdd_sobj, handle); if (rc != 0) GOTO(out_unlock, rc); diff --git a/lustre/osd-ldiskfs/osd_handler.c b/lustre/osd-ldiskfs/osd_handler.c index d894e86..265d758 100644 --- a/lustre/osd-ldiskfs/osd_handler.c +++ b/lustre/osd-ldiskfs/osd_handler.c @@ -1553,6 +1553,12 @@ static void osd_object_delete(const struct lu_env *env, struct lu_object *l) static void osd_object_release(const struct lu_env *env, struct lu_object *l) { + struct osd_object *o = osd_obj(l); + /* nobody should be releasing a non-destroyed object with nlink=0 + * the API allows this, but ldiskfs doesn't like and then report + * this inode as deleted */ + if (unlikely(!o->oo_destroyed && o->oo_inode && o->oo_inode->i_nlink == 0)) + LBUG(); } /* -- 1.8.3.1