aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLi Dongyang <[email protected]>2015-03-25 21:53:24 -0400
committerGreg Kroah-Hartman <[email protected]>2015-03-26 11:11:44 +0100
commita915ffda199013a8ee2dd6a8a23b89ea45879ed3 (patch)
treea2a2a221a7f94010ce0b5f025428e3de971afb44
parent502cb58e2138dea3cef0da29021528172ff9fe58 (diff)
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: Li Dongyang <[email protected]> Signed-off-by: Bob Glossman <[email protected]> Reviewed-by: Andreas Dilger <[email protected]> Reviewed-by: Jinshan Xiong <[email protected]> Reviewed-on: http://review.whamcloud.com/13439 Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6091 Signed-off-by: Oleg Drokin <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
-rw-r--r--drivers/staging/lustre/lustre/llite/file.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/staging/lustre/lustre/llite/file.c b/drivers/staging/lustre/lustre/llite/file.c
index 6dab3baa8063..85e74d18d1c7 100644
--- a/drivers/staging/lustre/lustre/llite/file.c
+++ b/drivers/staging/lustre/lustre/llite/file.c
@@ -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 */