From: Fan Yong Date: Tue, 26 May 2015 05:33:37 +0000 (+0800) Subject: LU-6683 osd: declare enough credits for generating LMA X-Git-Tag: 2.7.57~22 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=refs%2Fchanges%2F61%2F15361%2F2;p=fs%2Flustre-release.git LU-6683 osd: declare enough credits for generating LMA Usually, the LMA EA is set first after the object created. But if the system is upgraded from 1.8 release or older, then there is no LMA EA stored in the object, and then generating LMA EA for the object maybe not the first EA in the object's inode. Signed-off-by: Fan Yong Change-Id: I2bdbf5ba56db1ea08edf0a8a4d724df4ad97e071 Reviewed-on: http://review.whamcloud.com/15361 Reviewed-by: Andreas Dilger Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Yang Sheng Reviewed-by: Oleg Drokin --- diff --git a/lustre/osd-ldiskfs/osd_handler.c b/lustre/osd-ldiskfs/osd_handler.c index 6bce54c..dc190b9 100644 --- a/lustre/osd-ldiskfs/osd_handler.c +++ b/lustre/osd-ldiskfs/osd_handler.c @@ -2847,15 +2847,20 @@ static int osd_declare_xattr_set(const struct lu_env *env, oh = container_of0(handle, struct osd_thandle, ot_super); LASSERT(oh->ot_handle == NULL); - /* optimistic optimization: LMA is set first and usually fit inode */ if (strcmp(name, XATTR_NAME_LMA) == 0) { - if (dt_object_exists(dt)) + /* For non-upgrading case, the LMA is set first and + * usually fit inode. But for upgrade case, the LMA + * may be in another separated EA block. */ + if (!dt_object_exists(dt)) credits = 0; - else + else if (fl == LU_XATTR_REPLACE) credits = 1; + else + goto upgrade; } else if (strcmp(name, XATTR_NAME_VERSION) == 0) { credits = 1; } else { +upgrade: credits = osd_dto_credits_noquota[DTO_XATTR_SET]; if (buf && buf->lb_len > sb->s_blocksize) { credits *= (buf->lb_len + sb->s_blocksize - 1) >>