Whamcloud - gitweb
LU-5612 osd: typo in osd_declare_write() 89/11889/2
authorNiu Yawei <yawei.niu@intel.com>
Fri, 12 Sep 2014 03:30:05 +0000 (23:30 -0400)
committerOleg Drokin <oleg.drokin@intel.com>
Thu, 18 Sep 2014 00:42:32 +0000 (00:42 +0000)
Some bits are lost when porting the fix of LU-4611
3902ff4c54925b2f1fcb732a32ed7ee5428e9f77

That could result in insufficient credits in certain situation.

Signed-off-by: Niu Yawei <yawei.niu@intel.com>
Change-Id: I828a75c674978278b5adaf210586baa177ea0dc9
Reviewed-on: http://review.whamcloud.com/11889
Tested-by: Jenkins
Reviewed-by: Alex Zhuravlev <alexey.zhuravlev@intel.com>
Reviewed-by: Bob Glossman <bob.glossman@intel.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/osd-ldiskfs/osd_io.c

index 83d8efe..7e0bab8 100644 (file)
@@ -1106,8 +1106,14 @@ static ssize_t osd_declare_write(const struct lu_env *env, struct dt_object *dt,
                credits = osd_calc_bkmap_credits(sb, inode, size, _pos, blocks);
        }
 
-       osd_trans_declare_op(env, oh, OSD_OT_WRITE, credits);
+       /* if inode is created as part of the transaction,
+        * then it's counted already by the creation method */
+       if (inode != NULL)
+               credits++;
+
 out:
+       osd_trans_declare_op(env, oh, OSD_OT_WRITE, credits);
+
        /* dt_declare_write() is usually called for system objects, such
         * as llog or last_rcvd files. We needn't enforce quota on those
         * objects, so always set the lqi_space as 0. */