- /* XXX change inode size without i_sem hold! there is a race condition
- * with truncate path. (see ll_extent_lock) */
- kms = lov_merge_size(ll_i2info(inode)->lli_smd, 1);
- pgoff = ((address - vma->vm_start) >> PAGE_CACHE_SHIFT) + vma->vm_pgoff;
- size = (kms + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT;
+ if (vma->vm_flags & VM_EXEC && LTIME_S(inode->i_mtime) != old_mtime)
+ CWARN("binary changed. inode %lu\n", inode->i_ino);
+
+ lov_stripe_lock(lsm);
+ inode_init_lvb(inode, &lvb);
+ obd_merge_lvb(ll_i2obdexp(inode), lsm, &lvb, 1);
+ kms = lvb.lvb_size;
+
+ pgoff = ((address - vma->vm_start) >> CFS_PAGE_SHIFT) + vma->vm_pgoff;
+ size = (kms + CFS_PAGE_SIZE - 1) >> CFS_PAGE_SHIFT;
+
+ if (pgoff >= size) {
+ lov_stripe_unlock(lsm);
+ ll_glimpse_size(inode, LDLM_FL_BLOCK_GRANTED);
+ } else {
+ /* XXX change inode size without ll_inode_size_lock() held!
+ * there is a race condition with truncate path. (see
+ * ll_extent_lock) */
+ /* region is within kms and, hence, within real file size (A).
+ * We need to increase i_size to cover the read region so that
+ * generic_file_read() will do its job, but that doesn't mean
+ * the kms size is _correct_, it is only the _minimum_ size.
+ * If someone does a stat they will get the correct size which
+ * will always be >= the kms value here. b=11081 */
+ if (inode->i_size < kms) {
+ inode->i_size = kms;
+ CDEBUG(D_INODE, "ino=%lu, updating i_size %llu\n",
+ inode->i_ino, inode->i_size);
+ }
+ lov_stripe_unlock(lsm);
+ }