Commit a915ffda authored by Li Dongyang's avatar Li Dongyang Committed by Greg Kroah-Hartman

staging/lustre/llite: glimpse the inode before doing fiemap

For a new inode, the i_size is 0 until a stat, which will yield
an empty fiemap result.
Fix the issue by glimpsing the size before doing fiemap.
Signed-off-by: default avatarLi Dongyang <dongyang.li@anu.edu.au>
Signed-off-by: default avatarBob Glossman <bob.glossman@intel.com>
Reviewed-by: default avatarAndreas Dilger <andreas.dilger@intel.com>
Reviewed-by: default avatarJinshan Xiong <jinshan.xiong@intel.com>
Reviewed-on: http://review.whamcloud.com/13439
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6091Signed-off-by: default avatarOleg Drokin <oleg.drokin@intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 502cb58e
......@@ -1712,6 +1712,12 @@ static int ll_do_fiemap(struct inode *inode, struct ll_user_fiemap *fiemap,
fm_key.oa.o_oi = lsm->lsm_oi;
fm_key.oa.o_valid = OBD_MD_FLID | OBD_MD_FLGROUP;
if (i_size_read(inode) == 0) {
rc = ll_glimpse_size(inode);
if (rc)
goto out;
}
obdo_from_inode(&fm_key.oa, inode, OBD_MD_FLSIZE);
obdo_set_parent_fid(&fm_key.oa, &ll_i2info(inode)->lli_fid);
/* If filesize is 0, then there would be no objects for mapping */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment