staging/lustre/llite: Solve a race to access lli_has_smd in read case
[firefly-linux-kernel-4.4.55.git] / drivers / staging / lustre / lustre / llite / vvp_io.c
index 65d610abe06e53fc0ec8cb34ccd367b7492b40f4..91bba79678cf7da1f1cd303c114648ea76c8e53d 100644 (file)
@@ -307,18 +307,13 @@ static int vvp_io_rw_lock(const struct lu_env *env, struct cl_io *io,
 static int vvp_io_read_lock(const struct lu_env *env,
                            const struct cl_io_slice *ios)
 {
-       struct cl_io     *io  = ios->cis_io;
-       struct ll_inode_info *lli = ll_i2info(ccc_object_inode(io->ci_obj));
+       struct cl_io     *io = ios->cis_io;
+       struct cl_io_rw_common *rd = &io->u.ci_rd.rd;
        int result;
 
-       /* XXX: Layer violation, we shouldn't see lsm at llite level. */
-       if (lli->lli_has_smd) /* lsm-less file doesn't need to lock */
-               result = vvp_io_rw_lock(env, io, CLM_READ,
-                                       io->u.ci_rd.rd.crw_pos,
-                                       io->u.ci_rd.rd.crw_pos +
-                                       io->u.ci_rd.rd.crw_count - 1);
-       else
-               result = 0;
+       result = vvp_io_rw_lock(env, io, CLM_READ, rd->crw_pos,
+                               rd->crw_pos + rd->crw_count - 1);
+
        return result;
 }