Whamcloud - gitweb
LU-3285 lov: add MDT target to the LOV device
[fs/lustre-release.git] / lustre / lov / lov_io.c
index 577e7d1..acddf1d 100644 (file)
@@ -571,7 +571,10 @@ static int lov_io_setattr_iter_init(const struct lu_env *env,
 
        if (cl_io_is_trunc(io) && lio->lis_pos > 0) {
                index = lov_lsm_entry(lsm, lio->lis_pos - 1);
-               if (index > 0 && !lsm_entry_inited(lsm, index)) {
+               /* no entry found for such offset */
+               if (index < 0) {
+                       RETURN(io->ci_result = -ENODATA);
+               } else if (!lsm_entry_inited(lsm, index)) {
                        io->ci_need_write_intent = 1;
                        RETURN(io->ci_result = -ENODATA);
                }