Whamcloud - gitweb
Revert "b=19427 correct lmm_object_id and reserve fids for fid-on-OST."
[fs/lustre-release.git] / lustre / lclient / glimpse.c
index 78acee6..76b934d 100644 (file)
@@ -118,12 +118,18 @@ int cl_glimpse_lock(const struct lu_env *env, struct cl_io *io,
                         *descr = whole_file;
                         descr->cld_obj   = clob;
                         descr->cld_mode  = CLM_PHANTOM;
-                        /* The lockreq for glimpse should be mandatory,
-                         * otherwise, osc may decide to use lockless */
-                        io->ci_lockreq = CILR_MANDATORY;
+                        descr->cld_enq_flags = CEF_ASYNC | CEF_MUST;
                         cio->cui_glimpse = 1;
-                        lock = cl_lock_request(env, io, descr, CEF_ASYNC,
-                                               "glimpse", cfs_current());
+                        /*
+                         * CEF_ASYNC is used because glimpse sub-locks cannot
+                         * deadlock (because they never conflict with other
+                         * locks) and, hence, can be enqueued out-of-order.
+                         *
+                         * CEF_MUST protects glimpse lock from conversion into
+                         * a lockless mode.
+                         */
+                        lock = cl_lock_request(env, io, descr, "glimpse",
+                                               cfs_current());
                         cio->cui_glimpse = 0;
                         if (!IS_ERR(lock)) {
                                 result = cl_wait(env, lock);
@@ -217,10 +223,7 @@ int cl_local_size(struct inode *inode)
 
         ENTRY;
 
-        /*
-         * XXX layering violation.
-         */
-        if (cl_i2info(inode)->lli_smd->lsm_stripe_count == 0)
+        if (!cl_i2info(inode)->lli_smd)
                 RETURN(0);
 
         result = cl_io_get(inode, &env, &io, &refcheck);