Whamcloud - gitweb
LU-8778 osd: osd_index_declare_ea_delete() reserve more credits 86/23486/3
authorAlex Zhuravlev <alexey.zhuravlev@intel.com>
Sat, 29 Oct 2016 13:20:42 +0000 (16:20 +0300)
committerOleg Drokin <oleg.drokin@intel.com>
Thu, 17 Nov 2016 04:31:16 +0000 (04:31 +0000)
when ".." direntry is being removed, OSD may need to update
local representative (agent inodes). reserve additional
credits for these updates.

Change-Id: I3689239ac9e7859fbb4a7c6edc87aa3d59a6be7e
Signed-off-by: Alex Zhuravlev <alexey.zhuravlev@intel.com>
Reviewed-on: http://review.whamcloud.com/23486
Tested-by: Jenkins
Reviewed-by: Niu Yawei <yawei.niu@intel.com>
Reviewed-by: wangdi <di.wang@intel.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/osd-ldiskfs/osd_handler.c

index ee0284b..8acc960 100644 (file)
@@ -4326,7 +4326,7 @@ static int osd_index_declare_ea_delete(const struct lu_env *env,
 {
        struct osd_thandle *oh;
        struct inode       *inode;
-       int                 rc;
+       int                 rc, credits;
        ENTRY;
 
        LASSERT(!dt_object_remote(dt));
@@ -4335,10 +4335,14 @@ static int osd_index_declare_ea_delete(const struct lu_env *env,
        oh = container_of0(handle, struct osd_thandle, ot_super);
        LASSERT(oh->ot_handle == NULL);
 
-       /* due to DNE we may need to remove an agent inode */
-       osd_trans_declare_op(env, oh, OSD_OT_DELETE,
-                            osd_dto_credits_noquota[DTO_INDEX_DELETE] +
-                            osd_dto_credits_noquota[DTO_OBJECT_DELETE]);
+       credits = osd_dto_credits_noquota[DTO_INDEX_DELETE];
+       if (key != NULL && unlikely(strcmp((char *)key, dotdot) == 0)) {
+               /* '..' to a remote object has a local representative */
+               credits += osd_dto_credits_noquota[DTO_INDEX_DELETE];
+               /* to reset LMAI_REMOTE_PARENT */
+               credits += 1;
+       }
+       osd_trans_declare_op(env, oh, OSD_OT_DELETE, credits);
 
        inode = osd_dt_obj(dt)->oo_inode;
        if (inode == NULL)