Whamcloud - gitweb
LU-6768 osd: unmap reallocated blocks 93/15593/5
authorAlex Zhuravlev <alexey.zhuravlev@intel.com>
Mon, 13 Jul 2015 20:36:10 +0000 (23:36 +0300)
committerOleg Drokin <oleg.drokin@intel.com>
Mon, 3 Aug 2015 01:54:36 +0000 (01:54 +0000)
call unmap_underlying_metadata() on every allocated
block. otherwise metadata blocks released in a previous
transaction can be written by the kernel corrupting
user's data. pblock != 0 should be a good sign of that.

Change-Id: I0d06611feb384a3f7ef5d8e5b34951822369ed0f
Signed-off-by: Alex Zhuravlev <alexey.zhuravlev@intel.com>
Reviewed-on: http://review.whamcloud.com/15593
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Lai Siyao <lai.siyao@intel.com>
Reviewed-by: Bobi Jam <bobijam@hotmail.com>
Reviewed-by: Niu Yawei <yawei.niu@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/osd-ldiskfs/osd_io.c

index 065f2e4..3939ae9 100644 (file)
@@ -619,7 +619,7 @@ static int ldiskfs_ext_new_extent_cb(struct inode *inode,
 {
        struct bpointers *bp = cbdata;
        struct ldiskfs_extent nex;
-       unsigned long pblock;
+       unsigned long pblock = 0;
        unsigned long tgen;
        int err, i;
        unsigned long count;
@@ -745,11 +745,7 @@ map:
                                        i, cex->ec_len);
                for (; i < cex->ec_len && bp->num; i++) {
                        *(bp->blocks) = cex->ec_start + i;
-#ifdef LDISKFS_EXT_CACHE_EXTENT /* until kernel 2.6.37 */
-                       if (cex->ec_type != LDISKFS_EXT_CACHE_EXTENT) {
-#else
-                       if ((cex->ec_len == 0) || (cex->ec_start == 0)) {
-#endif
+                       if (pblock != 0) {
                                /* unmap any possible underlying metadata from
                                 * the block device mapping.  bug 6998. */
                                unmap_underlying_metadata(inode->i_sb->s_bdev,