Whamcloud - gitweb
LU-6683 osd: declare enough credits for generating LMA 61/15361/2
authorFan Yong <fan.yong@intel.com>
Tue, 26 May 2015 05:33:37 +0000 (13:33 +0800)
committerOleg Drokin <oleg.drokin@intel.com>
Tue, 21 Jul 2015 16:09:45 +0000 (16:09 +0000)
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 <fan.yong@intel.com>
Change-Id: I2bdbf5ba56db1ea08edf0a8a4d724df4ad97e071
Reviewed-on: http://review.whamcloud.com/15361
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Yang Sheng <yang.sheng@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/osd-ldiskfs/osd_handler.c

index 6bce54c..dc190b9 100644 (file)
@@ -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) >>